The constant that counts what does not happen
Worth reading first: The curve that is its own slope · Nobody gets their own hat.
Everything about so far in this ladder has been about change. It is the base whose curve is its own slope, the point where an area reaches one, the solution of an equation about rates, the thing a matrix does over time. Growth, in four costumes.
This rung is about the places it turns up where nothing grows at all. There is no rate of change in a shuffled pack of cards and none in the number 12!, and is in the middle of both.
A shuffle that misses everything
Hand back hats to people at random. The chance that nobody gets their own is, for of any size at all, about 0.3679 — and it barely moves as grows. Four people and four hundred give nearly the same answer.
That constancy is the first surprise. Intuition suggests either that the chance should fall, because there are more ways to go wrong with more people, or rise, because each individual is less likely to meet their own hat. It does neither.
The count itself is settled by inclusion–exclusion: subtract the arrangements fixing at least one item, add back those fixing at least two, and so on. What comes out is
and there is the whole answer. That alternating sum of reciprocal factorials is the series for evaluated at , cut off after terms.
So the proportion is not approximately in some vague asymptotic sense. It is the first terms of the series for , exactly, which is why the convergence is so fast — the error is the next term, at most , and by seven objects that is under a two-hundred-thousandth.
Why the exponential is there at all
It is worth asking what a series about growth is doing in a counting problem, and the answer is short: it is not a series about growth. The series is a fact about the numbers , and the reciprocal factorials appear here because items can be chosen and permuted in ways, and that ratio to is .
The exponential’s series is, in this reading, the generating function that counts labelled structures: dividing by is exactly what is done when the order of a chosen set is irrelevant, and every counting problem in which pieces are chosen and then ignored produces reciprocal factorials. So turns up in counting for the same structural reason it turns up in growth — both are about — and the two subjects meet in the series rather than in any shared idea about rates.
There is a matching probabilistic reading, which is the one worth carrying. Each person has probability of receiving their own hat, and the events are nearly independent. If they were exactly independent, the chance of all missing would be , which is the compound-interest limit and tends to . The events are not independent — the hats are handed out without replacement — and the remarkable thing is that the dependence cancels to a far higher order than it has any right to.
The distribution behind the constant
There is a way of seeing the whole thing at once, and it explains the alternation as well as the limit.
Count how many people get their own hat. The expected number is exactly 1, whatever is: each person contributes and there are of them, and expectation adds up whether or not the events are independent. The variance is also exactly 1. And as grows, the whole distribution of that count settles onto the Poisson distribution with mean 1, whose probability of zero is .
So the derangement proportion is one entry of a limiting distribution, and the other entries are just as tidy: the chance that exactly one person gets their own hat also tends to , the chance that exactly two do tends to , and in general exactly tends to . Those are the Poisson probabilities, and they sum to 1 because the series for does.
That reframing turns the constant from a curiosity into an instance. The Poisson distribution is what a large number of rare, nearly-independent chances produces, and is in every one of its probabilities. Derangements are the case , and the reason is that the expected number of fixed points is exactly one for every — a coincidence of the problem that makes the answer a clean rather than a clean for some less memorable .
The other place, where a factorial is nearly a power
The second appearance is inside the factorial itself.
grows faster than any exponential and is awkward to work with for exactly that reason: it has no closed form, and estimating it matters constantly, since it is the denominator of every probability in every counting problem. The estimate is
which is Stirling’s approximation, and it contains both and in a statement about multiplying whole numbers together.
The has a clean origin and it is worth extracting, because the derivation explains the shape of the answer.
Take logarithms: , a sum which is approximated by the area under from 1 to — and that area is . Exponentiating,
The is the in the integral of the logarithm, nothing more. It comes from the fact that , and the is there because differentiating produces an unwanted that has to be cancelled. That is the whole of why appears in Stirling’s formula, and the area under a curve is again the mechanism.
The is a different and harder story, which is where the bell curve comes in: it is the width of the peak of the integrand in an integral representation of the factorial, and the is the normalising constant of the normal distribution. Two constants, two mechanisms, one formula.
The smallest cases are worth having in front of the eye because they make the speed of the convergence concrete. One object: no derangements, proportion 0. Two: one out of two, proportion 0.5. Three: two out of six, 0.3333. Four: nine out of twenty-four, 0.375. Five: forty-four out of a hundred and twenty, 0.3667. The sequence is already oscillating tightly about 0.3679 by the time it can still be counted by hand, which is what an alternating series with factorial denominators does.
How good, and in what sense
The word “approximation” is doing something specific here and it is easy to get backwards. The difference grows without bound — at it is over three million. What shrinks is the ratio, which is what the table measures, and it shrinks like .
That distinction is not pedantry. Stirling’s formula is used to estimate ratios of factorials — binomial coefficients, probabilities, entropies — and in a ratio the errors partly cancel. Used to estimate a factorial itself to within a fixed number, it is useless for any worth using it for.
The last column of the table above is the check that the error really behaves as claimed. times the relative excess sits at about 0.0836 for every row, and . The figure asserts that agreement rather than displaying it, which is what turns a table into evidence: a formula predicting makes a claim about that column being flat, and a flat column is something a reader can see and a check can fail on. Carried to eighteen the ratio falls to 1.004640 and that column does not move — still 0.08352, still one twelfth — which is a more convincing display than a curve approaching a line.
A number nobody would guess
It is worth dwelling on how unhelpful intuition is here, because the failure is instructive.
Asked for the chance that a random shuffle of a large pack leaves no card in its own place, most people offer either a number near zero or a number near one, on the reasoning that with fifty-two chances something is bound to match, or that each individual match is unlikely. Both reasonings are sound and both point at the boundary; the answer sits at 0.37, near neither.
The resolution is that the expected number of matches is exactly 1 — not large, not small — and a count with mean 1 is neither reliably zero nor reliably positive. The whole of the surprise is that the expected number does not depend on : more people means more chances and each chance correspondingly rarer, and the two effects cancel exactly rather than approximately.
That exact cancellation is the fact worth carrying away, and it is the reason the answer is a constant rather than a function of . Whenever a count’s mean is pinned at a fixed value by two effects trading off, a Poisson limit and a power of are what to expect.
What the two have in common
Two appearances of in problems about counting, and it is fair to ask whether they have anything to do with each other beyond the letter.
They do, and the common object is the series. Both derivations pass through the same place: the derangement count is the truncated series for , and Stirling’s derivation goes through because the integral of a logarithm produces a linear term that exponentiates. Underneath both is the fact that is the function whose -th derivative is itself, so its series has in it — and is what appears whenever an ordering is imposed and then discarded.
That is a genuine explanation rather than a coincidence, and it also predicts where else to look. Any counting problem in which things are selected and then their order forgotten will produce reciprocal factorials, and any such sum evaluated at will produce a power of . The number of permutations with no cycle shorter than ; the distribution of the number of fixed points, which is Poisson with mean one; the probability that a random function has no small cycle — all of them are the same series read at different points.
The cleanest instance: adding random numbers until they pass one
There is a third appearance that is worth setting beside the two above, because the answer is exactly rather than in a limit, and because its proof is the essay’s own mechanism with nothing else in it.
Draw numbers uniformly between zero and one, one after another, and stop as soon as the running total exceeds one. The expected number of draws is exactly .
The proof is two observations. First, the process needs more than draws precisely when the first of them sum to at most one — so the chance of that is the volume of the region in the -dimensional cube where the coordinates add to at most one. Second, that volume is .
The second observation is the mechanism this essay named, in its most literal possible form. Sort the coordinates of a point in the cube from smallest to largest; the sorting divides the cube into regions, one for each ordering, all of the same volume by symmetry. The region where the coordinates add to at most one is carried onto exactly one of them by a volume-preserving change of coordinates, so it has volume . Choose, then forget the order, and a reciprocal factorial appears — here as a geometric volume rather than as a count.
Now add up. The expected value of a whole-number quantity is the sum over of the chance that it exceeds , so
No limit is taken, no approximation is made, and nothing grows: the answer is the series, summed. It is the tidiest demonstration available that is the sum of the reciprocal factorials first and everything else afterwards.
The same computation answers a variant worth knowing because it is so often stated wrongly. Stopping when the total exceeds rather than one gives an expected number of draws of for between zero and one, so the exponential function itself — not merely the constant — is the answer to a question about adding random numbers. And the corresponding probability that exactly draws are needed is , which sums to one as it must, with the reciprocal factorials again supplying every term.
Set the three appearances side by side and the common ingredient is visible in each. In the derangements it is an inclusion–exclusion whose -th term divides by because chosen items are then permuted freely. In Stirling’s formula it is the logarithm’s integral. Here it is the volume of a simplex, which is a cube divided by the number of orderings. Three routes, one arithmetic fact, and only one of the three has any notion of change in it.
Where else it turns up in counting
Once the mechanism is named — reciprocal factorials, from choosing and then forgetting the order — the same constant becomes predictable in places that look unconnected.
The secretary problem. Interviewing candidates one at a time and hiring the first that beats everything seen so far, the best strategy is to reject the first fraction of them and then take the next record. The chance of getting the best candidate is also . The arrives from an integral of , which is the area from the second rung of this ladder, and the essay on when to stop looking works it out.
Records in a random sequence. The expected number of times a running maximum is beaten in draws is , which grows like — the same logarithm, in a problem with no growth in it either.
Random permutations generally. The chance that a random permutation of things has no cycle of length one is ; the chance it has no cycle of length two tends to ; and in general the number of -cycles is Poisson with mean . The whole cycle structure of a random permutation is governed by a family of these constants, and the harmonic sum turns up again as the expected number of cycles.
Three problems about arrangements, three appearances of the same constant, and in none of them is anything increasing.
What the picture cannot show
The bars in the hero figure are exact counts, taken by enumerating every arrangement, and they stop at eight because arrangements are more than a figure can enumerate honestly on a page and is a wall. The claim being made is about all , and the picture shows the first eight — which is exactly the situation the site’s standing warning about small cases is about. What rescues it here is that the closed form is exact and elementary, so the pattern is proved rather than extrapolated.
Stirling’s table has a subtler limit. It shows the ratio approaching 1 and cannot show that the sequence of corrections — , then , and so on — is a series that diverges. Adding more correction terms improves the estimate up to a point and then makes it worse without bound, which is characteristic of asymptotic expansions and is invisible in any table of the first few. A picture of a good approximation getting better says nothing about what happens if the improvement is pursued.
The ladder from here
Rungs above: the Poisson distribution, of which the derangement count is one instance, and where appears for the same reason. Asymptotic series, and why an expansion can be divergent and still be the right tool. Stirling’s formula proved by Laplace’s method, where the is earned. The Gaussian integral, which is where the comes from in the first place. And the exponential generating functions of which this essay’s series is the simplest example.
The lesson worth keeping
The instinct on meeting in a problem about shuffling is to look for something growing, and there is nothing growing. That instinct comes from meeting the constant first as a rate of growth, which is a historical accident of how the subject is taught rather than a fact about the number.
What actually is, underneath every one of its appearances, is the sum of the reciprocal factorials. Growth is one consequence of that; counting is another; and neither is more fundamental. A constant met in one setting will keep turning up in others, and the reliable way to see why is to find the arithmetic identity that all its appearances pass through, rather than to look for the first setting hiding inside the later ones.
What links here
Computed from the collection, not written here: the essays that point at this one.
- A third of random games have no pure equilibrium
- A rectangle cut by a curve
- A series that converges nowhere
- One number under every bell
- Only one curve through the factorials bends the right way
- The product that deals the labels
- Two-thirds of a step past the line
- Matching when the arrivals are shuffled
- and 3 more
Shares its objects with
Essays that name at least two of the same things, and that neither author linked.
- A round table with no couple together — both name derangement, e, the number, inclusion exclusion, limit
- How many get their own hat — both name derangement, e, the number, inclusion exclusion, limit
- A sum stopped early still says something — both name approximation, counting argument, derangement
- The cells a permutation must miss — both name derangement, e, the number, inclusion exclusion
- A map that shrinks everything — both name approximation, limit
- A rectangle grown on two sides — both name approximation, limit
Named objects
A dashed tag is an object no other essay names yet.
ApproximationCounting argumentDerangemente, the numberFactorialInclusion exclusionLimitPower seriesProbabilityStirling approximation