# Solve didn't give the right solution

I've got a pretty simple equation set here but I cannot seem to solve it correctly.

T[0] = 1;

T[1] = 2;

f[i_] := T[i] - T[i + 1] == T[i + 1] - T[i + 2]

c = And @@ Array[f, 3, 0]

Solve[c, T[4]]


The answer only gave me the following

-1 == 2 - T[2] && 2 - T[2] == T[2] - T[3] &&
T[2] - T[3] == T[3] - T[4]


Instead of solving for T[4], so where did I messed up ? Thanks!

• Eliminate[c, T[3]] gives T[2] == 3 && T[4] == 5 – Rolf Mertig Oct 4 '15 at 22:11
• What happens if you ask it to solve for three of the variables? – Michael E2 Oct 4 '15 at 22:12
• I would like see the answer to that question as well:) – Fang Oct 4 '15 at 22:14
• @Fang Well, try it. :) – Michael E2 Oct 4 '15 at 22:24

It seems like you have the recursion t[i+2] = 2*t[i+1]-t[i]. Shifting this back two timesteps allows a standard form:

t[i_] := 2 t[i - 1] - t[i - 2];
t[0] = 1;
t[1] = 2;


which can be solved for any i:

t[#] & /@ Range[10]


Using recursion (NOTE that recursion can go either up or down)

Clear[t]

t[0] = 1;
t[1] = 2;
t[i_Integer?Positive] :=
t[i] = 2 t[i - 1] - t[i - 2];
t[i_Integer?Negative] :=
t[i] = 2 t[i + 1] - t[i + 2];

list1 = t /@ Range[-5, 5]

(*  {-4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6}  *)


The general solution is

FindSequenceFunction[

(*  1 + i  *)


You can use RSolve to find the general solution more directly

Clear[t]

t[i_] = t[i] /.
RSolve[{t[0] == 1, t[1] == 2,
t[i] == 2 t[i - 1] - t[i - 2]},
t[i], i][[1]]

(*  1 + i  *)

list2 = t /@ Range[-5, 5]

(*  {-4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6}  *)


Approaches are equivalent.

Reduce or FindInstance handles your problem. I switched to lower case t as it is recommended not to use uppercase letters at the beginning of a symbol.

t[0] = 1;
t[1] = 2;
f[i_] := t[i] - t[i + 1] == t[i + 1] - t[i + 2]
c = And @@ Array[f, 3, 0]


produces

-1 == 2 - t[2] && 2 - t[2] == t[2] - t[3] && t[2] - t[3] == t[3] - t[4]


and then

Reduce[c, t[4]]


gives

t[3] == 4 && t[2] == 3 && t[4] == 5


and

FindInstance[c, {t[2], t[3], t[4]}]


gives

{{t[2] -> 3, t[3] -> 4, t[4] -> 5}}

• This is exactly what I'm looking for. I was quite confused about the use of Eliminate and Reduce but now I can see the difference. Thanks for the help. – Fang Oct 5 '15 at 17:21