$X_1=a$, $X_2=b$ and $X_{n+2}=(X_n+X_{n+1})/2$
Find a formula for $\langle X_n\rangle$ valid for each $n\in\mathbb N$.
I wrote a few terms in this sequence and tried to derive a formula. But I couldn't come up with a solution. Any hints on how to solve this?
Solve the characteristic equation:
$$q^2 = \frac{q}{2} + \frac{1}{2}$$
$$q = 1,-\frac{1}{2}$$
Using these two roots: $$X_n = c_1 + c_2(-\frac{1}{2})^n$$
$$X_1 = c_1 - \frac{c_2}{2} = a$$ $$X_2 = c_1 + \frac{c_2}{4} = b$$
Solving the system of equations: $$c_1 = \frac{a + 2b}{3}$$ $$c_2 = \frac{4(b-a)}{3}$$
Giving us the final answer: $$X_n = \frac{a + 2b}{3} + \left(\frac{4(b-a)}{3}\right)(\frac{-1}{2})^n$$