Functional equation $f(x+f(x+y))=f(x-y)+f(x)^2 \quad \forall x,y\in \mathbb R$ We have to find all functions $f\colon \mathbb R\to\mathbb R$ such that $f$:
$$\forall x,y\in \mathbb R \quad f(x+f(x+y))=f(x-y)+f(x)^2.$$
Could somebody help me solve this problem?
Thank you.
 A: For a starter:
We denote $a=f(0)$, $b=f(a)$. Substituting $y=-x$ into the original equation gives
$$f(x+a)=f(2x)+f(x)^2\text.\tag1\label{1a}$$
Substituting $x=a$ into \eqref{1a}, we have $b=0$. Again, substituting $x=0$ into \eqref{1a}, we have $b=f(0)+f(0)^2$. This shows $f(0)+f(0)^2=0$, hence $f(0)=0$ or $-1$.
You can proceed from here.
A: It can  be shown that the only function satisfying
$$f\big(x+f(x+y)\big)=f(x-y)+f(x)^2\tag0\label0$$
is the constant zero function.
To show this, we let $x=0$ in \eqref{0} and get
$$f\big(f(y)\big)=f(-y)+f(0)^2\text.\tag1\label1$$
Also, substituting $-x$ for $y$ in \eqref{0} we have
$$f\big(x+f(0)\big)=f(2x)+f(x)^2\text.\tag2\label2$$
Letting $x=0$ and $x=f(0)$ in \eqref{2}, we respectively have:
$$f\big(f(0)\big)=f(0)+f(0)^2\text;$$
$$f\big(2f(0)\big)=f\big(2f(0)\big)+f\big(f(0)\big)^2\text.$$
So we conclude that $f\big(f(0)\big)=0$ and $f(0)\in\{0,-1\}$. Suppose that $f(0)=-1$.
letting $y=-1$ in \eqref{1} we get $f(1)=-2$. So if we let $x=1$ in \eqref{2} we'll have $f(2)=-5$. Now applying $f$ to both sides of \eqref{1} we have $f\Big(f\big(f(y)\big)\Big)=f\big(f(-y)+1\big)$ which by \eqref{1} yields $f\big(-f(y)\big)+1=f\big(f(-y)+1\big)$. By letting $y=1$ in the last equation, we have $f(2)=-3$ which leads to a contradiction. So $f(0)$ can't be equal to $-1$ and we must have $f(0)=0$.
Now substituting $f(y)-x$ for $y$ in \eqref{0} we have
$$f\Big(x+f\big(f(y)\big)\Big)=f\big(2x-f(y)\big)+f(x)^2\text,$$
which by \eqref{1} yields
$$f\big(x+f(-y)\big)=f\big(2x-f(y)\big)+f(x)^2\text.$$
Again, substituting $-x-y$ for $y$ in \eqref{0} we'll have
$$f\big(x+f(-y)\big)=f(2x+y)+f(x)^2\text.$$
Compairing the last two equations above, we get $f\big(2x-f(y)\big)=f(2x+y)$. Substituting $\frac{f(y)}2$ for $x$, we'll have $f\big(y+f(y)\big)=0$. Also by letting $y=0$ in \eqref{0} we know that $f\big(x+f(x)\big)=f(x)+f(x)^2$. So for every $x$ we find out that $f(x)\in\{0,-1\}$. Hence, adding $f(x)$ to both sides of \eqref{2} we'll get $2f(x)=f(2x)$ which shows that $f(x)$ cannot be equal to $-1$. So $f$ is the constant zero function.
