# Solve recurrence relations using Mathematica

• Mathematica
Hello,

I was hoping someone could help point me in the right direction. I am trying to figure out how to solve recurrence relations using Mathematica (6). I have tried to search the web for information on how to use the recurrence relation solving package but I must be doing something wrong. I did a Google search for recurrence relations Mathematica and the only thing I found that seemed accessible to me was a link to The Mathematica Book by Wolfram which told me to enter the command below... which gave me an error. It said with some versions you don't need to load it so I tried the equation given and it didn't return a proper result.

<< DiscreteMath' RSolve'

Get::noopen: Cannot open DiscreteMath. RSolve::argmu: RSolve called with 1 argument; 3 or more arguments are expected.

An example problem that I would like to be able to solve is:
T(n) = T(n-1) + 2T(n-2)

Thank you for your time and patience!
----

*It should be noted that I am fairly bad at Math and unskilled at Mathematica. I am definitely a "newbie" so :) I apologize if the answer is right in front of my face.* I am attempting to ask "intelligent" questions after I've tried for quite a while to figure it out on my own/do my own research.

What version of Mathematica are you using? In version 6.0 you can type:
Code:
RSolve[T[n] == T[n - 1] + 2 T[n - 2], T[n], n]

and the output is:
Code:
{{T[n] -> (-1)^n C[1] + 2^n C[2]}}
You could eliminate the undetermined constants by giving initial conditions:

Code:
RSolve[{T[n] == T[n - 1] + 2 T[n - 2].T[0]==0,T[1]==1}, T[n], n]

for which the output is:

Code:
{{T[n] -> 1/3 (-(-1)^n + 2^n)}}