Problem: Find all functions $f \colon \QQ \to \QQ$
such that the equation
\[f(xf(x)+y) = f(y) + x^2\]
holds for all rational numbers $x$ and $y$.

Solution: The answers are $f(x) \equiv +x$
and $f(x) \equiv -x$ which work.
To show they are the only ones,
we follow an approach similar to \texttt{SnowPanda}.


\begin{claim*}
  If $f(z) = 0$ then $z = 0$.
  In other words, $f$ has at most one root, at $0$.
\end{claim*}
\begin{proof}
  Take $P(z,0)$.
\end{proof}

\begin{claim*}
  The function $f$ is linear.
\end{claim*}
\begin{proof}
  Let $a,b \in \QQ$ be any two nonzero rational numbers, so $f(a), f(b) \neq 0$.
  Choose nonzero integers $m$ and $n$ such that
  \[ \frac nm = \frac{af(a)}{bf(b)}. \]
  Then for any $y \in \QQ$ we have
  \begin{align*}
    f(y + maf(a)) &= f(y) + m \cdot a^2 \\
    f(y + nbf(b)) &= f(y) + n \cdot b^2.
  \end{align*}
  The two left-hand sides were equal by construction, so we get
  \[  \frac{af(a)}{bf(b)} = \frac nm = \frac{a^2}{b^2}. \]
  Thus $f(a) / a = f(b) / b$, as needed.
\end{proof}

Once $f$ is linear we here quickly recover the solution set.