Motivation to the study of random vectors.
Variance of the sum of two random variables
Let Z=X+Y and compute
var(Z)=E((Z−E(Z))2)=E((X+Y−E(X)−E(Y))2)=E((X−E(X)+Y−E(Y))2)
=E((X−E(X))2)+E((Y−E(Y))2)+2E((X−E(X))(Y−E(Y)))=var(X)+var(Y)+2cov(X,Y),
where the following new definition was introduced.
Definition (covariance of X and Y).
cov(X,Y)≜E((X−E(X))(Y−E(Y))).
Properties of the covariance
- cov(X,Y)=cov(Y,X).
- cov(X,X)=var(X).
- cov(X,Y)=E(XY)−E(X)E(Y) (compare with var(X)=E(X2)−[E(X)]2).
- cov(aX+b,cY+d)=accov(X,Y).
The proof of properties 1-3 is trivial. For property 4 a direct computation gives
cov(aX+b,cY+d)=E[(aX+b)(cY+d)]−E(aX+b)E(cY+d)
=acE(XY)+adE(X)+bcE(Y)+bd−acE(X)E(Y)−adE(X)−bcE(Y)−bd
=ac[E(XY)−E(X)E(Y)]=accov(X,Y).□
- cov(X,Y) can be ≷0 depending on X,Y. For Y=−X: cov(X,−X)=−var(X)≤0; for Y=X: cov(X,X)=var(X)≥0.
- The special case cov(X,Y)=0 is very important and will be studied later (see Independent Random VariablesDiscrete random variables X and Y are independent when the joint density factorizes as p_XY = p_X p_Y for all pairs; independence is preserved by functions f(X), g(Y), implies E(XY) = E(X)E(Y) and var(X + Y) = var(X) + var(Y), but uncorrelated does not imply independent.Independent Random Variables →). For the time being:
Definition (uncorrelated). The random variables X,Y are called uncorrelated if cov(X,Y)=0, or equivalently E(XY)=E(X)E(Y).
Reduction of the problem to E(XY)
Computing var(X+Y)=var(X)+var(Y)+2cov(X,Y) is reduced to computing cov(X,Y), since var(X) and var(Y) are known. As cov(X,Y)=E(XY)−E(X)E(Y) and E(X),E(Y) are known, everything reduces to E(XY).
Definition (correlation). E(XY) is called the correlation of X and Y.
Why E(XY) cannot be computed from the marginals
Consider discrete X,Y with available data: the alphabet X and density pX(xk) of X; the alphabet Y and density pY(yℓ) of Y. It is impossible to compute E(XY): let Z=XY; its values are zm=xkyℓ with xk∈X, yℓ∈Y, but pZ(zm) cannot be computed from pX(xk) and pY(yℓ). At a fundamental level
pZ(zm)=P([Z=zm])=P([X=xk]∩[Y=yℓ]),
while the data are pX(xk)=P([X=xk]) and pY(yℓ)=P([Y=yℓ]). This is equivalent to trying to find P(E∩F) from the knowledge of P(E) and P(F), an impossible task in general.
Example. Let X,Y∼b(p) (Bernoulli). The random variable Z=XY is again Bernoulli: its alphabet is {0,1} with Z=1 iff X=1 and Y=1, and Z=0 in all other cases. Therefore
E(XY)=0⋅P(XY=0)+1⋅P(XY=1)=P([X=1]∩[Y=1]).
But the available data are only P(X=1)=P(Y=1)=p, and it is impossible to compute P([X=1]∩[Y=1]). To complete the computation one needs extra information on the joint behaviour of X and Y. This is what Discrete Random VectorsA discrete random vector (X,Y) is described by its joint discrete density p_XY(x_i,y_j) = P(X = x_i, Y = y_j), whose marginals are obtained by summing over the other variable and which gives expectations of any function g(X,Y), including E(XY), covariance and the density of X + Y.Discrete Random Vectors → provide; a worked numerical case of var(X+Y) with X,Y∼b(0.4) is given there.
Versione ripasso
Variance of a sum. var(X+Y)=var(X)+var(Y)+2cov(X,Y).
Covariance. cov(X,Y)=E((X−E(X))(Y−E(Y)))=E(XY)−E(X)E(Y).
Properties. symmetric; cov(X,X)=var(X); cov(aX+b,cY+d)=accov(X,Y) (proof: expand, the terms with b,d cancel). Sign can be anything: Y=−X⇒−var(X), Y=X⇒var(X).
Uncorrelated: cov(X,Y)=0⟺E(XY)=E(X)E(Y). Correlation: E(XY).
Key point. E(XY) (hence cov and var(X+Y)) is not determined by the marginals: for X,Y∼b(p), E(XY)=P([X=1]∩[Y=1]) needs the joint law. P(E∩F) cannot be found from P(E), P(F).
Typical mistakes. Writing var(X+Y)=var(X)+var(Y) without checking cov=0; forgetting the factor 2; thinking cov(aX+b,cY+d) depends on b,d.