Previously, I noted that if a line of dancers comes out on stage in a random order, then on average one dancer will be in the right spot, regardless of the number of dancers.
A more complete investigation would find the full probability distribution. What is the probability that no dancers are in the right spots, that exactly one is, that exactly two are, etc.?
This mundane question leads to a bit of math I find fascinating. There are also several clever tricks along the route.
To begin, we examine the case of no dancers in the right spot. The probability of every dancer getting it wrong is the number of ways to do that divided by the total number of possible orders. For dancers there are total orders, so we need to know the total number of ways they could all be wrong. Some wonderful person decided to call these “derangements”, and the rest of us have been smart enough to stick with that name since.
Before counting the derangements, I want to note a few things about them. The first is that once we know the number of derangements for dancers (call this ), we’ll be close to finishing the entire problem. For example, imagine we want the probability that exactly three dancers are in their correct positions. Then the rest of the dancers are in a derangement of dancers. So if we can count derangements, we can count any of the quantities we’re interested in.
(The probability to have exactly of dancers correct is
Next, we note that the derangements need to be a pretty significant fraction of the total number of arrangements. If one dancer is going to be in the right spot on average, then we’ll need a lot of times when no dancers are in the right spot to counter-balance times when two, three, four, or more dancers are in the right spot. So the number of derangements should grow roughly comparably to , although of course they are less than this.
Now investigate a similar but slightly different scenario. We go backstage and interview all the Rockettes, asking them what number they are in the lineup. They don’t know, so they just guess randomly. Then the probability that any given Rockette gets it right is , and to get it wrong, . The probability they all guess wrong is
which looks an awful lot like the definition of as . In fact it is easily proven to converge to .
The number of derangements is a slightly different problem than the one we just solved, because when interviewing the Rockettes, their answers are assumed to be independent. But when picking an order in a lineup, they are not. For example, if Rockette three takes Rockette seven’s spot, then Rockette seven’s chances of getting her spot correct are zero. However, as the number of Rockettes becomes very large, the chance of this happening gets very small, and so the problem feels like it’s almost independent.
Let’s make a conjecture, then. The number of derangements of dancers, , converges to for large , with very close to .
The actual answer to the number of derangements is a little bit clever. I’ll explain in video form:
If you can’t or aren’t inclined to watch, here is the text of the derivation from Wikipedia:
Suppose that there are n persons numbered from 1,2,…,n. Let there be n hats also numbered from 1,2,…,n. We have to find the number of ways in which no one gets the hat: having same number as that of his/her number. Let us assume that first person takes the hat i. There are n − 1 ways for first person to choose the number i. Now there are 2 options –
– Person i takes the hat of 1. So Now the problem reduces to n − 2 persons and n − 2 hats.
– Person i does not take the hat 1. This situation can be simulated as renumbering hat 1 as i. So now case is equivalent to solving problem with n − 1 persons n − 1 hats.
From this, following relation is clear:
Fine, then. Let’s test our conjectured against the recursion relation.
So we’ve at least failed to invalidate our asymptotic estimate. I like it when I fail to invalidate my conjectures. It reminds me that everything might be okay.
We still haven’t found our coefficient , that was supposed to be about . Let’s go through it in a few steps, working with the recursion relation.
A two-step recursion relation with nonlinear coefficients is hard. A one-step relation might be easier. So we work things out like this:
This makes it so the right hand side is pretty much the same as the left, but with reduced by one. Specifically, if we define
then the recurrence relation above is
Because and , we know and therefore
This can be abbreviated by
which we replace by
We gone from a recurrence relation with two terms down to just one. Next clever step is to divide by the asymptotic behavior, .
To clean things up, let’s define
Now we’re going to do a long column adding-thingy, which hopefully you’ve seen before so my sucky explanation doesn’t detract much
Add all those equations to each other, and everything on the left cancels except the very beginning and very end of the chain, leaving us with
I re-arranged the terms on the right to look more familiar. The summation on the right is just the power series of with . Also so
We defined , so the asymptotic form of the number of derangements is , exactly the same answer as to the separate problem about independently interviewing the Rockettes backstage.
There’s an explanation begging to be found here. It’s obvious the two questions should have similar answers, but not immediately obvious to me they should be the same.
Two events and are independent when . Let the two events be that Anne and Bubbatunde (who are first and second in the Rockette’s lineup) are in the wrong spot, respectively. Then , so
To find , count the ways they can both be wrong. If Anne takes Bubbatunde’s spot, then Bubbatunde can pick any of the remaining places, because her spot is already occupied so all the remaining ones are safe. That’s . Then if Anne chooses a different spot (of which there are ), then Bubbatunde has two forbidden spots: the one Anne is already in, and her own. That makes ways for this to happen. So the total number of ways for Anne and Bubbatunde both to get it wrong is .
The total number of ways Anne and Bubbatunde could pick their spots is , so is given by
To get an idea of how nearly independent events and are, let’s look at
where I have simplified the algebra. This goes to zero fairly quickly as , so the condition for independence holds in the limit of large , showing why the two different problems have the same answer in this limit.
Finally, we can answer the original question about the full probability distribution. Plugging in the asymptotic form for into the expression we derived earlier and simplifying, we get
where is the probability to have exactly Rockettes in the right spot. All the have canceled out, showing that for large numbers of Rockettes, the probability distribution settles down to a fixed distribution independent of . Surely this distribution has a special name. Does anyone out there on the internet want to drop me a comment?
Now if we could only find an infinite supply of Rockette fuel to feed them…