What is wrong with my method of computing $\int_0^{\infty}x^2 e^{-x^2} \space dx$ I want to check if the following improper integral converges or diverges:
$$\int_0^{\infty} x^2e^{-x^2}\space dx$$
Rewriting the integrand:
$$\int_0^{\infty}-\frac{1}{2}x(-2x e^{-x^2}) \space dx$$
Integrating by parts:
$u=-\frac{1}{2}x; \space u'=-\frac{1}{2}; \space v=e^{-x^2}; \space v'=-2xe^{-x^2}$
$$\implies\int_0^{\infty} -\frac{1}{2}x(-2x e^{-x^2}) \space dx=((-\frac{1}{2}xe^{-x^2})_0^\infty-(-\frac{1}{2}e^{-x^2})_0^{\infty}) $$
$$=(\lim_{N \to \infty}(Ne^{-N^2})-0)-(\lim_{N \to \infty}(-\frac{1}{2}e^{-N^2})-(-\frac{1}{2}))=\color{red}{-\frac{1}{2}}$$
As far as I know the answer should be $\frac{1}{4}$ but I can't figure out where I am making a mistake.
 A: $$
\begin{eqnarray}
\int_0^\infty x^2 e^{-x^2} dx &=& \Big[\frac{1}{2}x e^{-x^2}\Big]_0^\infty x^2
+ \frac{1}{2} \int_0^\infty e^{-x^2} dx\\
&=& \frac{1}{4} \int_{-\infty}^\infty e^{-x^2} dx\\
&=& \frac{\sqrt{\pi}}{4}
\end{eqnarray}
$$

Your question in the comment - how to integrate $e^{-x^2}$...
$$
\begin{eqnarray}
\int_{-\infty}^\infty e^{-x^2} dx &=& \sqrt{ \left( \int_{-\infty}^\infty e^{-x^2} dx \right)^2 }\\
&=& \sqrt{ \int_{-\infty}^\infty e^{-x^2} dx \int_{-\infty}^\infty e^{-y^2} dy}\\
&=& \sqrt{ \int_{-\infty}^\infty \int_{-\infty}^\infty e^{-x^2-y^2} dx  dy}\\
&=& \sqrt{ \int_{0}^\infty \int_0^{2\pi} e^{-r^2} r d\phi dr }\\
&=& \sqrt{ \pi \int_{0}^\infty e^{-r^2} d\phi d(r^2) }\\
&=& \sqrt{ \pi }
\end{eqnarray}
$$
A: There is a small mistake in the integration by parts. 
$$F(x) =\int x^2e^{-x^2}\space dx=-\frac12e^{-x^2} + \int \frac12 e^{-x^2}\space dx=-\frac12e^{-x^2} + \frac{\sqrt{\pi} \cdot \mathrm{erf}(x)}{4}+C$$
Since we have
$$\lim_{x\to\infty} -\frac12e^{-x^2} + \frac{\sqrt{\pi} \cdot \mathrm{erf}(x)}{4} = \lim_{x\to\infty} -\frac12e^{-x^2} + \frac{\sqrt{\pi}}{4} \lim_{x\to\infty} \mathrm{erf}(x) = \frac{\sqrt{\pi}}{4}$$
and $F(0)=0$, the result is $\frac{\sqrt{\pi}}{4}$.
A: $$\begin{eqnarray*}\int_{0}^{+\infty}-\frac{x}{2}(-2x e^{-x^2})\,dx &=& \left.-\frac{x}{2} e^{-x^2}\right|_{0}^{+\infty}+\frac{1}{2}\int_{0}^{+\infty}e^{-x^2}\,dx\\&=&\frac{1}{2}\cdot\frac{\sqrt{\pi}}{2}=\color{red}{\frac{\sqrt{\pi}}{4}}\end{eqnarray*}$$
or:
$$ \begin{eqnarray*}\int_{0}^{+\infty}x^2 e^{-x^2}\,dx = \frac{1}{2}\int_{0}^{+\infty}z^{1/2}e^{-z}\,dz = \frac{\Gamma(3/2)}{2} = \frac{\Gamma(1/2)}{4}=\color{red}{\frac{\sqrt\pi}{4}}.\end{eqnarray*}$$
