# 二维随机变量的数学期望

1，离散型随机变量：若 $$(X,Y)$$ 的联合分布律与边缘分布律各自为

$P(X=x_i,Y=y_j)=p_{ij},\quad P(X=x_i)=p_{i,\cdot},\quad P(Y=y_j)=p_{\cdot,j}$

$E(X)=\sum_ix_ip_{i,\cdot},\quad E(Y)=\sum_j y_jp_{\cdot,j}$

\begin{array}{|c|cccc|c|}\hline Y\Big{\backslash}X& 1&2&3&4&Y\\ \hline 1&\frac{1}{16}& 0&0&0&\frac{1}{16}\\ 2&\frac{1}{16}&\frac{1}{12}&\frac{1}{8}&0&\frac{7}{48}\\ 3&\frac{1}{16}&\frac{1}{12}&\frac{1}{8}&0&\frac{13}{48}\\ 4&\frac{1}{16}&\frac{1}{12}&\frac{1}{8}&\frac{1}{4}&\frac{25}{48}\\ \hline X&\frac{1}{4}&\frac{1}{4}&\frac{1}{4}&\frac{1}{4}&1\\ \hline\end{array}

\begin{align*}E(Y)&=1\cdot\frac{1}{16}+2\cdot\frac{7}{48}+3\cdot\frac{13}{48}+4\cdot\frac{25}{48}\\ &=\frac{156}{48}=\frac{13}{4}\end{align*}

2，连续型：设 $$(X,Y)$$ 的联合概率密度为 $$f(x,y)$$，边缘概率密度分别为

$f_X(x)=\int_{-\infty}^{\infty}f(x,y)dy,\quad f_Y(y)=\int_{-\infty}^{\infty}f(x,y)dx$

$E(X)=\int_{-\infty}^{\infty}xf_X(x)dx=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}xf(x,y)dydx$

$E(Y)=\int_{-\infty}^{\infty}yf_Y(y)dy=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}yf(x,y)dxdy$

$f(x,y)=\begin{cases}2e^{-(2x+y)},&x\ge 0, y\ge 0\\ 0,&\text{其它}\end{cases}$

\begin{align*}E(Y)&=\int_{-\infty}^{\infty}\int_{-\infty}^{\infty}yf(x,y)dxdy\\ &=\int_0^{\infty}\int_0^{\infty}2ye^{-(2x+y)}dxdy\\ &=\int_0^{\infty}ye^{-y}(-e^{-2x})\Big|_0^{\infty}dx\\ &=\int_0^{\infty}ye^{-y}dy\\ &=-ye^{-y}-e^{-y}\Big|_0^{\infty}=1\end{align*}