Fixed Points in Random Permutations
0. Introduction and problem statement
A standard question in probability theory and combinatorics is to determine the probability of having a specific number of fixed points in a random permutation. For instance, a real life problem that features this question is given in [1, Chapter 2 Exercises] and reads as follows.
Suppose
There are several interesting approaches to solving this and recently, I found another one that reminded me of Fibonacci numbers. With those you have the relationship
that can be transformed into the matrix representation
Diagonalizing that matrix then gives an explicit expression for
In the following I’ll show that a similar recurrence relation also holds for the number of fixed points in a permutation.
1. Definitions and Notation
First, we define the necessary terminology and notation.
Definition. A bijective function
For
A common way to denote permutations is by way of permutation tables, e.g.
Definition. A fixed point of a permutation
For example, there are no fixed points in the above permutation because
To derive the probability of having
(i). Obviously, it is
(ii). Consider the random variable
2. Solving the problem theoretically
Because of the uniformness distribution on
The problem now reduces to deriving an explicit expression for
Define
To construct a permutation with exactly one fixed point, we fix one element and permutate the remaining
Since for
Here the connection to Fibonacci numbers emerges. The expression above is recursive. Therefore, we’ll transform the equation into matrix format,
Some algebraic manipulations give
Note that
But
After multiplying the inverse with the vector on the right-hand side in (1), we arrive at
Finally, the number of permutations with
and with it the desired probability as
To return to the initial real-life application. For
3. Solving the problem computationally
The following R code produces simulation results that closely resemble the theoretical assertions.
Anzahl.Mantel = 5
Anzahl.Rep = 1000
Mantel = replicate(Anzahl.Rep, {
sample(1:Anzahl.Mantel, Anzahl.Mantel, replace = FALSE)
})
Test = matrix(1:Anzahl.Mantel, nrow = Anzahl.Mantel, ncol = Anzahl.Rep)
Vergleich = (Mantel == Test) %>%
t() %>%
as.data.frame() %>%
mutate(Anzahl = rowSums(.))
table(Vergleich$Anzahl)/sum(table(Vergleich$Anzahl))
The resulting distribution is as follows.
> table(Vergleich$Anzahl)/sum(table(Vergleich$Anzahl))
0 1 2 3 5
0.397 0.365 0.149 0.079 0.010
The difference to the true theoretical results is hence small after already 1000 draws.
4. Epilogue
It can be shown that the number of fixed points
References
[1] H.-O. Georgii (2014): Stochastik. Eine Einführung.