# 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 = 1;

T = 2;

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

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

Solve[c, T]


The answer only gave me the following

-1 == 2 - T && 2 - T == T - T &&
T - T == T - T


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

• Eliminate[c, T] gives T == 3 && T == 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 = 1;
t = 2;


which can be solved for any i:

t[#] & /@ Range


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

Clear[t]

t = 1;
t = 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 == 1, t == 2,
t[i] == 2 t[i - 1] - t[i - 2]},
t[i], i][]

(*  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 = 1;
t = 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 - t == t - t && t - t == t - t


and then

Reduce[c, t]


gives

t == 4 && t == 3 && t == 5


and

FindInstance[c, {t, t, t}]


gives

{{t -> 3, t -> 4, t -> 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