0

Let $C_n$​ count the number of cycles in a random permutation of $\{1,2,\cdots,2n\}$ that are larger than $n$ in length. Compute $\underset{n→∞}\lim⁡E[Cn]$.

Attempt :

Since this question was from a rapid round, I required a really short approach, so, I found a theorem stating that the expected number of cycles in a random permutation in a set of n-elements is the n-th harmonic sum.

So, I naturally put, $$E[C_n]\implies \sum_{k=1}^{2n}\frac{1}{k}$$

$$\underset{n→∞}\lim E[C_n]\implies \underset{n→∞}\lim\sum_{k=1}^{2n}\frac{1}{k}=\times$$

So, the limit diverges.

I am unable to find the fastest way to solve this problem while avoiding having to run some numerical test on it.

Amrut Ayan
  • 8,887

1 Answers1

2

You are only interested in cycles of length greater than $n$, so your formula should be: $$E[C_n]= \sum_{k=n+1}^{2n}\frac{1}{k}$$

That was your mistake. First I will explain how to derive the formula, then I will give you the limit.

There can only be at most $1$ cycle of length $k\geq n+1$ in a permutation of $2n$ items. Thus the expected number of such cycles is the probability that it occurs, which is the number of permutations which have such a cycle, divided by $(2n)!$.

As no permutation can have have a cycle of length $k_1$ and one of length $k_2$ where $k_1,k_2\geq n+1$, we can just sum the number of permutations containing a cycle of length $k$ from $n+1$ to $2n$, without worrying about overlaps.

For a given $k$, there are ${2n \choose k}$ choices of items to go in the cycle. Once these items are fixed, there are $(k-1)!$ possible cycles (pick an item, the cycle can take it to one of $k-1$ items, which can then be taken to one of $(k-2)$ items and so on ....). Finally, there are $(2n-k)!$ possible permutations for the remaining $2n-k$ items.

Thus the number of permutations containing a cycle of length $k$ is:$${2n \choose k} \times (k-1)! \times (2n-k)!\\=\frac{(2n)!}k.$$

Summing from $k=n+1$ to $2n$ and dividing by $(2n)!$ gets us to the corrected version of your formula:

$$E[C_n]= \sum_{k=n+1}^{2n}\frac{1}{k}.$$

Now we may rewrite this as $$E[C_n]= \sum_{k=n+1}^{2n}\frac{1}{k/n}\frac1n\\= \sum_{x=1+\delta x,\,\,x/\delta x\in \mathbb{N} }^{2}\frac{1}{x}\delta x,$$ where $x=k/n$ and $\delta x=\frac1n$.

Thus: $$\underset{n→∞}\lim E[C_n]= \int_1^2 \frac 1x dx\\{{}}\\{{}} \\= \log(2)\approx 0.69314718056$$


For context there is a well known puzzle, where there are $100$ boxes, numbered on the outside $1$ though $100$. Each contains a card with a number on it (again between the boxes they will have cards with all the numbers $1$ though $100$). There are also $100$ prisoners numbered $1$ though $100$. Each prisoner gets to open $50$ boxes, one at a time, seeing the number in each box before opening the next. After each prisoner is finished the cards are resealed in the boxes exactly as before, before the next prisoner begins.

If every prisoner opens the box with their own number, they are all released. However if even one prisoner fails to open their own number they are all executed.

Clearly each prisoner has a fifty-fifty shot at opening their own number. So if just the first prisoner had to open their number, they would have a $50\%$ chance of success. You might then expect that the chance of them all succeeding is about $\frac1{2^{100}}=0.00000000000000000000000000008\%$. However with a clever strategy they have close to $1-\log(2)$ chance of all succeeding- e.g. about $31\%$. The $\log(2)$ comes in here because the strategy succeeds precisely when there are no cycles of length greater than $50$ in the permutation coming from placing the cards in the boxes. As we have shown, this has approximately probability $1-\log(2)$ of happenning.

tkf
  • 15,315
  • Thank you for pointing out that silly mistake! and thank you for the extra insight through that puzzle, saw a strikingly similar question earlier in the same paper – Amrut Ayan May 08 '25 at 17:08
  • There may be a faster way of finding that the expected number of cycles of length $k$ is $\frac1k$: see https://math.stackexchange.com/a/4487223/6460 – Henry May 08 '25 at 23:33
  • 1
    Then $\sum\limits_{k=n+1}^{2n}\frac{1}{k} = \sum\limits_{k=1}^{2n}\frac{1}{k} - \sum\limits_{k=1}^{n}\frac{1}{k} $ $= \left(\log_e(2n)+\gamma +O(\frac1{n})\right) - \left(\log_e(n)+\gamma +O(\frac1{n})\right) $ $=\log_e(2)+O(\frac1{n})$ – Henry May 08 '25 at 23:36