If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Handshaking combinations

Sal figures out how different combinations of people can shake hands.

Want to join the conversation?

  • leaf blue style avatar for user Dr. λ the Creator of Variables, Binder of Variables, Applicator of Terms, Checker of Types, and β-Reducer of β-Redexes
    When I paused to think about this I found that if you have N people and you follow the rules of this video then you will have an amount of handshakes that are equal to the sum of all positive integers that are less than N.
    For example, with 8 people you will have 7+6+5+4+3+2+1 = 28 handshakes.

    But you will also have N! / ((N-2)! * 2) handshakes.

    So that means that the sum of all positive integers less than N is equal to N! / ((N-2)! * 2) when N is an integer that is greater than 1. Is this true? If so then why is this?
    (83 votes)
    Default Khan Academy avatar avatar for user
    • hopper jumping style avatar for user Oliver X
      Also, you can think the handshake question like this:
      Take 5 people for example.
      Then A will shake hand with B, C, D, E.
      B will shake hand with C, D, E (A is counted).
      C will shake hand with D, E (A, B are counted).
      D will shake hand with E
      add them up you get 4 + 3 + 2 + 1 which is the sum you discovered.

      Also, if you draw a pentagon and name the vertices A, B, C, D, E,
      all the diagonals and sides of the pentagon would represent the handshakes:
      AB, AC, AD, AE, BC, BD, BE, CD, CE, DE. Count them and it's easy to find
      there are 10 lines.
      (21 votes)
  • female robot amelia style avatar for user Gaganpreet
    at , how can there be 4 possibilities, one person only have 3 options and not his own self. right?
    (25 votes)
    Default Khan Academy avatar avatar for user
    • piceratops ultimate style avatar for user Just Keith
      The 4 means that the first person involved in shaking hands can be any of the 4 people.
      The 3 means that the second person involved in shaking hands can be any of the remaining 3 people not counting the person identified as the first person.
      (37 votes)
  • piceratops ultimate style avatar for user flashingjet101
    Why is it that when you roll two die, there are 21 different combinations that can arise, if you don't care about the order of rolling the die? For example, your first die being 4 and your second die being 3 is the same thing as the first die being 3 and the second die being 4?
    (13 votes)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user Saranyaraj Rajendran
      Alright, let's reason through this.
      Since, we only care about combinations, the order in which we roll the dice doesn't matter. So, yes. First die being 4 and the second die being 3 is the same thing as the first die being 3 and the second die being 4.
      Now, for the combinations as such.
      Let's list out all the ordered pairs first.
      (1,1) (1,2) (1,3) (1,4) (1,5) (1,6)
      (2,1) (2,2) (2,3) (2,4) (2,5) (2,6)
      (3,1) (3,2) (3,3) (3,4) (3,5) (3,6)
      (4,1) (4,2) (4,3) (4,4) (4,5) (4,6)
      (5,1) (5,2) (5,3) (5,4) (5,5) (5,6)
      (6,1) (6,2) (6,3) (6,4) (6,5) (6,6)

      Remember these are the possibilities when we care about order and it is equal to 6*6 = 36.
      Since for combination order doesn't matter, (1,4) = (4,1) and so on, we have a number of redundant ordered pairs in our list of possibilities. Let's remove them and at the same time count out the possibilities.
      (1,1) (1,2) (1,3) (1,4) (1,5) (1,6)    Count = 6
      (2,2) (2,3) (2,4) (2,5) (2,6) Count = 5
      (3,3) (3,4) (3,5) (3,6) Count = 4
      (4,4) (4,5) (4,6) Count = 3
      (5,5) (5,6) Count = 2
      (6,6) Count = 1

      So, all the possible combinations = 6+5+4+3+2+1 = 21. Hope this makes this a bit more clear.
      (32 votes)
  • marcimus pink style avatar for user Xi An Niles
    Is there any way to reason through the number of combinations without using permutations or the combination formula?
    (12 votes)
    Default Khan Academy avatar avatar for user
  • leaf green style avatar for user anand_ma
    Can combination be explained in arithmetic series. In this case say 3+2+1
    (A can shake with 3 other people, B with 2 other since B has already shaken hands with A and C with 1 and D with none)
    which is 6
    (5 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user robshowsides
      Yes, but only for combinations in which you are choosing groups of 2, like the handshake problem. The formula for choosing 2 items out of n items is n!/(2! * (n-2)!) = n(n-1)/2, and as you correctly noticed, this is also the formula for the sum of the arithmetic series 1 + 2 + ... + (n-1) = n(n-1)/2.

      The pattern does not continue to hold for combinations of 3 or more, however.
      (8 votes)
  • blobby green style avatar for user Neel.K
    So, in other words, is combination a subset of permutation?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • piceratops ultimate style avatar for user Gopal, Eashaan
    How did ( 4 ) turn into 4*3/2
    (2)
    (4 votes)
    Default Khan Academy avatar avatar for user
  • leaf red style avatar for user Joachim Marnitz
    I have a question regarding Metcalfe's Law (en.wikipedia.org/wiki/Metcalfe%27s_law) in this context.

    You could see the possible handshakes as potential network connections as Metcalfe's law describes them. The formula for it is n (n - 1) / 2, so for 4 network members you would get 4 (4 - 1) / 2 = 4 * 3 / 2 = 6, the same result.

    So here's my question: Is that just a different way to express the same thing?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Iniquitous
    I'm having a difficult time grasping the difference in selection criteria. Were I choosing two teams out of a certain number of people, and each team had a name, this would be the permutation (criteria of 2) and if the teams had no names this would be the combination? Or do I have that backwards?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • leaf grey style avatar for user Nabla ∇
      It's not really about names but about situations.

      If there are 12 teams and 4 must go to the 2nd category at the end of the season, the number of ways this can happen is ₁₂C₄ (are combinations. If team A, B, C and D went to the 2nd category, the order at which they do so doesn't matter).

      If there 12 teams and 3 can win a medal (gold, silver or bronze) then the number of ways a medal can be won is ₁₂P₄ (are permutations. It's not the same having Team A with gold, B with silver and D with bronze than B with gold, D with silver and A with bronze. So order do matter).

      Choosing between permutations or combinations has to do with the order, and the order has to do with those things in real life where we care about order and things we don't.

      (:
      (4 votes)
  • piceratops seed style avatar for user netaly21
    so.. i tried to solve this one yet i couldnt.. can anyone help?

    How many different nine-digit numbers can be created by moving digits in the number 123454321

    thanks
    (2 votes)
    Default Khan Academy avatar avatar for user

Video transcript

- Let's say that there are four people in a room. And you're probably tired of me naming the people with letters, but I'm going to continue doing that. So the four people in the room are people A, B, C, and D. And they are all told, "You don't know each other. "So I want you to all meet each other. "You need to shake the hand, exactly once, "of every other person in the room so that you all meet." So my question to you is, if each of these people need to shake the hand of every other person exactly once, how many handshakes are going to occur? The number of handshakes that are going to occur. So, like always, pause the video and see if you can make sense of this. Alright, I'm assuming you've had a go at it. So one way to think about it is, if you say there's a handshake, two people are party to a handshake. We're not talking about some new three-person handshake or four-person handshake, we're just talking about the traditional, two people shake their right hands. And so, there's one person and there's another person in this party. There's four possibilities of one party. And if we assume people aren't shaking their own hands, which we are assuming, they're always going to shake someone else's hand. For each of these four possibilities who's this party, there's three possibilities who's the other party. And so you might say that there's four times three handshakes. Since there's four times three possible handshakes. And what I'd like you to do is think a little bit about whether this is right, whether there would actually be 12 handshakes. You might have thought about it, and you might say, there's four times three, this is actually counting the permutations. This is counting how many ways can you permute four people into two buckets, the two buckets of handshakers, where you care about which bucket they are in. Whether they're handshaker number one, or handshaker number two. This would count A being the number one handshaker and B being the number two handshaker as being different than B being the number one handshaker and A being the number two handshaker. But we don't want both of these things to occur. We don't want A to shake B's hand, where A is facing north and B is facing south. And then another time, they shake hands again where now B is facing north and A is facing south. We only have to do it once. These are actually the same thing, so there's no reason for both of these to occur. So we are going to be double counting. So what we really want to do is think about combinations. One way to think about it is, you have four people. In a world of four people or a pool of four people, how many ways can you choose two? Because that's what we're doing. Each handshake is just really a selection of two of these people. And so we want to say, how many ways can we select two people? So that each combination, each of these ways to select two people should have a different combination of people in it. If two of them have the same, AB and BA, these are the same combination. And so this is really a combinations problem. This is really equivalent to saying, how many ways are there to choose two people from a pool of four? Or four choose two. And so this is going to be, well how many ways are there to permute four people into three spots? Which is going to be four times three. Which we just figured out right over there, which is 12. Actually want to do it in that green color so you see where that came from. So four times three. And then you're going to divide that by the number of ways you can arrange two people. Well you can arrange two people in two different ways. One's on the left, one's on the right, or the other one's on the left or the other one's on the right. Or, you could also view that as two factorial, which is also equal to two. So we could write this down as two. This is the number of ways to arrange two people. This up here, that's the permutations. That's the number of permutations if you take two people from a pool of four. So here you would care about order. And so one way to think about it, this two is correcting for this double counting here. And if you want to apply the formula, you could. I just kind of reasoned through it again. You could literally say, four times three is 12. We're double counting because there's two ways to arrange two people. So you just divide it by two. And then you are going to be left with six. You can think of it in terms of this, or you could just apply the formula. You could just say, four choose two, or the number of combinations of selecting two from a group of four. This is going to be four factorial over two factorial times four minus two factorial. And I'm going to make this color different just so you can keep track of how I'm at least applying this. And so what is this going to be? This is going to be four times three times two times one, over two times one times this right over here is two times one. So that would cancel with that. Four divided by two is two. Two times three divided by one is equal to six. And to just really hit the point home, let's actually draw it out. A could shake B's hand. A could shake C's hand. A could shake D's hand. Let me just do what we calculated first, the 12. B could shake A's hand. B could shake C's hand. B could shake D's hand. C could shake A's hand. C could shake B's hand. C could shake D's hand. D could shake A's hand. D could shake B's hand. D could shake C's hand. And this is 12 right over here, and this is the permutations. If D shaking C's hand was actually different than C shaking D's hand, then we would count 12. But we just wanted to say, how many ways, they just have to meet each other once. And so we're double counting. So AB is the same thing as BA. AC is the same thing as CA. AD is the same thing as DA. BC is the same thing as CB. BD is the same thing as DB. CD is the same thing as DC. And so we would be left with, if we correct for the double counting, we're left with one, two, three, four, five, six combinations. Six possible ways of choosing two from a pool of four. Especially when you don't care about the order in which you choose them.