<s>[INST] Exponential generating function - what happens when there is a leftover term? Find the coefficient on $x^2/2!$ in the following generating function:
$$xe^{3x}-x^2$$
I got this far:
$$x\sum_{n=0}^{\infty}\frac{3^nx^n}{n!}-x^2=\sum_{n=0}^{\infty}\frac{3^nx^{n+1}}{n!}-x^2$$
So, there are two terms here. To find the coefficient of $x^2/2!$, I can see that for the first sigma term, $n = 1$. So we have $\frac{3^1x^2}{1!}=\frac{6x^2}{2!}$. Thus the coefficient for the first term is 6. (is that right?) But what about the coefficient for the term $-x^2$? Is it just $-1$? I guess that $-x^2$ can be rewritten as $-\frac{2x^2}{2!}$, so maybe the coefficient should be $-2$? I would appreciate any clarification on this. Thanks.
 [/INST] It’s probably simplest first to find the coefficient of $x^2$. The $x^2$ term in the summation
$$\sum_{n\ge 0}\frac{3^nx^{n+1}}{n!}$$
is the $n=1$ term, $\dfrac{3^1x^{1+1}}{1!}=3x^2\;.$ The $x^2$ term in $xe^{3x}-x^2$ is therefore $3x^2-x^2=2x^2$. 
To finish the problem, you need to express $2x^2$ as a multiple of $\dfrac{x^2}{2!}$:
$$2x^2=4\cdot\frac{x^2}{2!}\;,$$
so the desired coefficient is $4$. Your approach will also work: $x^2=\dfrac{2x^2}{2!}$, so the $x^2$ term is
$$\frac{6x^2}{2!}-\frac{2x^2}{2!}=4\cdot\frac{x^2}{2!}\;.$$
</s>