For continuous random variables, expected values are defined in a similar way, but with the double summation replaced by a double integral.
Definition
If \(X\) and \(Y\) are continuous random variables with joint probability density function \(f(x,y)\), then the expected value of a function of the variables, \(g(X,Y)\), is defined to be
\[ E[g(X,Y)] \;=\; \int_{-\infty}^{\infty}{\int_{-\infty}^{\infty} {g(x,y) \times f(x,y)} \;dx} \;dy \]This again corresponds to each possible value of \(g(x,y)\) being "weighted" by its probability density, with the most likely values of the variables contributing most to the expected value.
Example
A point is randomly selected within a unit square. What is the expected area of the rectangle with it and the origin as corners? What is its variance? |
![]() |
\(X\) and \(Y\) are independent \(\UniformDistn(0,1)\) random variables, so their joint probability density function is
\[ f(x,y) \;=\; 1 \qquad \text{for } 0 \le x \le 1 \text{ and } 0 \le y \le 1 \]The expected area is
\[ \begin{align} E[XY] \;&=\; \int_0^1 {\int_0^1 xy\;dx}\;dy \\ &=\; \int_0^1 x \;dx \; \times\; \int_0^1 y \;dy \\ &=\; \left[\frac{x^2}{2}\right]_0^1 \; \times\; \left[\frac{y^2}{2}\right]_0^1 \\ &=\; \left(\frac 1 2\right)^2 \;=\; \frac 1 4 \end{align} \]To find the variance of \(XY\), we first find \(E\left[(xy)^2\right]\).
\[ \begin{align} E\left[(XY)^2\right] \;&=\; \int_0^1 {\int_0^1 x^2y^2\;dx}\;dy \\ &=\; \int_0^1 x^2 \;dx \; \times\; \int_0^1 y^2 \;dy \\ &=\; \left[\frac{x^3}{3}\right]_0^1 \; \times\; \left[\frac{y^3}{3}\right]_0^1 \\ &=\; \left(\frac 1 3\right)^2 \;=\; \frac 1 9 \end{align} \]The variance is found from
\[ \Var(XY) \;=\; E\left[(XY)^2\right] - \left(E[XY]\right)^2 \;=\; \frac 1 9 - \frac 1{16} \;=\; \frac 7{144} \]