The following question is taken from the practice set of JEE exam.
The function $f : R → R$ satisfies $x + f(x) = f(f(x))$ for every $x\in R$. Find all solutions of the equation $f(f(x)) = 0$.
I found its answer online here. The solution given is:
The domain of this function is $R$, so there isn't much hope that this can be solved using mathematical induction. Notice that $f(f(x))-f(x)=x$ and if $f(x)=f(y)$ then clearly $x=y$. This means that the function is injective. Since $f(f(0))=f(0)+0=f(0)$, because of injectivity we must have $f(0)=0$, implying $f(f(0))=0$. If there were another $x$ such that $f(f(x))=x$, injectivity would imply $f(x)=f(0)$ and $x=0$
I understood most of it except how they implied injectivity. I understand if $f(x)=f(y)$ is giving $x=y$ it implies injectivity. But how is it implied from $f(f(x))-f(x)=x$?
If I put $f(x)=y$, I get $f(y)-y=x\implies f(y)=y+x$ i.e. $f(y)=f(x)+x$. Not getting $f(y)=f(x)$.