I am trying to solve the following nonhomogeneous recurrence relation.
$a_n=\frac{1}{2}a_{n-1}+\frac{1}{2}a_{n+1}+1$
I know the general solution is of the form $-x^2+mx+n$, but I can't seem to derive it for the life of me. I haven't had to solve one of these in ages. My first stab at it got me this far: First I rewrote the relation to get rid of the $a_{n+1}$ term, so I have
$a_{n-1}=\frac{1}{2}a_{n-2}+\frac{1}{2}a_{n}+1$ The associated characteristic equation is $\frac{1}{2}r^2-r+\frac{1}{2}=0$, whose solution is $r=1$. Then $a_n=c*1^{n}=c.$ This seems totally wrong to me. No idea how to gather a particular solution from here either. Any help would be appreciated.
solution is r=1
That's a double root, so $a_n=(c_0 + c_1 n)\cdot 1^n\,$ for the homogeneous part. Or, without characteristic polynomials, write the recurrence as $(a_{n+1}-a_n)=(a_n-a_{n-1}) - 2\,$ and telescope. $\endgroup$