# Calculate $E[XY]$ for $(X,Y)\sim N(\mu_{1},\mu_{2},\sigma_{1}^{2},\sigma_{2}^{2}, \rho)$

I need to calculate $E[XY]$ for $(X,Y) \sim N(\mu_{1},\mu_{2},\sigma_{1}^{2}, \sigma_{2}^{2}, \rho)$ by using integration and then determine the correlation coefficient afterwards.

Now, when $X \sim N(\mu_{1},\sigma_{1}^{2})$ and $Y \sim N(\mu_{2}, \sigma_{2}^{2})$, the probability density function is given by $$f(x,y)= \\ \frac{1}{2\pi \sigma_{1} \sigma_{2} \sqrt{1-\rho^{2}}}\exp \left( - \frac{1}{2(1-\rho^{2})} \left[ \frac{(x-\mu_{1})^{2}}{\sigma_{1}^{2}}+ \frac{(y-\mu_{2})^{2}}{\sigma_{2}^{2}} - \frac{2 \rho (x-\mu_{1})(y-\mu_{2})}{\sigma_{1}\sigma_{2}}\right]\right)$$

But, I don't know how to calculate $E[XY]$ as an integral, short of setting up $$\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}xyf(x,y)dydx. \,\,\,(*)$$

Somebody told me that this integral is equal to $$\int_{-\infty}^{\infty} x \left[\int_{-\infty}^{\infty} y f(y \vert x) dy\right]f(x)dx,$$ where $f(y|x)$ is normal density with mean $=\int_{-\infty}^{\infty}yf(y\vert x)dy = \mu_{2}$, but I don't know what this means or how to get from $(*)$ to this last integral above.

• As an easy way, if you know that $\text{Cov}(X,Y) = \rho \sigma_1 \sigma_2$, and $\text{Cov}(X,Y) = E[X Y] - E[X] E[Y]$, then it follows that $E[X Y] =\mu_1 \mu_2 + \rho \sigma_1 \sigma_2$ – wolfies Nov 28 '17 at 2:17
• @wolfies I guess that's a good check, but the directions said to use integration, and my professor is kind of strict about that sort of thing. Plus, it's always better to know how to prove things in all different ways. – Jeff Nov 28 '17 at 3:04
• Hint: rearrange $P(A|B)=P(A \cap B)/P(B)$. – Christoph Hanck Nov 28 '17 at 9:54
• A straightforward way to evaluate the integral $(*)$ directly (which is what "use integration" seems to mean) is to apply the substitution $$X=\mu_1+\sigma_1U,\ Y=\mu_2+\sigma_2\left(\sqrt{1-\rho^2}V+\rho U\right).$$ This makes $(U,V)$ a standard binormal variable and gives the easy calculation $$E[XY]=E[\mu_1\mu_2+\sigma_1\sigma_2\rho U^2 + aU+bV+cUV]=\mu_1\mu_2 + \sigma_1\sigma_2\rho$$ where $a,b,c$ are constants you don't even have to compute since $E[U]=E[V]=E[UV]=0$. – whuber Nov 28 '17 at 16:07

The hint you suggest in your question is to use condition expectations. although not the only way to solve this problem, it is a quick method if you are comfortable with conditioning arguments.

$\mathbb{E}(XY) = \mathbb{E}_X(\mathbb{E}_y(XY|X))$

where the subscripts denote expectation with respect to which variable (for clarity to the reader. Then $\mathbb{E}_X(\mathbb{E}_Y(XY|X))= \mathbb{E}_X(X\mathbb{E}_Y(Y|X)).$ Now if you know the distribution of $Y|X$ this is easy,

$Y|X \sim N(\mu_y+\rho\frac{\sigma_y}{\sigma_x}(X-\mu_x), \sigma_y^2(1-\rho)).$

This means the mean of $Y|X$ is the first quantity, $\mathbb{E}_X(X(\mu_y+\rho\frac{\sigma_y}{\sigma_x}(X-\mu_x))).$

Now multiply the $X$ through and take expectations to get $\mathbb{E}_X(X)\mu_y+\rho\frac{\sigma_y}{\sigma_x}\left[\mathbb{E}_X(X^2)-\mu_x\mathbb{E}_X(X)\right].$

Now using the variance breakdown of the second and the first moment gives: $\mathbb{E}_X(X)\mu_y+\rho\frac{\sigma_y}{\sigma_x}\left[\sigma_x^2 +\mu_x^2 -\mu_x^2\right].$ And a little simplification yields:

$\mu_X\mu_y+\rho\sigma_y\sigma_x.$

You can check this against the correlation by substractions of $\mu_x\mu_y$ to get the co-variance, verifying the result is correct.