Secret-Santa: Probability of two people drawing each other. When playing Secret Santa this year, where a group of $n$ people buy presents and these $n$ presents get randomly distributed to the other people, excluding the possibility of someone getting his or her own present (we did it with a online-distributer, so this possibility really is excluded), someone in this round asked the question about the probabilty of two people giving presents to each other. Since then I've been thinking about this problem, but I didnt get very far. The only thing that comes to my mind is working with the symmetric group $S_{n}$, and considering the possibilities $S_{n}\setminus F$, with $F$ being the set of all permuations with at least one fixpoint, as this is not possible in the game of Secret Santa. The probabilty I'm interested in now can be calculated by coming up with the cardinality of the set $\{\pi \in S_{n}\setminus F\ \mid \pi $ contains at least a two-cycle$\}$. Any futher ideas?
 A: Define an $r$-derangement to be a permutation whose smallest cycle has length strictly greater than $r$. Let $D_{n,r}$ denote the number of $r$-derangements in $S_n$. It is a standard result that for fixed $r$, we have that $\frac{D_{n,r}}{n!} \sim e^{-H_{r}}$ where $H_r$ is the $r$-th Harmonic number. This is proven, for instance, in Analytic Combinatorics by Flajolet and Sedgewick.
The probability that two people do not give presents to each other should thus be approximately $\frac{e^{-H_{2}}}{e^{-1}} = e^{-1/2}$.
A: The numbers of ways to distribute $n$ gifts according to the rules are OEIS A000166. The numbers of those ways where two people give gifts to each other (i.e. there is a $2$-cycle) is OEIS A158243. The probability you seek is then an entry of the first sequence divided by that of the second.
Asymptotically, as given in the formulas section of both sequences, the numerator tends to $n!(e^{-1}-e^{-3/2})$ and the denominator to $n!(e^{-1})$, leading to a limiting probability of $1-\frac1{\sqrt e}=0.393469\dots$
A: Here's a fun fact: you might know that the probability that a random permutation has no fixed points is approximately $e^{-1}$ (and approaches this value quite rapidly). This generalizes: the probability that a random permutation has no cycles of length $\le \ell$ is approximately
$$e^{-H_{\ell}} = e^{- \left( 1 + \frac{1}{2} + \dots + \frac{1}{\ell} \right)}$$
where $H_{\ell}$ is the $\ell^{th}$ harmonic number. So the probability that a random permutation has no $2$-cycles given that it has no fixed points is approximately $e^{-\frac{1}{2}}$, which means the probability you want is the complement of this, namely
$$\boxed{ 1 - e^{- \frac{1}{2} } \approx 0.393 \dots }.$$
This can be proven using a result called the permutation form of the exponential formula, which implies that for fixed $\ell$ the sequence $f(n, \ell)$ counting the number of permutations of $n$ elements with no cycles of length $\le \ell$ has exponential generating function
$$\sum_{n \ge 0} f(n, \ell) \frac{t^n}{n!} = \exp \left( \sum_{k \ge \ell+1} \frac{t^k}{k} \right) = \frac{\exp \left( - \sum_{k=1}^{\ell} \frac{t^k}{k} \right)}{1 - t}.$$
The result follows (with very good error terms) from looking at the pole at $t = 1$. You can plug this generating function into a computer algebra system like WolframAlpha to compute specific coefficients and it will tell you, for example, that when $n = 8$ there are exactly $14833$ permutations without fixed points and $8988$ permutations without cycles of length $\le 2$, so the exact probability for $n = 8$ is
$$\frac{14833 - 8988}{14833} = 0.394 \dots$$
so the above is quite a close approximation already for this small value of $n$. We have $14833 = \left[ \frac{8!}{e} \right]$ where $[x]$ denotes the closest-integer function (this is a well-known formula for the number of derangements); we might hope that $8988$ is equal to $\left[ \frac{8!}{e^{1 + \frac{1}{2}}} \right]$ but this is actually equal to $8987$. So close but not quite! Probably a very slight adjustment to this will produce an exact formula for all but possibly very small $n$.
