The recursion formula for some probability $P_n(s)$ is $$P_{n+1}(s) = qP_n(s+1) + pP_n(s-1).$$ Define the generating function $$G(z,n) = \sum_{s=-\infty}^{\infty} z^s P_n(s)$$ and prove the recursion relation $$G(z,n+1) = (pz + qz^{-1}) G(z,n)$$ Obtain a closed form solution for $G(z,n)$.
Attempt: I've proven the recursion relation for $G$, what I am unsure of is how to obtain the closed form solution. I thought I could take derivatives of $G$ wrt to $z$ say and maybe generate a differential equation whose solution would correspond to $G$ itself but I have not managed this. I could also try an ansatz and fix the parameters of this ansatz through the recursion relation but again I didn't manage to obtain a complete solution.
Thanks for any tips!
Observe that $G(z,n)$ is a geometric sequence for fixed $z$ hence $G(z,n)=(pz+qz^{-1})^nG(z,0)$