# Compute the moment generating function of $Y = X_1X_2 + X_1X_3 + X_2X_3$

## Suppose $$X_1, X_2,$$ and $$X_3$$ are independent and $$N(0, 1)$$-distributed. Compute the moment generating function of $$Y = X_1X_2 + X_1X_3 + X_2X_3$$.

1. I know that any $$X_iX_j$$ with $$i \not =j$$ is a joint normal with variables $$(x_i,x_j)$$

2. I also know the formula of the moment generating function of a normal distribution.

Furthermore, I know that if $$Y_1,…, Y_n$$ are independent $$N(0,1)$$, that is, $$Y = (Y_1,…,Y_n )´$$ are $$N(0,I)$$ by definition, the moment generating function of Y is given by $$e^{\frac{1}{2}\mathbf t' \mathbf t}$$

I thought about using the pdf's and the definition of a moment generating function but it proved to be a really tedious process jacked of multiple integrations.

Does anyone know how to easily solve this problem with some relatively simple lines? (Especially using the multivariate normal properties and matrices)

Define $$A=\begin{bmatrix} 0&1&1\\ 1&0&1\\ 1&1&0 \end{bmatrix},\quad X=\begin{bmatrix} X_1\\ X_2\\ X_3 \end{bmatrix}$$ the other choices of $$A$$ would give the correct $$Y$$, but I need it to be symmetric later. Then $$Y=\frac{1}{2}X^TAX$$ The pdf for 3d standard normal distribution $$p(x)=(2\pi)^{-3/2}\exp\left[-\frac{1}{2}x^Tx\right]$$ The moment generating function for y is then $$\mathbb{E}(e^{\lambda y})=\int d^3x(2\pi)^{-3/2}\exp\left[\frac{\lambda}{2}x^TAx\right]\exp\left[-\frac{1}{2}x^Tx\right]=(2\pi)^{-3/2}\int d^3x\exp\left[-\frac{1}{2}x^T(I-\lambda A)x\right]$$ The above integral is solved by the following for a real symmetric matrix $$M$$ $$\int d^3x\exp\left[-\frac{1}{2}x^TMx\right]=\sqrt{\frac{(2\pi)^3}{\det M}}$$ Inserting we find $$\mathbb{E}(e^{\lambda y})=\frac{1}{\sqrt{\det(I-\lambda A)}}=\frac{1}{\sqrt{-2\lambda^3-3\lambda^2+1}}$$

• I am not too familiar with the MGF but if you plug in $\lambda = 1$, then $E[e^Y]$ should still be a real number, right? Your final expression would evaluate to an imaginary number $1 / \sqrt{-4}$. – antkam Mar 5 '19 at 18:03
• Not quite, $\mathbb{E}(y^n)=\left.\frac{d^n}{d\lambda^n}\mathbb{E}(e^{\lambda y})\right|_{\lambda=0}$. So if you don't differentiate you just get the normalization 1, then differentiate once you get the mean and so on. – benjamins Mar 5 '19 at 18:33
• I wasn't talking about $E[Y^n]$. I was talking about $E[e^Y]$. Let $Z = e^Y$, and $Z$ is a well-defined real-valued random variable. It is not a-priori clear that $Z$ has finite mean, but it is still curious that your formula gives $E[Z] = 1/\sqrt{-4}$. – antkam Mar 5 '19 at 18:38
• Arhh I get what you mean, it's because the the integral then diverges. The integral formula in the post uses that I can diagonalize the matrix. For $I-\lambda A$ I get the following eigenvalues $-2\lambda+1,1+\lambda,1+\lambda$, thus for positive $\lambda$ it diverges. – benjamins Mar 5 '19 at 18:47
• All the eigenvalues need to be positive, so I wasn't quite correct when I said positive $\lambda$ doesn't work, e.g. $\lambda=2/5$ works. It just boils down to normal gaussian integral $\int e^{-ax^2}\,dx$, where you also need $a>0$. – benjamins Mar 5 '19 at 19:09

There may be some smarter ways to solve this, but repeated applications of the tower rule $$\mathbf E [X] = \mathbf E[\mathbf E[X|Y]]$$ will give you the result.

Take the definition of the moment generating function $$M_Y(t) = \mathbf E[\mathrm e^{t Y}]$$ and, in the first step, condition on $$X_2$$ and $$X_3$$; you get that \begin{aligned} M_Y(t) &= \mathbf E\big[ \mathbf E [ \mathrm e^{t Y} | X_2, X_3]\big]\\ &= \mathbf E\big[ \mathbf E [ \mathrm e^{t X_1(X_2 + X_3)} | X_2, X_3] \mathrm e^{t X_2X_3}\big] \end{aligned} Note that, conditioned on $$X_2$$ and $$X_3$$, the random variable $$X_1(X_2+X_3)$$ is $$N\big(0,(X_2+X_3)^2\big)$$, so (using the definition of the MGF of a normal random variable) $$\mathbf E [ \mathrm e^{t X_1(X_2 + X_3)} | X_2, X_3] = \mathrm e^{\frac{1}{2}(X_2 + X_3)^2t^2}$$ So we have that $$M_Y(t) = \mathbf{E} \big[ \mathrm e^{\frac{1}{2}(X_2 + X_3)^2t^2 + tX_2 X_3}\big].$$

Apply the same trick again to integrate out $$X_2$$: \begin{aligned} M_Y(t) &= \mathbf{E} \big[ \mathbf E[\mathrm e^{\frac{1}{2}(X_2 + X_3)^2t^2 + tX_2 X_3}|X_3]\big]\\ &=\mathbf{E} \big[ \mathbf E[\mathrm e^{\frac{1}{2}X_2^2 t^2 + X_2 X_3t^2 + tX_2 X_3}|X_3]\mathrm e^{\frac{1}{2} X_3^2t^2}\big]. \end{aligned} The conditional expectation can be computed writing out the integral and completing the square at the exponent; you may need to prove the following intermediate result

Let $$X\sim N(0, 1)$$, then $$\mathbf{E} [ \mathrm e^{ \frac{1}2 a X^2 + b X}] = \frac{1}{\sqrt{1-a}}\mathrm e^{\frac{1}{2}\frac{b^2}{1-a}}$$

Doing the same "complete the square" once more to integrate out $$X_3$$ should give you the final answer.