Proving $\int_{0}^{\infty} \mathrm{e}^{-x^2} dx = \dfrac{\sqrt \pi}{2}$

How to prove
$$\int_{0}^{\infty} \mathrm{e}^{-x^2}\, dx = \frac{\sqrt \pi}{2}$$

Solutions Collecting From Web of "Proving $\int_{0}^{\infty} \mathrm{e}^{-x^2} dx = \dfrac{\sqrt \pi}{2}$"

This is an old favorite of mine.
Define $$I=\int_{-\infty}^{+\infty} e^{-x^2} dx$$
Then $$I^2=\bigg(\int_{-\infty}^{+\infty} e^{-x^2} dx\bigg)\bigg(\int_{-\infty}^{+\infty} e^{-y^2} dy\bigg)$$
$$I^2=\int_{-\infty}^{+\infty}\int_{-\infty}^{+\infty}e^{-(x^2+y^2)} dxdy$$
Now change to polar coordinates
$$I^2=\int_{0}^{+2 \pi}\int_{0}^{+\infty}e^{-r^2} rdrd\theta$$
The $\theta$ integral just gives $2\pi$, while the $r$ integral succumbs to the substitution $u=r^2$
So $$I=\sqrt{\pi}$$ and your integral is half this by symmetry

I have always wondered if somebody found it this way, or did it first using complex variables and noticed this would work.

A variation on Ross Millikan’s answer.

We can start again with the observation
Now $V$ is simply the volume of the body
$$-\infty < x,y < \infty,\qquad 0 < z < e^{-(x^2+y^2)},$$
or, equivalently,
$$0 < x^2+y^2 < -\ln z,\qquad 0 < z < 1.$$
This implies that the body is a solid of revolution. Using the
disk integration formula, we have
$$V=\int_{0}^{1}\pi(-\ln z)dz=[\pi(z-z\ln z)]_{0}^1=\pi.$$

I know this:

Define $f$ and $g$ as:

$$f(x):=\left(\int_0^x e^{-t^2}dt\right)^{2} \quad\text{and}\quad g(x):=\left(\int_{0}^{1}\frac{e^{-x^{2}(t^{2}+1)}}{t^{2}+1}dt\right)$$

Now, $$f'(x)=2e^{-x^{2}}\int_{0}^{x}e^{-t^{2}}dt$$ and

$$g'(x)=\int_0^1 \frac{\partial}{\partial x}\left[\frac{e^{-x^2(t^2+1)}}{t^2+1}\right]dt = -2xe^{-x^{2}}\int_{0}^{1}e^{-x^{2}t^{2}}dt$$

So putting $t=tx$, get $\displaystyle\int_{0}^{1}e^{-x^{2}t^{2}}dt= \frac{1}{x}\displaystyle\int_{0}^{x}e^{-t^{2}}dt$

Then we get:


Thus $f'(x)+g'(x)=0$ for all $x$, then $f(x)+g(x)$ is an constant function. Also $$f(0)+g(0)=\displaystyle\int_{0}^{1}\frac{1}{t^{2}+1}dt = \displaystyle\frac{\pi}{4}$$

Then $f(x)+g(x)=\displaystyle\frac{\pi}{4}$ for all $x$.

Now $\lim_{x \to{+}\infty}{g(x)}=0$

So $$\displaystyle\frac{\pi}{4} = \lim_{x \to{+}\infty}{f(x)+g(x)}=\lim_{x \to{+}\infty}{f(x)}= \left(\int_{0}^{\infty}e^{-t^{2}}dt\right)^{2}$$


$$\int_{0}^{\infty}e^{-t^{2}}dt=\sqrt{\frac{\pi}{4}}= \frac{\sqrt{\pi}}{2}$$

The end.

It might be worth mentioning that one also can use spherical coordinates in 3-dimensions analogously to the polar coordinates Ross Millikan used above: If $I$ denotes $\int_{-\infty}^{\infty} e^{-x^2}dx$, then we have
$$I^3 = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} \int_{-\infty}^{\infty}e^{-x^2 – y^2 – z^2}\,dx\,dy\,dz$$
Switching to spherical coordinates this becomes
$$\int_0^{2\pi}\int_0^{\pi}\int_0^{\infty}\sin(\phi) \rho^2 e^{-\rho^2}\,d\rho\,d\phi\,d\theta$$
Doing the theta and $\phi$ integrations this becomes
$$I^3 = 4\pi\int_0^{\infty}\rho^2 e^{-\rho^2}\,d\rho$$
One can then integrate parts in this, differentiating $\rho$ and integrating $\rho e^{-\rho^2}$. This leads us to
$$I^3 = 2\pi \int_0^{\infty} e^{-\rho^2}\,d\rho$$
Note the right-hand side is exactly $2\pi * {I \over 2} = \pi I$. Thus $I^3 = \pi I$ and thus $I = \sqrt{\pi}$ as needed. Obviously polar coordinates are faster. Just sayin’…

An alternative derivation is to show that

$$\int_{0}^{\infty}xe^{-x^{2}y^{2}}\; \mathrm{d}y=I,$$

where $I$ is your integral:

$$I:=\int_{0}^{\infty}e^{-x^2}\; \mathrm{d}x,$$

and then evaluate $I^2$ by reversing the order of integration. If $x>0$, then

$$\int_{0}^{\infty}xe^{-x^{2}y^{2}}\; \mathrm{d}y=x\int_{0}^{\infty}e^{-{(xy)}^2}\; \mathrm{d}y=x\int_{0}^{\infty}e^{-u^2}\dfrac{\mathrm{d}u}{x}=\int_{0}^{\infty}e^{-u^2}\; \mathrm{d}u=I.$$


$$\begin{aligned}I^2&=\int_{0}^{\infty}e^{-x^2}\; \mathrm{d}x\int_{0}^{\infty}xe^{-x^{2}y^{2}}\; \mathrm{d}y=\displaystyle\int_{0}^{\infty}\mathrm{d}y\int_{0}^{\infty}xe^{-x^2}e^{-x^{2}y^{2}}\; \mathrm{d}x\\ &=\int_{0}^{\infty}\mathrm{d}y\int_{0}^{\infty}xe^{-x^{2}(1+y^2)}\; \mathrm{d}x=\int_{0}^{\infty}\mathrm{d}y\dfrac{1}{2\left( 1+y^{2}\right) }\left[ -e^{-x^{2}\left( 1+y^{2}\right) }\right] _{x=0}^{\infty }\\ &=\int_{0}^{\infty }\dfrac{1}{2\left( 1+y^{2}\right) }\; \mathrm{d}y=\dfrac{1}{2}\left[ \arctan y\right] _{y=0}^{\infty }=\dfrac{\pi}{4}.\end{aligned}$$



Another proof, from G.M. Fichtengoltz, Calculus Course, page 612.

$$K=\int_{0}^{\infty} e^{-x^2} dx $$

It easy to see (and prove) that, $\max\{(1+t)e^{-t}\}=1$ at $t=0$, hence for all $t\in\mathbb{R}$:


Substitution of $t=\pm x^2$, leads us to:

$$(1-x^2)e^{x^2}<1 \ \ \ \ \text{and} \ \ \ \ \ (1+x^2)e^{-x^2}<1 $$


$${1-x^2} <e^{-x^2}<\frac{1}{1+x^2} \ \ \ \ \ \ (x>0) $$

Now, at the left inequality we restrict our $x$ to be in $(0,1)$ (so that, $1-x^2>0$), and in the right inequality let $x>0$. Raising all the inequalities with natural number $n$, we get,

$$\underset{x\in (0,1)}{(1-x^2)^n<e^{-nx^2}} \ \ \ \ \text{and} \ \ \ \ \ \underset{x>0}{e^{-nx^2}<\frac{1}{(1+x^2)^n}}$$

Integrating the first inequality from $0$ to $1$, and the second inequality from $0$ to $+\infty$ we’ll get:

$$\int_0^1({1-x^2})^ndx <\int_0^1 e^{-nx^2} dx<\int_0^{\infty} e^{-nx^2} dx<\int_0^{\infty}\frac{dx}{(1+x^2)^n}$$


$$\int_0^{\infty} e^{-nx^2}dx=\frac{1}{\sqrt{n}}K \ \ \ \ \ \ (\text{substitution} \ \ u=\sqrt{nx}),$$

$$\int_0^1({1-x^2})^ndx=\int_0^{\frac{\pi}{2}}\sin^{2n+1}(v)dv=\frac{(2n)!!}{(2n+1)!!} \ \ \ (\text{substitution} \ \ x=\cos(v))$$

and, finally,

$$\int_0^{\infty}\frac{dx}{(1+x^2)^n}=\int_0^{\frac{\pi}{2}}\sin^{2n-2}(v)dv=\frac{(2n-3)!!}{(2n-2)!!}\frac{\pi}{2} \ \ \ (\text{substitution} \ \ x=\text{ctg}(v))$$

Hence, our unknown, $K$ is bound:




Now, the final step – Wallis Formula


Then, when $n$ tends to $\infty$ in our last inequality, we get:



$$K=\frac{\sqrt{\pi}}{2} \ \ \ \ \ \text{as}\ K>0 $$

By using Beta and Gamma functions properties we may simply obtain that:
$$\operatorname B\left(\tfrac 12,\tfrac12\right)=\frac{\left[\Gamma(\tfrac{1}{2})\right]^{2}}{\Gamma{(1)}}=\left[\Gamma(\tfrac{1}{2})\right]^{2}$$
$$\operatorname B\left(\tfrac{1}{2},\tfrac{1}{2}\right)=\frac{\pi}{\sin{\frac{\pi}{2}}}=\pi$$
In other words we have that:
$$\Gamma(\tfrac{1}{2})=\sqrt{\pi}\longrightarrow \space\int\limits_0^\infty x^{\frac{-1}{2}} e^{-x} \,\mathrm dx = \sqrt{\pi}$$

By substitution $x=t^2$ we get the final result:

$$2\int\limits_0^\infty e^{-t^2} \,\mathrm dt=\sqrt{\pi} \longrightarrow \int\limits_0^\infty e^{-t^2} \,\mathrm dt = \frac{\sqrt{\pi}}{2}.$$

Q.E.D. (Chris)

First, we notice that $$n!\ =\ \int_0^\infty e^{-\sqrt[n]x}\ dx\quad\iff\quad\tfrac1n!\ =\ \int_0^\infty e^{-x^n}dx\quad\rightarrow\quad\tfrac12!\ =\ \int_0^\infty e^{-x^2}dx$$ Then we further notice that $$\int_0^1\Big(1-\sqrt[n]x\Big)^m\,dx\ =\ \int_0^1\Big(1-\sqrt[m]x\Big)^n\,dx\ =\ \frac1{C_{m+n}^n}\ =\ \frac1{C_{m+n}^m}\ =\ \frac{m!\,n!}{(m+n)!}$$ From where we deduce that $$\frac\pi4\ =\ \int_0^1\sqrt{1-x^2}\,dx\ =\ \frac{\Big(\frac12!\Big)^2}{\Big(\frac12 + \frac12\Big)!}\ =\ \Big(\tfrac12!\Big)^2$$ Which leads us to conclude that $$\int_0^\infty e^{-x^2}dx\ =\ \tfrac12!\ =\ \sqrt{\pi\over4}\ =\ \frac{\sqrt\pi}2$$ QED

The following argument, similar to Bryan Yock’s, is a Feynman parameter trick I invented in Integrating $\int^{\infty}_0 e^{-x^2}\,dx$ using Feynman's parametrization trick

Let $$I(b) = \int_0^\infty \frac {e^{-x^2}}{1+(x/b)^2} \mathrm d x = \int_0^\infty \frac{e^{-b^2y^2}}{1+y^2} b\,\mathrm dy$$ so that $I(0)=0$, $I'(0)= \pi/2$ and $I(\infty)$ is the thing we want to evaluate.

Now note that rather than differentiating directly, it’s convenient to multiply by some stuff first to save ourselves some trouble. Specifically, note

$$\left(\frac 1 b e^{-b^2}I\right)’ = -2b \int_0^\infty e^{-b^2(1+y^2)} \mathrm d y = -2 e^{-b^2} I(\infty)$$

Then usually at this point we would solve the differential equation for all $b$, and use the known information at the origin to infer the information at infinity. Not so easy here because the indefinite integral of $e^{-x^2}$ isn’t known. But we don’t actually need the solution in between; we only need to relate information at the origin and infinity. Therefore, we can connect these points by simply integrating the equation definitely; applying $\int_0^\infty \mathrm d b$ we obtain

$$-I'(0)= -2 I(\infty)^2 \quad \implies \quad I(\infty) = \frac{\sqrt \pi} 2$$

Another way is to make use of the Poisson summation formula. I will work with the Fourier transform $$\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x) \exp(-2 \pi i \xi x) dx$$ The Poisson summation formula states that $$\sum_{\xi \in \mathbb{Z}} \hat{f}(\xi) = \sum_{n \in \mathbb{Z}} f(n).$$
Now take $f(x) = \exp(-\pi x^2)$. We then get that
\hat{f}(\xi) & = \int_{-\infty}^{\infty} \exp(- \pi x^2) \exp(-2 \pi i \xi x) dx\\
& = \int_{-\infty}^{\infty} \exp(-\pi(x+i \xi)^2 – \pi \xi^2) dx\\
& = \exp( – \pi \xi^2)\int_{-\infty}^{\infty} \exp(-\pi(x+i \xi)^2) dx\\
& = \exp( – \pi \xi^2)\int_{-\infty + ic}^{\infty+ic} \exp(-\pi x^2) dx
By integrating from $-\infty+ic$ to $\infty + ic$, I mean integrate along the line Im$(x) = c$ from left to right. Now since the integrand is analytic, we can move this contour to $X$ axis and conclude that
$$\int_{-\infty + ic}^{\infty+ic} \exp(-\pi x^2) dx = \int_{-\infty}^{\infty} \exp(-\pi x^2) dx$$
Hence, we get that $$\hat{f}(\xi) = C \exp( – \pi \xi^2)$$where $C = \displaystyle \int_{-\infty}^{\infty} \exp(-\pi x^2) dx$. Now make use of the Poisson summation formula to get that
$$C \left(\sum_{\xi \in \mathbb{Z}} \exp(-\pi \xi^2) \right) = \left(\sum_{x \in \mathbb{Z}} \exp(-\pi x^2) \right)$$
We can afford to cancel $\displaystyle \left(\sum_{x \in \mathbb{Z}} \exp(-\pi x^2) \right)$ since it converges and hence we can conclude that $$C = \displaystyle \int_{-\infty}^{\infty} \exp(-\pi x^2) dx = 1$$
Suitable scaling gives you the integral and answer you are looking for.

Change variables. Let $z=x^2$.
We find $\int_{0}^{\infty} e^{-x^2} dx = \frac{1}{2} \Gamma(\frac{1}{2}) = \frac{\sqrt{\pi}}{2}$.

Setting $z=1/2$ in Euler’s reflection formula,
$\Gamma(1-z)\Gamma(z) = \pi/\sin \pi z$,
we find $\Gamma(1/2) = \sqrt{\pi}$.

Here you have a solution using Wallis’ formula for $\pi$ and the squeeze theorem which I learned. It’s from a post I made in a forum.

Consider the mapping $\eta\! : \mathbb{R}^2\to \mathbb{R}$ given by
\eta((x,y)) = \sqrt{x^2+y^2},\quad (x,y)\in\mathbb{R}^2.
(1) Show that the image-measure $\lambda_2\circ\eta^{-1}$ is the measure on $(\mathbb{R},\mathcal{B}(\mathbb{R}))$ with density
f(z)=2\pi z 1_{(0,\infty)}(z),\quad z\in\mathbb{R},
by using Dynkin’s Lemma.

(2) Show that
\int_{\mathbb{R}^2} e^{-x^2-y^2}\,\lambda_2(\mathrm{d}x,\mathrm{d}y)=\pi
by using the formula for integration under measurable transformations.

(3) Use Tonelli’s theorem to conclude that
and now your result follows.

Using Normal density:

\int_0^\infty e^{-x^2}dx=\sqrt \pi \int_0^\infty \frac{1}{\sqrt \pi}e^{-x^2}dx=\sqrt \pi P(X\geq0),

where $X\sim \mathrm{Normal}(0,\frac{1}{2})$. Remember that the normal distribution is symmetric around its mean, so $P(X>0)=P(X>E(X))=\frac{1}{2}$, and the result follows.

Consider the integral:
\int_0^\infty t^{-1/2}{e^{-t}} dt
We perform a change of variables $u=t^{1/2}$ and $du= \frac{1}{2}t^{-1/2} dt$.
The integral then becomes:
\int_0^\infty t^{-1/2}{e^{-t}} dt=\int_0^\infty 2{e^{-u^2}} du.
Now let us consider the well-known integral:
\frac{\pi}{2}=\int_0^\infty \frac{1}{1+x^2} dx
We can expand the right hand side into a double integral:
\int_0^\infty \frac{1}{1+x^2} dx= \int_0^\infty \int_0^\infty e^{-y(1+x^2)}dy dx=\int_0^\infty \int_0^\infty e^{-y-yx^2}dy dx
Reversing the order of integration:
\int_0^\infty \int_0^\infty e^{-y-yx^2}dy dx=\int_0^\infty \int_0^\infty e^{-y-yx^2}dx dy
Now, we can perform a change of variables $x^2=\frac{u^2}{y}$ and $2xdx=\frac{2u}{y}du$ or $dx=y^{-1/2}du$
\int_0^\infty \int_0^\infty e^{-y-yx^2}dx dy=\int_0^\infty \int_0^\infty y^{-1/2} e^{-y-u^2}du dy= \int_0^\infty y^{-1/2} e^{-y} dy\int_0^\infty e^{-u^2}du
Because of what was established earlier:
$$\int_0^\infty y^{-1/2}{e^{-y}} dy=\int_0^\infty 2{e^{-u^2}} du $$

\frac{\pi}{2}=\int_0^\infty \frac{1}{1+x^2} dx= 2 \left(\int_0^\infty {e^{-u^2}} du\right)^2
\frac{\pi}{4}=\left(\int_0^\infty {e^{-u^2}} du\right)^2
The desired result follows upon taking the square root of both sides.


  • The integral considered at the start of the solution is $\Gamma \left(\frac{1}{2} \right).$
  • We essentially evaluated $$\int_{0}^{\infty} \frac{1}{1+x^2} \ dx$$ in two different ways; we know the closed form recognizing it is an arctangent integral, but the crux of the proof is to show it is the same as $\frac{\Gamma(\frac{1}{2})^2}{2}.$ This same arctangent integral appears in proofs 2,3, and 4 of
  • Tonelli’s Theorem enables us to reverse the order of integration in the expanded double integral. See

This is similar to user17762’s answer, but uses Plancherel’s Theorem instead of Poisson summation. Define the Fourier transform by

$$\mathcal{F}[f](y) = \hat{f}(y) = \frac{1}{\sqrt{2\pi}}\int_{-\infty}^\infty f(x) e^{-i xy}\;dx$$


$$\mathcal{F}[e^{-\frac{1}{2}x^2}]= \frac{1}{\sqrt{2\pi}}\int_{-\infty}^\infty e^{\frac{1}{2}x^2} e^{-i xy}\;dx = \frac{e^{-\frac{1}{2}y^2}}{\sqrt{2\pi}}\int_{-\infty}^\infty e^{\frac{1}{2}(x+iy)^2}\;dx$$

Now, consider the contour integral of $e^{-\frac{1}{2}z^2}$ over the rectangular contour with corners at $\pm R$ and $\pm R + iy$. This integral must be $0$, since $e^{-\frac{1}{2}z^2}$ is analytic. Taking the limits as $R \to +\infty$, the contributions from the vertical edges go to $0$, so we find that
$$\int_{-\infty}^\infty e^{-\frac{1}{2}x^2}\;dx = \int_{-\infty}^\infty e^{-\frac{1}{2}(x+iy)^2}\;dx$$

$$\mathcal{F}[e^{-\frac{1}{2}x^2}](y) = \frac{e^{-\frac{1}{2}y^2}}{\sqrt{2\pi}}\int_{-\infty}^\infty e^{-\frac{1}{2}x^2}\;dx$$

By Plancherel’s Theorem,
$$\int_{-\infty}^\infty e^{x^2}\;dx = \int_{-\infty}^\infty e^{-y^2} \frac{1}{2\pi}\left(\int_{-\infty}^\infty e^{-\frac{1}{2}x^2}\;dx\right)^2\;dy = \frac{1}{2\pi}\left(\int_{-\infty}^\infty e^{-\frac{1}{2}x^2}\;dx\right)^2\int_{-\infty}^\infty e^{-y^2}\;dy$$
dividing through by $\int_{-\infty}^\infty e^{-x^2}\;dx$, we find
$$1 = \frac{1}{2\pi}\left(\int_{-\infty}^\infty e^{-\frac{1}{2}x^2}\;dx\right)^2$$
$$\sqrt{2\pi} = \int_{-\infty}^\infty e^{-\frac{1}{2}x^2}\;dx$$
Changing variables and observing that $\int_0^\infty e^{-x^2}\;dx = \frac{1}{2}\int_{-\infty}^\infty e^{-x^2}\;dx$, we find that
$$\int_0^\infty e^{-x^2}\;dx = \frac{\sqrt{\pi}}{2}$$

I will add an additional Solution to this problem because it is using a powerful integral that Euler derived in one of his famous books about complex analysis (Euler’s derivation).

$$\frac{\Gamma(s)}{n(a^2+b^2)^{s/2}}\cos(\alpha s)=\int_0^{\infty}u^{ns-1}e^{-au^n}\cos(bu^n) du$$, where $\tan(\alpha)=b/a$.

Plug in $a=1$, $b=0$ ($\alpha =0$),$n=2$ and $s=1/2$ to get:


Evaluate Eulers reflection formula $\Gamma(s)\Gamma(1-s)=\frac{\pi}{\sin(\pi s)}$ for $s=1/2$ to get $\Gamma(1/2)=\sqrt{\pi}$.

With that we conclude:

  1. Note that there is a similar formula, containing $\sin$ instead of $\cos$. Both formulas can be used for many special integrals like the Fresnel Integral or the Sinc Integral and much more.

  2. Note that one could directly derive this result from $\Gamma(1/2)$ by substitution, but the formula is far more powerful.

Long time ago in a galaxy far far away … Ouch, not so far, it was at some shopping centre in Prague, I stumbled upon a question wheather is the integral above derivable in sense of elementary (in some sense) functions to obtain. I claim no originality, but this is what I get :

Let us denote our integral $I$, via substitution $x=\sqrt{-\ln y}$ we have :

$$I=\int_{-\infty}^{\infty}e^{-x^2}\mathrm{d}x=2\int_{0}^{\infty}e^{-x^2}\mathrm{d}x=\int_{0}^{1}\frac{1}{\sqrt{-\ln y}}\,\mathrm{d}y$$

Step back for a second and dream about another meaning of definite integration – namely area under the curve, the area under curve can be approximated by rectangles, if we divide it so that maximum widht goes to zero the sum in the limit goes to original integral – let us choose clever division, namely geometrical sequence $\{y=q^n\}$ with maximal widht equal to the width of ist first rectangle (ergo $1-q$) :

Riemannian summation over geometrical sequence domain division

Clearly from the picture above (note : could be generalised) :

$$S_n = \left(q^{n-1}-q^n\right)f(q^n) = q^{n-1}\frac{1-q}{\sqrt{-n\ln q}}$$

Then by riemannian summation on geometrical sequence domain division :

$$\int_{0}^{1}\frac{1}{\sqrt{-\ln y}}\,\mathrm{d}y=\lim_{\; q\to 1^-}\sum_{n=1}^{\infty}S_n=\lim_{\; q\to 1^-}\frac{1-q}{\sqrt{-\ln q}}\sum_{n=1}^{\infty}\frac{q^n}{\sqrt{n}}$$

Hence (with some estetics by limit of a product) :

$$ I = \lim_{\; q\to 1^-}\sqrt{1-q}\,\sum_{n=1}^{\infty}\frac{q^n}{\sqrt{n}}$$

So, if we are able to manage deriving exact value of this limiting summation, we are done, however, there does not exist an exact sum in terms of elementary functions, the sloppiness of the sequence $1/\sqrt{n}$ is slowing our progress. But, if we find a sequence not so different maybe it will clear out itself! The key is : keep it as simple as possible :

I shall start, with this observation at – the method describes an assymptotical finding of the values of definite integrals and is very common and useful in some application, I will use similar technique to find such sequence decribed earlier, in all discussion however, I will pretend, if $I$ pops up somewhere, that we don’t know it yet, let’s see …

$$\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}\cos^n\!\theta\, \mathrm{d}\theta
=\frac{1}{\sqrt n}\int_{-\frac{\pi}{2}\sqrt n}^{\frac{\pi}{2}\sqrt n}\cos^n\!\frac{\theta}{\sqrt n} \, \mathrm{d}\theta
=\frac{1}{\sqrt n} \int_{-\frac{\pi}{2}\sqrt n}^{\frac{\pi}{2}\sqrt n}\left(1-\frac{\theta^2}{2n}+O\left(\frac{1}{n^2} \right)\right)^n \, \mathrm{d}\theta
\\ =\frac{1}{\sqrt n}\left(
\int_{-\infty}^{\infty}e^{-\frac{\theta^2}{2}} \, \mathrm{d}\theta + O\left(\frac{1}{n}\right)\right) = I\sqrt{\frac{2}{n}} + O\left(\frac{1}{n^{3/2}}\right)$$

We are now fully prepared to attack the integral from the side, pluggin in the result above, ie. interchange the $1/\sqrt n$ term by integral fo $n$ large :

$$I^2 = \frac{1}{\sqrt 2} \lim_{\; q\to 1^-}\sqrt{1-q}\,\sum_{n=1}^{\infty}\left( O\left(\frac{q^n}{n^{3/2}}\right) + \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}}q^n\cos^n\!\theta\, \mathrm{d}\theta\right) $$

The first term in the sum converges for $q\to 1$, so the multiplication with $\sqrt{1-q}$ kills this terms out (!!!), we don’t have at all worry about its values any more, hence, the limit is simply (after summing infinite convergent $\left(|q \cos\theta| <1\right)$ geometric series) :

$$I^2 = \frac{1}{\sqrt 2} \lim_{\; q\to 1^-}\sqrt{1-q}\,\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{q \cos\theta}{1-q\cos\theta}\, \mathrm{d}\theta \qquad (*)$$

One can easily compute it him/herself, of course, but for sake of completeness I will do it here : At first simplify the fraction (where at the last step $\theta \to \theta – \pi/2$ substitution has been made) :

$$\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{q\cos\theta}{1-q\cos\theta}\, \mathrm{d}\theta = \int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{1-1+q\cos\theta}{1-q\cos\theta}\, \mathrm{d}\theta = -\pi\! +\!\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{\mathrm{d}\theta}{1-q\cos\theta} = -\pi\! +\!\int_{0}^{\pi}\! \frac{\mathrm{d}\theta}{1-q\sin\theta} $$

Via the same argument as in the vanishment of $O(1/n^{3/2})$ we disregard also $-\pi$ (Important note : this is equivalent to say we are summing the terms from $n=0$, since we can add finite number of terms, results stays the same). Using standard $t = \tan(\theta/2)$ substitution we can exactly compute the integral we have been left with :

$$\int_{0}^{\pi} \frac{\mathrm{d}\theta}{1-q\sin\theta} = \int_{0}^{\infty} \frac{\frac{2\mathrm{d}t}{1+t^2}}{1-q\frac{2t}{1+t^2}} = 2\int_{0}^{\infty} \frac{\mathrm{d}t}{t^2-2qt+1} = 2\int_{0}^{\infty} \frac{\mathrm{d}t}{(t-q)^2+1-q^2} =\\
\frac{2}{\sqrt{1-q^2}}\arctan\frac{t-q}{\sqrt{1-q^2}}\bigg{|}_0^\infty = \frac{2}{\sqrt{1-q^2}}\left(\frac{\pi}{2}+\arctan\frac{q}{\sqrt{1-q^2}}\right) $$

Throwing the result back into $(*)$ we get the great return :

$$I^2 = \frac{1}{\sqrt 2} \lim_{\; q\to 1^-}\frac{2\sqrt{1-q}}{\sqrt{1-q^2}}\left(\frac{\pi}{2}+\arctan\frac{q}{\sqrt{1-q^2}}\right) = \pi $$


$$\int_{-\infty}^{\infty}e^{-x^2}\mathrm{d}x = \sqrt{\pi}$$

Addendum :
About two months after this text had been written I have come up with another choice to be made to assymptotically converge towards $1/\sqrt{n}$ sequence, namely

\!=\!\frac{1}{\sqrt n}\int_{-\sqrt n}^{\sqrt n}\left(1-\frac{x^2}{n}\right)^n\!\mathrm{d}x\!=\!\frac{1}{\sqrt n}\left(

So then (where the summation in the last term was changed as counting from $n=0$)

$$I^2\!=\!\lim_{\; q\to 1^-}\!\sqrt{1-q}\,\sum_{n=1}^{\infty}\left( O\left(\!\frac{q^n}{n^{3/2}}\!\right)\!+\!\int_{-1}^{1}q^n\left(1\!-\!x^2\right)^n\, \mathrm{d}x\right)\!=\!\lim_{\; q\to 1^-}\sqrt{1-q}\int_{-1}^{1} \frac{\mathrm{d}x}{1\!-\!q(1\!-\!x^2)}$$

And this is just a piece of cake ! So :

$$I^2=\lim_{\; q\to 1^-} \frac{2\sqrt{1-q}}{\sqrt{q}\sqrt{1-q}}\arctan{\sqrt{\frac{q}{1-q}}}=\pi$$

Moreover, there is even another
\!=\!\frac{1}{\sqrt n}\left(

$$I^2\!=\!\lim_{\; q\to 1^-}\!\sqrt{1-q}\,\sum_{n=1}^{\infty}\left( O\left(\!\frac{q^n}{n^{3/2}}\!\right)\!+\!\int_{-\infty}^{\infty}\frac{q^n}{\left(1\!+\!x^2\right)^n}\, \mathrm{d}x\right)\!=\!\lim_{\; q\to 1^-}\sqrt{1-q}\int_{-\infty}^{\infty} \frac{q\,\mathrm{d}x}{1\!-\!q\!+\!x^2}$$

This integral arisen is the simplest of all of them, since

$$\int_{-\infty}^{\infty} \frac{\mathrm{d}x}{1\!-\!q\!+\!x^2}=\frac{\pi}{\sqrt{1-q}}$$

The result is now obvious…

Little bonus : from the steps throughout the text we can also conclude that
$$\sum_{n=1}^{\infty}\frac{x^n}{\sqrt n}\sim\sqrt{\frac{\pi}{1-x}}\qquad \mathrm{as}\qquad x\rightarrow 1$$
an assymptote for the series.

Note : I’m really curious about knowing whether one can resolve also the Basel problem this way (i.e. summing $\sum_{n=1}^{\infty}\frac{1}{n^2}$)

No entender mucho el idioma pero aqui dejo mi solucion en una imagen didactica. enter image description here