[Algebra]
Problem: Let $q$ be a real number. Gugu has a napkin with ten distinct real numbers written on it, and he writes the following three lines of real numbers on the blackboard:

- In the first line, Gugu writes down every number of the form $a-b$, where $a$ and $b$ are two (not necessarily distinct) numbers on his napkin.
- In the second line, Gugu writes down every number of the form $q a b$, where $a$ and $b$ are two (not necessarily distinct) numbers from the first line.
- In the third line, Gugu writes down every number of the form $a^{2}+b^{2}-c^{2}-d^{2}$, where $a, b, c, d$ are four (not necessarily distinct) numbers from the first line.

Determine all values of $q$ such that, regardless of the numbers on Gugu's napkin, every number in the second line is also a number in the third line.

Solution: Call a number $q$ good if every number in the second line appears in the third line unconditionally. We first show that the numbers 0 and \pm 2 are good. The third line necessarily contains 0 , so 0 is good. For any two numbers $a, b$ in the first line, write $a=x-y$ and $b=u-v$, where $x, y, u, v$ are (not necessarily distinct) numbers on the napkin. We may now write

$$
2 a b=2(x-y)(u-v)=(x-v)^{2}+(y-u)^{2}-(x-u)^{2}-(y-v)^{2},
$$

which shows that 2 is good. By negating both sides of the above equation, we also see that -2 is good.

We now show that $-2,0$, and 2 are the only good numbers. Assume for sake of contradiction that $q$ is a good number, where $q \notin\{-2,0,2\}$. We now consider some particular choices of numbers on Gugu's napkin to arrive at a contradiction.

Assume that the napkin contains the integers $1,2, \ldots, 10$. Then, the first line contains the integers $-9,-8, \ldots, 9$. The second line then contains $q$ and $81 q$, so the third line must also contain both of them. But the third line only contains integers, so $q$ must be an integer. Furthermore, the third line contains no number greater than $162=9^{2}+9^{2}-0^{2}-0^{2}$ or less than -162 , so we must have $-162 \leqslant 81 q \leqslant 162$. This shows that the only possibilities for $q$ are \pm 1 .

Now assume that $q= \pm 1$. Let the napkin contain $0,1,4,8,12,16,20,24,28,32$. The first line contains \pm 1 and \pm 4 , so the second line contains \pm 4 . However, for every number $a$ in the first line, $a \not \equiv 2(\bmod 4)$, so we may conclude that $a^{2} \equiv 0,1(\bmod 8)$. Consequently, every number in the third line must be congruent to $-2,-1,0,1,2(\bmod 8)$; in particular, \pm 4 cannot be in the third line, which is a contradiction.
Let $q$ be a good number, as defined in the first solution, and define the polynomial $P\left(x_{1}, \ldots, x_{10}\right)$ as

$$
\prod_{i<j}\left(x_{i}-x_{j}\right) \prod_{a_{i} \in S}\left(q\left(x_{1}-x_{2}\right)\left(x_{3}-x_{4}\right)-\left(a_{1}-a_{2}\right)^{2}-\left(a_{3}-a_{4}\right)^{2}+\left(a_{5}-a_{6}\right)^{2}+\left(a_{7}-a_{8}\right)^{2}\right)
$$

where $S=\left\{x_{1}, \ldots, x_{10}\right\}$.

We claim that $P\left(x_{1}, \ldots, x_{10}\right)=0$ for every choice of real numbers $\left(x_{1}, \ldots, x_{10}\right)$. If any two of the $x_{i}$ are equal, then $P\left(x_{1}, \ldots, x_{10}\right)=0$ trivially. If no two are equal, assume that Gugu has those ten numbers $x_{1}, \ldots, x_{10}$ on his napkin. Then, the number $q\left(x_{1}-x_{2}\right)\left(x_{3}-x_{4}\right)$ is in the second line, so we must have some $a_{1}, \ldots, a_{8}$ so that

$$
q\left(x_{1}-x_{2}\right)\left(x_{3}-x_{4}\right)-\left(a_{1}-a_{2}\right)^{2}-\left(a_{3}-a_{4}\right)^{2}+\left(a_{5}-a_{6}\right)^{2}+\left(a_{7}-a_{8}\right)^{2}=0
$$



and hence $P\left(x_{1}, \ldots, x_{10}\right)=0$.

Since every polynomial that evaluates to zero everywhere is the zero polynomial, and the product of two nonzero polynomials is necessarily nonzero, we may define $F$ such that

$$
F\left(x_{1}, \ldots, x_{10}\right) \equiv q\left(x_{1}-x_{2}\right)\left(x_{3}-x_{4}\right)-\left(a_{1}-a_{2}\right)^{2}-\left(a_{3}-a_{4}\right)^{2}+\left(a_{5}-a_{6}\right)^{2}+\left(a_{7}-a_{8}\right)^{2} \equiv 0
$$

for some particular choice $a_{i} \in S$.

Each of the sets $\left\{a_{1}, a_{2}\right\},\left\{a_{3}, a_{4}\right\},\left\{a_{5}, a_{6}\right\}$, and $\left\{a_{7}, a_{8}\right\}$ is equal to at most one of the four sets $\left\{x_{1}, x_{3}\right\},\left\{x_{2}, x_{3}\right\},\left\{x_{1}, x_{4}\right\}$, and $\left\{x_{2}, x_{4}\right\}$. Thus, without loss of generality, we may assume that at most one of the sets $\left\{a_{1}, a_{2}\right\},\left\{a_{3}, a_{4}\right\},\left\{a_{5}, a_{6}\right\}$, and $\left\{a_{7}, a_{8}\right\}$ is equal to $\left\{x_{1}, x_{3}\right\}$. Let $u_{1}, u_{3}, u_{5}, u_{7}$ be the indicator functions for this equality of sets: that is, $u_{i}=1$ if and only if $\left\{a_{i}, a_{i+1}\right\}=\left\{x_{1}, x_{3}\right\}$. By assumption, at least three of the $u_{i}$ are equal to 0 .

We now compute the coefficient of $x_{1} x_{3}$ in $F$. It is equal to $q+2\left(u_{1}+u_{3}-u_{5}-u_{7}\right)=0$, and since at least three of the $u_{i}$ are zero, we must have that $q \in\{-2,0,2\}$, as desired.

Final answer: $-2,0,2$