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?
 A: I believe you are searching for a complicated solution to a simple problem.
If $P_n=5$, then
$$
 P_{n+1} = 5 - 10n +10n = 5
$$
By recursion, as the starting value is $5$ then each of the following terms is also equal to $5$. 
A: 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. 
A: Note
$$P_{n}-5=2n(P_{n-1}-5)$$
let $P_{n}-5=a_{n}$.then we have
$$a_{n}=2na_{n-1}\Longrightarrow \dfrac{a_{n}}{a_{n-1}}=2n$$
then easy to find 
$$a_{n}=\prod_{i=2}^{n}\dfrac{a_{i}}{a_{i-1}}\cdot a_{1}=5\cdot 2^n\cdot n!$$
A: I agree with the comment by Aulo.  The sequence is all 5's.  The generating function is 5/(1 - x).  If we are determined to find a "complicated solution to a simple problem" then we can solve the differential equation: DSolve[{2 x y'[x] - 10 x/(1 - x)^2 + 5/(1 - x) == y[x], y[0] == 5}, y[x], x].  Mathematica gives: y[x] -> (-5 - Sqrt[x] C[1] + x^(3/2) C[1])/(-1 + x).
