# Evaluating $\int_{0}^{+\infty}(\frac{\sqrt \pi}{2}-\int_{0}^{x}\mathrm{e}^{-t^2}dt)dx$

I need to evaluate $$\int_{0}^{+\infty} \left(\frac{\sqrt\pi}{2}-\int_{0}^{x}\mathrm{e}^{-t^2}dt\right)dx$$ in my homework problem, which should probably be equal to $$\frac{1}{2}$$. I know $$\frac{\sqrt\pi}{2}=\lim\limits_{x\to+\infty}\int_{0}^{x}\mathrm{e}^{-t^2}dt$$, but I have no idea on how to evaluate the integral.

Inasmuch as $$\frac{\sqrt \pi}{2}=\int_0^\infty e^{-t^2}\,dt$$, we have
\begin{align} \int_0^\infty \left( \frac{\sqrt \pi}{2}-\int_0^x e^{-t^2}\,dt\right)\,dx &=\int_0^\infty \int_x^\infty e^{-t^2}\,dt\,dx\\\\ &=\int_0^\infty e^{-t^2}\left(\int_0^t 1\,dx\right) \,dt \end{align}