# A functional equation of two variables

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.

• It's allowed to take $f^{-1}$ on both sides if a function is monotonic. Can you assume that $f$ is monotonic in this case? – Matti P. Jan 2 at 9:01
• Of $f$ is not injective you can't cancel it out – Holo Jan 2 at 9:02
• @MattiP. Not monotonic, to be able to use $f^{-1}$ you need $f$ to be bijective, and to cancel out $f$ you need it to be injective – Holo Jan 2 at 9:04
• It holds, because we have that at $y=-2017$, $f(0)=f(f(x)-2017)-x$ and at $f(x)=2017$, $f(0)=f(0)-x|_{f(x)=2017}$ so that $f(0)=2017$. – TheSimpliFire Jan 2 at 9:19
• $f(x)=x+2017$ is clearly a solution, and probably the only solution, showing nothing else works is proving to be tricky though. – Erik Parkinson Jan 2 at 9:36

Got it! I probably complicated it more than I had to so if anyone sees any way to simply this I would love to hear feedback.

To solve this, let $$y=0$$ so that $$f(f(x)) = x+f(2017)$$. Let $$c=f(2017)$$. Then for all $$x\in\mathbb{Z}$$, $$f(f(x)) = x+c$$

Now plugging $$x=y=0$$ into the original equation we get $$f(f(0)) = f(2017)$$. Taking $$f$$ of both sides yields $$f(f(f(0))) = f(f(2017))$$ which is $$f(0)+c=2017+c$$ so $$f(0) = 2017$$.

Now take $$f$$ of both sides of the original equation to get $$f(f(f(x)+y)) = f(x+f(y+2017))$$ which is $$f(x)+y + c = f(x+f(y+2017))$$ Setting $$y=-2017$$ gives $$f(x)-2017 + c = f(x+f(0)) = f(x+2017)$$.

Now we return again to the original equation with $$y=1$$. This gives $$f(f(x)+1) = x+f(2018)$$ which by the above formula is $$x+f(1)-2017 + c$$. So $$f(f(x)+1)-f(f(x)) = x+f(1)-2017+c - (x+c) = f(1)-2017$$

Now, as $$f(f(x)) = x+c$$, $$f(f(x))$$, and thus $$f(x)$$, can attain all values in $$\mathbb{Z}$$. So for any $$k\in\mathbb{Z}$$, there is an $$x\in\mathbb{Z}$$ such that $$f(x)=k$$, and so the above formula becomes $$f(k+1)-f(k) = f(1)-2017$$ for all $$k\in\mathbb{Z}$$. So for all $$k\in\mathbb{Z}$$, $$f(k) = k+c_2$$ for some $$c_2$$. So the original equation becomes $$x+y+2c_2=x+y+2017+c_2$$ so $$c_2=2017$$. Thus the only solution is $$f(x) = x+2017$$

• (+1) nice! ${}{}$ – TheSimpliFire Jan 2 at 10:38

You could take $$y=0$$ there and get $$f(f(x))=x+f(2017)=x+n$$ where $$n$$ is a constant. Thus $$f(f(x))$$ is a linear function. You can observe (guess?) what $$f(x)$$ could be like here. If it is so, then you have no problem taking $$f^{-1}$$ and you can easily find $$n$$.

The point is how to prove the nature of $$f(x)$$ if you know $$f(f(x))$$ is linear. This is an interesting problem. What is the square root (with integer values) of a linear function?

Now here I'm not sure $$f(x)$$ will end up being a simple function involving only arithmetic operations, or a function also involving the modulo.

• This is better posted as a comment. As you don't yet have enough reputation for that, how about answering some other questions and come back? :) – TheSimpliFire Jan 2 at 9:20

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)$$.