Maths Olympiad Prep

Library / /2 of 4

Combinatorics Difficulty 6.3 National olympiad Prove it North Macedonia

Let pp be a positive integer, p>1p > 1. Find the number of m×nm \times n matrices with entries in the set {1,2,3,...,p}\{1,2,3,..., p\} and such that the sum of elements on each row and each column is not divisible by pp.

Solution

Denote by XX the set of all matrices with entries in the set {1,2,3,...,p}\{1,2,3,..., p\} and let AiA_i, respectively BjB_j, the set of matrices in which the sum of elements in the row ii, respectively on the column jj, be divisible by pp. Then we have to obtain the cardinality NN of the set
X((i=1mAi)(j=1nBj)). X \setminus \left( \left( \bigcup_{i=1}^{m} A_i \right) \cup \left( \bigcup_{j=1}^{n} B_j \right) \right).
For this we apply the inclusion-exclusion principle. Then
N=pmn+i=0mj=0n(1)i+jk1<k2<<kil1<l2<<ljAk1Ak2AkiBl1Bl2Blj(i) N = p^{mn} + \sum_{i=0}^{m} \sum_{j=0}^{n} (-1)^{i+j} \sum_{\substack{k_1 < k_2 < \dots < k_i \\ l_1 < l_2 < \dots < l_j}} |A_{k_1} \cap A_{k_2} \cap \dots \cap A_{k_i} \cap B_{l_1} \cap B_{l_2} \cap \dots \cap B_{l_j}| \quad (i)
the sum being taken for all i,ji, j with i+j0i + j \neq 0.
But we have
Ak1Ak2AkiBl1Bl2Blj=A1A2AiB1B2Bj(ii)|A_{k_1} \cap A_{k_2} \cap \dots \cap A_{k_i} \cap B_{l_1} \cap B_{l_2} \cap \dots \cap B_{l_j}| = |A_1 \cap A_2 \cap \dots \cap A_i \cap B_1 \cap B_2 \cap \dots \cap B_j| \quad (ii)
and moreover
pmn=(1)0+0(m0)(n0)pmn00. p^{mn} = (-1)^{0+0} \binom{m}{0} \binom{n}{0} p^{mn-0-0}.
For all i,ji, j participating in the summation we have
A1A2AiB1B2Bj={pmnij,if im or jnpmnmn1,if i=m and j=n |A_1 \cap A_2 \cap \dots \cap A_i \cap B_1 \cap B_2 \cap \dots \cap B_j| = \begin{cases} p^{mn-i-j}, & \text{if } i \neq m \text{ or } j \neq n \\ p^{mn-m-n-1}, & \text{if } i = m \text{ and } j = n \end{cases}
So,
N=i=0mj=0mi+jm+n(1)i+j(mi)(nj)pmnij+(1)m+n(mm)(nn)pmnmn+1==i=0mj=0m(1)i+j(mi)(nj)pmnij(1)m+n(mm)(nn)pmnmn++(1)m+n(mm)(nn)pmnmn+1= \begin{align*} N &= \sum_{i=0}^{m} \sum_{j=0}^{m} \sum_{i+j \neq m+n} (-1)^{i+j} \binom{m}{i} \binom{n}{j} p^{mn-i-j} + (-1)^{m+n} \binom{m}{m} \binom{n}{n} p^{mn-m-n+1} = \\ &= \sum_{i=0}^{m} \sum_{j=0}^{m} (-1)^{i+j} \binom{m}{i} \binom{n}{j} p^{mn-i-j} - (-1)^{m+n} \binom{m}{m} \binom{n}{n} p^{mn-m-n} + \\ & \qquad + (-1)^{m+n} \binom{m}{m} \binom{n}{n} p^{mn-m-n+1} = \end{align*}
---

=s=0m+n(1)spmnsi+j=s(mi)(nj)+(1)m+n(mm)(nn)pmnmn(p1)==pmns=0m+n(1p)s(m+ns)+(1)m+npmnmn(p1)==pmn((1p)m+n+(1)m+n(mm)(nn)pmnmn(p1))==pmnmn((p1)m+n+(1)m+n(p1))\begin{align*} &= \sum_{s=0}^{m+n} (-1)^s p^{mn-s} \sum_{i+j=s} \binom{m}{i} \binom{n}{j} + (-1)^{m+n} \binom{m}{m} \binom{n}{n} p^{mn-m-n} (p-1) = \\ &= p^{mn} \sum_{s=0}^{m+n} \left(\frac{-1}{p}\right)^s \binom{m+n}{s} + (-1)^{m+n} p^{mn-m-n} (p-1) = \\ &= p^{mn} \left( \left(-\frac{1}{p}\right)^{m+n} + (-1)^{m+n} \binom{m}{m} \binom{n}{n} p^{mn-m-n} (p-1) \right) = \\ &= p^{mn-m-n} \left( (p-1)^{m+n} + (-1)^{m+n} (p-1) \right) \end{align*}

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

Source: MathNet, licensed CC-BY-4.0. Statement and solution reproduced as published; topic and difficulty added by this site.