In a discrete mathematics past paper, I must find the first eight terms of the sequence whose generating function is $$\frac{x^2}{(1-x)(1-2x)}.$$
I have looked at both of the following posts:
- How can I determine the sequence generated by a generating function?
- how to determine the sequence generated by these generating functions?
A comment from the first post states that 'To compute the term $a_n$ in the sequence generated by an ordinary generating function, take the $n$-th derivative of the function at $x=0$ and divide by $n!$.'
I haven't tried to use this method in my case, because I would like to see a justification for it, rather than simply memorising and using it.
An answer from the second post refers to updating the affected terms in a simpler generating function; however, I am not sure if that would be useful in my case.
I would appreciate help to understand how to efficiently solve this problem.
Expanding on Did's comment: $$ \begin{align} \frac{x^2}{(1-2x)(1-x)} &= x \, \frac{1}{1-2x} - x \, \frac{1}{1-x} \\ &= x \sum_{n=0}^{\infty} 2^n x^n - x \sum_{n=0}^{\infty} x^n \\ &= \sum_{k=1}^{\infty} (2^{k-1}-1) x^k \end{align} $$ Thus the first eight terms $a_0,\dotsc,a_7$ of the sequence $(a_k)_{k\geq0}$ are $$ 0, 0, 1, 3, 7, 15, 31, 63 $$