# USAMO 2022 Solution Notes Evan Chen《陳誼廷》 15 April 2024 This is a compilation of solutions for the 2022 USAMO. The ideas of the solution are a mix of my own work, the solutions provided by the competition organizers, and solutions found by the community. However, all the writing is maintained by me. These notes will tend to be a bit more advanced and terse than the "official" solutions from the organizers. In particular, if a theorem or technique is not known to beginners but is still considered "standard", then I often prefer to use this theory anyways, rather than try to work around or conceal it. For example, in geometry problems I typically use directed angles without further comment, rather than awkwardly work around configuration issues. Similarly, sentences like "let $\mathbb{R}$ denote the set of real numbers" are typically omitted entirely. Corrections and comments are welcome! ## Contents 0 Problems ..... 2 1 Solutions to Day 1 ..... 3 1.1 USAMO 2022/1, proposed by Ankan Bhattacharya ..... 3 1.2 USAMO 2022/2, proposed by Ankan Bhattacharya ..... 4 1.3 USAMO 2022/3, proposed by Hung-Hsun Hans Yu ..... 6 2 Solutions to Day 2 ..... 8 2.1 USAMO 2022/4, proposed by Holden Mui ..... 8 2.2 USAMO 2022/5, proposed by Gabriel Carroll ..... 9 2.3 USAMO 2022/6, proposed by Yannick Yao ..... 10 ## §0 Problems 1. Let $a$ and $b$ be positive integers. Every cell of an $(a+b+1) \times(a+b+1)$ grid is colored either amber or bronze such that there are at least $a^{2}+a b-b$ amber cells and at least $b^{2}+a b-a$ bronze cells. Prove that it is possible to choose $a$ amber cells and $b$ bronze cells such that no two of the $a+b$ chosen cells lie in the same row or column. 2. Let $b \geq 2$ and $w \geq 2$ be fixed integers, and $n=b+w$. Given are $2 b$ identical black rods and $2 w$ identical white rods, each of side length 1. We assemble a regular $2 n$-gon using these rods so that parallel sides are the same color. Then, a convex $2 b$-gon $B$ is formed by translating the black rods, and a convex $2 w$-gon $W$ is formed by translating the white rods. An example of one way of doing the assembly when $b=3$ and $w=2$ is shown below, as well as the resulting polygons $B$ and $W$. ![](https://cdn.mathpix.com/cropped/2024_11_19_0824a9a7bcda8c860a08g-02.jpg?height=609&width=1013&top_left_y=952&top_left_x=571) Prove that the difference of the areas of $B$ and $W$ depends only on the numbers $b$ and $w$, and not on how the $2 n$-gon was assembled. 3. Solve over positive real numbers the functional equation $$ f(x)=f(f(f(x))+y)+f(x f(y)) f(x+y) $$ 4. Find all pairs of primes $(p, q)$ for which $p-q$ and $p q-q$ are both perfect squares. 5. A function $f: \mathbb{R} \rightarrow \mathbb{R}$ is essentially increasing if $f(s) \leq f(t)$ holds whenever $s \leq t$ are real numbers such that $f(s) \neq 0$ and $f(t) \neq 0$. Find the smallest integer $k$ such that for any 2022 real numbers $x_{1}, x_{2}, \ldots, x_{2022}$, there exist $k$ essentially increasing functions $f_{1}, \ldots, f_{k}$ such that $$ f_{1}(n)+f_{2}(n)+\cdots+f_{k}(n)=x_{n} \quad \text { for every } n=1,2, \ldots, 2022 $$ 6. There are 2022 users on a social network called Mathbook, and some of them are Mathbook-friends. (On Mathbook, friendship is always mutual and permanent.) Starting now, Mathbook will only allow a new friendship to be formed between two users if they have at least two friends in common. What is the minimum number of friendships that must already exist so that every user could eventually become friends with every other user? ## §1 Solutions to Day 1 ## §1.1 USAMO 2022/1, proposed by Ankan Bhattacharya Available online at https://aops.com/community/p24774812. ## Problem statement Let $a$ and $b$ be positive integers. Every cell of an $(a+b+1) \times(a+b+1)$ grid is colored either amber or bronze such that there are at least $a^{2}+a b-b$ amber cells and at least $b^{2}+a b-a$ bronze cells. Prove that it is possible to choose $a$ amber cells and $b$ bronze cells such that no two of the $a+b$ chosen cells lie in the same row or column. Claim - There exists a transversal $T_{a}$ with at least $a$ amber cells. Analogously, there exists a transversal $T_{b}$ with at least $b$ bronze cells. Proof. If one picks a random transversal, the expected value of the number of amber cells is at least $$ \frac{a^{2}+a b-b}{a+b+1}=(a-1)+\frac{1}{a+b+1}>a-1 $$ Now imagine we transform $T_{a}$ to $T_{b}$ in some number of steps, by repeatedly choosing cells $c$ and $c^{\prime}$ and swapping them with the two other corners of the rectangle formed by their row/column, as shown in the figure. ![](https://cdn.mathpix.com/cropped/2024_11_19_0824a9a7bcda8c860a08g-03.jpg?height=243&width=809&top_left_y=1466&top_left_x=629) By "discrete intermediate value theorem", the number of amber cells will be either $a$ or $a+1$ at some point during this transformation. This completes the proof. ## §1.2 USAMO 2022/2, proposed by Ankan Bhattacharya Available online at https://aops.com/community/p24775345. ## Problem statement Let $b \geq 2$ and $w \geq 2$ be fixed integers, and $n=b+w$. Given are $2 b$ identical black rods and $2 w$ identical white rods, each of side length 1. We assemble a regular $2 n$-gon using these rods so that parallel sides are the same color. Then, a convex $2 b$-gon $B$ is formed by translating the black rods, and a convex $2 w$-gon $W$ is formed by translating the white rods. An example of one way of doing the assembly when $b=3$ and $w=2$ is shown below, as well as the resulting polygons $B$ and $W$. ![](https://cdn.mathpix.com/cropped/2024_11_19_0824a9a7bcda8c860a08g-04.jpg?height=623&width=1021&top_left_y=859&top_left_x=521) Prove that the difference of the areas of $B$ and $W$ depends only on the numbers $b$ and $w$, and not on how the $2 n$-gon was assembled. We are going to prove that one may swap a black rod with an adjacent white rod (as well as the rods parallel to them) without affecting the difference in the areas of $B-W$. Let $\vec{u}$ and $\vec{v}$ denote the originally black and white vectors that were adjacent on the $2 n$-gon and are now going to be swapped. Let $\vec{x}$ denote the sum of all the other black vectors between $\vec{u}$ and $-\vec{u}$, and define $\vec{y}$ similarly. See the diagram below, where $B_{0}$ and $W_{0}$ are the polygons before the swap, and $B_{1}$ and $W_{1}$ are the resulting changed polygons. ![](https://cdn.mathpix.com/cropped/2024_11_19_0824a9a7bcda8c860a08g-05.jpg?height=734&width=1220&top_left_y=227&top_left_x=424) Observe that the only change in $B$ and $W$ is in the parallelograms shown above in each diagram. Letting $\wedge$ denote the wedge product, we need to show that $$ \vec{u} \wedge \vec{x}-\vec{v} \wedge \vec{y}=\vec{v} \wedge \vec{x}-\vec{u} \wedge \vec{y} $$ which can be rewritten as $$ (\vec{u}-\vec{v}) \wedge(\vec{x}+\vec{y})=0 $$ In other words, it would suffice to show $\vec{u}-\vec{v}$ and $\vec{x}+\vec{y}$ are parallel. (Students not familiar with wedge products can replace every $\wedge$ with the cross product $\times$ instead.) Claim - Both $\vec{u}-\vec{v}$ and $\vec{x}+\vec{y}$ are perpendicular to vector $\vec{u}+\vec{v}$. Proof. We have $(\vec{u}-\vec{v}) \perp(\vec{u}+\vec{v})$ because $\vec{u}$ and $\vec{v}$ are the same length. For the other perpendicularity, note that $\vec{u}+\vec{v}+\vec{x}+\vec{y}$ traces out a diameter of the circumcircle of the original $2 n$-gon; call this diameter $A B$, so $$ A+\vec{u}+\vec{v}+\vec{x}+\vec{y}=B $$ Now point $A+\vec{u}+\vec{v}$ is a point on this semicircle, which means (by the inscribed angle theorem) the angle between $\vec{u}+\vec{v}$ and $\vec{x}+\vec{y}$ is $90^{\circ}$. ## §1.3 USAMO 2022/3, proposed by Hung-Hsun Hans Yu Available online at https://aops.com/community/p24774907. ## Problem statement Solve over positive real numbers the functional equation $$ f(x)=f(f(f(x))+y)+f(x f(y)) f(x+y) . $$ The answer is $f(x) \equiv c / x$ for any $c>0$. This works, so we'll prove this is the only solution. The following is based on the solution posted by pad on AoPS. In what follows, $f^{n}$ as usual denotes $f$ iterated $n$ times, and $P(x, y)$ is the given statement. Also, we introduce the notation $Q$ for the statement $$ Q(a, b): \quad f(a) \geq f(b) \Longrightarrow f(f(b)) \geq a . $$ To see why this statement $Q$ is true, assume for contradiction that $a>f(f(b))$; then consider $P(b, a-f(f(b)))$ to get a contradiction. The main idea of the problem is the following: Claim - Any function $f: \mathbb{R}_{>0} \rightarrow \mathbb{R}_{>0}$ obeying statement $Q$ satisfies $f^{2}(x)=f^{4}(x)$. Proof. From $Q(t, t)$ we get $$ f^{2}(t) \geq t \quad \text { for all } t>0 $$ So this already implies $f^{4}(x) \geq f^{2}(x)$ by choosing $t=f^{2}(x)$. It also gives $f(x) \leq f^{3}(x) \leq$ $f^{5}(x)$ by choosing $t=f(x), t=f^{3}(x)$. Then $Q\left(f^{4}(x), x\right)$ is valid and gives $f^{2}(x) \geq f^{4}(x)$, as needed. Claim - The function $f$ is injective. Proof. Suppose $f(u)=f(v)$ for some $u>v$. From $Q(u, v)$ and $Q(v, u)$ we have $f^{2}(v) \geq u$ and $f^{2}(u) \geq v$. Note that for all $x>0$ we have statements $$ \begin{aligned} & P\left(f^{2}(x), u\right) \Longrightarrow f^{3}(x)=f(x+u)+f(x f(u)) f(x+u)=(1+f(x f(u))) f(x+u) \\ & P\left(f^{2}(x), v\right) \Longrightarrow f^{3}(x)=f(x+v)+f(x f(v)) f(x+v)=(1+f(x f(v))) f(x+v) . \end{aligned} $$ It follows that $f(x+u)=f(x+v)$ for all $x>0$. This means that $f$ is periodic with period $T=u-v>0$. However, this is incompatible with $Q$, because we would have $Q(1+n T, 1)$ for all positive integers $n$, which is obviously absurd. Since $f$ is injective, we obtain that $f^{2}(x)=x$. Thus $P(x, y)$ now becomes the statement $$ P(x, y): \quad f(x)=f(x+y) \cdot[1+f(x f(y))] . $$ In particular $$ P(1, y) \Longrightarrow f(1+y)=\frac{f(1)}{1+y} $$ so $f$ is determined on inputs greater than 1 . Finally, if $a, b>1$ we get $$ P(a, b) \Longrightarrow \frac{1}{a}=\frac{1}{a+b} \cdot\left[1+f\left(\frac{a}{b} f(1)\right)\right] $$ which is enough to determine $f$ on all inputs, by varying $(a, b)$. ## §2 Solutions to Day 2 ## §2.1 USAMO 2022/4, proposed by Holden Mui Available online at https://aops.com/community/p24774670. ## Problem statement Find all pairs of primes $(p, q)$ for which $p-q$ and $p q-q$ are both perfect squares. The answer is $(3,2)$ only. This obviously works so we focus on showing it is the only one. 『 Approach using difference of squares (from author). Set $$ \begin{aligned} a^{2} & =p-q \\ b^{2} & =p q-q . \end{aligned} $$ Note that $0N$ and choose $x_{n}=-n$ for each $n=1, \ldots, N$. Now for each index $1 \leq n \leq N$, define $$ S(n)=\left\{\text { indices } i \text { for which } f_{i}(n) \neq 0\right\} \subseteq\{1, \ldots, k\} $$ As each $S(n t)$ is nonempty, by pigeonhole, two $S(n)$ 's coincide, say $S(n)=S\left(n^{\prime}\right)$ for $nx_{n^{\prime}}$ in that case due to the essentially increasing condition. 【 Construction. It suffices to do $N=2^{k}-1$. Rather than drown the reader in notation, we'll just illustrate an example of the (inductive) construction for $k=4$. Empty cells are zero. | | $f_{1}$ | $f_{2}$ | $f_{3}$ | $f_{4}$ | | ---: | ---: | ---: | ---: | ---: | | $x_{1}=3$ | 3 | | | | | $x_{2}=1$ | 10 | -9 | | | | $x_{3}=4$ | | 4 | | | | $x_{4}=1$ | 100 | 200 | $-\mathbf{2 9 9}$ | | | $x_{5}=5$ | | 200 | -195 | | | $x_{6}=9$ | 100 | | -91 | | | $x_{7}=2$ | | | 2 | | | $x_{8}=6$ | 1000 | 2000 | 4000 | $-\mathbf{6 9 9 4}$ | | $x_{9}=5$ | | 2000 | 4000 | -5995 | | $x_{10}=3$ | 1000 | | 4000 | -4997 | | $x_{11}=5$ | | | 4000 | -3995 | | $x_{12}=8$ | 1000 | 2000 | | -2992 | | $x_{13}=9$ | | 2000 | | -1991 | | $x_{14}=7$ | 1000 | | | -993 | | $x_{15}=9$ | | | | 9 | The general case is handled in the same way with powers of 10 replaced by powers of $B$, for a sufficiently large number $B$. ## §2.3 USAMO 2022/6, proposed by Yannick Yao Available online at https://aops.com/community/p24774626. ## Problem statement There are 2022 users on a social network called Mathbook, and some of them are Mathbook-friends. (On Mathbook, friendship is always mutual and permanent.) Starting now, Mathbook will only allow a new friendship to be formed between two users if they have at least two friends in common. What is the minimum number of friendships that must already exist so that every user could eventually become friends with every other user? With 2022 replaced by $n$, the answer is $\left\lceil\frac{3}{2} n\right\rceil-2$. 【 Terminology. Standard graph theory terms: starting from a graph $G$ on $n$ vertices, we're allowed to take any $C_{4}$ in the graph and complete it to a $K_{4}$. The problem asks the minimum number of edges needed so that this operation lets us transform $G$ to $K_{n}$. 【T Construction. For even $n$, start with an edge $a b$, and then create $n / 2-1$ copies of $C_{4}$ that use $a b$ as an edge, as shown below for $n=14$ (six copies of $C_{4}$ ). ![](https://cdn.mathpix.com/cropped/2024_11_19_0824a9a7bcda8c860a08g-10.jpg?height=563&width=818&top_left_y=1306&top_left_x=625) This can be completed into $K_{n}$ by first completing the $n / 2-1 C_{4}$ 's into $K_{4}$, then connecting red vertices to every grey vertex, and then finishing up. The construction for odd $n$ is the same except with one extra vertex $c$ which is connected to both $a$ and $b$. 【 Bound. Notice that additional operations or connections can never hurt. So we will describe a specific algorithm that performs operations on the graph until no more operations are possible. This means that if this algorithm terminates with anything other $G=K_{n}$, the graph was never completable to $K_{n}$ to begin with. The algorithm uses the following data: it keeps a list $\mathcal{C}$ of cliques of $G$, and a labeling $\mathcal{L}: E(G) \rightarrow \mathcal{C}$ which assigns to every edge one of the cliques that contains it. - Initially, $\mathcal{C}$ consists of one $K_{2}$ for every edge of $G$, and each edge is labeled in the obvious way. - At each step, the algorithm arbitrarily takes any $C_{4}=a b c d$ whose four edges $a b$, $b c, c d, d a$ do not all have the same label. Consider these labels that appear (at least two, and up to four), and let $V$ be the union of all vertices in any of these 2-4 cliques. - Do the following graph operations: connect $a c$ and $b d$, then connect every vertex in $V-\{a, b, c, d\}$ to each of $\{a, b, c, d\}$. Finally, complete this to a clique on $V$. - Update $\mathcal{C}$ by merging these 2-4 cliques into a single clique $K_{V}$. - Update $\mathcal{L}$ by replacing every edge that was labeled with one of these 2-4 cliques with the label $K_{V}$. Also, update every newly created edge to have label $K_{V}$. However, if there were existing edges not labeled with one of the 2-4 cliques, then we do not update these! - Stop once every $C_{4}$ has only one label appearing among its edges. When this occurs, no operations are possible at all on the graph. A few steps of the process are illustrated below for a graph on six vertices with nine initial edges. There are initially nine $K_{2}$ 's labeled A, B, ..., I. Original edges are always bolder than added edges. The relabeled edges in each step are highlighted in color. Notice how we need an entirely separate operation to get $G$ to become L, even though no new edges are drawn in the graph. ![](https://cdn.mathpix.com/cropped/2024_11_19_0824a9a7bcda8c860a08g-11.jpg?height=912&width=1223&top_left_y=1257&top_left_x=428) Step 2: Operate on 1235. Merges CIJ into K. $\theta(\mathrm{K})=6$ Step 3: Operate on 2356. Merges GK into L. $\theta(\mathrm{L})=7$ As we remarked, if the graph is going to be completable to $K_{n}$ at all, then this algorithm must terminate with $\mathcal{C}=\left\{K_{n}\right\}$. We will use this to prove our bound. We proceed by induction in the following way. For a clique $K$, let $\theta(K)$ denote the number of edges of the original graph $G$ which are labeled by $K$ (this does not include new edges added by the algorithm); hence the problem amounts to estimating how small $\theta\left(K_{n}\right)$ can be. We are trying to prove: Claim - At any point in the operation, if $K$ is a clique in the cover $\mathcal{C}$, then $$ \theta(K) \geq \frac{3|K|}{2}-2 . $$ where $|K|$ is the number of vertices in $K$. Proof. By induction on the time step of the algorithm. The base case is clear, because then $K$ is just a single edge of $G$, so $\theta(K)=1$ and $|K|=2$. The inductive step is annoying casework based on the how the merge occurred. Let $C_{4}=a b c d$ be the 4 -cycle operated on. In general, the $\theta$ value of a newly created $K$ is exactly the sum of the $\theta$ values of the merged cliques, by definition. Meanwhile, $|K|$ is the number of vertices in the union of the merged cliques; so it's the sum of the sizes of these cliques minus some error due to overcounting of vertices appearing more than once. To be explicit: - Suppose we merged four cliques $W, X, Y, Z$. By definition, $$ \begin{aligned} \theta(K) & =\theta(W)+\theta(X)+\theta(Y)+\theta(Z) \\ & \geq \frac{3}{2}(|W|+|X|+|Y|+|Z|)-8=\frac{3}{2}(|W|+|X|+|Y|+|Z|-4)-2 . \end{aligned} $$ On the other hand $|K| \leq|W|+|X|+|Y|+|Z|-4$; the -4 term comes from each of $\{a, b, c, d\}$ being in two (or more) of $\{W, X, Y, Z\}$. So this case is OK. - Suppose we merged three cliques $X, Y, Z$. By definition, $$ \begin{aligned} \theta(K) & =\theta(X)+\theta(Y)+\theta(Z) \\ & \geq \frac{3}{2}(|X|+|Y|+|Z|)-6=\frac{3}{2}\left(|X|+|Y|+|Z|-\frac{8}{3}\right)-2 . \end{aligned} $$ On the other hand, $|K| \leq|X|+|Y|+|Z|-3$, since at least 3 of $\{a, b, c, d\}$ are repeated among $X, Y, Z$. Note in this case the desired inequality is actually strict. - Suppose we merged two cliques $Y, Z$. By definition, $$ \begin{aligned} \theta(K) & =\theta(Y)+\theta(Z) \\ & \geq \frac{3}{2}(|Y|+|Z|)-4=\frac{3}{2}\left(|Y|+|Z|-\frac{4}{3}\right)-2 . \end{aligned} $$ On the other hand, $|K| \leq|Y|+|Z|-2$, since at least 2 of $\{a, b, c, d\}$ are repeated among $Y, Z$. Note in this case the desired inequality is actually strict. Remark. Several subtle variations of this method do not seem to work. - It does not seem possible to require the cliques in $\mathcal{C}$ to be disjoint, which is why it's necessary to introduce a label function $\mathcal{L}$ as well. - It seems you do have to label the newly created edges, even though they do not count towards any $\theta$ value. Otherwise the termination of the algorithm doesn't tell you enough. - Despite this, relabeling existing edges, like G in step 1 of the example, 1 seems to cause a lot of issues. The induction becomes convoluted if $\theta(K)$ is not exactly the sum of $\theta$-values of the subparts, while the disappearance of an edge from a clique will 】 also break induction.