# generating function / stream cipher

I'm struggling to solve this exercise.

$s_n = 6s_{n-1} - 5s_{n-2}$ with initial states $s_1 = 1$ and $s_2 = 2$

Now I have to find a closed formula for this sequence.

The generating function is given by $f(z) = \frac{s_1}{z} + \frac{s_2}{z^2} + ...$

How can I find from this the generating function with $z^2 - 6z + 5$ in the denominator? Thanks for any hints.

• Why not $f(z)=s_1z+s_2z^2+s_3z^3+\cdots$? – Lord Shark the Unknown Jan 31 '18 at 18:12
• we definded it the other way and have to do it like this. – Livpez. Jan 31 '18 at 18:19

Since $$s_{n+2}-s_{n+1}=5(s_{n+1}-s_n),$$ we obtain $$s_{n+1}-s_n=5^{n-1}$$ and use the telescopic sum.
I got $$s_n=\frac{5^{n-1}+3}{4}.$$