6. find all functions $f: \mathbb{R} \rightarrow \mathbb{R}$ such that for all $x, y \in \mathbb{R}$ the following equation holds

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

## Solution
Obviously, $f=0$ is a solution to the equation. In the following, we therefore assume that $f$ does not vanish identically and show that $f(z)=z^{2}$ applies for all $z \in \mathbb{R}$. It is easy to calculate that this is really a solution to the equation. With $x=y=0$ it follows that $f(f(0))=f(0)^{2}+f(f(0))$, i.e. $f(0)=0$. If you set $y=0$, the following follows

$$
f(f(x))=f(x)^{2}
$$

If you insert this into the original equation, you get

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

If we replace $y$ with $f(y)$ and use (1) again, we get

$$
f\left(f(x)-f(y)^{2}\right)=\left(f(x)-f(y)^{2}\right)^{2}
$$

In other words

$$
f(z)=z^{2} \quad \text { for all } z \in S=\left\{f(u)-f(v)^{2} \mid u, v \in \mathbb{R}\right\} \text {. }
$$

We first show that every non-positive real number lies in $S$. To do this, we choose a real number $a$ with $f(a) \neq 0$. By replacing $a$ with $f(a)$ if necessary, we can even assume $f(a)>0$ because of (1). From (2) with $x=a$ now follows

$$
f\left(f(a)-y^{2}\right)-f(y)^{2}=f(a)\left(f(a)-2 y^{2}\right)
$$

Because $f(a)>0$, the right-hand side now assumes all non-positive real values, including the left-hand side. This proves $\mathbb{R}_{\leq 0} \subset R$ and thus $f(z)=z^{2}$ applies to all $z \leq 0$ according to (3). However, this in turn implies that all non-negative real numbers occur as values of $f$. Because $f(0)=0$, this now also results in $\mathbb{R}_{\geq 0} \subset S$, thus also $f(z)=z^{2}$ for all $z \in \mathbb{R}$, as claimed.