how I prove a valid recursion?

2.9k Views Asked by At

Determine whether is this a valid recursive definition of a function f from the set of nonnegative integers to the set of integers. If f is well defined (valid recursion), find a formula for f(n) when n is a nonnegative integer and prove your formula is valid.

f(0) = 1, f(n) = -f(n-1) for n >= 1

This is extra work for a final exam tomorrow.

So I got f(0) = -f(0 - 1) = 1, so 1 = 1

So what are the next steps that I do next?

1

There are 1 best solutions below

2
On

First, you should be able to make the (correct) guess that the function is $f(n) = (-1)^n$. Then, you prove this by induction. As you pointed out, the first step is to show the base case, that is that the claim holds for $n=0$. $$ f(0) = (-1)^0 = 1 $$ Next, we suppose that the if claim holds for $n-1$, it must also hold for $n$. This is the induction step. $$ f(n) = -f(n-1) = -1(-1)^{n-1} = (-1)^n $$ By the principle of mathematical induction, $f(n) = (-1)^n$ for $n\geq 0$.