Tutorials › Measure Theory › Gaussian Moments and Their Recurrence

Applications of Fubini: Change of Variables and Convolution · Tutorial 433 of 798

Gaussian Moments and Their Recurrence

Derive the moments of the Gaussian distribution from a single integration by parts, and verify them again with a generating function justified by Fubini.

Advanced 11 min read

What You'll Learn

  • Show that every polynomial moment of the Gaussian density is finite.
  • Prove the recurrence \(m_{n+1}=n\,m_{n-1}\) and the formula \(m_{2k}=(2k-1)!!\).
  • Compute moments of a general normal variable \(\mu+\sigma Z\) from the binomial expansion.
  • Justify term-by-term integration of the generating function with Fubini's theorem.

The standard Gaussian density is \(\varphi(x)=\dfrac{e^{-x^2/2}}{\sqrt{2\pi}}\), and the previous tutorial established \(\int_{\mathbb{R}}\varphi(x)\,dx=1\) using Fubini's theorem and polar coordinates. Here we compute the moments \(m_n=\int_{\mathbb{R}}x^n\varphi(x)\,dx\) and show that they obey a one-line recurrence. These numbers reappear in variance calculations, in the central limit theorem, and in the Hermite expansions used in analysis.

The Moments Exist

Before computing anything we must check integrability. For each \(n\ge0\), the function \(x\mapsto|x|^ne^{-x^2/4}\) is continuous and tends to zero at infinity, so it is bounded by some constant \(C_n\). Then \(|x|^n\varphi(x)\le C_n\,e^{-x^2/4}/\sqrt{2\pi}\), and the right side is integrable. Hence \(x^n\in L^1(\varphi\,dx)\) for every \(n\), and \(m_n\) is a well-defined real number.

The Recurrence

Theorem: For the standard Gaussian, \(m_n=0\) for odd \(n\), \(m_0=1\), and \(m_{n+1}=n\,m_{n-1}\) for every \(n\ge1\). Consequently \[ m_{2k}=(2k-1)!!=1\cdot3\cdot5\cdots(2k-1). \]

Proof. If \(n\) is odd, then \(x^n\varphi(x)\) is an odd integrable function, so its integral over \(\mathbb{R}\) is zero (substitute \(x\mapsto-x\)). For the recurrence, observe that \(\varphi'(x)=-x\varphi(x)\). Fix \(n\ge1\) and integrate by parts on \([-R,R]\): \[ \int_{-R}^{R}x^{n+1}\varphi(x)\,dx=-\int_{-R}^{R}x^n\varphi'(x)\,dx=\Big[-x^n\varphi(x)\Big]_{-R}^{R}+n\int_{-R}^{R}x^{n-1}\varphi(x)\,dx. \] The boundary term equals \(-R^n\varphi(R)+(-R)^n\varphi(-R)\), and it tends to zero as \(R\to\infty\) because \(R^ne^{-R^2/2}\to0\). Both integrals converge by the previous section, so letting \(R\to\infty\) gives \(m_{n+1}=n\,m_{n-1}\). Starting from \(m_0=1\), the even moments are \(m_2=1\cdot m_0\), \(m_4=3\,m_2\), \(m_6=5\,m_4\), and so on, so \(m_{2k}=(2k-1)(2k-3)\cdots1\). \(\square\)

Worked Example: The First Even Moments

Applying \(m_{2k}=(2k-1)\,m_{2k-2}\) repeatedly:

\(k\)\(2k\)\(m_{2k}\)Computation
001total mass
121\(1\cdot1\)
243\(3\cdot1\)
3615\(5\cdot3\)
48105\(7\cdot15\)
510945\(9\cdot105\)

In particular, a standard normal \(Z\) has variance \(m_2=1\), fourth moment \(m_4=3\), and \(\operatorname{Var}(Z^2)=m_4-m_2^2=3-1=2\). The ratio \(m_4/m_2^2=3\) is the kurtosis of the Gaussian, the benchmark against which heavy tails are measured.

General Gaussians

If \(X=\mu+\sigma Z\) with \(Z\) standard normal, then the binomial theorem and linearity of the integral give \[ \mathbb{E}[X^n]=\sum_{j=0}^{n}\binom{n}{j}\mu^{n-j}\sigma^j\,m_j. \] Since \(m_j=0\) for odd \(j\), only even powers of \(\sigma\) survive. For \(n=3\) and \(n=4\) this reads \[ \mathbb{E}[X^3]=\mu^3+3\mu\sigma^2,\qquad \mathbb{E}[X^4]=\mu^4+6\mu^2\sigma^2+3\sigma^4. \]

Worked Example: A Gaussian with Mean 1 and Standard Deviation 2

Let \(\mu=1\) and \(\sigma=2\), so \(\sigma^2=4\) and \(\sigma^4=16\). Then \[ \mathbb{E}[X^3]=1+3\cdot1\cdot4=13,\qquad \mathbb{E}[X^4]=1+6\cdot1\cdot4+3\cdot16=1+24+48=73. \] As a check, \(\mathbb{E}[X^2]=\mu^2+\sigma^2=5\), so \(\operatorname{Var}(X)=5-1=4=\sigma^2\), as it should be. The fourth central moment is \(\mathbb{E}[(X-\mu)^4]=\sigma^4m_4=3\cdot16=48\), which is the last term in the expansion of \(\mathbb{E}[X^4]\).

Absolute Moments and the Gamma Function

For non-integer exponents, use the symmetry of \(\varphi\) and the substitution \(x=\sqrt{2u}\), so that \(dx=du/\sqrt{2u}\). For \(p>-1\), \[ \mathbb{E}|Z|^p=\frac{2}{\sqrt{2\pi}}\int_0^\infty x^pe^{-x^2/2}\,dx=\frac{2}{\sqrt{2\pi}}\,2^{(p-1)/2}\int_0^\infty u^{(p-1)/2}e^{-u}\,du=\frac{2^{p/2}}{\sqrt\pi}\,\Gamma\Big(\frac{p+1}{2}\Big). \] For \(p=1\) this is \(\sqrt{2/\pi}\approx0.7979\), and for \(p=3\) it is \(2^{3/2}\Gamma(2)/\sqrt\pi=2\sqrt{2/\pi}\approx1.5958\). The functional equation \(\Gamma(s+1)=s\Gamma(s)\) turns the formula into the same recurrence as before: with \(a_p=\mathbb{E}|Z|^p\), we get \(a_{p+1}/a_{p-1}=2\cdot\tfrac p2=p\). Indeed \(a_3=2a_1\), matching the two numbers just computed.

A Second Derivation Using Fubini

The moments can also be read off the exponential generating function. Completing the square, \(\int e^{tx}\varphi(x)\,dx=e^{t^2/2}\int\varphi(x-t)\,dx=e^{t^2/2}\). Expand \(e^{tx}=\sum_n t^nx^n/n!\) and integrate term by term. The interchange of sum and integral is a Fubini argument for counting measure times Lebesgue measure: it is legitimate because \[ \sum_{n\ge0}\int\frac{|tx|^n}{n!}\varphi(x)\,dx=\int e^{|tx|}\varphi(x)\,dx\le\int\big(e^{tx}+e^{-tx}\big)\varphi(x)\,dx=2e^{t^2/2}<\infty. \] Therefore \[ \sum_{n\ge0}\frac{m_n}{n!}\,t^n=e^{t^2/2}=\sum_{k\ge0}\frac{t^{2k}}{2^kk!}. \] Comparing coefficients of the power series gives \(m_{2k}=\dfrac{(2k)!}{2^kk!}\). For \(k=3\) this is \(720/(8\cdot6)=15\), in agreement with the table. The two formulas coincide because \((2k)!=(2k)!!\,(2k-1)!!\) and \((2k)!!=2^kk!\).

A Counting Interpretation

The number \((2k-1)!!\) counts the ways to split \(2k\) labelled points into unordered pairs. Point 1 can be paired with any of the other \(2k-1\) points, and the remaining \(2k-2\) points are then paired in \((2k-3)!!\) ways, which is exactly the recurrence \(m_{2k}=(2k-1)m_{2k-2}\). For \(k=2\) the three pairings of \(\{1,2,3,4\}\) are \(12|34\), \(13|24\) and \(14|23\), matching \(m_4=3\). This is the simplest case of Isserlis' theorem, cited here without proof, which expresses any moment of a Gaussian vector as a sum over pairings of covariances.

Unnormalized Integrals and Other Scales

The recurrence is often needed without the factor \(1/\sqrt{2\pi}\). Multiplying through gives \(\int x^{2k}e^{-x^2/2}\,dx=(2k-1)!!\sqrt{2\pi}\). For example, \[ \int_{\mathbb{R}}x^2e^{-x^2/2}\,dx=\sqrt{2\pi}\approx2.5066,\qquad \int_{\mathbb{R}}x^4e^{-x^2/2}\,dx=3\sqrt{2\pi}\approx7.5199. \] For a general scale \(s>0\), substituting \(x=sy\) gives \(\int x^{2k}e^{-x^2/(2s^2)}\,dx=s^{2k+1}(2k-1)!!\sqrt{2\pi}\). With \(s=2\) and \(k=1\), the integral of \(x^2e^{-x^2/8}\) is \(2^3\sqrt{2\pi}\approx20.05\).

Worked Example: Variance of a Sum of Squares

Let \(Z_1,\dots,Z_n\) be independent standard normals and \(Q=\sum_{i=1}^nZ_i^2\). Independence and the moments above give \(\mathbb{E}[Q]=n\,m_2=n\) and \(\operatorname{Var}(Q)=n\operatorname{Var}(Z_1^2)=n(m_4-m_2^2)=2n\). For \(n=10\) this gives mean 10, variance 20, and standard deviation \(\sqrt{20}\approx4.47\). This is the mean and variance of the chi-square distribution with 10 degrees of freedom, obtained here without ever writing down its density.

Using Moments for Tail Bounds

Markov's inequality applied to \(Z^{2k}\) gives \(\mathbb{P}(|Z|>t)\le m_{2k}/t^{2k}\) for every \(k\). The exact tail at \(t=3\) is \(\mathbb{P}(|Z|>3)\approx0.0027\). The moment bounds are:

\(k\)\(m_{2k}\)\(m_{2k}/3^{2k}\)
110.1111
230.0370
3150.0206
41050.0160
59450.0160

The bounds improve quickly, then stall at \(0.0160\), because \(m_{10}/m_8=9=3^2\) makes the last two ratios equal. Beyond \(k=5\) they get worse, since \(m_{2k+2}/m_{2k}=2k+1>9\). Even the best moment bound is about six times the true tail, so polynomial moments are a blunt instrument compared with the exponential bound obtained from the generating function \(e^{t^2/2}\).

Hermite Polynomials as Centred Moments

The generating function can be refined to \(e^{tx-t^2/2}=\sum_{n\ge0}He_n(x)\,t^n/n!\), which defines the probabilists' Hermite polynomials. The first few are \(He_0=1\), \(He_1=x\), \(He_2=x^2-1\), \(He_3=x^3-3x\) and \(He_4=x^4-6x^2+3\). Their Gaussian expectations are computed from the moment table.

Worked Example: Checking Orthogonality

For \(n=4\), \(\mathbb{E}[He_4(Z)]=m_4-6m_2+3=3-6+3=0\), as orthogonality to the constant \(He_0\) requires. For \(n=2\), expanding the square, \[ \mathbb{E}[He_2(Z)^2]=\mathbb{E}[(Z^2-1)^2]=m_4-2m_2+1=3-2+1=2=2!. \] In general \(\mathbb{E}[He_n(Z)He_m(Z)]=n!\,\delta_{nm}\), a fact we cite. These polynomials form an orthogonal basis of \(L^2(\varphi\,dx)\), which is why the moment recurrence appears throughout harmonic analysis and probability.

Computing a Gaussian Integral Against a Polynomial

The recurrence is also a tool for evaluating integrals of the form \(\int p(x)e^{-ax^2}\,dx\) for a polynomial \(p\) and \(a>0\). The substitution \(x=y/\sqrt{2a}\) reduces the weight to \(e^{-y^2/2}\), and the moments of \(\varphi\) do the rest. We illustrate with a case that mixes odd and even powers.

Worked Example: A Polynomial Against \(e^{-x^2}\)

Compute \(I=\int_{\mathbb{R}}(x^4+2x^3-x^2+5)\,e^{-x^2}\,dx\). With \(a=1\), set \(x=y/\sqrt2\), so \(dx=dy/\sqrt2\) and \(e^{-x^2}=e^{-y^2/2}\). Each power becomes \(x^j=y^j2^{-j/2}\). Using \(\int y^je^{-y^2/2}\,dy=m_j\sqrt{2\pi}\), \[ I=\frac{\sqrt{2\pi}}{\sqrt2}\Big(\tfrac14m_4+2\cdot2^{-3/2}m_3-\tfrac12m_2+5m_0\Big)=\sqrt\pi\Big(\tfrac34-\tfrac12+5\Big)=\frac{21}{4}\sqrt\pi. \] The odd term vanishes because \(m_3=0\). Numerically \(I\approx5.25\cdot1.77245\approx9.3054\). As a sanity check, the term \(5\int e^{-x^2}\,dx\) alone is \(5\sqrt\pi\approx8.862\), and the remaining even terms contribute the correction \((\tfrac34-\tfrac12)\sqrt\pi\approx0.443\).

Where the Fubini Argument Does the Work

The generating-function derivation looks routine, but it is a genuine application of Fubini's theorem, and it is worth isolating the point. A power series \(\sum_nt^nx^n/n!\) integrated against \(\varphi\) is an integral over the product space \(\mathbb{N}\times\mathbb{R}\) with counting measure on the first factor. Tonelli's theorem allows the sum and the integral to be interchanged for nonnegative terms with no hypothesis at all, and Fubini's theorem extends this to signed terms precisely when the absolute series has finite integral. That finiteness is what we verified using \(e^{|tx|}\le e^{tx}+e^{-tx}\). Without it, an interchange can fail even when both iterated expressions look reasonable.

Do the Moments Determine the Distribution?

For the Gaussian the answer is yes. The generating function \(e^{t^2/2}\) is finite for every real \(t\), and a random variable whose moment generating function is finite on an interval around zero is determined by its moments; this is a standard fact that we cite rather than prove. So the sequence \(1,0,1,0,3,0,15,\dots\) identifies the standard normal law uniquely. This is not automatic: there exist distinct distributions with identical moment sequences, for example certain lognormal laws, so determinacy always needs a hypothesis such as finiteness of the generating function.

Common Mistakes

Three errors recur. First, confusing the double factorials: \(m_{2k}\) is the product of the odd numbers up to \(2k-1\), not of the even numbers. Second, using the recurrence as \(m_{n+1}=(n+1)m_{n-1}\); the factor is \(n\), coming from differentiating \(x^n\). Third, claiming odd moments vanish for every symmetric distribution: symmetry gives zero only when the moment exists, and for a Cauchy variable the first moment does not exist at all. Here integrability was verified in the first section.

Takeaway: For the standard Gaussian, \(\varphi'=-x\varphi\) and one integration by parts give \(m_{n+1}=n\,m_{n-1}\), so odd moments vanish and \(m_{2k}=(2k-1)!!\). A general Gaussian \(\mu+\sigma Z\) has moments from the binomial expansion, and absolute moments are expressed with the Gamma function. The generating-function route, justified by Fubini, gives the same answer.

Check Your Understanding

Try each question before looking back.

  1. Compute \(m_{12}\) from the recurrence.
  2. Where does the integration by parts use \(R^ne^{-R^2/2}\to0\)?
  3. For \(X\sim N(2,3^2)\), find \(\mathbb{E}[X^3]\) and \(\mathbb{E}[X^4]\).
  4. Why does the Fubini justification require the absolute-value series \(\sum_n\int|tx|^n\varphi/n!\) to be finite?
  5. Use the Gamma formula to compute \(\mathbb{E}|Z|^2\) and check it equals \(m_2\).