Given the function $f (n) = 1 + (-1)^n$ for $n ≥ 1$.
a) Define recursively the function $f (n)$.
b) Use induction to prove that the given definition is correct. Say what kind of induction has been used.
My attempt:
a) For $f(1)=1+(-1)^1=1-1=0$. For $f(n-1)=1+(-1)^{n-1}=1+\frac{(-1)^n}{-1}=1-(-1)^n$. So I think $1-(-1)^n$ is the recursive definition.
b) I don't know what to do. The induction is the same method as the above, it's just $n+1$ so I don't know what the exercise expects me to do.
You need to find a relation between $f(n)=1+(-1)^n$ and $f(n+1)=1+(-1)^{n+1}$, i.e. some function $g$ such that $f(n+1)=g(f(n))$.
Notice that $(-1)^{n+1}=-(-1)^n$, so that
$$f(n+1)-1=-(f(n)-1)$$
and
$$f(n+1)=2-f(n).$$