Integral of Gaussian function, for squared x

Click For Summary

Homework Help Overview

The discussion revolves around computing an integral related to the expected value formula using a Gaussian probability density function (PDF). The integral in question is \(\int_{-\infty}^{\infty} (x)^2 p(x) dx\), where \(p(x)\) is defined as \(\frac{1}{\sigma \sqrt{2 \pi}} \exp\left(-\frac{x^2}{2 \sigma^2}\right)\). Participants are exploring the implications of this integral for even and odd powers of \(x\).

Discussion Character

  • Exploratory, Mathematical reasoning, Assumption checking

Approaches and Questions Raised

  • Participants discuss various methods for evaluating the integral, including using known equations from Wikipedia related to Gaussian functions and exponential functions. Some express uncertainty about removing parts of the PDF from the integral and changing limits. Others suggest using integration by parts or changing variables to simplify the computation.

Discussion Status

There is an ongoing exploration of different approaches to solve the integral, with some participants sharing their attempts and calculations. While some guidance has been offered regarding methods, there is no explicit consensus on the correct approach or final answer yet.

Contextual Notes

Participants are working under the assumption that the integral should yield the variance of the distribution, and there is discussion about the implications of using different values for \(\sigma\). Some participants note potential errors in their calculations and seek clarification on the assumptions made in the problem setup.

Avinto
Messages
3
Reaction score
0

Homework Statement


I am trying to compute an integral, as part of the expected value formula (using a Gaussian PDF)

\int_{-∞}^{∞} (x)^2 p(x) dx

Where p(x) is the Gaussian probability density function:
\frac{1}{\sigma \sqrt(2 \pi)} \exp(\frac{-x^2}{2 \sigma^2})

My aim after this is to be able to compute for all even x^n in the above formula. For all odd x^n, the positive and negative componets cancel out, with an computation of zero for all odd functions.


Homework Equations


Wikipedia lists two equations that relate to this:
[1]https://en.wikipedia.org/wiki/List_of_integrals_of_Gaussian_functions

[1]
\int_{-∞}^{∞} (x)^2 \phi(x)^n dx = \frac{1}{\sqrt(n^3 (2 \pi)^{n-1})}

and
[2]https://en.wikipedia.org/wiki/List_of_integrals_of_exponential_functions

[2]
The range here is zero to infinity, however as this function is even, the result for minus infinity to infinity should be twice what the below computes.
\int_{0}^{∞} (x)^n \exp(-\alpha x^2) dx= \frac{(2 k -1)!}{2^{k+1} \alpha^k} \sqrt(\frac{\pi}{\alpha})
Where
n=2 k, k integer, \alpha > 0

The Attempt at a Solution


Using [1], I can compute a answer equalling 1, which is apparently the right answer. However when using [2] (where k=1), I compute a different anwser:

Compute:
Let \alpha = \frac{1}{2 \sigma^2}
and
k=1

then:
\int_{0}^{∞} (x)^2 \exp(-\alpha x^2) dx = \frac{(2 k -1)!}{2^{k+1} \alpha^k} \sqrt(\frac{\pi}{\alpha})

=\frac{1!}{4 \alpha}\sqrt(\frac{\pi}{\alpha})

=\frac{\sigma^2}{2}\sqrt(2 \sigma^2 \pi)

=\frac{\sigma^2}{2} \sigma \sqrt(2 \pi)

=\frac{\sigma^3 \sqrt(2 \pi)}{2}

Now, this is where I think I messed up. I previously removed
\frac{1}{\sigma \sqrt(2 \pi)}
from inside the integral, and attempted to multiply it by the obtained result (and then doubled everything, as it is an even function)

2 \frac{1}{\sigma \sqrt(2 \pi)} \frac{\sigma^3 \sqrt(2 \pi)}{2}

Then by cancelling:
=\sigma

I'm thinking this is because I took part of the PDF out of the integral, and then changed the limits. However, I'm not sure how to go about working this out while leaving it in there.

I will keep browsing around for a solution to this problem (and the more general x^n), and would really appreciate any hints on this.

Thanks.
 
Physics news on Phys.org
Avinto said:

Homework Statement


I am trying to compute an integral, as part of the expected value formula (using a Gaussian PDF)

\int_{-∞}^{∞} (x)^2 p(x) dx

Where p(x) is the Gaussian probability density function:
\frac{1}{\sigma \sqrt(2 \pi)} \exp(\frac{-x^2}{2 \sigma^2})

My aim after this is to be able to compute for all even x^n in the above formula. For all odd x^n, the positive and negative componets cancel out, with an computation of zero for all odd functions.


Homework Equations


Wikipedia lists two equations that relate to this:
[1]https://en.wikipedia.org/wiki/List_of_integrals_of_Gaussian_functions

[1]
\int_{-∞}^{∞} (x)^2 \phi(x)^n dx = \frac{1}{\sqrt(n^3 (2 \pi)^{n-1})}

and
[2]https://en.wikipedia.org/wiki/List_of_integrals_of_exponential_functions

[2]
The range here is zero to infinity, however as this function is even, the result for minus infinity to infinity should be twice what the below computes.
\int_{0}^{∞} (x)^n \exp(-\alpha x^2) dx= \frac{(2 k -1)!}{2^{k+1} \alpha^k} \sqrt(\frac{\pi}{\alpha})
Where
n=2 k, k integer, \alpha > 0

The Attempt at a Solution


Using [1], I can compute a answer equalling 1, which is apparently the right answer. However when using [2] (where k=1), I compute a different anwser:

Compute:
Let \alpha = \frac{1}{2 \sigma^2}
and
k=1

then:
\int_{0}^{∞} (x)^2 \exp(-\alpha x^2) dx = \frac{(2 k -1)!}{2^{k+1} \alpha^k} \sqrt(\frac{\pi}{\alpha})

=\frac{1!}{4 \alpha}\sqrt(\frac{\pi}{\alpha})

=\frac{\sigma^2}{2}\sqrt(2 \sigma^2 \pi)

=\frac{\sigma^2}{2} \sigma \sqrt(2 \pi)

=\frac{\sigma^3 \sqrt(2 \pi)}{2}

Now, this is where I think I messed up. I previously removed
\frac{1}{\sigma \sqrt(2 \pi)}
from inside the integral, and attempted to multiply it by the obtained result (and then doubled everything, as it is an even function)

2 \frac{1}{\sigma \sqrt(2 \pi)} \frac{\sigma^3 \sqrt(2 \pi)}{2}

Then by cancelling:
=\sigma

I'm thinking this is because I took part of the PDF out of the integral, and then changed the limits. However, I'm not sure how to go about working this out while leaving it in there.

I will keep browsing around for a solution to this problem (and the more general x^n), and would really appreciate any hints on this.

Thanks.

First get
I_n = \int_0^{\infty} x^n \phi(x) \, dx, \:\: \phi(x) = <br /> \frac{1}{\sqrt{2 \pi}} e^{-x^2/2},
then obtain the general result by re-scaling the variable. Note that ##x \phi(x) \, dx = d(-\phi(x))## so we can use integration by parts:
\int x^n \phi(x) \, dx = \int u dv,\\<br /> u = x^{n-1}, \: dv = x \phi(x) \, dx = d(-\phi(x))
 
Alternatively, change variables to ##t = x^2## and use the definition of the Gamma function.
 
Thank you for your suggestions.

Ray, I will attempt to work it out using your way later today, and see how it goes.

Orodruin, I have had a go at your method, but have not had much luck.

t = x^2

\Gamma(z) = \int_0^{∞} t^{z-1} exp(-t) dt

\Gamma(3) = \int_0^{∞} t^{3-1} \exp(-t) dt

\Gamma(3) = (3-1)! = 2

Then for the range {-∞,0}, this answer should be the same, so I get an answer of 4 overall.I'm working under the assumption that the answer should be 1
 
Last edited:
Well, the answer cannot be 1. It should be the variance of the distribution (since the expectation value is zero). In fact, you had it (almost) right in your first post... Also note that in the substitution, z is not 3. If you do it correctly, z should have a half-integer value (which is why you end up with a semi-factorial and 2^(k+1)).

Edit: Well, of course the answer would be one if the variance is ... :)
 
Orodruin said:
Well, the answer cannot be 1. It should be the variance of the distribution (since the expectation value is zero). In fact, you had it (almost) right in your first post... Also note that in the substitution, z is not 3. If you do it correctly, z should have a half-integer value (which is why you end up with a semi-factorial and 2^(k+1)).

Edit: Well, of course the answer would be one if the variance is ... :)

Ok, I see what you mean about the variance, the definition of \phi on the wiki page assumes \sigma=1. Using \sigma=1, my calculation did evaluate to one, which is where I must have gotten that assumption from.

I redid my calculations with including \sigma, and realized I made a silly error in my cancellation.
2 \frac{1}{\sigma \sqrt(2 \pi)} \frac{\sigma^3 \sqrt(2 \pi)}{2}

Should evaluate to \sigma^2, not \sigma.

I will look more into the Gamma function as well, and try to understand it from that direction. Thanks
 

Similar threads

  • · Replies 14 ·
Replies
14
Views
2K
Replies
4
Views
2K
  • · Replies 47 ·
2
Replies
47
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
4
Views
3K
  • · Replies 105 ·
4
Replies
105
Views
10K
  • · Replies 11 ·
Replies
11
Views
3K