How to integrate $x^2e^{|x|}$ I have $\int^\infty_{-\infty}\frac{1}{2}x^2ce^{-c|x|}dx$. How can I integrate this? The answer is $2c^{-2}$, but how do I show this?
This is what I thought: $$\begin{align}\int_{-\infty}^\infty\frac{1}{2}x^2ce^{-c|x|}dx &= \int_{-\infty}^0\frac{1}{2}x^2ce^{cx}dx+\int_0^\infty\frac{1}{2}x^2ce^{-cx}dx \\
&=-\int_0^\infty\frac{1}{2}x^2ce^{-cx}dx+\int_0^\infty\frac{1}{2}x^2ce^{-cx}dx\\
&=0.
\end{align}$$
Earlier this evening I asked the same integration, except that it had the term $x$ instead of $x^2$, and this method worked. now it doesn't, why not?
 A: Assuming $c>0$ (otherwise the integrand function is not integrable) we have:
$$ \frac{1}{2}\int_{-\infty}^{+\infty}cx^2 e^{-c|x|}\,dx = \int_{0}^{+\infty} cx^2 e^{-cx}\,dx = \frac{1}{c^2}\int_{0}^{+\infty}z^2 e^{-z}\,dz = \frac{\Gamma(3)}{c^2}=\color{red}{\frac{2}{c^2}}.$$
 In the middle, we just set $z=cx$.
A: we can evaluate $$\int_{-\infty}^\infty \frac 12 x^2 ce^{-|cx|} \, dx$$ 
assuming $c > 0,$ first we make a change of variable $cx = u, x = \frac u c, \, dx = du$ so the integral becomes $$\frac 1{2c^2} \int_{-\infty}^\infty u^2 e^{-|u|} \,du $$  we will find the constant 
$$\begin{align}\int_{-\infty}^\infty u^2 e^{-|u|} \,du &= 2\int_0^\infty u^2 e^{-u} \,du \\ 
&=2(u^2e^{-u})\big|_0^\infty+ 4 \int_0^\infty u e^{-u} \, du\\
&=  4 \int_0^\infty u e^{-u} \, du = 4(-ue^{-u})\big|_0^\infty + 4 \int_0^\infty  e^{-u}\\
& = 4
\end{align}$$
therefore $$\int_{-\infty}^\infty \frac 12 x^2 ce^{-|cx|} \, dx = \frac{2}{c^2}$$ 
A: In the first integral on the right hand side, you simultaneously swapped the order of integration and made the substitution $x\mapsto -x$. Each of these introduces a minus sign (the latter from $dx\mapsto-dx$). So there is no minus sign in front of that integral in the second row.
