Definition
Definition. (X,Y) are independent if their joint density factorizes:
pXY(xi,yj)=pX(xi)pY(yj)for all (xi,yj)∈X×Y.
Equivalent to: P([X=xi]∩[Y=yj])=P(X=xi)P(Y=yj) (see 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 → for the joint density and its marginals).
Example. (X,Y) with joint density (rows X, columns Y, marginals at the edge):
| X\Y |
−1 |
2 |
pX |
| −1 |
0.42 |
0.18 |
0.6 |
| 0 |
0.21 |
0.09 |
0.3 |
| 1 |
0.07 |
0.03 |
0.1 |
| pY |
0.7 |
0.3 |
|
Check that (X,Y) are independent (exercise on the page): every entry is the product of its two marginals, e.g. 0.6⋅0.7=0.42, 0.6⋅0.3=0.18, 0.3⋅0.7=0.21, 0.3⋅0.3=0.09, 0.1⋅0.7=0.07, 0.1⋅0.3=0.03.
Exercise. Let (X,Y) be both binary random variables with joint density pXY(i,j), i,j∈{0,1}, and marginals pX, pY. Prove that (X,Y) are independent if and only if the determinant of the joint density vanishes.
Solution sketch. The determinant is Δ=pXY(0,0)pXY(1,1)−pXY(0,1)pXY(1,0). Using pX(0)=pXY(0,0)+pXY(0,1), pY(0)=pXY(0,0)+pXY(1,0) and the normalization ∑pXY=1,
pX(0)pY(0)=pXY(0,0)(pXY(0,0)+pXY(0,1)+pXY(1,0))+pXY(0,1)pXY(1,0)=pXY(0,0)−Δ.
So pXY(0,0)=pX(0)pY(0) iff Δ=0; the other three cells differ from the product of marginals by ∓Δ in the same way. Hence factorization holds for all four cells iff Δ=0.
Independence is preserved by functions
Lemma. (X,Y) independent if and only if (f(X),g(Y)) independent for all f,g:R→R.
Proof. (⇐) trivial: it is enough to take f=g= identity.
(⇒) For given f,g let U=f(X) and V=g(Y). Then
pUV(uk,vh)=xi:f(xi)=ukyj:g(yj)=vh∑pXY(xi,yj)=xi:f(xi)=ukyj:g(yj)=vh∑pX(xi)pY(yj)=[xi:f(xi)=uk∑pX(xi)]⋅[yj:g(yj)=vh∑pY(yj)]=pU(uk)pV(vh). □
Remark. This result should be compared with: events (E,F) are independent iff (Ec,F) are independent iff (E,Fc) are independent iff (Ec,Fc) are independent.
Consequences for expectations and variances
Lemma. If (X,Y) is independent then X,Y are uncorrelated, i.e. E(XY)=E(X)E(Y).
Proof.
E(XY)=xi∑yj∑xiyjpXY(xi,yj)=xi∑yj∑xiyjpX(xi)pY(yj)=xi∑xipX(xi)yj∑yjpY(yj)=E(X)E(Y). □
Corollary. If (X,Y) is independent then E(f(X)g(Y))=E(f(X))E(g(Y)) for all f,g:R→R (apply the lemma to f(X),g(Y), which are independent by the previous lemma). Example: (X,Y) independent ⇒E(X2Y3)=E(X2)E(Y3).
Corollary. If (X,Y) is independent then cov(X,Y)=0. Proof: cov(X,Y)=E(XY)−E(X)E(Y)=0 (see Covariance and CorrelationThe variance of a sum X + Y equals var(X) + var(Y) + 2 cov(X,Y), where the covariance E((X - E(X))(Y - E(Y))) cannot be computed from the two marginal laws alone, which motivates the study of random vectors and joint behaviour.Covariance and Correlation →).
Corollary. If (X,Y) is independent then var(X+Y)=var(X)+var(Y).
Exercise. Let (X,Y) be independent. Compute var(X−Y). Solution: var(X−Y)=var(X)+var(−Y)+2cov(X,−Y)=var(X)+var(Y) because cov(X,−Y)=−cov(X,Y)=0 and var(−Y)=var(Y) (property 4 of covariance with a=1,c=−1).
WARNING. (X,Y) independent ⇒ (X,Y) uncorrelated, but (X,Y) uncorrelated ⇒ (X,Y) independent.
Counterexample. Consider the joint density
pXY(0,1)=pXY(1,0)=pXY(0,−1)=pXY(−1,0)=41
(four points on the axes at distance 1 from the origin, figure). Verify that (X,Y) are uncorrelated but not independent. Verification: pX(−1)=pX(1)=41, pX(0)=21 and the same for Y, so E(X)=E(Y)=0; E(XY)=0 because on each of the four points at least one coordinate is 0; hence cov(X,Y)=0. But pXY(0,0)=0=pX(0)pY(0)=21⋅21=41, so the density does not factorize.
Extension to n-ples
Definition. The components of the random vector (X1,X2,…,Xn) are independent if
pX1…Xn(x1,…,xn)=i=1∏npXi(xi).
Remark. Compare with the definition of independence for a family {E1,…,En} of events, and explain why the definition for random variables is given only n at a time instead of k at a time for k=2,3,…,n (the notes leave this as a question; the reason is that summing the factorization over the remaining variables gives the factorization of every sub-family, so the n-fold identity implies all the k-fold ones).
Lemma. (X1,…,Xn) independent ⇒ (Xi,Xj) uncorrelated for all i=j.
Proof. E(XiXj)=E(Xi)E(Xj), indeed all the two-marginals satisfy pXiXj=pXipXj. □
Lemma. (X1,…,Xn) independent ⇒ var(∑iXi)=∑ivar(Xi).
Remark. For var(∑iXi)=∑ivar(Xi) it is enough that (X1,…,Xn) are uncorrelated (the covariance matrix of Mean Vector and Covariance MatrixFor a column random vector X the mean vector collects the expectations of the components, the correlation matrix R = E(X X^T) and the covariance matrix Sigma = E((X - mu)(X - mu)^T) = R - mu mu^T are symmetric positive semidefinite, and under Y = A X + b they transform as mu_Y = A mu_X + b and Sigma_Y = A Sigma_X A^T.Mean Vector and Covariance Matrix → is then diagonal).
Versione ripasso
Definition. pXY(xi,yj)=pX(xi)pY(yj) for all (xi,yj); equivalently P([X=xi]∩[Y=yj])=P(X=xi)P(Y=yj). For n components: pX1…Xn=∏ipXi (marginalizing gives every sub-family).
Checks. Table with pX=(0.6,0.3,0.1), pY=(0.7,0.3) and entries 0.42,0.18,0.21,0.09,0.07,0.03: independent. Binary (X,Y): independent iff pXY(0,0)pXY(1,1)−pXY(0,1)pXY(1,0)=0.
Functions. (X,Y) independent ⟺(f(X),g(Y)) independent for all f,g (sum pXY=pXpY over preimages).
Consequences.
- E(XY)=E(X)E(Y), and E(f(X)g(Y))=E(f(X))E(g(Y)) (e.g. E(X2Y3)=E(X2)E(Y3));
- cov(X,Y)=0;
- var(X+Y)=var(X)+var(Y), and var(X−Y)=var(X)+var(Y);
- n independent: pairs uncorrelated, var(∑Xi)=∑var(Xi) (uncorrelated is enough for the variance).
WARNING. Independent ⇒ uncorrelated, not the converse. Counterexample: mass 41 at (0,1),(1,0),(0,−1),(−1,0): E(X)=E(Y)=E(XY)=0 but pXY(0,0)=0=41=pX(0)pY(0).
Typical mistakes. Checking factorization on a few cells only (it must hold for all pairs, including cells of zero probability); concluding independence from cov=0; writing var(X−Y)=var(X)−var(Y).