Finding a Taylor series for $f(x)=(x^{2}+2x)e^x$?

Find the Taylor series for $f(x)=(x^2+2x)e^x$ centered at a=0

I know this is just a Maclaurin series, so I calculated the first four orders, which yields these terms:

$2x+3x^2+2x^3+\frac{5x^4}6+\frac{x^5}4+O(x^6)$

I'm having trouble finding the Taylor series as a sum using n representation (need to find the actual generalized series)

I know it's something with $x^{n+1}$, but I'm not sure about the coefficients

$$e^x \underset{x \to 0}{=} \sum_{k=0}^n \frac{x^k}{k!} + \mathcal{O}(x^{n+1})$$ so $$(x^2 + 2x)e^x \underset{x\to0}{=} \sum_{k=0}^n \frac{x^{k+2}}{k!} + 2 \sum_{k=0}^n \frac{x^{k+1}}{k!} + \mathcal{O}(x^{n+2})\\ = 2x + \sum_{k=2}^{n+1} x^k \left(\frac{1}{(k-2)!} + \frac{2}{(k-1)!}\right) + \mathcal{O}(x^{n+2})$$

EDIT: from @tomi remark: $$f(x) \underset{x\to0}{=} 2x + \sum_{k=2}^{n+1} x^k \frac{k+1}{(k-1)!} + \mathcal{O}(x^{n+2})$$

• thank you, very clear. would the radius of convergence be 2? – gticecream8 Dec 7 '16 at 9:26
• I would simplify the last part of the sum to $\frac 1{(n-2)!}+\frac 2{(n-1)!}=\frac {n-1}{(n-1)!}+\frac 2{(n-1)!}=\frac {n+1}{(n-1)!}$ – tomi Dec 7 '16 at 9:26
• $e^x$ converges for all $x$ so presumably this does, too... – tomi Dec 7 '16 at 9:27
• And then notice that the general formula also includes the $2x$ case, for $k=1$. Also, the general term behaves like a factorial, so it definitely converges over all of $\mathbb R$. – Riccardo Orlando Dec 7 '16 at 9:28

Hint

Consider $$g(x)=x^2e^x=x^2\sum_{n=0}^\infty \frac{x^n}{n!}=\sum_{n=0}^\infty \frac{x^{n+2}}{n!}$$ and differentiate the result later since $$g'(x)=(x^2+2x)e^x=\sum_{n=0}^\infty \frac{{n+2}}{n!}x^{n+1}$$.

• Very neat. Unfortunately wouldn't help the questioner with more general problems... – tomi Dec 7 '16 at 9:21
• Still, that's a good idea. I'd never have thought of that, and it saves a lot of accounting. It also yields a cleaner result than the technique used in the other answer. – Riccardo Orlando Dec 7 '16 at 9:23

Re-expressing $e^x$ as $\displaystyle\sum_{k=0}^{\infty}\frac{x^k}{k!}$, we get:

\begin{align} f(x)&=(x^2+2x)\sum_{k=0}^\infty \frac{x^k}{k!}\\\\ &=(x+2)\sum_{k=0}^{\infty}\frac{x^{k+1}}{k!}\\\\ &=\sum_{k=0}^{\infty}\frac{(x+2)\ x^{k+1}}{k!} \end{align}