Functions $f$ satisfying $ f\circ f(x)=2f(x)-x,\forall x\in\mathbb{R}$. How to prove that the continuous functions $f$ on $\mathbb{R}$  satisfying 
$$f\circ f(x)=2f(x)-x,\forall x\in\mathbb{R},$$
are given by 
$$f(x)=x+a,a\in\mathbb{R}.$$
Any hints are welcome. Thanks.
 A: If $f$ were bounded from below, so were $x=2f(x)-f(f(x))$. Therefore $f$ is unbounded, hence by IVT surjective.
Also, $f(x)=f(y)$ implies $x=2f(x)-f(f(x))=2f(y)-f(f(y))=y$, hence $f$ is also injective and has a twosided inverse. With this inverse we find $$\tag1f(x)+f^{-1}(x)=2x.$$
We conclude that $f$ is either strictly increasing or strictly decreasing. But in the latter case $f^{-1}$ would also be decreasing, contradicting $(1)$. Therefore $f$ is strictly increasing.
Following TMM's suggestion, define $g(x)=f(x)-x$.
Then using $(1)$ we see $f^{-1}(x)=2x-f(x)=x-g(x)$, hence $f(x-g(x))=x$ and $g(x-g(x))=g(x)$. By induction, $$\tag2g(x-ng(x))=g(x)$$ for all $x\in\mathbb R, n\in\mathbb N$.
Because $f$ is increasing, we conclude that
$$\tag3 x<y\implies g(x)<g(y)+(y-x).$$
If we assume that $g$ is not constant, there are $x_0,x_1\in\mathbb R$ with $g(x_0)g(x_1)>0$ and $\alpha:=\frac{g(x_1)}{g(x_0)}$ irrational (and positive!).
Wlog. $g(x_1)<g(x_0)$.
Because of this irrationality, for any $\epsilon>0$ we find $n,m$ with 
$$x_0-ng(x_0) < x_1-mg(x_1)< x_0-ng(x_0)+\epsilon,$$
hence $g(x_0-ng(x_0)) < g(x_1-mg(x_1))+\epsilon$ by $(3)$.
Using $(2)$ we conclude $g(x_0)<g(x_1)+\epsilon$, contradiction.
Therefore $g$ is constant.
