<s>[INST] Find all pairs (p,q) of real numbers such that whenever $\alpha$ is a root of $x^2 + px+q=0$ $\alpha^2-2$ is also root of the equation. 
Find all pairs (p,q) of real numbers such that whenever $\alpha$ is a root of $x^2 + px+q=0$ $\alpha^2-2$ is also root of the equation.

My Approach:
I could not find any elegant method that is why I tried applying quadratic formula: the roots will be $\frac{-p±\sqrt{p^2-4q}}{2}$
Now we have 2 cases:

*

*$$\left(\frac{-p+\sqrt{p^2-4q}}{2}\right) =\left (\frac{-p-\sqrt{p^2-4q}}{2}\right)^2 -2$$

*$$\left(\frac{-p-\sqrt{p^2-4q}}{2}\right)=\left(\frac{-p+\sqrt{p^2-4q}}{2}\right)^2-2$$
It's very tedious to solve these. I searched on Wolfram alpha and got these I II
Is there an elegant way to approach this problem?
 [/INST] Let $\alpha, \beta$ be roots of this polynomial. If $\alpha=\beta$, then $\alpha^2-2=\alpha$, $\alpha=-1, 2$, and then $(p,q)=(2,1)$ or $(-4, 4)$, both choices work.
Suppose $\alpha\ne \beta$.
If $\alpha^2-2=\beta$, $\beta^2-2=\alpha$, then $(\alpha^2-2)^2-2=\alpha$, $\alpha^4-4\alpha^2-\alpha+2=0$, same for $\beta$. The polynomial $x^4-4x^2-x+2$ is $(x - 2)(x + 1)(x^2+x-1)$, $\alpha,\beta\in\{2, -1\}$ do not work. So $\{\alpha,\beta\}=\{(-1+\sqrt{5})/2, (-1-\sqrt{5})/2\}$. It works, $(p,q)=(1,-1)$.
Finally it could be that $\alpha^2-2=\alpha$ which means $\alpha\in\{-1,2\}$, and $\beta^2-2=\alpha$, so either $\alpha=-1$, $\beta^2-2=-1$, $\beta^2=1$, $\beta=1$ since $\beta\ne \alpha$, $(p,q)=(0,-1)$ or $\alpha=2$, $\beta^2-2=2$, $\beta=-2$, $(p,q)=(0,-4)$
Hence the answer: $(p,q)\in\{(-4,4), (2,1), (1,-1), (0,-1), (0,-4)\}$.
</s>