假设 X X X 和 Y Y Y 是两个随机变量,我们需要求 X Y XY XY 的方差。
方差公式:
Var ( X ) = E [ ( X − E ( X ) ) 2 ] = E [ ( X 2 − 2 X E ( X ) + E ( X ) ) 2 ] = E [ X 2 ] − ( E [ X ] ) 2 \text{Var}(X) = \mathbb{E}[(X - E(X))^2] = \mathbb{E}[(X^2 - 2XE(X) + E(X))^2] = \mathbb{E}[X^2] - (\mathbb{E}[X])^2 Var(X)=E[(X−E(X))2]=E[(X2−2XE(X)+E(X))2]=E[X2]−(E[X])2
根据方差的定义,方差是平方值的期望减去期望值的平方,即
Var ( X Y ) = E [ ( X Y ) 2 ] − ( E [ X Y ] ) 2 \text{Var}(XY) = \mathbb{E}[(XY)^2] - (\mathbb{E}[XY])^2 Var(XY)=E[(XY)2]−(E[XY])2
求 E [ X Y ] \mathbb{E}[XY] E[XY]:
根据协方差定义:
Cov ( X , Y ) = E [ ( X − E [ X ] ) ( Y − E [ Y ] ) ] \text{Cov}(X, Y) = \mathbb{E}[(X - \mathbb{E}[X])(Y - \mathbb{E}[Y])] Cov(X,Y)=E[(X−E[X])(Y−E[Y])]
= E [ X Y − X E [ Y ] − E [ X ] Y + E [ X ] E [ Y ] ] = \mathbb{E}[XY - X\mathbb{E}[Y] - \mathbb{E}[X]Y + \mathbb{E}[X]\mathbb{E}[Y]] =E[XY−XE[Y]−E[X]Y+E[X]E[Y]]
= E [ X Y ] − E [ X ] E [ Y ] − E [ X ] E [ Y ] + E [ X ] E [ Y ] = \mathbb{E}[XY] - \mathbb{E}[X]\mathbb{E}[Y] - \mathbb{E}[X]\mathbb{E}[Y] + \mathbb{E}[X]\mathbb{E}[Y] =E[XY]−E[X]E[Y]−E[X]E[Y]+E[X]E[Y]
= E [ X Y ] − E [ X ] E [ Y ] = \mathbb{E}[XY] - \mathbb{E}[X]\mathbb{E}[Y] =E[XY]−E[X]E[Y]
有: E [ X Y ] = E [ X ] E [ Y ] + Cov ( X , Y ) \mathbb{E}[XY] = \mathbb{E}[X] \mathbb{E}[Y] + \text{Cov}(X,Y) E[XY]=E[X]E[Y]+Cov(X,Y)
求 E [ ( X Y ) 2 ] \mathbb{E}[(XY)^2] E[(XY)2]:
E [ ( X Y ) 2 ] = E [ X 2 Y 2 ] \mathbb{E}[(XY)^2] = \mathbb{E}[X^2 Y^2] E[(XY)2]=E[X2Y2]
同样我们可以利用协方差公式得到:
E [ X 2 Y 2 ] = E [ X 2 ] E [ Y 2 ] + Cov ( X 2 , Y 2 ) \mathbb{E}[X^2 Y^2] = \mathbb{E}[X^2] \mathbb{E}[Y^2] + \text{Cov}(X^2, Y^2) E[X2Y2]=E[X2]E[Y2]+Cov(X2,Y2)
将其代入:
E [ ( X Y ) 2 ] = E [ X 2 Y 2 ] \mathbb{E}[(XY)^2] = \mathbb{E}[X^2 Y^2] E[(XY)2]=E[X2Y2]
有:
E [ ( X Y ) 2 ] = E [ X 2 ] E [ Y 2 ] + Cov ( X 2 , Y 2 ) \mathbb{E}[(XY)^2] = \mathbb{E}[X^2] \mathbb{E}[Y^2] + \text{Cov}(X^2, Y^2) E[(XY)2]=E[X2]E[Y2]+Cov(X2,Y2)
求 Var ( X Y ) \text{Var}(XY) Var(XY) :
Var ( X Y ) = E [ X 2 ] E [ Y 2 ] + Cov ( X 2 , Y 2 ) − ( E [ X ] E [ Y ] + Cov ( X , Y ) ) 2 \text{Var}(XY) = \mathbb{E}[X^2] \mathbb{E}[Y^2] + \text{Cov}(X^2, Y^2) - (\mathbb{E}[X] \mathbb{E}[Y] + \text{Cov}(X,Y))^2 Var(XY)=E[X2]E[Y2]+Cov(X2,Y2)−(E[X]E[Y]+Cov(X,Y))2
如果两个变量独立,进一步简化
假设 X X X 和 Y Y Y 是两个独立的随机变量,可以推导出 X 2 X^2 X2和 Y 2 Y^2 Y2也是独立的。
推导 X 2 X^2 X2和 Y 2 Y^2 Y2独立:
如果 X X X 和 Y Y Y 是独立的,则 X X X 和 Y Y Y 的联合概率密度函数可以分解为各自的概率密度函数的乘积:
f X , Y ( x , y ) = f X ( x ) f Y ( y ) f_{X,Y}(x, y) = f_X(x) f_Y(y) fX,Y(x,y)=fX(x)fY(y)
在这种情况下,我们有:
E [ X Y ] = E [ X ] E [ Y ] \mathbb{E}[XY] = \mathbb{E}[X] \mathbb{E}[Y] E[XY]=E[X]E[Y]
但这并不直接意味着 E [ X 2 Y 2 ] = E [ X 2 ] E [ Y 2 ] \mathbb{E}[X^2 Y^2] = \mathbb{E}[X^2] \mathbb{E}[Y^2] E[X2Y2]=E[X2]E[Y2]。
X 2 Y 2 X^2 Y^2 X2Y2 的概率密度函数为:
E [ X 2 Y 2 ] = ∫ − ∞ ∞ ∫ − ∞ ∞ x 2 y 2 f X 2 , Y 2 ( x 2 , y 2 ) d x 2 d y 2 \mathbb{E}[X^2 Y^2] = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} x^2 y^2 f_{X^2,Y^2}(x^2, y^2) \, dx^2 \, dy^2 E[X2Y2]=∫−∞∞∫−∞∞x2y2fX2,Y2(x2,y2)dx2dy2
令 M = X 2 M = X^2 M=X2, N = Y 2 N = Y^2 N=Y2,则:
E [ M N ] = ∫ − ∞ ∞ ∫ − ∞ ∞ m n f M , N ( m , n ) d m d n \mathbb{E}[M N] = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} m n f_{M,N}(m, n) \, dm \, dn E[MN]=∫−∞∞∫−∞∞mnfM,N(m,n)dmdn
由于 X X X 和 Y Y Y 独立,有:
f X , Y ( x , y ) = f X ( x ) f Y ( y ) f_{X,Y}(x, y) = f_X(x) f_Y(y) fX,Y(x,y)=fX(x)fY(y)
因此:
f M , N ( m , n ) = f M ( m ) f N ( n ) f_{M,N}(m, n) = f_M(m) f_N(n) fM,N(m,n)=fM(m)fN(n)
因此联合概率密度函数可以分解:
E [ M N ] = ∫ − ∞ ∞ ∫ − ∞ ∞ m n f M ( m ) f N ( n ) d m d n \mathbb{E}[MN] = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty}m n f_M(m) f_N(n) \, dm \, dn E[MN]=∫−∞∞∫−∞∞mnfM(m)fN(n)dmdn
可以将积分分开:
E [ M N ] = ( ∫ − ∞ ∞ m f M ( m ) d m ) ( ∫ − ∞ ∞ n f N ( n ) d n ) \mathbb{E}[M N] = \left( \int_{-\infty}^{\infty} m f_M(m) \, dm \right) \left( \int_{-\infty}^{\infty} n f_N(n) \, dn \right) E[MN]=(∫−∞∞mfM(m)dm)(∫−∞∞nfN(n)dn)
因此:
E [ M N ] = E [ M ] E [ N ] \mathbb{E}[MN] = \mathbb{E}[M] \mathbb{E}[N] E[MN]=E[M]E[N]
这正是:
E [ X 2 Y 2 ] = E [ X 2 ] E [ Y 2 ] \mathbb{E}[X^2 Y^2] = \mathbb{E}[X^2] \mathbb{E}[Y^2] E[X2Y2]=E[X2]E[Y2]
我们得出结论,当 X X X 和 Y Y Y 独立时, X 2 X^2 X2 和 Y 2 Y^2 Y2 也独立。
因此:
Cov ( X 2 , Y 2 ) = Cov ( X , Y ) = 0 \text{Cov}(X^2, Y^2) = \text{Cov}(X, Y) = 0 Cov(X2,Y2)=Cov(X,Y)=0
代入:
Var ( X Y ) = E [ X 2 ] E [ Y 2 ] + Cov ( X 2 , Y 2 ) − ( E [ X ] E [ Y ] + Cov ( X , Y ) ) 2 \text{Var}(XY) = \mathbb{E}[X^2] \mathbb{E}[Y^2] + \text{Cov}(X^2, Y^2) - (\mathbb{E}[X] \mathbb{E}[Y] + \text{Cov}(X,Y))^2 Var(XY)=E[X2]E[Y2]+Cov(X2,Y2)−(E[X]E[Y]+Cov(X,Y))2
有:
Var ( X Y ) = E [ X 2 ] E [ Y 2 ] − ( E [ X ] E [ Y ] ) 2 \text{Var}(XY) = \mathbb{E}[X^2] \mathbb{E}[Y^2] - (\mathbb{E}[X] \mathbb{E}[Y])^2 Var(XY)=E[X2]E[Y2]−(E[X]E[Y])2
由于:
Var ( X ) = E [ ( X − E ( X ) ) 2 ] = E [ ( X 2 − 2 X E ( X ) + E ( X ) ) 2 ] = E [ X 2 ] − ( E [ X ] ) 2 \text{Var}(X) = \mathbb{E}[(X - E(X))^2] = \mathbb{E}[(X^2 - 2XE(X) + E(X))^2] = \mathbb{E}[X^2] - (\mathbb{E}[X])^2 Var(X)=E[(X−E(X))2]=E[(X2−2XE(X)+E(X))2]=E[X2]−(E[X])2
则:
E [ X 2 ] = Var ( X ) + ( E [ X ] ) 2 \mathbb{E}[X^2] = \text{Var}(X) + (\mathbb{E}[X] )^2 E[X2]=Var(X)+(E[X])2
E [ Y 2 ] = Var ( Y ) + ( E [ Y ] ) 2 \mathbb{E}[Y^2] = \text{Var}(Y) + (\mathbb{E}[Y] )^2 E[Y2]=Var(Y)+(E[Y])2
进一步:
Var ( X Y ) = Var ( X ) Var ( Y ) + E [ X ] 2 Var ( Y ) + E [ Y ] 2 Var ( X ) \text{Var}(XY) = \text{Var}(X) \text{Var}(Y) + \mathbb{E}[X]^2\text{Var}(Y) + \mathbb{E}[Y]^2 \text{Var}(X) Var(XY)=Var(X)Var(Y)+E[X]2Var(Y)+E[Y]2Var(X)
如果X和Y均值为0,则有:
Var ( X Y ) = Var ( X ) Var ( Y ) \text{Var}(XY) = \text{Var}(X)\text{Var}(Y) Var(XY)=Var(X)Var(Y)