How to prove that only a particular function satisfies some properties?

Prove that $f(n) = 1 - n$ is the only integer valued function defined on integers such that $f(f(n)) = n$ and $f(f(n + 2) + 2) = n$ for all $n \in \mathbb{Z}$ with f(0) = 1

• I tried applying f again to the second condition and obtained f(n + 2) + 2 = f(n), then tried generalizing it using induction but I am unable to proceed – saisanjeev Jul 12 '17 at 8:36
• What you've found is a concrete link between $f(n)$ and $f(n+2)$, for any $n$. That means if you know what $f(0)$ is, then you can tell what $f(2)$ is. But then you know what $f(2)$ is, and can therefore tell what $f(4)$ is. Do you see how induction follows naturally from here? The cases for odd or negative $n$ follow similiarily. – Arthur Jul 12 '17 at 8:46

Let's prove by induction that for all $n \ge 0$ you have $f(n)=1-n$.
Basic step: for $n=0$ $$f(0)=1=1-0$$ and for $n=1$ $$f(1)=f(f(0))=0=1-1$$
Inductive step: for $n \ge 2$ $$f(n)= [f((n-2)+2)+2]-2 = f(n-2)-2 = 1-(n-2)-2=1-n$$ And the proof is concluded.
A similar argument can be used to prove the equality for $n <0$.
• How is that the answer, he was asking for the unicity of $f$. – Furrane Jul 12 '17 at 9:59
• @Furrane The only function satisfying those conditions is $n \mapsto (1-n)$. It is unique. – Crostul Jul 12 '17 at 11:48