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.