18. [10] Over all real numbers $x$ and $y$ such that
$$
x^{3}=3 x+y \quad \text { and } \quad y^{3}=3 y+x
$$
compute the sum of all possible values of $x^{2}+y^{2}$.
Answer:
15
Solution 1: First, we eliminate easy cases.
- if $x=-y$, then $x^{3}=3 x-x=2 x$, so $x \in\{0, \sqrt{2},-\sqrt{2}\}$. Therefore, we get $(\sqrt{2},-\sqrt{2}),(-\sqrt{2}, \sqrt{2})$, and $(0,0)$.
- if $x=y \neq 0$, then $x^{3}=3 x+x=4 x$, so $x \in\{2,-2\}$. Therefore, we get $(2,2)$ and $(-2,-2)$.

Otherwise, adding two equations gives
$$
\begin{aligned}
x^{3}+y^{3} & =4 x+4 y \\
(x+y)\left(x^{2}-x y+y^{2}\right) & =4(x+y) \\
x^{2}-x y+y^{2} & =4,
\end{aligned}
$$
and subtracting the two equations gives
$$
\begin{aligned}
x^{3}+y^{3} & =2 x-2 y \\
(x-y)\left(x^{2}+x y+y^{2}\right) & =2(x-y) \\
x^{2}+x y+y^{2} & =2 .
\end{aligned}
$$

We have $x^{2}-x y+y^{2}=4$ and $x^{2}+x y+y^{2}=2$, so adding these gives $x^{2}+y^{2}=3$. One can also see that $x y=-1$, so the solution obtained will be real.
The final answer is $4+8+0+3=15$.
Solution 2: Let $x=a+\frac{1}{a}$ and $y=b+\frac{1}{b}$ for nonzero $a$ and $b$. Then $x^{3}-3 x=a^{3}+\frac{1}{a^{3}}$ and $y^{3}-3 y=b^{3}+\frac{1}{b^{3}}$, so
$$
a^{3}+\frac{1}{a^{3}}=b+\frac{1}{b} \quad \text { and } \quad b^{3}+\frac{1}{b^{3}}=a+\frac{1}{a} .
$$

These imply $b \in\left\{a^{3}, 1 / a^{3}\right\}$ and $a \in\left\{b^{3}, 1 / b^{3}\right\}$. These mean $a^{9}=a$ or $a^{9}=\frac{1}{a}$, so $a^{8}=1$ or $a^{10}=1$. We can WLOG $b=a^{3}$ for simplicity.
First suppose $a^{8}=1$. Now $a=1$ gives $(2,2), a=-1$ gives $(-2,-2), a=\operatorname{cis}( \pm \pi / 4)$ gives $(\sqrt{2},-\sqrt{2})$, and $a=\operatorname{cis}( \pm 3 \pi / 4)$ gives $(-\sqrt{2}, \sqrt{2})$. Finally $a= \pm i$ gives $(0,0)$. This gives $8+4+0=12$ to our sum. Now suppose $a^{10}=1$; we can assume $a \neq 1,-1$ since these were covered by the previous case. It can be seen that for all other values of $a$, the pairs $(a, b)$ that work can be get by either swapping $a$ and $b$ or negating one of the variables, all of which give the same value of $x^{2}+y^{2}$, so we only need to work on one of them. Suppose $a=\operatorname{cis}(\pi / 5)$ and $b=\operatorname{cis}(3 \pi / 5)$, so $x=2 \cos (\pi / 5)=\frac{1+\sqrt{5}}{2}$ and $y=2 \cos (3 \pi / 5)=\frac{1-\sqrt{5}}{2}$. Then $x^{2}+y^{2}=3$.
The final answer is $12+3=15$.