taocp

This site has no text of the book. Keep your own copy of TAOCP next to it. See what is checked.

Exercise · Volume 1 · 1.2.5-2

Exercise 1.2.5-2

proved in Lean solution written

Rating10
KindK1, prove: show that a stated fact is true from the written solution
SectionSection 1.2.5 of Volume 1. Companion chapter: Permutations and factorials

The task

Show that the number of ways to arrange n−1n-1 of nn objects equals the number of ways to arrange all nn, and give the reason.

The exact wording is in your copy of the book.

Hints

Open one hint at a time. Try the exercise again after each.

Hint 1

Use eq. (2): pn(k)p_n^{(k)} is a product of kk factors, and nk‾n^{\underline{k}} in eq. (18) is the same product.

Hint 2

Write both products out and compare their last factors.

Solution

Show the solution

By eq. (2), pn(k)=n(n−1)⋯(n−k+1)p_n^{(k)} = n(n-1)\cdots(n-k+1), a product of kk factors. For k=n−1k = n-1 the last factor is n−(n−1)+1=2n-(n-1)+1 = 2. For k=nk = n the last factor is n−n+1=1n-n+1 = 1. So

pn(n)=n(n−1)⋯2⋅1=pn(n−1)⋅1=pn(n−1).p_n^{(n)} = n(n-1)\cdots 2 \cdot 1 = p_n^{(n-1)} \cdot 1 = p_n^{(n-1)}.

The reason is that the last factor is 11. After n−1n-1 places are filled, exactly one object is left, and it must go to the last place. A choice of n−1n-1 objects in a row, with order, therefore fixes the full row. Each full row cuts down to one (n−1)(n-1)-row by dropping its last object, and this map is a bijection. The case n=1n = 1 is the equality p1(0)=p1(1)=1p_1^{(0)} = p_1^{(1)} = 1.

Check

For n=4n = 4: p4(3)=4⋅3⋅2=24p_4^{(3)} = 4 \cdot 3 \cdot 2 = 24 and p4(4)=4⋅3⋅2⋅1=24p_4^{(4)} = 4 \cdot 3 \cdot 2 \cdot 1 = 24. Python: math.perm(4, 3) == math.perm(4, 4) == 24, and the same holds for n=1,…,10n = 1, \ldots, 10.

Remarks

Both counts equal n!n!. For k<n−1k < n-1 the counts pn(k)p_n^{(k)} and pn(k+1)p_n^{(k+1)} differ, because the next factor n−kn - k is at least 22. Exercise 1.2.5-3 uses the same rule to build the permutations of nn objects from those of n−1n-1.

This solution is checked, and a person has not reviewed it yet. The source.

In Lean

proved The statement and its proof are in Lean. The kernel accepts the proof, and it uses the standard axioms only.

The status is computed from the Lean build. The node of the map.

Something is wrong? Report it.