Calculating the definite integral $\int^a_{-a} e^{-x^2} \, dx$ After I learnt about this proof that $$\int^\infty_{-\infty} e^{-x^2} dx=\sqrt\pi$$I wondered if it could be applied to calculate the more general case $$\int^a_{-a} e^{-x^2} dx$$ for real $a\ge0$. Following the proof, we have $$\left(\int^a_{-a} e^{-x^2} dx\right)^2=\int^a_{-a}e^{-x^2}dx\int^a_{-a}e^{-y^2}dy$$$$=\int^a_{-a}\int^a_{-a}e^{-x^2+y^2}dxdy$$$$2\pi\int^a_0re^{-r^2}dr, r=x^2+y^2$$ $$=-\pi\int^{r=a}_{r=0}e^sds,s=-r^2$$ $$=-\pi\left|e^{-r^2}\right|^{a}_0$$ $$=\pi\left(1-e^{-a^2}\right)$$ Then, $$\int^a_{-a} e^{-x^2} dx=\sqrt{\pi\left(1-e^{-a^2}\right)}$$

But when I tried to plot $\sqrt{\pi\left(1-e^{-a^2}\right)}$ and $\int^a_{-a} e^{-x^2} dx$, there are some discrepancies:

$\sqrt{\pi\left(1-e^{-a^2}\right)}$ and $\int^a_{-a} e^{-x^2} dx$">

As you can see, $\sqrt{\pi\left(1-e^{-a^2}\right)}=\int^a_{-a} e^{-x^2} dx$ only when $x=0$ and (asymtopically) $x=\infty$. Why do the two functions deviate from each other?
This approach doesn't work. The set $\{re^{i\theta} : 0\leq r \leq a, \theta \in [0,2\pi]\}$ is not the same as $\{x+iy, -a\leq x \leq a, -a\leq y \leq a\}$. The first one a disk and the second one a rectangle.
$$\left(\int^a_{-a} e^{-x^2} dx\right)^2=2\pi\int^a_0re^{-r^2}dr$$

No, this is not true.



In general, because the function $x\mapsto e^{-x^2}$ is even, we know that  $$\int_{-a}^ae^{-x^2}dx = 2\cdot \int_0^a e^{-x^2} dx$$

which means that finding a closed form for one expression is equivalent to finding a closed form for the other expression.

It is also a well known result in mathematics that the integral of the function $x\mapsto e^{-x^2}$ is not elementary, which means that it cannot be written in closed form.