# Can't get solution to a system of recurrence equeations

I would be grateful if someone could help me with this problem. I define two series recursively, thus:

Subscript[f, 0][n_] := Subscript[f, 0][n - 1] + Subscript[f, 1][n - 2]
Subscript[f, 1][n_] := Subscript[f, 0][n - 1] + Subscript[f, 1][n - 1]
Subscript[f, 0] = 0
Subscript[f, 0] = 1
Subscript[f, 1] = 1
Subscript[f, 1] = 1


Mathematica lists the first few values (from index 1 on) just fine, but for some reason it can't find out the values of the two series for indices below 1. And RSolve can't figure out the closed formula for any of the series.

But this should be easy, say if $f_0(2)=f_0(1)+f_1(0)$, then $f_1(0)=f_0(2)-f_0(1)=1$. I thought Mathematica could extrapolate series like that.

• You are setting the fs at zero and at one. The recursive relationship you're using is based on previous values. So, there is no way for Mma to calculate (for example) f1[-2] – Dr. belisarius Feb 26 '15 at 20:40
• Yes but if I try rewording my definitions thus f₀[n_ + 2] := f₀[n + 1] + f₁[n], I get the same error… Surely there must be a way to make Mma calculate something I can calculate on a piece of paper in a few seconds. – vpprof Feb 26 '15 at 20:46
• Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Dr. belisarius Feb 26 '15 at 21:35

You can use RSolve indeed:

sol = RSolve[{f0[n] == f0[n - 1] + f1[n - 2],
f1[n] == f0[n - 1] + f1[n - 1],
f0 == 0, f0 == 1, f1 == 1, f1 == 1}, {f0, f1}, n];

f0 /. sol // N // Chop
(* {86.} *)


You can also revert your recursive relations to go upwards:

g1[n_] := g0[n + 2] - g0[n + 1]
g0[n_] := g1[n] - g1[n + 1]
g0 = 0
g0 = 1
g1 = 1
g1 = 1

g0[-10]
(*- 595*)

• Hmm… it seems I rushed into marking your answer as the solution, for if I define my recursive relations to go upwards, Mma doesn't calculate values for indices greater than 2. Or are you suggesting I need to use four different series, two for indices > 2, and two for indices < 1? – vpprof Feb 26 '15 at 20:56
• @vpprof You need to set a starting point ... from that you can calculate upwards OR downwards – Dr. belisarius Feb 26 '15 at 20:57
• OK, that's a bit disappointing but let's forget about that for now. What about RSolve, it cannot find the closed form neither for my original f-s, nor for your g-s. What would you suggest I do to make RSolve work? – vpprof Feb 26 '15 at 21:05
• @vpprof See edit, please – Dr. belisarius Feb 26 '15 at 21:35
• Many thanks! For some reason, RSolve works just fine if you chuck all the equations into it, but gets bogged down when the series are defined beforehand (and keeps throwing the 'recursion depth exceeded' error). Thanks again :) – vpprof Feb 27 '15 at 23:11