Recursion problem

discm

New member
Joined
Aug 16, 2011
Messages
2
Hi.

Find f(2), f(3), f(4), and f(5) if f is defined recursively by f(0) = f(1) = 1 and for n = 1,2...
a) f(n+1) = f(n) - f(n-1).

Plz. help me get started. thank u
 
Hi.

Find f(2), f(3), f(4), and f(5) if f is defined recursively by f(0) = f(1) = 1 and for n = 1,2...
a) f(n+1) = f(n) - f(n-1).

n begins with 1, given in your problem statement.


For n = 1:


Then f(n - 1) =

f(1 - 1) =

f(0) = 1 -----> (Given in the problem)

--------------------------------------

For n = 1:


f(n) =

f(1) = 1 -----> (Given in the problem)


--------------------------------------

For n = 1:


f(n + 1) =

f(1 + 1) =

f(2) = ?


-------------------------------------


We have f(n + 1) = f(n) - f(n - 1) -----> Given in the problem

But f(n + 1) = f(2), worked out from above, so, by substitution,

f(2) = f(1) - f(0), or

f(2) = 1 - 1

f(2) = 0


Then try to continue this...
 
Recursion Problem

Thank you lookagain. I did not know I had a response from anyone. I will look through what you have provided. Thank you so muc.
discm
 
Hello, discm!

Find \(\displaystyle f(2),\:f(3),\:f(4)\text{, and }f(5)\)
of \(\displaystyle f(n)\) is defined recursively for \(\displaystyle n = 1,2,3 \hdots\) by: .\(\displaystyle f(0) = f(1) = 1\)
and: .\(\displaystyle f(n+1) \:=\:f(n) - f(n-1)\)
Did you read what it says?

It says: .\(\displaystyle \underbrace{f(n\!+\!1)}_{\text{Each term}} \;\; \underbrace{=}_{\text{equals}}\;\underbrace{f(n)}_{\text{preceding term}} \; \underbrace{-}_{\text{minus}}\;\; \underbrace{f(n\!-\!1)}_{\text{term before}} \)


So we have:

. . \(\displaystyle \begin{array}{cccccc}f(0) &&&=& 1 \\ f(1) &&&=& 1 \\ f(2) &=& 1-1 &=& 0 \\ f(3) &=& 0-1 &=& \text{-}1 \\ f(4) &=& \text{-}1 - 0 &=& \text{-}1 \\ f(5) &=& \text{-}1 - (\text{-}1) &=& 0 \\ f(6) &=& 0 - (\text{-}1) &=& 1 \\ f(7) &=& 1-0 &=& 1 \\ \vdots && \vdots && \vdots \end{array}\)


We see that the sequence has a period of 6 terms: .\(\displaystyle \{1,1,0,\text{-}1,\text{-}1,0\}\)
 
Top