Maths Olympiad Prep

Library / Baltic Way Shortlist /86 of 92

Baltic Way Shortlist, 2023

Combinatorics Difficulty 9.0 Shortlist Prove it Baltic Way

For positive integers nn, kk let S(n,k)S(n, k) be the number of ways to partition a set with nn elements into kk non-empty parts. For example S(3,2)=3S(3, 2) = 3, because there are three ways to partition the set {1,2,3}\{1, 2, 3\} into two parts. For another example, S(4,2)=7S(4, 2) = 7.
Let pp be a prime number, and mm, nn positive integers such that p−1∣m−np-1 \mid m-n. Prove that S(m,i)≡S(n,i)(modp)S(m, i) \equiv S(n, i) \pmod{p} for all i=1,2,…,p−1i = 1, 2, \dots, p-1.

Solution

Let Epi(n,i)\mathrm{Epi}(n, i) be the number of surjective functions from a set with nn elements to a set with ii elements. It is not hard to see that S(n,i)=Epi(n,i)i!S(n, i) = \frac{\mathrm{Epi}(n, i)}{i!}. Indeed, a surjective function from {1,…,n}\{1, \dots, n\} to {1,…,i}\{1, \dots, i\} is the same thing as a partition of {1,…,n}\{1, \dots, n\} into ii parts, together with a numbering of the blocks of the partition, from 11 to ii. For every partition there exists i!i! numberings, and therefore S(n,i)⋅i!=Epi(n,i)S(n, i) \cdot i! = \mathrm{Epi}(n, i).

When 1≤i≤p−11 \le i \le p-1, gcd⁡(p,i!)=1\gcd(p, i!) = 1. It follows that for 1≤i≤p−11 \le i \le p-1, S(n,i)≡S(m,i)(modp)S(n, i) \equiv S(m, i) \pmod{p} if and only if Epi(n,i)≡Epi(m,i)(modp)\mathrm{Epi}(n, i) \equiv \mathrm{Epi}(m, i) \pmod{p}. So it is enough to prove that if p−1∣m−np-1 \mid m-n then Epi(n,i)≡Epi(m,i)(modp)\mathrm{Epi}(n, i) \equiv \mathrm{Epi}(m, i) \pmod{p} for all 1≤i≤p−11 \le i \le p-1.

There is a formula for Epi(n,i)\mathrm{Epi}(n, i):
Epi(n,i)=∑j=0i−1(−1)j(i−j)n(ij). \mathrm{Epi}(n, i) = \sum_{j=0}^{i-1} (-1)^j (i-j)^n \binom{i}{j}.
This formula is based on nothing more than the inclusion-exclusion principle. The number of surjective functions is the number of all functions −i-i times the number of functions that miss one particular element +(i2)+ \binom{i}{2} times the number of functions that miss two particular elements, etc. The number of functions that miss jj specified elements is (i−j)n(i-j)^n.

Now suppose mm, nn are positive integers satisfying p−1∣m−np-1 \mid m-n. Then am≡an(modp)a^m \equiv a^n \pmod{p} for all integers aa. When aa is not divisible by pp this follows from Fermat's little theorem. When aa is divisible by pp, both sides are zero mod pp. But we only need the cases when a=1,…,p−1a = 1, \dots, p-1 anyway.

It follows that if p−1∣m−np-1 \mid m-n then Epi(n,i)≡Epi(m,i)(modp)\mathrm{Epi}(n,i) \equiv \mathrm{Epi}(m,i) \pmod{p} for all 1≤i≤p−11 \le i \le p-1, and we are done.

Lemma:
For every i>1i > 1 and n>in > i:
S(n,i)=i⋅S(n−1,i)+S(n−1,i−1) S(n,i) = i \cdot S(n-1,i) + S(n-1,i-1)
Proof. Select an element xx. There are S(n−1,i)S(n-1,i) ways to partition the remaining elements into ii different sets. By adding xx to any of them, we get a partition of the original set. All the partitions obtained this way are different and the only partitions that cannot be obtained this way are the ones where xx ends up alone. But in that case the n−1n-1 other elements must form i−1i-1 sets, yielding another S(n−1,i−1)S(n-1,i-1) partitions. □\square

Lemma:
For every pp prime, p>i≥1p > i \ge 1 and λ≥0\lambda \ge 0:
S(i+λ(p−1),i)=1(modp). S(i + \lambda(p-1), i) = 1 \pmod{p}.
Proof. As S(n,1)=1S(n,1) = 1 and S(i,i)=1S(i,i) = 1, this is obvious for i=1i = 1 or λ=0\lambda = 0. We proceed by induction over ii and λ\lambda. Using the induction hypothesis and the previous lemma:
S(i+λ(p−1),i)=i⋅S(i−1+λ(p−1),i)+S(i−1+λ(p−1),i−1)=i⋅S(i−1+λ(p−1),i)+1mod p \begin{aligned} S(i + \lambda(p-1), i) &= i \cdot S(i-1 + \lambda(p-1), i) + S(i-1 + \lambda(p-1), i-1) \\ &= i \cdot S(i-1 + \lambda(p-1), i) + 1 \quad \text{mod } p \end{aligned}
Otherwise applying this p−1p-1 times gives
S(i+λ(p−1),i)=ip−1⋅S(i+(λ−1)(p−1),i)+∑j=0p−2ijmod p=ip−1⋅1+ip−1−1i−1mod p=1⋅1+0mod p. \begin{aligned} S(i + \lambda(p-1), i) &= i^{p-1} \cdot S(i + (\lambda - 1)(p-1), i) + \sum_{j=0}^{p-2} i^j \quad \text{mod } p \\ &= i^{p-1} \cdot 1 + \frac{i^{p-1} - 1}{i-1} \quad \text{mod } p \\ &= 1 \cdot 1 + 0 \quad \text{mod } p. \end{aligned}
Where the last equality holds by Fermat's little theorem as p>i>1p > i > 1 implies i≠0,1(modp)i \neq 0, 1 \pmod{p}. □\square

We can now proceed to proving the problem statement by induction: If i=1i=1 the statement is obvious. If m=im=i or n=in=i, we have the statement of the second lemma. So assume i>1i>1 and n>in>i, m>im>i and that the problem statement holds for all smaller values. Then
S(n,i)−S(m,i)=i⋅(S(n−1,i)−S(m−1,i))++S(n−1,i−1)−S(m−1,i−1)=i⋅0+0mod p=0mod p. \begin{aligned} S(n,i) - S(m,i) &= i \cdot (S(n-1,i) - S(m-1,i)) + \\ &\quad + S(n-1,i-1) - S(m-1,i-1) \\ &= i \cdot 0 + 0 \quad \text{mod } p \\ &= 0 \quad \text{mod } p. \end{aligned}

Want a route through all this instead of an archive? The track puts 2,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

Source: MathNet, licensed CC-BY-4.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.