Integral $\int_0^∞ x^2 \exp(-2kx)\,dx$ not defined when putting limits I have this integral : $\displaystyle\int_0^∞ x^2 \exp(-2kx)\,dx$
now, integrating by parts ($x^2$ as first function and $\exp(-2kx)$ as second), 
\begin{align}
I & = \int_0^∞ x^2 \exp(-2kx)\,dx \\[6pt]
& = \frac{x^2 \exp (-2kx)}{-2k} - \int_0^∞ \frac{2x \exp(-2kx)}{-2k} \,dx \\[6pt]
& = \frac{x^2 \exp (-2kx)}{-2k} + \left[ \frac{x \exp(-2kx)}{-2k} - \int_0^∞\frac{\exp (-2kx)}{-2k}\,dx\right] \\[6pt]
& = \left.\frac{x^2 \exp (-2kx)}{-2k} +  \frac{x \exp(-2kx)}{-2k} + \frac{\exp (-2kx)}{-2k} \right|_0^∞ \\[6pt]
& = \left.\frac{\exp(-2kx) (x^2 + x + 1)}{-2k} \right|_0^∞
\end{align}
now how to solve this? have i done the integral right? suggest some other ways if possible.
 A: Assuming $k\in\mathbb{R}^+$ we have:
$$ I_k = \int_{0}^{+\infty} x^2 e^{-2k x}\,dx = \frac{1}{(2k)^3}\int_{0}^{+\infty} z^2 e^{-z}\,dz = \frac{2}{8k^3} = \color{red}{\frac{1}{4k^3}}.$$
The integral appearing in the middle term is just the integral defining a value of the $\Gamma$ function :
$$ \forall n\in\mathbb{N},\qquad \int_{0}^{+\infty} x^n e^{-x}\,dx = n!.$$
A: What we usually mean whenever we write
$$
\int^{\infty}_0 x^2 e^{-2kx}\, dx
$$
is
$$
\lim_{M\to \infty} \int^{M}_0 x^2 e^{-2kx}\, dx.
$$
Thus, we compute the integral (from $0$ to $M$) using the integration by parts formula twice:
\begin{align*}
\int_0^M x^2e^{-2kx}\, dx & = \Bigg[-\frac{x^2e^{-2kx}}{2k}\Bigg]^M_0 +\int_0^Mx\frac{e^{-2kx}}{k}\, dx = -\frac{M^2e^{-2Mk}}{2k} + \Bigg[-x\frac{e^{-2kx}}{2k^2}\Bigg]^M_0  \\
& +\int_0^M \frac{e^{-2kx}}{2k^2}\, dx = -\frac{e^{-2Mk}}{2k}\Big(M^2+\frac{M}{k}\Big) + \Bigg[-\frac{e^{-2kx}}{4k^3}\Bigg]^M_0 \\
& = -\frac{e^{-2Mk}}{2k}\Big(M^2+\frac{M}{k}\Big) - \frac{e^{-2Mk}}{4k^3} + \frac{1}{4k^3}.
\end{align*}
Then, for any $k>0$, we have
$$
\int^{\infty}_0 x^2 e^{-2kx}\, dx= \lim_{M\to\infty} -\frac{e^{-2Mk}}{2k}\Big(M^2+\frac{M}{k}\Big) - \frac{e^{-2Mk}}{4k^3} + \frac{1}{4k^3} = \frac{1}{4k^3}.
$$
A: Hint: Alternately, evaluate $I(k)=\displaystyle\int_0^\infty e^{-2kx}~dx$, then differentiate both sides twice with regard to the parameter k.
