How do I get the closed form of this recurrence using generating functions?

56 Views Asked by At

Recurrence: $T(n) = n + nT(n-1)$ and $T(0) = 0$.

What I tried:

Let $G(x) = \sum_{n=0}^{\infty} T(n) x^n$ so that $xG'(x) = \sum_{n=0}^{\infty} nT(n)x^n$

Solving:

\begin{align} G(x) &= \sum_{n=0}^{\infty} T(n) x^n \\&= 0x^0 + \sum_{n=1}^{\infty} T(n) x^n \\&= \sum_{n=1}^{\infty} n x^n + \sum_{n=1}^{\infty} nT(n-1) x^n \\&= -0x^0 + \sum_{n=0}^{\infty} n x^n + x\sum_{n=1}^{\infty} nT(n-1) x^{n-1} \\&= \frac{x}{(1-x)^2} + x\sum_{n=0}^{\infty} (n+1)T(n) x^{n} \\&= \frac{x}{(1-x)^2} + x\sum_{n=0}^{\infty} nT(n) x^{n} + x\sum_{n=0}^{\infty} T(n) x^{n} \\&= \frac{x}{(1-x)^2} + x^2G'(x) + xG(x) \end{align}

And $G(x) = \frac{x}{(1-x)^2} + x^2G'(x) + xG(x)$ rearranges to $G(x) = \frac{x}{(1-x)^3} + \frac{x^2}{1-x}G'(x)$

No idea where to take it from here.

1

There are 1 best solutions below

19
On BEST ANSWER

$$G(x)-xG'(x)=\frac{x}{(1-x)^2}$$

Now use the fact that $$\left(\frac{G(x)}{x} \right)'=\frac{G'(x) x -G(x)}{x^2}$$

to reduce your equation to $$\left(\frac{G(x)}{x} \right)'=-\frac{1}{x (1-x)^2}$$

Integrate and you are done.

Edit To address the updated question: $$ G'(x) -\frac{1-x}{x^2}G(x) =-\frac{1}{x(1-x)^2} $$ is a first order linear differential equation.

You can solve it by using the method listed in these notes:

Linear Differential Equations