Solve recurcion using generating function I have got a problem with solving this equation using generating functions. 
$$ P_{n}=2nP_{n-1}-10n+5 $$ 
$$  P_{0}=5  $$
I started like that:
$$
f(x)=\sum_{n=0}^{\infty}P_{n}x^{n}=5+\sum_{n=1}^{\infty}P_{n}x^{n}=5+\sum_{n=1}^{\infty}(2nP_{n-1}-10n+5)x^{n}=5+\sum_{n=1}^{\infty}2nP_{n-1}x^{n}-\sum_{n=1}^{\infty}10nx^{n}+\sum_{n=1}^{\infty}5x^{n}
$$
So:
$$\sum_{n=1}^{\infty}10nx^{n}=10x\sum_{n=1}^{\infty}(x^{n})'=\frac{10x}{(1-x)^{2}} $$
Also:
$$
5\sum_{n=1}^{\infty}x^{n}=\frac{5x}{1-x}
$$
But I don't know what to do with:
$$
2\sum_{n=1}^{\infty}nP_{n-1}x^{n}
$$
Can you help me to solve this equations?

Method 1: Given $P_{n}=2nP_{n-1}-10n+5$ and $P_{0}=5$ then
\begin{align}
\sum_{n=0}^{\infty} P_{n+1} \, t^{n} &= 2 \, \sum_{n=0}^{\infty} (n+1) \, P_{n} \, t^{n} - 10 \, \sum_{n=0}^{\infty} n \, t^{n} - 5 \, \sum_{n=0}^{\infty} t^{n} \\
\sum_{n=1}^{\infty} P_{n} \, t^{n-1} &= 2 \, \frac{d}{dt} \, \sum_{n=0}^{\infty} P_{n} \, t^{n+1} - 10 \frac{d}{dt}\left(t \,  \sum_{n=0}^{\infty} t^{n} \right) - \frac{5}{1-t} \\
\frac{1}{t} \left( - P_{0} + P(t) \right) &= 2 \, \frac{d}{dt} \left( t P(t) \right) - 10 \frac{d}{dt} \left( \frac{t}{1-t} \right) - \frac{5}{1-t} \\
\frac{1}{t} \left( -5 + P(t) \right) &= 2t P'(t) + 2P(t) - \frac{5(1+t)}{(1-t)^{2}} 
\end{align}
which becomes
\begin{align}
2 t^{2} \, P'(t) - (1-2t) \, P(t) = \frac{5(1-3t)}{(1-t)^{2}}
\end{align}
where $P(t) = \sum_{n=0}^{\infty} P_{n} \, t^{n}$. This result leads to more complications. 
Method 2:
Consider the exponential generating function method. 
\begin{align}
P(t) = \sum_{n=0}^{\infty} P_{n} \, \frac{t^{n}}{n!} &= 2 \, \sum_{n=0}^{\infty} P_{n-1} \, \frac{t^{n}}{(n-1)!} - 10 \, \sum_{n=0}^{\infty} \frac{t^{n}}{(n-1)!} + 5 \sum_{n=0}^{\infty} \frac{t^{n}}{n!} \\
&= 2 \sum_{n=1}^{\infty} P_{n-1} \, \frac{t^{n}}{(n-1)!} - 10 \, \sum_{n=1}^{\infty} \frac{t^{n}}{(n-1)!} + 5 \, e^{t} \\
&= 2 t P(t) - 10 t \, e^{t} + 5 \, e^{t} = 2t P(t) + 5(1-2t) \, e^{t}
\end{align}
This leads to $P(t) = 5 e^{t}$ or $P_{n} = 5$. A verification can be made and is indeed a solution. 
Method 3: From the difference equation it is readily found that $P_{n} = 5 \cdot 2^{n} \, n!$ for $n \geq 0$. A quick check verifies this is also a valid solution. 
