Look at the cycle containing 1 (of course, just talking about “cycles” in the first place means making things complicated).

There’s a 1 in N chance that the cycle consists of 1 alone (in which case 1 is fixed), and the remaining N-1 elements are expected to have another 1 fixed element by induction. There’s another 1 in N chance that the cycle contains all N elements, so there are no fixed elements. On average between these two cases (which are equiprobable) there is 1 fixed point.

The remaining probability is that the cycle contains K elements, 1<K<N, and the remaining N-K elements have an average of 1 fixed point by induction. So the overall average is to have 1 element fixed by the permutation.

]]>*â€œOf all n! permutations, 1/n of them have the correct element in the first slot,â€
But how do you know this without looking at what permutations look like?*

Because the first element has to have an equal chance of being in any slot, by a trivial symmetry argument. This is basically what you said too, although for me it fell below my threshold of interestingness.

*Once you *know* that X is in the correct slot 1/N-th of the time, I wouldnâ€™t have thought there was much interesting to sayâ€¦ I wasnâ€™t even aware there was a â€œtrickâ€ to that part of it.*

Yeah, I guess you immediately jumped to the idea of thinking about the entire set of permutations as a collection, rather than by adding up lots of different individual rows with differing properties. That is not an obvious step to a lot of people.

Apparently our ideas of what constitutes a trick and what is obvious are complementary…

]]>But how do you know this without looking at what permutations look like?

My solution to this part of the problem involves noticing that there’s nothing special about the “correct slot”. You can just as easily ask about, say, “how many permutations are there where item X is in the Y slot”. Because there’s nothing to distinguish the slots, the answer must be the same no matter what Y is, therefore the chance that X is in the X’th slot is 1/N (because the sum of all the possible Ys must be 1).

Once you *know* that X is in the correct slot 1/N-th of the time, I wouldn’t have thought there was much interesting to say… I wasn’t even aware there was a “trick” to that part of it.

]]>Of all n! permutations, 1/n of them have the correct element in the first slot, 1/n have the correct element in the second slot, etc. (of course many of these overlap but we don’t care). Summing over all slots, we get an average of 1/n * n = 1.

The key is not to worry about what any given permutation looks like and just look at the properties of the collection as a whole.

]]>The answer is 1.

Of course, I figured that out by brute force, generating all the permutations for n = 3 and n = 4 and counting. Figuring out *why* the mean is 1 is the interesting part. Intuitively, it obviously has something to do with the fact that it’s easy to generate lots of permutations by leaving one digit in place and scrambling the rest. I don’t really have time right now to confirm it, but I’m guessing that all the others balance out because at any time you can take two numbers that are both in their correct positions and swap them to get two numbers that are both in their incorrect positions, balancing a two-right-numbers case against a zero-right-numbers case. With three right, you can shift-right, shift-left, reverse, reverse-shift-right and reverse-shift-left, and get one case of three right and two of zero right balanced against three of one right. (With n numbers, you can *never* have n âˆ’ 1 right.) And it ends up being one of those things we learned in numerical analysis class years ago, where if you can prove that it’s true for *k* and you can prove that *if* it’s true for *k*, it’s also true for *k* + 1, then it’s always true.

I was going to post my answer, but on second thoughts let’s avoid spoilers.

]]>A random element in a random permutation has a 1/n probability of being in correct position, so — cue hand-waving — with a total of n elements, the number of correct ones is expected to be n*1/n = 1.

]]>