Wolfram alpha giving wrong result on recurrence?

152 Views Asked by At

I have the recurrence$$a_{n+2}-a_n=1$$

The answer I got was $a_n=A+B(-1)^n+\frac n 2$, while WolframAlpha is giving me $a_n=A+B(-1)^n+\frac n 2- \frac 1 4$.

Although when I plug them in the relation, both work. What's going on here?

My guessed particular solution was $a_n=n\cdot k$.

E: After adding the initial conditions $a_0=1, a_1=0$ I got the same answer as WA. Thanks!

2

There are 2 best solutions below

1
On BEST ANSWER

Wolfram Alpha isn't wrong because $A - \frac{1}{4}$ could be anything. So in fact they're equivalent.

$A$ and $B$ are arbitrary constants.

The general solution is given by the sum of the particular solution (which you know how to find) and the general solution to $b_n - b_{n-2} = 0$.

0
On

hint: Write $a_{n+2} - a_n = (a_{n+2} - a_{n+1}) + (a_{n+1} - a_n)$. Let $b_n = a_n - a_{n-1} \Rightarrow b_n - b_{n-1} = 1$. Can you continue? and see a telescoping sum near by?do it twice to get back to $a_n$.