# 概率论，条件期望

If E (Y |X) = a + bX, find E (Y X) as a function of E (X) and E(X^2)

$\displaystyle E(XY)=\sum_{x,y} xyP(X=x, Y=y)$
$\displaystyle=\sum_{x} \Big[xP(X=x)\sum_y yP(Y=y|X=x)\Big]$
$\displaystyle=\sum_x \Big[xP(X=x)E(Y|X=x)\Big]$
$\displaystyle=\sum_x xP(X=x)(a+bx)$
$\displaystyle=\sum_x (ax+bx^2)P(X=x)$
$\displaystyle=aE(X)+bE(X^2)$