It depends on the limits of the integration. If the limits are ±infinity then the integral can be done analytically - see below. However, if at least one of the limits is finite then the integral can only be done numerically (an exception is if one of the limits is zero, then the integral from zero to infinity is just half of the integral from -infinity to infinity).
Here is a brief derivation of the integral of e-x^2 from - infinity to infinity:
LetI=\int_{-\infty}^{\infty}e^{-x^2}dxBecausexisadummyvariablewecanalsowritethisasI=\int_{-\infty}^{\infty}e^{-y^2}dyMultiplythetwotogethertogetI^2=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}e^{-(x^2+y^2}dxdyNowifwethinkofxandyasbeingaxesonastandardCartesiangraph,thentheright−handsideisjusttheintegraloverthewholeplaneof$e−(x2+y2)$.Changetopolarcoordinates,$r,θ$wherex = r.cos\theta, y = r.sin\theta.Thelimitsoftheintegrationbecome$0$to$∞$for$r$and$0$to$2π$for$θ$.$dxdy$becomes$r.drdθ$.So:
I2=∫2π0∫∞0e−r2r.drdθ\\
I2=2π∫∞0e−r2r.dr\\
I2=2π∫∞0e−r212dr2\\
I2=π∫∞0e−zdz\\
where I've substituted $z$ for $r^2$ in that last integral. So:
I2=π
as $\int_{0}^{\infty}e^{-z}dz=1$
Finally, $I=\sqrt\pi$ or
∫∞−∞e−x2dx=√π$$
.