This is really basic, but I've been trying hard for a while and didn't get where I made a mistake, so after some consideration decided to ask it here.
So I got a basic recurrence equation for stationary distribution in MC: $$ 0=\lambda \pi_{k-1} + \mu \pi_{k+1} - (\lambda+ \mu) \pi_k $$
I tried to solve it using generating functions with $G(z)=\sum_{k \geq 0} \pi_k z^k$, so I got
$$ \frac{\mu \pi_0}{z}=P(z)(z-1)(\lambda-\frac{\mu}{z}) $$ I understand how to go from here equating coefficients and so on, but this expression is incorrect! The correct one is
$$ \frac{\mu \pi_0(1-z)}{z}=P(z)(z-1)(\lambda-\frac{\mu}{z}) $$ before cancellations. I suspect I made a mistake when working out the generating function $G(z)$: $$ \lambda \sum_{k \geq 0} \pi_{k-1} z^k=\lambda z G(z)\\ \mu \sum_{k \geq 0} \pi_{k+1}z^k = \frac{\mu}{z}(G(z)- \pi_0) $$
OK, start with: $$ 0 = \lambda \pi_k + \mu \pi_{k + 2} - (\lambda + \mu) \pi_{k + 1} $$ Define: $$ P(z) = \sum_{k \ge 0} \pi_k z^k $$ Applying properties of ordinary generating functions: $$ \begin{align*} 0 &= \lambda P(z) + \mu \frac{P(z) - \pi_0 - \pi_1 z}{z^2} - (\lambda + \mu) \frac{P(z) - \pi_0}{z} \\ P(z) &= \frac{(\mu \pi_1 - (\mu + \lambda) \pi_0) z + \mu \pi_0} {(1 - z) (\lambda z - \mu)} \end{align*} $$ (This is a second order recurrence, need starting values $\pi_0$ and $\pi_1$.)
Maxima's help with algebra is gratefully aknowledged.