TITLE: A functional equation of two variables
QUESTION [6 upvotes]: Solve the following functional equation :
$f:\Bbb Z \rightarrow \Bbb Z$, $f(f(x)+y)=x+f(y+2017)$
I have no prior experience with solving functional equation but still tried a bit. I set $x=y=0$ to get $f(f(0))=f(2017)$. Can we apply $f^{-1}$ both sides to get $f(0)=2017$?  I am unable to carry this on.

REPLY [2 votes]: Let $n$ be an integer. Then at $f(x)=n$ and $y=0$, the equation $f(f(x)+y)=x+f(y+n)$ becomes $f(n+y)=f(y+n)+x\Big|_{f(x)=n}$, so $f(0)=n$. 
Now at $f(x)=n+1$, we can derive similar relations, at $y=0$ and $y=-1$ respectively, $$x\Big|_{f(x)=n+1}=f(n+1)-f(n)=f(n)-f(n-1)\implies 2f(n)=f(n-1)+f(n+1).$$ 
By induction it can be proven that $2f(n)=f(n-x)+f(n+x)$ or $2f(n)=f(x)+f(2n-x)$ for any integer $x$. Assuming differentiability, $f'(x)-f'(2n-x)=0$ so $f$ is either a linear or periodic function. It cannot be periodic because $f(0)=n$ and $x\Big|_{f(x)=0}=f(n)-f(0)$. 
Thus $f$ is a linear function and putting it in $f(x)=ax+b$, gives us $b=n$ and $a=1$ since $f(f(x))=x+f(n)$.