Cycles in Permutations
Cycles in Permutations
(b) Find the average number of the last floor visited before the ground floor.
1. What is a permutation?
1 → 4 → 3 → 1, 2 → 2, 5 → 7 → 6 → 8 → 9 → 5,
4 3
6 8
Exercise 1. Give the matrix and the cycle notation for the permutation
illustrated below.
6 9 12 8
7 13
4 10
2 11
3 1 5 14
Who did person 7 choose to sit to the right of (if the cycle scheme of permu-
tation choice is considered)?
2. Random permutations
In the case of matrix notation we start with drawing σ(1) (each possible
value with chance n1 ), then we draw σ(2) from among the remaining numbers
1
(chance n−1 for each of them), etc. Each n-permutation has then a chance
of being chosen equal to n1 · n−1
1
· . . . · 21 · 1 = n!
1
.
We similarly modify the scheme with tables: i-th person (or generally i-th
element) with equal probability 1i chooses one of i options: either takes a
seat right to one of already sitting i − 1 people (joins an existing cycle), or
sits by an empty table (opens a new cycle). Every arrangement (so every
permutation) has probability of obtaining: 1 · 21 · . . . · n−1
1
· n1 = n!
1
.
∀1 2.1. (a) What is the probability that element 1 is a fixed point of a random
n-permutation?
(b) What is the average number of fixed points in an n-permutation?
∀1 2.2. (a) What is the probability that elements 1 and 2 are in the same cycle
of a random n-permutation?
(b) What is the probability that elements i and j (1 6 i < j 6 n) are
in the same cycle of a random n-permutation?
7
Exercise 4. Write down the next row, i.e. find k for 0 6 k 6 7.
n
" #
X
k n
∃1 3.4. Prove that for n > 2: (−1) = 0.
k=1
k
n
!" #" # " # !
X n k n−k n a+b
(a) = ,
k=0
k a b a+b a
m
" # " #
X n+k n+m+1
(b) (n + k) = ,
k=0
k m
n
" # " #
X k n! n+1
(c) = .
k=m
m k! m+1
∀2 3.6. Prove that for every n > 1 and x ∈ R holds
n n
" #
Y X n k
(x + k − 1) = x .
k=1 k=1
k
Exercise 5. Solve as many problems from this script as possible using the
identity from the previous problem, choosing adequate value for x.
n
X 1
Definition. The sum Hn := is called n-th harmonic number.
k=1
k
∀2 3.7. (a) Fix a cycle of length k. To how many different n-permutations does
it belong?
(b) How many different cycles of length k and elements from the set
{1, 2, . . . , n} are there?
(c) What is the total number of cycles in all n-permutations?
(d) Prove that n-permutation has Hn cycles on average.
" #
n+1
∃2 3.8. Prove that = n!Hn .
2
The key feature of the notation described above is that we can omit the
brackets and it remains unique. The structure of cycle decomposition can be
then encoded with use of ‘ordinary’ ordering of elements. Existence of this
particular bijection is called the transition lemma.
(b) Prove the described property, i.e. that after omitting the brackets they can
be uniquely added (allowing for reconstruction of the initial permutation).
∀2 4.1. Prove directly (not having used previous problems) that
n
" # " #
X n n+1
k = .
k=1
k 2
∀2 4.4. Let 1 6 k 6 n. What is the probability that all elements not greater
than k of a random n-permutation belong
(a) to the same cycle;
(b) to k different cycles?
Lockbox riddle. There are n locked boxes and n keys, each matching a
different lock. The keys are put in the boxes randomly (in each box there is
exactly one key). We can force opening of exactly k boxes (e.g. by cutting the
locks), where 0 6 k 6 n. Then we might get access to some keys allowing for
opening other locked boxes, keys from which would allow to open yet other
ones etc.
∀2 4.5. What is the probability that (after cutting k locks) we will succeed to
open all the boxes?
Plane riddle. In a plane there are n seats (n > 2), each on a ticket of
exactly one passenger. The first n−1 passengers enter the plane and take their
seats at random (independently on a seat number on their tickets). When the
last passenger enters the board: if his seat is free he takes it, otherwise he
asks the passenger sitting on the taken seat to switch place to the one they
have on their ticket. Then the other passenger stands up, goes to their seat
and the procedure is repeated (he sits if his seat is free and asks for switching
seats otherwise). This goes on until someone sits on the empty place.
∃2 4.6. (a) What is the probability that the passenger who was first to enter
the plane would have to switch seats?
(b) What is the average (expected) number of passengers who would
have to switch seats?
The prisoners enter the office one after another and everyone is allowed to
open and look into exactly 50 boxes (of their own choice and in whatever
order they want); then the boxes are locked again. If every prisoner succeed
to find their number, all of them can go free, otherwise (if at least one of
them does not find their number) — they remain imprisoned forever. Before
the first prisoner enters the office they have time to discuss the strategy, but
then they loose any possibility of communication with each other.
For instance if they agree to choose boxes randomly, then one particular
prisoner will succeed with chance 12 , so all of them will be set free with
1
probability 2100 ≈ 8 · 10−31 . . .
∀3 5.2. Provide a strategy giving the prisoners over 30% chance to be set free.
∃3 5.3. (a) Suppose that the head officer did not put the numbers at random
but he deduced the prisoners’ strategy and located the numbers da-
stardly. How does it affect the chances of the prisoners?
(b) Suppose now that the head officer is gracious and allowed the first
prisoner not only to see the contents of all boxes, but also to swap the
numbers in two of them (of his choice). How does it affect the chances
of the prisoners?
∀3 5.4. Let (mk )sk=1 be nonnegative integers such that sk=1 kmk = n. Prove
P
k
" #
n n! X Y 1
∃3 5.6. Prove that = , where ri > 1.
k k! k
r
i=1 i
P
ri =n
i=1
∃3 5.7. (a) How many (2m)-permutations have all the cycles of even length?
(b) Let n = km. Prove that the number of n-permutations having only
cycles of length divisible by k is equal to
n! m−1
Y
m
(ki + 1).
k m! i=1
n n
! !
X n X n
∀3 6.1. Prove that Dn−k = k Dn−k .
k=0
k k=0
k
∃3 6.2. Prove that if n > 2, then Dn = (n − 1)(Dn−1 + Dn−2 ).
n
X (−1)k
∃3 6.3. Prove that: (a) Dn = n! · , (b) Dn = nDn−1 + (−1)n .
k=0
k!
The power series representation of the exponential function, i.e. the fact that
for every real x holds
∞
X xn
ex = ,
n=0
n!
where e ≈ 2.71828 is the base of natural logarithm, allows to deduce from
the first part of the previous problem that Dn ≈ n!/e.
∀3 6.4. There are n people at a party, each having a hat. When leaving, every
person took a random hat. What is the probability that at least one
person took their own hat? How can this probability be approximated
for large n?
∃3 6.5. How many n-permutations do not contain any cycle of length k? Argue
that for large n this number is approximately equal to e−1/k .
n
" #
X n n−k
∀3 7.1. Prove that 2 = (2n − 1)!!.
k=1
k
1 2 3 4 5 6 7 8 9 10 11 12 13 14
9 5 10 3 11 4 2 14 1 6 13 7 12 8 ; 3.2. It is convenient to write the formula with use
of binomial coefficients in the first place, and then
transform it into a polynomial. How many cycles of
cycle form: particular lengths can an (n−2)-cycle n-permutation
have?
(1 9)(2 5 11 13 12 7)(3 10 6 4)(8 14);
3.3. The number of possible choices of an (n + 1)-
permutation of the set {0, 1, . . . , n} can be counted
to the right of 5 (and then 11, 12, 13 between them). independently in two cases: according to whether 0 is
or is not a fixed point.
2. (a) (0)(1793)(2486)(5). (b) Functions f and h:
f = (013764)(25)(8), h = (015348672); g is not a 3.4. It may be helpful to divide all the n-per-
permutation (as e.g. g(0) = g(3)). (c) For all pairs mutations into pairs with the property that within
(a, b) such that NWD(a, m) = 1. Then each pair one permutation has an even, and the other
one has odd number of cycles. E.g. such pairs that the
number of cycles differs by 1.
f (x) = f (y) ⇐⇒ m | a(x − y) ⇐⇒ m | x − y,
4. The next row: (0, 720, 1764, 1624, 735, 175, 21, 1).
3.7. (a) The remaining elements should be permuted
somehow. (b) Choose k elements and arrange them in
5. E.g.: 3.1. (a) Coefficient of x equals (n − 1)!. (b) a cycle. (c) Using previous points count all the cycles
n
Coefficient of xn−1 equals 1+2+. . .+(n−1) = 2
. with respect to their length k. (d) Divide the answer
in the previous point by n!.
(c) x = 1. 3.4. x = −1. 4.2. (b) x = 2. 7.1. x = 1
2
.
3.8. The recurrence from problem 3.3. can be used.
6. (a) (9)(7)(4658)(2)(13) or equivalently (13)(4658). Also the permutations of the set {0, 1, . . . , n} can
(b) Consider the following procedure: highlight the be counted with respect to the length of the cycle
first term and then every term which is least than without 0.
each of the highlighted so far. The highlighted elements
are then the first terms of the cycles, so the opening 4.1. RHS stands for 2-cycle permutations of the set
brackets can be put directly before them. {0, 1, . . . , n} (each consisting of a cycle with 0 and a
cycle without 0). LHS stands for permutations of the
7. (D1 , D2 , D3 , D4 , D5 ) = (0, 1, 2, 9, 44). set {1, . . . , n} with one highlighted cycle. An appro-
priate bijection can be pointed with help of the trans-
ition lemma (encoding non-highlighted cycles from
Hints to problems the LHS with one of the cycles from the RHS so-
mehow).
2.1. (a) Exactly when in the first step of ‘matrix
drawing’ 1 is chosen. (b) Every element has the sa- 4.2. (a) Similarly as in the previous problem, but
me probability for being a fixed point (and this is the this time k-cycle n-permutations with m highligh-
number of fixed points that this element ‘contributes’ ted cycles are to be counted. (b) Also similarly:
to the permutation on average). now we highlight some number of cycles (for k-cycle
n-permutation each cycle is either highlighted, or
2.2. (a) Exactly when in the second step of ‘cycle not).
drawing’ person 2 sits to the right of person 1. (b)
For each pair the probability will be the same. 4.3. (a) How does the alternative cycle notation for
such permutation look like? (b) How many, on avera-
2.3. (a) In ‘cyclic drawing’ nobody but 1 can open ge, does adding the k-th element (during ‘cycle dra-
a new cycle. (b) This number divided by n! is the wing’) ‘contribute’ to the sum of squares of cycle
answer in the previous point. (c) As in (a), but this lengths? The previous point may turn out useful.
time no element greater than k can open a new cycle.
4.6. (a) Several cases for n may be checked in or- 6.5. Try Principle of Inclusion-Exclusion for sets Ac
der to conjecture the right answer; maybe compare it of those σ, which contain a fixed cycle c of length
with the solution of problem 2.2. (b), or the trans- k in their decomposition. Take a look at the remark
ition lemma. Consider the permutation that assigns about power series expansion of ex .
the seat number to a passenger. (b) Take a look at
problem 4.3. (a).
6.6. Principle of Inclusion-Exclusion for sets Ai of
those k-cycle σ, which have a fixed point i.
5.1. (a) If a permutation contains such cycle,
then there is exactly one of a kind. So one co-
7.1. RHS is the number of ways to divide a
uld count cycles, not permutations. (b) Principle of
(2n)-element set into pairs. If we consider the set
Inclusion-Exclusion may turn out useful; every such
{1, 10 , 2, 20 , . . . , n, n0 }, then each such division can
permutation contains at most m such cycles.
be associated with some n-permutation in some num-
ber of ways (depending on the number of cycles this
5.2. Prisoners can condition the drawer to be opened permutation decomposes to).
with the content of the one just opened. Part (a) and
an approximate equality 1 − (H100 − H50 ) ≈ 0.31
7.2. (a) What is the probability that a permutation
may turn out useful.
containing exactly i+j cycles will have precisely i red
cycles (having exactly k elements altogether)? Make
5.3. (a) Does not change at all; the prisoners can use of the previous problem. (b) Make use of the pre-
ensure randomness somehow, they do not need it to vious part.
be guaranteed by the director. (b) The probability
reaches 100% — as the first prisoner knows every-
thing, it suffices for him to change the permutation
in such a way that the potential reason of losing is
eliminated.