Skip to the Main Content

Note:These pages make extensive use of the latest XHTML and CSS Standards. They ought to look great in any standards-compliant modern browser. Unfortunately, they will probably look horrible in older browsers, like Netscape 4.x and IE 4.x. Moreover, many posts use MathML, which is, currently only supported in Mozilla. My best suggestion (and you will thank me when surfing an ever-increasing number of sites on the web which have been crafted to use the new standards) is to upgrade to the latest version of your browser. If that's not possible, consider moving to the Standards-compliant and open-source Mozilla browser.

November 24, 2019

Random Permutations (Part 1)

Posted by John Baez

I’m going to solve some problems on random permutations in my combinatorics class, to illustrate some of the ideas on species and generating functions, but also to bring in some ideas from complex analysis.

In all these problems we choose permutations randomly from S nS_n, with each permutation having probability 1/n!1/n! of being chosen.

I’ll start with one that’s easy, given the stuff I’ve already explained in class.

Puzzle 1. What is the probability that a randomly chosen permutation of an nn-element set has exactly kk fixed points? What does this probability converge to as nn \to \infty?

In homework the students already computed the probability that a randomly chosen permutation of an nn-element set has no fixed points. A permutation with no fixed points is called a derangement, and the number of derangements of an nn-element set is called the subfactorial !n!\!n.

Using the inclusion-exclusion principle, the number of derangements of {1,,n}\{1,\dots, n\} is the number of permutations of this set, minus the number of permutations that fix the point 11, minus the number that fix the point 22,… minus the number that fix the point nn, plus the number that fix the points 11 and 22, plus the number that fix the points 11 and 33,… minus the number that fix the points 1,21, 2 and 33,… and so on.

In short:

!n=n!(n1)(n1)!+(n2)(n2)!+(1) n(nn)(nn)! !n = n! \; -\; \binom{n}{1} (n-1)! + \binom{n}{2} (n-2)! - \cdots + (-1)^n \binom{n}{n} (n-n)!

We can simplify this to

!n=n!(10!11!+12!+(1) nn!) !\!n = n! \, \left(\frac{1}{0!} - \frac{1}{1!} + \frac{1}{2!} - \cdots + \frac{(-1)^n}{n!} \right)

Thus, the probability that a permutation of an nn-element set has no fixed points is

!nn!=10!11!+12!+(1) nn! \frac{!\!n}{n!} = \frac{1}{0!} - \frac{1}{1!} + \frac{1}{2!} - \cdots + \frac{(-1)^n}{n!}

and this approaches 1/e1/e as nn \to \infty. So cool.

Now, what about kk fixed points? To choose a permutation of an nn-element set with kk fixed points, we need to choose kk points and then choose a derangement of the remaining (nk)(n-k)-element set. There are

(nk)!(nk) \binom{n}{k} \, !(n-k)

ways to do this. Thus, the probability that a permutation of an nn-element set has kk fixed points is

(nk)!(nk)n! \binom{n}{k} \; \frac{!\!(n-k)}{n!}

which can be written more charmingly as

1k!!(nk)(nk)! \frac{1}{k!} \; \frac{!\!(n-k)}{(n-k)!}

We have seen that as nn \to \infty we have

!(nk)(nk)!1e \frac{!\!(n-k)}{(n-k)!} \to \frac{1}{e}

Thus, as nn \to \infty, the probability that a permutation of an nn-element set has kk fixed points approaches

1ek! \frac{1}{e \, k!}

Note that these probabilities sum to 11, as they must.

Puzzle 2. In the nn \to \infty limit, what is the expected number of fixed points of a permutation of an nn-element set?

You might naively think it would be infinite, but remember as we increase the size of our set we decrease the probability that any point gets mapped to itself.

We know that in the nn \to \infty limit the probability of there being kk fixed points is

1ek! \frac{1}{e \, k!}

so in this limit, the expected number of fixed points is

k0k1k!e=1e k11(k1)!=1 \sum_{k \ge 0} k \frac{1}{k! e} = \frac{1}{e} \sum_{k \ge 1} \frac{1}{(k-1)!} = 1

Exactly one!

You might also wonder what’s the expected number of fixed points for an arbitrary finite nn, but I’ll leave that to you.

Posted at November 24, 2019 1:39 AM UTC

TrackBack URL for this Entry:   https://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/3161

4 Comments & 0 Trackbacks

Re: Random Permutations (Part 1)

Is it clear why the limit as nn \to \infty of the expected number of fixed points of a permutation on nn elements is the same as k=0 P kk\sum_{k = 0}^\infty P_k k, where P kP_k is the limit as nn \to \infty of the probability of a permutation on nn elements having exactly kk fixed points? This seems like the sort of interchange-of-limits argument with which one must take some care.

Posted by: L Spice on November 25, 2019 3:46 PM | Permalink | Reply to this

Re: Random Permutations (Part 1)

Good point - it’s true one should take care with this. I’m pretty sure the dominated convergence theorem can handle it.

Posted by: John Baez on November 25, 2019 6:23 PM | Permalink | Reply to this

Re: Random Permutations (Part 1)

The distribution of the number of fixed points for a random permutation of size nn has the same first nn moments as the Poisson distribution with λ=1\lambda = 1. Here someone on MathOverflow pointed me to a paper on this by Diaconis, Fulman and Guralnick.

Posted by: Scott McKuen on November 25, 2019 5:51 PM | Permalink | Reply to this

Re: Random Permutations (Part 1)

Cool!

Posted by: John Baez on November 26, 2019 12:37 AM | Permalink | Reply to this

Post a New Comment