Quadratic exponentials of Gaussian random vectors

2024

The goal of this note is to gather some elementary facts on integrals of the form, say, E[eλX2]\mathbb{E}[e^{\lambda X^2}] where XX is a Gaussian random variable. These kind of integrals arise in many situations: for instance, in the Laplace transform of chi-square distributions. I'll cover the one-dimensional case first, then the multi-dimensional case.

The one-dimensional case

We recall the fundamental Gaussian integral, valid for λ>0\lambda >0:

eλt2/2dt=2πλ. \int_{-\infty}^{\infty} e^{-\lambda t^2/2}dt = \sqrt{\frac{2\pi}{\lambda}}.
Let XN(0,1)X \sim N(0,1). Then, for any real numbers a,b,ca,b,c, E[eaX2+bX+c2]=+\mathbb{E}[e^{\frac{aX^2+bX+c}{2}}] = +\infty if a1a\geq 1, and otherwise E[eaX2+bX+c2]=exp(c2+b28(1a))1a.\mathbb{E}[e^{\frac{aX^2+bX+c}{2}}] = \frac{\exp\left(\frac{c}{2} + \frac{b^2}{8(1-a)}\right)}{\sqrt{1-a}}.

Proof. Set q(x)=ax2+bx+cq(x) = ax^2+bx+c. Then, E[eq(X)/2]\mathbb{E}[e^{q(X)/2}] is equal to 12πet22+at2+bt+c2dt, \frac{1}{\sqrt{2\pi}}\int e^{-\frac{t^2}{2} + \frac{at^2+bt+c}{2}}dt, which obviously diverges iff a1a\geq 1. Otherwise, simple algebraic manipulations show that

(a1)t22+bt2+c2=γ2(tb2γ)2+c2+b28γ \frac{(a-1)t^2}{2}+\frac{bt}{2}+\frac{c}{2} = -\frac{\gamma}{2}\left(t-\frac{b}{2\gamma}\right)^2 +\frac c 2 + \frac{b^2}{8\gamma}

where γ=1a>0\gamma = 1-a>0. Plugging this into (3) yields

ec/2+b2/8γe12γ(tb2γ)2dte^{c/2 + b^2/8\gamma}\int e^{-\frac{1}{2}\gamma\left(t-\frac{b}{2\gamma}\right)^2}dt

which, after changing variables tb/2γt-b/2\gamma into ss, then using (1) and replacing γ\gamma by its value 1a1-a, gives exactly (2).

We now list a few consequences of this formula.

Laplace transform of a chi-square distribution:

E[eλX2]=11+2λ.\mathbb{E}[e^{-\lambda X^2}]=\frac{1}{\sqrt{1 + 2\lambda}}.

Analytic continuation. Take b=c=0b=c=0 for simplicity. The function 1/1z1/\sqrt{1-z} is defined for any zz not in [1,+)[1,+\infty) if we use the principal branch of the Logarithm. But outside of this set, the formula remains valid, and thus we can compute E[ezX2/2]=(1z)1/2\mathbb{E}[e^{zX^2/2}] = (1 - z)^{-1/2} for any zC[1,+)z \in \mathbb{C}\setminus [1,+\infty). Of course, proving that E[ezX2/2]\mathbb{E}[e^{zX^2/2}] is holomorphic on this domain is a bit more delicate.

Fresnel integral. Taking b=c=0b=c=0 and a=1+2ia=1+2i (which is not in [1,+[[1,+\infty[ as requested) we see that

E[eaX2/2]=12πeit2dt. \mathbb{E}[e^{aX^2 / 2}] = \frac{1}{\sqrt{2\pi}}\int e^{it^2}dt.

The value of the LHS was proven to be 1/2i=(1+i)/21 / \sqrt{-2i} = (1+i)/2. We thus get eit2dt=(1+i)π/2 \int e^{it^2}dt = (1+i)\sqrt{\pi /2}. In particular, we recover the famous Fresnel integral

0sin(t2)dt=0cos(t2)dt=π/22=π8.\int_0^\infty \sin(t^2)dt = \int_0^\infty \cos(t^2)dt = \frac{\sqrt{\pi/2}}{2} = \sqrt{\frac{\pi}{8}}.

The multi-dimensional case

For simplicity, in this case we'll only consider standard Gaussians. The general formula can nonetheless be derived using the same proof, see right after the proof.

Let XN(0,Id)X \sim N(0,I_d) and let AA be a real symmetric matrix. Then, E[e12X,AX]\mathbb{E}[e^{\frac{1}{2}\langle X, AX\rangle}] diverges if λmax(A)1\lambda_{\max}(A)\geq 1, and otherwise

E[e12X,AX]=det(IdA)1/2.\mathbb{E}[e^{\frac{1}{2}\langle X, AX\rangle}] = \sqrt{\det(I_d-A)^{-1/2}}.
The proof is trivial once we have the one-dimensional case : since A=UDUA = UDU^* and UXUX has the same distribution as XX, we can write X,AX\langle X, AX\rangle as a sum of λiξi2\lambda_i \xi_i^2 where the λi\lambda_i are the eigenvalues of AA (all of which are smaller than 11 by assumption) and the ξi\xi_i are i.i.d.

General formula. Now if μ\mu was to be nonzero, one could write X=μ+YX = \mu+Y with YN(0,Id)Y \sim N(0,I_d), and then develop:

X,AX=μ,Aμ+2Aμ,Y+Y,AY.\langle X, AX\rangle = \langle \mu, A\mu\rangle + 2\langle A\mu, Y\rangle + \langle Y, AY\rangle.

Set A=UDUA = U^* DU and Z=UYZ = UY. Then, ZN(0,Id)Z \sim N(0,I_d) and

E[e12X,AX]=e12μ,AμE[e12(Z,DZ+2UAμ,Z)]=e12μ,Aμi=1dE[eλi2Zi2+2biZi]\mathbb{E}[e^{\frac{1}{2}\langle X, AX\rangle}] = e^{\frac{1}{2}\langle \mu, A\mu\rangle}\mathbb{E}[e^{\frac{1}{2}(\langle Z, DZ\rangle+ 2\langle U^* A \mu, Z \rangle)}] = e^{\frac{1}{2}\langle \mu, A\mu\rangle}\prod_{i=1}^d \mathbb{E}[e^{\frac{\lambda_i}{2}Z_i^2 + 2b_i Z_i}]

where we introduced b=UAμb = U A \mu. Using the first result, we get

E[e12X,AX]=e12μ,Aμi=1debi28(1λi)1λi.\mathbb{E}[e^{\frac{1}{2}\langle X, AX\rangle}] = e^{\frac{1}{2}\langle \mu, A\mu\rangle}\prod_{i=1}^d \frac{e^{\frac{b_i^2}{8(1-\lambda_i)}}}{\sqrt{1-\lambda_i}}.

Chi-square, again. If XN(0,Id)X \sim N(0,I_d), then Y:=X2χ2(d)Y:=|X|^2 \sim \chi^2(d), and we recover the Laplace transform of a chi-square distribution YY with dd degrees of freedom:

E[eλY]=(11+2λ)d2.\mathbb{E}[e^{-\lambda Y}] = \left(\frac{1}{1+2\lambda}\right)^{\frac{d}{2}}.