Permutation roots
(832) 422-8646
Contact
Let σ be a permutation on n elements. If there is a permutation τ such that applying τ twice has the same effect on the list of elements as applying σ once, we say σ = τ² and τ is a square root of σ.
If we let our n elements be the integers 0 through n − 1, then we can represent permutations by what they do to this list of numbers. In Python as a tuple of length n and compose permutations with the following function:
import itertools
def compose(sigma, tau):<br>"Return the composition σ ∘ τ (apply τ first, then σ)."<br>return tuple(sigma[j] for j in tau)
We can always construct permutations that have square roots by squaring a permutation. If we run the following code
tau = (3, 1, 4, 5, 2, 0)<br>sigma = compose(tau, tau)
we find σ = (5, 1, 2, 0, 4, 3), and by construction (3, 1, 4, 5, 2, 0) is a square root of &sigma, though it’s not the only one.
The following code shows that σ has four roots.
import itertools
def numroots(sigma):<br>n = len(sigma)<br>c = 0<br>for tau in itertools.permutations(range(n)):<br>if sigma == compose(tau, tau):<br>c += 1<br>return c
print( numroots(sigma) )<br>print( numroots( (1, 2, 3, 4, 5, 0) ) )
It also shows that the rotation (1, 2, 3, 4, 5. 0) has no roots.
The function numroots has runtime proportional to n! and so it’s not practical for large permutations. There is a theorem that says a permutation σ has a square root if and only if the number of cycles it has of every even length is even. See [1].
We can also define cubes and cube roots of permutations, and higher powers and roots.
How common is it for permutations to have square roots, or cube roots, etc.? If you pick a random permutation on n elements, what is the probability that it has a kth root?
This is a hard question in general, but it is equivalent to finding the coefficient of xk in the infinite product
This is theorem 4.8.3 in [1]. This theorem was the motivation for writing about expq in the previous post.
Although the product is infinite, there’s no need to compute terms in the product that only contribute powers of x higher than you’re interested in. The following Mathematica code will compute the probability that a permutation on n elements has a kth root.
expq[x_, q_] := MittagLefflerE[q, x^q]<br>p[n_, k_] := SeriesCoefficient[<br>Product[expq[x^m/m, GCD[m, k]], {m, 1, n}], {x, 0, n}]
So, for example, the probability that a permutation of 10 elements has a square root is 29/96.
[1] Herbert Wilf. Generatingfunctionology. Available online here.
Leave a Reply<br>Your email address will not be published. Required fields are marked *<br>Comment *<br>Name *
Email *
Website
Search for:
John D. Cook, PhD
My colleagues and I have decades of consulting experience helping companies solve complex problems involving data privacy, applied math, and statistics.
Let’s talk. We look forward to exploring the opportunity to help your company too.