so I came across the problem below and somehow I can't really make sense of it. I looked through my lecture notes but I can't make any sense of it. So
- How can one understand $E[XY]$ intuitively?
- How exactly do we end up with the integral?
Problem: Let $X$ and $Y$ be two continous random variables with mutual density
$$f(x,y)=\begin{cases}\frac{1}{2}\quad &, 0\leq x \leq y \leq 2\\ 0\quad &,\text{else}\end{cases}$$
Calculate $E[XY]$.
Solution:
$E[XY]=\int_0^2 \int _0^y \frac{1}{2}xy \ dx dy = \int_0^2 \frac{1}{4}y^3 dy = \frac{1}{16}y^4 |_0^2 = 1$
Intuitively, $\mathsf E(XY)$ may be considered the probability-weighted average of the product of the random variables measured over the support.
So we are integrating $xy f(x,y)$ over the $\Bbb R^2$ plane, although of course, $f(x,y)$ equals zero except in its support.
These variables have a joint probability density function with a support of $\{\langle x,y\rangle: 0\leq x\leq y\leq 2\}$, a triangle.
So...
$$\begin{align}\mathsf E(XY)&=\iint_{\Bbb R^2} xy~f(x,y)~\mathrm d\langle x,y\rangle\\[1ex]&=\iint_{\Bbb R^2} xy~\tfrac 12\mathbf 1_{\small{0\leq x\leq y\leq 2}}~\mathrm d\langle x,y\rangle\\[2ex]&=\int_{0\leq x\leq 2}\int_{x\leq y\leq 2} \tfrac 12xy~\mathrm d y~\mathrm d x\\[1ex]&=\int_0^2\int_x^2\tfrac 12xy~\mathrm d y~\mathrm d x\end{align}$$