Find two numbers whose sum and the sum of their squares are given numbers. Under what conditions do we get positive rational solutions?
$$
\begin{gathered}
x+y=a \\
x^{2}+y^{2}=b \\
x=\frac{a}{2}+\frac{1}{2} \sqrt{2 b-a^{2}}
\end{gathered}
$$

The solutions are rational if $2 b-a^{2}$ is a positive perfect square.