Shifted Gaussians and Hermite functions

April 15, 2014. I give a simple method for calculating moments of a shifted Gaussian using the generating function for Hermite polynomials.

The Hermite polynomials $H_n(\xi), n \in \mathbb{Z}_{\geq 0}$, are a classical family of orthogonal polynomials. In physics, they are most famous as the wavefunctions of the quantum harmonic oscillator. Hermite polynomials are often defined as derivatives,

\[H_n(\xi) := (-1)^ne^{\xi^2}\frac{d^n}{d\xi^n}e^{-\xi^2},\]

but are more elegantly given as coefficients of a generating function,

\[\exp(2s\xi - s^2) = \sum_{n\geq 0}H_n(\xi)\frac{s^n}{n!}.\]

The generating function gives us a nice way to calculate integrals of products of Hermite polynomials. Since the Gaussian density $e^{-x^2}$ appears in both definitions, it’s not surprising that the generating function turns up in the calculation of the “shifted” Gaussian integral

\[I_n(a, b) = \int_{-\infty}^\infty x^ne^{-ax^2 - bx}\,dx, \quad a \geq 0, \quad n \in \mathbb{Z}_{\geq0}.\]

Going through the details is a nice exposé of the generating function method.

The main trick is to assemble the $I_n$ terms into a power series. Define $C = (\pi/a)^{1/2} e^{b^2/4a}$, and consider

\[\begin{align*} \int_{-\infty}^\infty C^{-1}e^{tx}e^{-ax^2 - bx}\,dx & = \int_{-\infty}^\infty C^{-1}\sum_{n=0}^\infty \frac{t^nx^n}{n!}e^{-ax^2 - bx}\,dx \label{first}\\ & = \sum_{n=0}^\infty \frac{t^n}{Cn!}\int_{-\infty}^\infty x^ne^{-ax^2 - bx}\,dx \notag\\ & = \sum_{n=0}^\infty \frac{t^n}{Cn!}I_n(a, b). \end{align*}\]

We can evaluate the first expression directly using the standard Gaussian integral $\,I_0(a, b-t)$:

\[\begin{align*} \int_{-\infty}^\infty C^{-1}e^{tx}e^{-ax^2 - bx}\,dx & = C^{-1}\int_{-\infty}^\infty e^{-ax^2 - (b - t)x}\,dx \notag\\ & = \sqrt{\frac{a}{\pi}}e^{-b^2/4a} \cdot \sqrt{\frac{\pi}{a}}e^{(b - t)^2/4a} \\ & = e^{(-b^2 + b^2 - 2bt + t^2)/4a}\\ & = e^{(t^2 - 2bt)/4a}. \end{align*}\]

We observe that this is almost the Hermite generating function $e^{2s\xi - s^2}$. To massage it into that form, we change variables:

\[s = \frac{it}{2\sqrt{a}}, \quad \xi = -\frac{bt}{4as} = \frac{ib}{2\sqrt{a}}.\]

Using the Hermite polynomials, we have

\[\begin{align*} e^{(t^2 - 2bt)/4a} & = e^{2s\xi - s^2}\notag\\ & = \sum_{n=0}^\infty \frac{H_n(\xi)}{n!}s^n \notag\\ & = \sum_{n=0}^\infty \frac{1}{n!}\left(\frac{it}{2\sqrt{a}}\right)^nH_n\left(\frac{ib}{2\sqrt{a}}\right) \notag\\ & = \sum_{n=0}^\infty \frac{i^nt^n}{n!2^na^{n/2}}H_n\left(\frac{ib}{2\sqrt{a}}\right). \end{align*}\]

We now have two different power series for the same thing. Identifying them term by term gives us our rather neat final result:

\[\begin{align*} % \frac{1}{Cn!}I_n(a,b) & = \frac{i^n}{n!2^na^{n/2}}H_n\left(\frac{ib}{2\sqrt{a}}\right) \\\implies \quad I_n(a,b) & = e^{b^2/4a}\left(\frac{i}{2}\right)^n\sqrt{\frac{\pi}{a^{n+1}}}H_n\left(\frac{ib}{2\sqrt{a}}\right). \end{align*}\]

As a quick application, let’s find the even moments of the Gaussian distribution:

\[I_{2n}(1, 0) = \int_{-\infty}^{\infty} x^{2n}e^{-x^2}\,dx.\]

To evaluate this, we’ll need the constant term of $H_{2n}$. We can use the generating function to get this too:

\[\begin{align*} \sum_{n\geq 0}H_n(0)\frac{s^n}{n!} = \exp(-s^2) & = \sum_{k\geq 0}\frac{(-1)^ks^{2k}}{k!}. \end{align*}\]

Hence, $H_{2n+1}(0) = 0$ and

\[H_{2n}(0) = \frac{(-1)^n(2n)!}{n!}.\]

Subbing in to our expression for $I_{2n}(1, 0)$, we get

\[\int_{-\infty}^{\infty} x^{2n}e^{-x^2}\,dx = \frac{(2n!)\sqrt{\pi}}{4^nn!}.\]
Written on April 15, 2014
Mathematics