Using generating functions to solve the recurrence relation for factorials

factorialgenerating-functionsrecurrence-relations

Consider the recurrence relation $a_n = n a_{n-1}$ with initial condition $a_0=1$, by generating functions, I got the above expression as:

$$ A(x) = \frac{d}{dx} (xA)$$

With $A(x) = \sum_n x^n a_n$

On solving the DE I get:

$$ A(x) =C$$

Did I do something wrong? because the answer seems quite strange..


Deriving the DE:

$$A(x) = a_o + a_1 x … =\sum a_n x^n $$

$$ \frac{d}{dx}(xA)= a_o + 2a_1 x… = \sum_n n a_{n-1} x^n$$

Multiply $x^n$ on both sides of $a_n = na_{n-1}$ and plug the above two relations, this gives:

$$A(x)= \frac{d}{dx}(xA)$$

Or,

$$ A'(x) x = 0$$

Or, $A(x)=C$

… now what went wrong?

Best Answer

If $A(x) =\sum_{n=0}^{\infty} a_nx^n $ then $xA(x) =\sum_{n=0}^{\infty} a_nx^{n+1} $ so

$\begin{array}\\ (xA(x))' &=\sum_{n=0}^{\infty} (n+1)a_nx^{n}\\ &=\sum_{n=1}^{\infty} na_{n-1}x^{n-1}\\ &=\sum_{n=1}^{\infty} a_nx^{n-1}\\ &=\dfrac1{x}\sum_{n=1}^{\infty} a_nx^{n}\\ &=\dfrac1{x}(A(x)-a_0)\\ \end{array} $

so $xA'+A =\dfrac1{x}(A-a_0) $.