Maths Olympiad Prep

Library / /2 of 2

Combinatorics Difficulty 8.8 Shortlist Prove it India

In a school, every pair of students are either friends or strangers. A sequence of (not necessarily distinct) students A1,A2,,A2023A_1, A_2, \dots, A_{2023} is called mischievous if

* Total number of friends of A1A_1 is odd.
* AiA_i and Ai+1A_{i+1} are friends for i=1,2,,2022i = 1, 2, \dots, 2022.
* Total number of friends of A2023A_{2023} is even.

Prove that the total number of mischievous sequences is even.

Solutions — 3

Solution 1

We first put the problem in graph theoretic terms:
Consider a finite simple graph GG. A walk of length 20222022 is called mischievous if the degree of its starting vertex is odd, and the degree of its ending vertex is even. Prove that the total number of mischievous walks is even.
Let 2022=m2022 = m. We prove the problem for all positive integers mm.
Denote the number of mischievous walks by SS. Let VV be the vertex set of the graph. For any two distinct vertices u,vu, v let f(u,v)f(u, v) denote the number of walks of length mm with starting vertex uu and ending vertex vv. Note that f(u,v)=f(v,u)f(u, v) = f(v, u). Then
S=deg(u) odddeg(v) evenf(u,v) S = \sum_{\substack{\deg(u) \text{ odd} \\ \deg(v) \text{ even}}} f(u, v)
We can also write the above sum as sum over all unordered pairs {u,v}\{u, v\} such that deg(u),deg(v)\deg(u), \deg(v) have different parities.
Note that deg(u),deg(v)\deg(u), \deg(v) have different parities     deg(u)+deg(v)1(mod2)\iff \deg(u) + \deg(v) \equiv 1 \pmod 2. Hence we can write the following equalities: ({u,v}\{u, v\} denotes unordered pair, while (u,v)(u, v) denotes ordered pair)
S{u,v}Vuvf(u,v)(deg(u)+deg(v))(mod2)=12(u,v)V×Vuvf(u,v)(deg(u)+deg(v))=12((u,v)V×Vuvf(v,u)deg(u)+(u,v)V×Vuvf(u,v)deg(v))=(u,v)V×Vuvf(u,v)deg(v) \begin{align*} S &\equiv \sum_{\substack{\{u,v\} \in V \\ u \neq v}} f(u,v)(\deg(u) + \deg(v)) \pmod{2} \\ &= \frac{1}{2} \sum_{\substack{(u,v) \in V \times V \\ u \neq v}} f(u,v)(\deg(u) + \deg(v)) \\ &= \frac{1}{2} \left( \sum_{\substack{(u,v) \in V \times V \\ u \neq v}} f(v,u) \deg(u) + \sum_{\substack{(u,v) \in V \times V \\ u \neq v}} f(u,v) \deg(v) \right) \\ &= \sum_{\substack{(u,v) \in V \times V \\ u \neq v}} f(u,v) \deg(v) \end{align*}
Let RR denote the RHS. It is sufficient to prove that RR is even.
Call a walk good if the first vertex and the second-last vertex in the walk are distinct, and bad otherwise.

Claim 1 RR is the total number of good walks of length m+1m+1 in GG.

Proof. Fix a pair of distinct vertices (u,v)(u, v). Note that we can represent any walk of length m+1m + 1 as a sequence of its m+2m + 2 vertices. We will count the number of walks w0,w1,,wm,wm+1w_0, w_1, \dots, w_m, w_{m+1} with w0=uw_0 = u and wm=vw_m = v. We can see that the walk w0,w1,,wmw_0, w_1, \dots, w_m has f(u,v)f(u, v) choices, while wm+1w_{m+1} has deg(v)\deg(v) choices. Hence number of walks of length m+1m+1 with first vertex uu and second-last vertex vuv \neq u is f(u,v)deg(v)f(u, v) \deg(v). Summing over all pairs (u,v)(u, v) we get the required expression. \square

Claim 2 Total number of walks of length kk in GG is even, for any k1k \ge 1.

Proof. We prove this statement by induction on kk. Base case: k=1k = 1 is true because any walk of length 1 is just an ordered pair of adjacent vertices, so if (u,v)(u, v) works so does (v,u)(v, u). Now assume number of walks of length kk are even for all knk \le n, for some n1n \ge 1. For any walk of length n+1n+1: w0,w1,,wn,wn+1w_0, w_1, \dots, w_n, w_{n+1} we can associate a corresponding walk wn+1,wn,,w1,w0w_{n+1}, w_n, \dots, w_1, w_0 with it. (Basically associate any walk with its reversed counterpart). Note that these two walks are different as long as wiwn+1iw_i \ne w_{n+1-i} for some ii. Thus all such walks can be matched into pairs, so their total number is even. We are left with walks for which wi=wn+1iw_i = w_{n+1-i} for each ii, i.e., palindromic walks. These are not possible if nn is even since then, wn2=wn+22w_{\frac{n}{2}} = w_{\frac{n+2}{2}} which is not an edge in our graph.
Now, if nn is odd then these walks can be uniquely determined by the first n+12\lceil \frac{n+1}{2} \rceil vertices in the walk, and any walk of length n+12\lceil \frac{n+1}{2} \rceil gives us a unique palindromic walk of length n+1n+1. Thus the number of walks of length n+1n+1 has the same parity as number of walks of length n+12n\lceil \frac{n+1}{2} \rceil \le n, which is even by induction hypothesis. \square

Claim 3 Total number of bad walks of length m+1m+1 in GG is even.

Proof. To any bad walk of length m+1m+1: w0,w1,,wm,wm+1w_0, w_1, \dots, w_m, w_{m+1} (w0=wmw_0 = w_m) we can associate a corresponding walk wm,wm1,,w0,wm+1w_m, w_{m-1}, \dots, w_0, w_{m+1} with it. (Basically associate any walk with a walk where the cycled part is reversed). Note that these two walks are different as long as wiwmiw_i \ne w_{m-i} for some ii. Thus all such walks can be matched into pairs, so their total number is even. We are left with walks for which wi=wmiw_i = w_{m-i} for each ii, i.e., walks where the cycled part is palindromic. These bad walks are uniquely determined by the walk wm+1,w0,w1,,wm2w_{m+1}, w_0, w_1, \dots, w_{\lceil \frac{m}{2} \rceil}, and any such walk of length m2+1\lceil \frac{m}{2} \rceil + 1 gives us a unique bad walk of length m+1m+1 where the cycled part is palindromic (it gives us the walk w0,w1,,wm2w_0, w_1, \dots, w_{\lceil \frac{m}{2} \rceil}, wm21,,w0,wm+1w_{\lceil \frac{m}{2} \rceil-1}, \dots, w_0, w_{m+1}). Thus the number of bad walks of length m+1m+1 has the same parity as number of walks of length m2+1\lceil \frac{m}{2} \rceil + 1, which is even by Claim 2. \square

Claim 2 and Claim 3 give us that the number of good walks of length m+1m+1 are even. Therefore by Claim 1, RR is even, as required. \square

Solution 2

Again we use the graph restatement. Let fk(u,v)f_k(u, v) be the number of walks of length k+1k+1 from uu to vv. Again, fk(u,v)=fk(v,u)f_k(u, v) = f_k(v, u). Let SmS_m be the set of mischievous walks of length mm, and let sm=Sms_m = |S_m|. Further, let TmT_m denote the set of walks of length mm starting from an odd degree vertex and ending at an odd degree vertex, and let tm=Tmt_m = |T_m|. Then
tm=(u,v)V×Vdeg(u),deg(v) oddfm(u,v) t_m = \sum_{\substack{(u,v) \in V \times V \\ \deg(u), \deg(v) \text{ odd}}} f_m(u, v)
Note that sm+tms_m + t_m is the total number of walks starting from an odd degree vertex.
We will prove by induction on k0k \ge 0 that sks_k and tkt_k are both even. Base cases: k=0k = 0. Walks of length 0 are just single vertices, so s0=0s_0 = 0 and t0t_0 is the number of odd degree vertices, which is even since sum of degrees in a graph is even. Now assume that sks_k and tkt_k are even for all knk \le n. We will first prove that tn+1t_{n+1} is even. To any walk w0,w1,,wn,wn+1w_0, w_1, \dots, w_n, w_{n+1} in Tn+1T_{n+1}, we can associate a corresponding walk wn+1,wn,,w1,w0w_{n+1}, w_n, \dots, w_1, w_0 with it. (Basically associate any walk with its reversed counterpart). These two walks are different as long as wiwn+1iw_i \ne w_{n+1-i} for some ii. Thus all such walks can be matched into pairs, so their total number is even. We are left with walks for which wi=wn+1iw_i = w_{n+1-i} for each ii, i.e., palindromic walks. These walks can be uniquely determined by the first n+12\lceil \frac{n+1}{2} \rceil vertices in the walk, and any walk of length n+12\lceil \frac{n+1}{2} \rceil starting from an odd degree vertex gives us a unique palindromic walk in Tn+1T_{n+1} of length n+1n+1. Thus the number of walks in Tn+1T_{n+1} has the same parity as number of walks of length n+12n\lceil \frac{n+1}{2} \rceil \le n starting from an odd degree vertex, i.e. sn+12+tn+12s_{\lceil \frac{n+1}{2} \rceil} + t_{\lceil \frac{n+1}{2} \rceil} which is even by induction hypothesis. Hence tn+1t_{n+1} is even.
To prove that sn+1s_{n+1} is even, it is sufficient to prove that sn+1+tn+1s_{n+1} + t_{n+1} is even, i.e., number of walks of length n+1n+1 starting from an odd degree vertex is even. But this quantity is just
(u,v)V×Vdeg(u) oddfn(u,v)deg(v) \sum_{\substack{(u,v) \in V \times V \\ \deg(u) \text{ odd}}} f_n(u, v) \deg(v)
This is because, if we fix the first and second-last vertices of a walk as uu (having odd degree) and vv respectively, then there are fn(u,v)f_n(u, v) walks of length nn from uu to vv, and the (n+1)(n+1)-st edge can be chosen adjacent to vv in deg(v)\deg(v) ways. Therefore
sn+1+tn+1=(u,v)V×Vdeg(u) oddfn(u,v)deg(v)=(u,v)V×Vdeg(u),deg(v) oddfn(u,v)deg(v)+(u,v)V×Vdeg(u) odddeg(v) evenfn(u,v)deg(v)(u,v)V×Vdeg(u),deg(v) oddfn(u,v)(mod 2)=tn \begin{align*} s_{n+1} + t_{n+1} &= \sum_{\substack{(u,v) \in V \times V \\ \deg(u) \text{ odd}}} f_n(u, v) \deg(v) \\ &= \sum_{\substack{(u,v) \in V \times V \\ \deg(u), \deg(v) \text{ odd}}} f_n(u, v) \deg(v) + \sum_{\substack{(u,v) \in V \times V \\ \deg(u) \text{ odd} \\ \deg(v) \text{ even}}} f_n(u, v) \deg(v) \\ &\equiv \sum_{\substack{(u,v) \in V \times V \\ \deg(u), \deg(v) \text{ odd}}} f_n(u, v) \quad (\text{mod } 2) \\ &= t_n \end{align*}
which is even by induction hypothesis, as required. Hence each sns_n is even, and we are done.

Solution 3

Let fn(u,v)f_n(u, v) be the number of nn length walks from vertex uu to vertex vv.
We want to compute (u,v)Vf2022(u,v)(degu)(degv+1)(mod2)\sum_{(u,v) \in V} f_{2022}(u, v)(\deg u)(\deg v + 1) \pmod{2} across all vertices u,vVu, v \in V.
Now, if RnR_n is the number of all walks in the graph, then by Claim 2 in Solution A, RnR_n is even for all nNn \in \mathbb{N}.
(u,v)Vf2022(u,v)(degu)(degv)+f2022(degu)=R2024+R20230+0(mod2) \sum_{(u,v) \in V} f_{2022}(u, v)(\deg u)(\deg v) + f_{2022}(\deg u) = R_{2024} + R_{2023} \equiv 0 + 0 \pmod{2}
Thus, we are done. \square

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 reproduced verbatim; metadata (topic, difficulty) added by this project.