记任取的两数为X,Y
由题设可知X,1到n的均匀分布
即P(X=i)=1/n,i=1,2,...,n
并且照题设X,Y应独立
即P(XY)=P(x)*P(Y)
于是:
E(XY)=sum(xy*P(X=x,Y=y))
=sum(xy*P(X)*P(Y))
=sum(x*P(X)*y*P(y))
=E(X)*E(Y)
=n^2/4
记任取的两数为X,Y
由题设可知X,1到n的均匀分布
即P(X=i)=1/n,i=1,2,...,n
并且照题设X,Y应独立
即P(XY)=P(x)*P(Y)
于是:
E(XY)=sum(xy*P(X=x,Y=y))
=sum(xy*P(X)*P(Y))
=sum(x*P(X)*y*P(y))
=E(X)*E(Y)
=n^2/4