# Math Help - Help evaluating an integral

1. ## Help evaluating an integral

I want to integrate:
p^2

Are there any shortcuts I can use?

2. Is that

$\int_0^\infty \frac{2}{\lambda}x^2e^\frac{-x^2}{\lambda}\: dx$ ?

3. Originally Posted by Bruno J.
Is that

$\int_0^\infty \frac{2}{\lambda}x^2e^\frac{-x^2}{\lambda}\: dx$ ?
If that is the integral, we know that the variance of $\mathcal{N}\left(0,\sigma^2\right)\sim\mathcal{N}\ left(0,\tfrac{\lambda}{2}\right)$ is defined to be $\frac{1}{\sqrt{\lambda\pi}}\int_{-\infty}^{\infty}x^2e^{-x^2/\lambda}\,dx=\frac{\lambda}{2}$

So $\frac{2}{\lambda}\int_0^{\infty}x^2e^{-x^2/\lambda}\,dx=\frac{1}{\lambda}\int_{-\infty}^{\infty}x^2e^{-x^2/\lambda}\,dx$ $=\frac{\sqrt{\lambda\pi}}{\lambda}\int_{-\infty}^{\infty}\frac{1}{\sqrt{\lambda\pi}}x^2e^{-x^2/\lambda}\,dx=\frac{\sqrt{\lambda\pi}}{\lambda}\cdo t\frac{\lambda}{2}=\frac{\sqrt{\lambda\pi}}{2}$

EDIT: Here's another way. (Probably the way that most people would take...when I saw it originally, I thought Variance of the Normal Distribution... )

Let $u=\frac{1}{\lambda}x^2$. Then $\,du=\frac{2x}{\lambda}\,dx$

So $\frac{2}{\lambda}\int_0^{\infty}x^2e^{-x^2/\lambda}\,dx\xrightarrow{u=x^2/\lambda}{}\int_0^{\infty}\sqrt{\lambda u}e^{-u}\,du$ $=\sqrt{\lambda}\int_0^{\infty}u^{\frac{1}{2}}e^{-u}\,du=\sqrt{\lambda}\Gamma\left(\tfrac{3}{2}\righ t)=\sqrt{\lambda}\left(\tfrac{1}{2}\Gamma\left(\tf rac{1}{2}\right)\right)=\sqrt{\lambda}\left(\frac{ \sqrt{\pi}}{2}\right)=\frac{\sqrt{\lambda\pi}}{2}$

(Aside)

Spoiler:
To show that $\Gamma\left(\tfrac{1}{2}\right)=\sqrt{\pi}$, note that $\Gamma\left(\tfrac{1}{2}\right)=\int_0^{\infty}e^{-t}t^{-\frac{1}{2}}\,dt$.

Let $t=u^2\implies \,dt=2u\,du$.

Thus, $\int_0^{\infty}e^{-t}t^{-\frac{1}{2}}\,dt\xrightarrow{t=u^2}{}\int_0^{\inft y}e^{-u^2}u^{-1}\left(2u\right)\,du=2\int_0^{\infty}e^{-u^2}\,du=2\left(\frac{\sqrt{\pi}}{2}\right)=\sqrt{ \pi}$.

Spoiler:
To show that $\int_0^{\infty}e^{-ax^2}=\frac{1}{2}\sqrt{\frac{\pi}{a}}$, suppose that $I=\int_0^{\infty}e^{-ax^2}\,dx=\int_0^{\infty}e^{-ay^2}\,dy$.

Thus, $I^2=\left(\int_0^{\infty}e^{-ax^2}\,dx\right)\left(\int_0^{\infty}e^{-ay^2}\,dy\right)=\int_0^{\infty}\int_0^{\infty}e^{-a\left(x^2+y^2\right)}\,dx\,dy$.

Now convert to polar to get $\int_0^{\infty}\int_0^{\infty}e^{-a\left(x^2+y^2\right)}\,dx\,dy=\int_0^{\frac{\pi}{ 2}}\int_0^{\infty}e^{-ar^2}r\,dr\,d\theta$.

Now from here, let $u=ar^2\implies \,du=2ar\,dr$

So $\int_0^{\frac{\pi}{2}}\int_0^{\infty}e^{-ar^2}r\,dr\,d\theta\xrightarrow{u=ar^2}\frac{1}{2a }\int_0^{\frac{\pi}{2}}\int_0^{\infty}e^{-u}\,du\,d\theta=\frac{1}{2a}\int_0^{\frac{\pi}{2}} \lim_{b\to\infty}\left.\left[-e^{-u}\right]\right|_0^b\,d\theta$ $=\frac{1}{2a}\int_0^{\frac{\pi}{2}}\,d\theta=\frac {\pi}{4a}$.

Since $I^2=\frac{\pi}{4a}$, it follows that $I=\int_0^{\infty}e^{-ax^2}\,dx=\frac{1}{2}\sqrt{\frac{\pi}{a}}$.

4. Originally Posted by Chris L T521
If that is the integral, we know that the variance of $\mathcal{N}\left(0,\sigma^2\right)\sim\mathcal{N}\ left(0,\tfrac{\lambda}{2}\right)$ is defined to be $\frac{1}{\sqrt{\lambda\pi}}\int_{-\infty}^{\infty}x^2e^{-x^2/\lambda}\,dx=\frac{\lambda}{2}$

So $\frac{2}{\lambda}\int_0^{\infty}x^2e^{-x^2/\lambda}\,dx=\frac{1}{\lambda}\int_{-\infty}^{\infty}x^2e^{-x^2/\lambda}\,dx$ $=\frac{\sqrt{\lambda\pi}}{\lambda}\int_{-\infty}^{\infty}\frac{1}{\sqrt{\lambda\pi}}x^2e^{-x^2/\lambda}\,dx=\frac{\sqrt{\lambda\pi}}{\lambda}\cdo t\frac{\lambda}{2}=\frac{\sqrt{\lambda\pi}}{2}$

EDIT: Here's another way. (Probably the way that most people would take...when I saw it originally, I thought Variance of the Normal Distribution... )

Let $u=\frac{1}{\lambda}x^2$. Then $\,du=\frac{2x}{\lambda}\,dx$

So $\frac{2}{\lambda}\int_0^{\infty}x^2e^{-x^2/\lambda}\,dx\xrightarrow{u=x^2/\lambda}{}\int_0^{\infty}\sqrt{\lambda u}e^{-u}\,du$ $=\sqrt{\lambda}\int_0^{\infty}u^{\frac{1}{2}}e^{-u}\,du=\sqrt{\lambda}\Gamma\left(\tfrac{3}{2}\righ t)=\sqrt{\lambda}\left(\tfrac{1}{2}\Gamma\left(\tf rac{1}{2}\right)\right)=\sqrt{\lambda}\left(\frac{ \sqrt{\pi}}{2}\right)=\frac{\sqrt{\lambda\pi}}{2}$

(Aside)

Spoiler:
To show that $\Gamma\left(\tfrac{1}{2}\right)=\sqrt{\pi}$, note that $\Gamma\left(\tfrac{1}{2}\right)=\int_0^{\infty}e^{-t}t^{-\frac{1}{2}}\,dt$.

Let $t=u^2\implies \,dt=2u\,du$.

Thus, $\int_0^{\infty}e^{-t}t^{-\frac{1}{2}}\,dt\xrightarrow{t=u^2}{}\int_0^{\inft y}e^{-u^2}u^{-1}\left(2u\right)\,du=2\int_0^{\infty}e^{-u^2}\,du=2\left(\frac{\sqrt{\pi}}{2}\right)=\sqrt{ \pi}$.

Spoiler:
To show that $\int_0^{\infty}e^{-ax^2}=\frac{1}{2}\sqrt{\frac{\pi}{a}}$, suppose that $I=\int_0^{\infty}e^{-ax^2}\,dx=\int_0^{\infty}e^{-ay^2}\,dy$.

Thus, $I^2=\left(\int_0^{\infty}e^{-ax^2}\,dx\right)\left(\int_0^{\infty}e^{-ay^2}\,dy\right)=\int_0^{\infty}\int_0^{\infty}e^{-a\left(x^2+y^2\right)}\,dx\,dy$.

Now convert to polar to get $\int_0^{\infty}\int_0^{\infty}e^{-a\left(x^2+y^2\right)}\,dx\,dy=\int_0^{\frac{\pi}{ 2}}\int_0^{\infty}e^{-ar^2}r\,dr\,d\theta$.

Now from here, let $u=ar^2\implies \,du=2ar\,dr$

So $\int_0^{\frac{\pi}{2}}\int_0^{\infty}e^{-ar^2}r\,dr\,d\theta\xrightarrow{u=ar^2}\frac{1}{2a }\int_0^{\frac{\pi}{2}}\int_0^{\infty}e^{-u}\,du\,d\theta=\frac{1}{2a}\int_0^{\frac{\pi}{2}} \lim_{b\to\infty}\left.\left[-e^{-u}\right]\right|_0^b\,d\theta$ $=\frac{1}{2a}\int_0^{\frac{\pi}{2}}\,d\theta=\frac {\pi}{4a}$.

Since $I^2=\frac{\pi}{4a}$, it follows that $I=\int_0^{\infty}e^{-ax^2}\,dx=\frac{1}{2}\sqrt{\frac{\pi}{a}}$.
Thank you so much. The variance method is so clever, saves a lot of time!

5. Also, how could you tell what the variance was? Could you explain to me how I'd be able to tell the variance of this?

$\int_0^\infty \frac{2}{\lambda}xe^\frac{-x^2}{\lambda}\: dx$

thank you

6. Originally Posted by bluebiro
Also, how could you tell what the variance was? Could you explain to me how I'd be able to tell the variance of this?

$\int_0^\infty \frac{2}{\lambda}xe^\frac{-x^2}{\lambda}\: dx$

thank you
The pdf of $\mathcal{N}(0,\sigma^2)$, where $\sigma^2$ is the variance, is :

$\frac{1}{\sigma\sqrt{2\pi}} \cdot\exp\left(-\frac{x^2}{2\sigma^2}\right)$

Now, you can see that this looks like $e^{-\frac{x^2}{\lambda}}$ (if we let $\sigma^2=\frac \lambda 2$)

Then, we have an integral in the form $\int_{-\infty}^\infty x^2 f(x) ~dx$

which is $\mathbb{E}(X^2)$, where X has the pdf f.

And since its expectation is 0, it corresponds to the variance $\text{Var}(X)=\mathbb{E}(X^2)-(\mathbb{E} X)^2=\mathbb{E}(X^2)$

the one you've just put is more like an expectation than a variance, because it's x, not x².

when I saw it originally, I thought Variance of the Normal Distribution...
That's normal I bet he took it from a probability problem.

7. Originally Posted by Moo
The pdf of $\mathcal{N}(0,\sigma^2)$, where $\sigma^2$ is the variance, is :

$\frac{1}{\sigma\sqrt{2\pi}} \cdot\exp\left(-\frac{x^2}{2\sigma^2}\right)$

Now, you can see that this looks like $e^{-\frac{x^2}{\lambda}}$ (if we let $\sigma^2=\frac \lambda 2$)

Then, we have an integral in the form $\int_{-\infty}^\infty x^2 f(x) ~dx$

which is $\mathbb{E}(X^2)$, where X has the pdf f.

And since its expectation is 0, it corresponds to the variance $\text{Var}(X)=\mathbb{E}(X^2)-(\mathbb{E} X)^2=\mathbb{E}(X^2)$

the one you've just put is more like an expectation than a variance, because it's x, not x².

That's normal I bet he took it from a probability problem.
thanks I did get it from a stats problem

I got the integral as lambda, and therefore the variance would be lambda?

Something I don't understand though is why E(X) = 0, and not the integral of x.f(x)?

8. Originally Posted by bluebiro
thanks I did get it from a stats problem

I got the integral as lambda, and therefore the variance would be lambda?

Something I don't understand though is why E(X) = 0, and not the integral of x.f(x)?
They're both the same. Since the distribution for $X$ is $\mathcal{N}\left({\color{red}0},\tfrac{\lambda}{2} \right)$, we know its pdf is of the form $f\left(x\right)=\frac{1}{\sqrt{\lambda\pi}}e^{-x^2/\lambda}$. Now, it follows that $E\left(X\right)=\frac{1}{\sqrt{\lambda\pi}}\int_{-\infty}^{\infty}xe^{-x^2/\lambda}\,dx=\mu={\color{red}0}$, since $\mu$ was known when we defined the distribution.

So $\frac{2}{\lambda}\int_0^{\infty}xe^{-x^2/\lambda}\,dx=\frac{\sqrt{\lambda\pi}}{\lambda}\int _{-\infty}^{\infty}\frac{1}{\sqrt{\lambda\pi}}xe^{-x^2/\lambda}\,dx=\frac{\sqrt{\lambda\pi}}{\lambda}\cdo t{\color{red}0}={\color{red}0}$