# New to generating functions - how do I get the function from the sequence defined by $a_n= n$ for $n\geqslant 0$?

I'm given: $a_n= n$ for $n \geqslant 0$.

I'm quite good at recursive generating functions, but I haven't came across a simpler one like this, so I'm sure I'm just overlooking something really basic.

-
What function are you talking about? – Ian Coley Apr 18 '13 at 16:48
That's literally what I'm given: The sequence a_n defined by a_n = n for n >= 0. Explain how this function is derived. (And I'm asked to give the generating function of that sequence.) – Doug Smith Apr 18 '13 at 16:50
According to Wikipedia, the ordinary generating function of a sequence an is $$G(a_n,x)=\sum_{n=0}^\infty a_nx^n.$$ In your case, $G(a_n,x)=\sum_{n=0}^\infty nx^n$. – Ian Coley Apr 18 '13 at 16:53
The generating function should be just $\sum \limits_{n=0} n\cdot x^n$... No? – Harold Apr 18 '13 at 16:54

The generating function is, by definition $$g(x) = \sum_{n=0}^\infty a_n x^n = \sum_{n=0}^\infty n x^n$$ The sum can be evaluated as follows: $$g(x) = \sum_{n=0}^\infty n x^n = 0 + \sum_{n=1}^\infty n x^n \stackrel{n=m+1}{=} \sum_{m=0}^\infty (m+1) x^{m+1} = x \sum_{m=0}^\infty (m+1) x^{m} = x \left( \sum_{m=0}^\infty m x^{m} +\sum_{m=0}^\infty x^{m} \right) = x \left( g(x) + \frac{1}{1-x} \right)$$ Now solve for $g(x)$ to get $$g(x) = \frac{x}{(1-x)^2}$$
Wouldn't it be $A(x)=\sum_{i=1}^\infty ix^i$? To get this in a closed form, we have $A(x)=x\frac d{dx}\sum_{i=1}^\infty x^i=x\frac d{dx}\frac x{1-x}$