LibraryInterview questions

Number of Cycles in a Random Permutation

Quant interview question · hard · members

The question

Ten numbered tickets are shuffled uniformly at random and laid out in a row, so ticket π(j)\pi(j) ends up in position jj. Starting from any position, follow the chain: go to the position that its ticket points at, then again, and again. The chain must eventually come back to where it started, closing a loop.

The rest of the question is for members

Hint

Work out very small shuffles by hand, then ask how the expected count of loops changes each time another item joins the shuffle.

The idea behind it

Cycles have no natural index, so define an indicator per element instead: element jj contributes if it is the smallest member of its own cycle. That event has probability 1/j1/j by symmetry, and linearity finishes it.

The rest of the question and the solution are for members

You have the opening of the question, a hint and the idea. It derives the expected number of loops for the given shuffle and for any size, and says how that grows as the shuffle gets larger.

The full question and its solution are part of Thuztra Learn membership, which is a paid subscription. Install the app to read them:

Download on the Microsoft Store Download for Android

On Android, the app is a direct download, not a Google Play listing. Which devices, and what each one needs.

Further reading

Related problems

Topics

Also in the library