Exercise 5. Find all functions $\mathrm{f}: \mathbb{R} \longrightarrow \mathbb{R}$ such that for all $x, y$ in $\mathbb{R}$,

$$
f(x+y)^{2}-f\left(2 x^{2}\right)=f(y+x) f(y-x)+2 x f(y)
$$
Solution to Exercise 5 By setting \( x = y = 0 \), we obtain that \( f(0)^{2} - f(0) = f(0)^{2} \), hence \( f(0) = 0 \). By taking \( y = 0 \), we get

\[
f(x)^{2} = f\left(2 x^{2}\right) + f(x) f(-x)
\]

so \( f^{2} \) is even, i.e., \( f(x)^{2} = f(-x)^{2} \) for all \( x \).

By substituting \( -x \) for \( x \) in the equation, we obtain

\[
f(y - x)^{2} - f\left(2 x^{2}\right) = f(y + x) f(y - x) - 2 x f(y)
\]

By subtracting this equality from the original equation, it follows that

\[
f(y + x)^{2} - f(y - x)^{2} = 4 x f(y)
\]

By swapping \( x \) and \( y \), we find

\[
f(y + x)^{2} - f(x - y)^{2} = 4 y f(x)
\]

Since \( f^{2} \) is even, we always have \( f(y - x)^{2} = f(x - y)^{2} \), so for all real numbers \( x, y \), \( x f(y) = y f(x) \).

In particular, by taking \( x = 1 \), we get \( f(y) = y f(1) \) for all \( y \), so \( f \) is of the form \( x \rightarrow a x \), with \( a \in \mathbb{R} \). By taking \( x = 1 \) and \( y = 0 \), the original equation becomes \( a^{2} - 2 a = -a^{2} \), hence \( a = a^{2} \), so \( a = 0 \) or \( a = 1 \). Thus, \( f \) is the zero function or the identity function.

Conversely, it is easy to verify that these functions are solutions.