Find all functions $f:\mathbb{Z} \to \mathbb{Z} $ such that$f(0)=1$ and $$f(f(n))=f(f(n+2)+2)=n. \quad \forall n \in \mathbb{Z} $$
My approach: Plugging in some values, it is not hard to see that $f(n)=1-n$ satisfies the given relation. I claim that $ f(k)=1-k $ for some $k \in \mathbb{Z}$.
I just cannot see a way to use the relation and induct on $k$ to prove my hypothesis. Am I missing something obvious? Please help as I am new to functional equations. Also please share some online resources to solve functional equations as I am preparing for Olympiads.
Thank you.
$f(f(n)) = n \ (\forall n \in \mathbb{Z})$ implies $f$ is injective, thus$$ f(f(n)) = f(f(n + 2) + 2) \Longrightarrow f(n) = f(n + 2) + 2. \quad \forall n \in \mathbb{Z} $$ Also$$ 0 = f(f(0)) = f(1), $$ then$$ f(n) = -n + 1 \quad (\forall n \in \mathbb{Z}) $$ can be proved by induction.