Factorial and counting seat arrangements | Probability and Statistics | Khan Academy
In this video, we are going to introduce ourselves to the idea of permutations, which is a fancy word for a pretty straightforward concept: what are the number of ways that we can arrange things? How many different possibilities are there?
To make that a little bit tangible, let's have an example with, say, a sofa. My sofa can seat exactly three people. I have seat number one on the left of the sofa, seat number two in the middle of the sofa, and seat number three on the right of the sofa. Let's say we're going to have three people who are going to sit in these three seats: person A, person B, and person C. How many different ways can these three people sit in these three seats? Pause this video and see if you can figure it out on your own.
Well, there are several ways to approach this. One way is to just try to think through all of the possibilities. You could do it systematically. You could say, “All right, if I have person A in seat number one, then I could have person B in seat number two and person C in seat number three.” Then I could think of another situation: if I have person A in seat number one, I could then swap B and C. So, I could look like that.
That's all of the situations, all of the permutations where I have A in seat number one. Now let's put someone else in seat number one. So, now let's put B in seat number one, and I could put A in the middle and C on the right. Or, I could put B in seat number one and then swap A and C, so C, then A. Then if I put C in seat number one, well, I could put A in the middle and B on the right. Or, with C in seat number one, I could put B in the middle and A on the right.
These are actually all of the permutations, and you can see that there are one, two, three, four, five, six. Now this wasn't too bad, and in general, if you're thinking about permutations of six things and/or three things in three spaces, you can do it by hand. But it could get very complicated if I said, “Hey, I have a hundred seats and I have 100 people that are going to sit in them.”
How do I figure it out mathematically? Well, the way that you would do it, and this is going to be a technique that you can use for really any number of people and any number of seats, is to really just build off of what we just did here. What we did here is we started with seat number one and we said, “All right, how many different possibilities are there? How many different people could sit in seat number one, assuming no one has sat down before?” Well, three different people could sit in seat number one.
You can see it right over here. This is where A is sitting in seat number one; this is where B is sitting in seat number one, and this is where C is sitting in seat number one. Now, for each of those three possibilities, how many people can sit in seat number two? Well, we saw when A sits in seat number one, there's two different possibilities for seat number two. When B sits in seat number one, there's two different possibilities for seat number two. When C sits in seat number one—this is a tongue twister—there's two different possibilities for seat number two.
So, you're going to have two different possibilities here. Another way to think about it is: one person has already sat down here; there are three different ways of getting that, and so there's two people left who could sit in the second seat. We saw that right over here, where we really wrote out the permutations.
So, how many different permutations are there for seat number one and seat number two? Well, you would multiply. For each of these three, you have two for each of these three. In seat number one, you have two in seat number two. And then what about seat number three? Well, if you know who's in seat number one and seat number two, there's only one person who can be in seat number three. Another way to think about it: if two people have already sat down, there's only one person who could be in seat number three.
So, mathematically, what we could do is just say three times two times one. You might recognize the mathematical operation factorial, which literally just means, “Hey, start with that number and then keep multiplying it by the numbers one less than that and then one less than that, all the way until you get to one.” This is three factorial, which is going to be equal to six, which is exactly what we got here.
To appreciate the power of this, let's extend our example. Let's say that we have five seats: one, two, three, four, five. And we have five people: person A, B, C, D, and E. How many different ways can these five people sit in these five seats? Pause this video and figure it out.
Well, you might immediately say, “Well, that's going to be 5 factorial,” which is going to be equal to 5 times 4 times 3 times 2 times 1. 5 times 4 is 20. 20 times 3 is 60, and then 60 times 2 is 120, and then 120 times 1 is equal to 120.
And once again, that makes a lot of sense. There were five different—if no one's sat down—there are five different possibilities for seat number one. And then for each of those possibilities, there's four people who could sit in seat number two. And then for each of those twenty possibilities in seat numbers one and two, well, there's going to be three people who could sit in seat number three. And for each of these sixty possibilities, there's two people who can sit in seat number four.
Then, once you know who's in the first four seats, you know who has to sit in that fifth seat, and that's where we got that 120 from.