Unit 7, lesson 47

Independent Random Variables

What it means for random variables to be independent, how the product law and CDF factorization test a joint law at every cell and threshold, why separate functions stay independent, and what mutual independence adds.

  • Video 47
  • Independence and Covariance

Two separately built devices produce random outputs. The first gives XX, equal to 00 or 11 with probabilities 0.40.4 and 0.60.6, and the second gives YY, equal to 00, 11 or 22 with probabilities 0.20.2, 0.30.3 and 0.50.5. These two lists do not yet answer a joint question such as how likely it is that X=1X = 1 while Y≥1Y \ge 1, because the answer depends on how the outputs occur together. When the devices operate independently, the probability of each pair of values is the product of the two marginal probabilities. This lesson states that product law precisely, tests joint tables against it at every cell and every CDF threshold, and separates pairwise independence from mutual independence.

Key terms

Independent random variables

Definition Let XX and YY be discrete random variables on the same probability model. They are independent if every event described by XX alone is independent of every event described by YY alone, that is, if

P(X∈A,Y∈B)=P(X∈A) P(Y∈B)\begin{aligned} &P(X \in A, Y \in B) \\[0.4em] &\quad = P(X \in A)\,P(Y \in B) \end{aligned}

for all sets AA and BB of real numbers, where the left side is the probability that both events occur. Events with probability 00 satisfy this product rule automatically, so independence is equivalent to P(Y∈B∣X∈A)=P(Y∈B)P(Y \in B \mid X \in A) = P(Y \in B) for every set BB and every set AA with P(X∈A)>0P(X \in A) > 0. Independence is a property of the joint distribution of the pair. In general it cannot be read from the two marginal distributions, and it does not follow from the variables having different names or different descriptions.

In plain words Learning any fact about XX alone, as long as that fact has positive probability, leaves the probabilities for YY unchanged, and the same holds the other way around. In a model this is either assumed, for example for devices that operate separately, or checked against the joint distribution.

Example Assume the two devices from the opening operate independently. Taking A={x}A = \{x\} and B={y}B = \{y\} shows that each cell of the joint table is a product of a probability for XX and a probability for YY.

y=0y = 0y=1y = 1y=2y = 2pX(x)p_X(x)
x=0x = 00.080.080.120.120.200.200.40.4
x=1x = 10.120.120.180.180.300.300.60.6
pY(y)p_Y(y)0.20.20.30.30.50.511

The event {Y≥1}\{Y \ge 1\} has probability 0.3+0.5=0.80.3 + 0.5 = 0.8, so P(X=1,Y≥1)=0.6⋅0.8=0.48P(X = 1, Y \ge 1) = 0.6 \cdot 0.8 = 0.48, and the two qualifying cells of the second row give the same total 0.18+0.30=0.480.18 + 0.30 = 0.48. Dividing the second row by its total 0.60.6 gives 0.20.2, 0.30.3 and 0.50.5, which is the distribution of YY itself. Dividing the first row by 0.40.4 gives the same three numbers, so learning either value of XX leaves the distribution of YY unchanged.

Product law

Definition Discrete random variables XX and YY satisfy the product law when their joint PMF factors at every pair of real numbers xx and yy,

pX,Y(x,y)=pX(x) pY(y).p_{X,Y}(x, y) = p_X(x)\,p_Y(y).

Discrete XX and YY are independent if and only if the product law holds. Taking A={x}A = \{x\} and B={y}B = \{y\} in the definition of independence gives the product law. Conversely, when the product law holds, the cells with xx in AA and yy in BB add up to P(X∈A,Y∈B)P(X \in A, Y \in B), and their products pX(x) pY(y)p_X(x)\,p_Y(y) add up to P(X∈A) P(Y∈B)P(X \in A)\,P(Y \in B), so the two are equal. A pair in which xx or yy is not a possible value satisfies the law automatically, because both sides are 00, so for a table it is enough to check every cell against the margins of that same table. A single cell where the law fails proves dependence. A cell where it holds does not by itself settle the other cells, except in a table with two rows and two columns, where the margins then force all four cells to agree. In particular, if pX(x)>0p_X(x) > 0 and pY(y)>0p_Y(y) > 0 but pX,Y(x,y)=0p_{X,Y}(x, y) = 0, the variables are dependent. The joint support of independent variables is therefore the full grid of pairs of possible values, but a full grid does not prove independence.

In plain words In an independent table each cell is its row total times its column total. To test a table, compute its margins, multiply them, and compare the products with every cell.

Example Keep the margins of the device table but change the cells to 0.100.10, 0.100.10 and 0.200.20 in the first row and 0.100.10, 0.200.20 and 0.300.30 in the second. The rows still add to 0.40.4 and 0.60.6 and the columns to 0.20.2, 0.30.3 and 0.50.5, so someone who sees only the margins cannot tell this model from the independent one. The top left cell is 0.100.10, while the product law requires 0.4⋅0.2=0.080.4 \cdot 0.2 = 0.08, so in the changed model XX and YY are dependent. The bottom right cell still equals 0.6⋅0.5=0.300.6 \cdot 0.5 = 0.30 and all six cells are positive, but neither fact rescues independence. In conditional form, P(Y=0∣X=0)=0.10/0.4=0.25P(Y = 0 \mid X = 0) = 0.10/0.4 = 0.25, while P(Y=0)=0.2P(Y = 0) = 0.2.

Joint cumulative distribution function

Definition The joint cumulative distribution function of random variables XX and YY on the same probability model is

FX,Y(a,b)=P(X≤a,Y≤b)\begin{aligned} &F_{X,Y}(a, b) \\[0.4em] &= P(X \le a, Y \le b) \end{aligned}

for all real numbers aa and bb. It is defined for variables of every type, discrete or not. For discrete variables it is the sum of pX,Y(x,y)p_{X,Y}(x, y) over the pairs with x≤ax \le a and y≤by \le b, and both thresholds are included. The marginal CDFs are recovered by letting one threshold grow, since FX(a)=lim⁡b→∞FX,Y(a,b)F_X(a) = \lim_{b \to \infty} F_{X,Y}(a, b). When YY has a largest possible value, FX,Y(a,b)=FX(a)F_{X,Y}(a, b) = F_X(a) already for every bb at least that large.

In plain words Pick a threshold for each variable and ask how likely it is that both variables are at or below their thresholds. When the rows and columns of a table are listed in increasing order, this adds up a block of cells in the top left corner, including any row or column whose value equals a threshold.

Example For the independent device table, FX,Y(0,1)=P(X≤0,Y≤1)=0.08+0.12=0.20F_{X,Y}(0, 1) = P(X \le 0, Y \le 1) = 0.08 + 0.12 = 0.20, the first two cells of the top row. The value at the thresholds (0.5,1.7)(0.5, 1.7) is the same, because XX has no possible value in (0,0.5](0, 0.5] and YY has none in (1,1.7](1, 1.7]. Also FX,Y(1,1)=0.08+0.12+0.12+0.18=0.50F_{X,Y}(1, 1) = 0.08 + 0.12 + 0.12 + 0.18 = 0.50, which equals FY(1)F_Y(1) because every value of XX is at most 11, and FX,Y(a,b)=0F_{X,Y}(a, b) = 0 whenever a<0a < 0 or b<0b < 0.

CDF factorization

Definition Random variables XX and YY of any type are independent if their joint CDF factors at every pair of thresholds,

FX,Y(a,b)=FX(a) FY(b)F_{X,Y}(a, b) = F_X(a)\,F_Y(b)

for all real aa and bb. This is the general definition of independence for random variables, and for discrete variables it is equivalent to the product law. A failure at one pair of thresholds proves dependence, and agreement at one pair is only one check. When XX and YY take finitely many values, both sides stay constant as a threshold moves between consecutive possible values, and both are 00 below the smallest ones, so it is enough to check thresholds at pairs of possible values. Pairs with aa at least the largest value of XX, or bb at least the largest value of YY, always agree, because there one factor equals 11 and the joint CDF reduces to the other marginal CDF.

In plain words Every threshold block must carry the product of its two marginal CDF values. This version also works for continuous variables, where every single value has probability 00 and there is no PMF to factor.

Example In the independent device table, FX,Y(0,0)=0.08=0.4⋅0.2F_{X,Y}(0, 0) = 0.08 = 0.4 \cdot 0.2 and FX,Y(0,1)=0.20=0.4⋅0.5F_{X,Y}(0, 1) = 0.20 = 0.4 \cdot 0.5. Every other pair of possible values has a=1a = 1 or b=2b = 2, where agreement is automatic, so the CDF factors at all thresholds. In the changed table with the same margins, FX,Y(0,0)=0.10≠0.08F_{X,Y}(0, 0) = 0.10 \ne 0.08, so the variables are dependent. Yet there FX,Y(0,1)=0.10+0.10=0.20=0.4⋅0.5F_{X,Y}(0, 1) = 0.10 + 0.10 = 0.20 = 0.4 \cdot 0.5 as well, so checking that one threshold alone would have missed the dependence.

Functions of independent variables

Definition Let XX and YY be independent discrete random variables, and let gg and hh be real functions defined at their possible values. Then g(X)g(X) and h(Y)h(Y) are independent. The reason is that an event {g(X)∈C}\{g(X) \in C\} is the event {X∈A}\{X \in A\} for the set AA of values xx with g(x)∈Cg(x) \in C, and likewise for h(Y)h(Y), so the product rule for XX and YY carries over. The result needs one function of each variable. It does not make XX independent of X2X^2, and it does not make XX independent of X+YX + Y, because each of these pairs shares the input XX. Such pairs have to be checked directly.

In plain words Recoding, rescaling or squaring each output separately keeps independent outputs independent. Building one quantity from both inputs, or two quantities from the same input, can create dependence.

Example In the independent device model, let UU indicate the event {X=1}\{X = 1\} and VV indicate {Y≥1}\{Y \ge 1\}. These are functions of XX alone and of YY alone, so they are independent, and indeed P(U=1,V=1)=0.48=0.6⋅0.8P(U = 1, V = 1) = 0.48 = 0.6 \cdot 0.8. By contrast, XX and the total S=X+YS = X + Y are dependent. The total S=3S = 3 requires X=1X = 1 and Y=2Y = 2, so P(S=3)=0.30P(S = 3) = 0.30, while P(X=0,S=3)=0P(X = 0, S = 3) = 0 differs from P(X=0) P(S=3)=0.4⋅0.30=0.12P(X = 0)\,P(S = 3) = 0.4 \cdot 0.30 = 0.12.

Mutual independence of random variables

Definition Discrete random variables X1,…,XnX_1, \dots, X_n on the same probability model are mutually independent if

P(X1=x1,…,Xn=xn)=∏i=1nP(Xi=xi)\begin{aligned} &P(X_1 = x_1, \dots, X_n = x_n) \\[0.4em] &\quad = \prod_{i=1}^{n} P(X_i = x_i) \end{aligned}

for every choice of real numbers x1,…,xnx_1, \dots, x_n. Summing out any of the variables shows that every subcollection then satisfies the same product law, so this single condition on the full joint PMF covers every group of the variables. Equivalently, P(X1∈A1,…,Xn∈An)=P(X1∈A1)⋯P(Xn∈An)P(X_1 \in A_1, \dots, X_n \in A_n) = P(X_1 \in A_1) \cdots P(X_n \in A_n) for all sets A1,…,AnA_1, \dots, A_n of real numbers. The variables are pairwise independent if every two of them are independent. Mutual independence implies pairwise independence, but for three or more variables pairwise independence does not imply mutual independence. Functions of disjoint groups of mutually independent variables are independent, for example X1+X2X_1 + X_2 and X32X_3^2 when X1X_1, X2X_2 and X3X_3 are mutually independent. A sequence of random variables is IID, independent and identically distributed, if all of them have the same distribution and every finite collection of them is mutually independent.

In plain words Pairwise independence checks the variables two at a time. Mutual independence also requires that learning the values of several of them, whenever those values have positive probability, leaves the probabilities for the rest unchanged. Identical distributions say nothing about dependence on their own. Copying one fair coin toss into ten variables gives ten identically distributed variables that always agree, so they are dependent.

Example Let UU and VV be independent fair bits, and let W=1W = 1 when they differ and W=0W = 0 when they match. The four triples (0,0,0)(0, 0, 0), (0,1,1)(0, 1, 1), (1,0,1)(1, 0, 1) and (1,1,0)(1, 1, 0) each have probability 14\tfrac14, and each variable equals 11 with probability 12\tfrac12. Any two of the three variables show each of their four possible pairs of values exactly once, with probability 14=12⋅12\tfrac14 = \tfrac12 \cdot \tfrac12, so the three variables are pairwise independent. They are not mutually independent, since

P(U=0,V=0,W=0)=14≠(12)3.\begin{aligned} &P(U = 0, V = 0, W = 0) \\[0.4em] &\quad = \frac14 \ne \Bigl(\frac12\Bigr)^3 . \end{aligned}

Knowing UU and VV together determines WW. The three variables are identically distributed and pairwise independent, yet they are not IID.

Check yourself

  1. Let XX equal 00 or 11 with probability 12\tfrac12 each, and let YY equal 00 or 11 with probabilities 34\tfrac34 and 14\tfrac14, independently of XX. Build the joint table and find P(X≠Y)P(X \ne Y).
Show the answer

Each cell is its row probability times its column probability. The row for x=0x = 0 is 12⋅34=38\tfrac12 \cdot \tfrac34 = \tfrac38 and 12⋅14=18\tfrac12 \cdot \tfrac14 = \tfrac18, and the row for x=1x = 1 is the same, 38\tfrac38 and 18\tfrac18. The two rows are identical because the two values of XX are equally likely and, by independence, YY has the same distribution given either value. The values differ in the cells (0,1)(0, 1) and (1,0)(1, 0), so

P(X≠Y)=18+38=12.P(X \ne Y) = \frac18 + \frac38 = \frac12 .
  1. Another pair of binary variables has the joint table with rows 38\tfrac38, 18\tfrac18 and 18\tfrac18, 38\tfrac38. A classmate says the variables are independent, since both margins are 12\tfrac12 and 12\tfrac12 and every cell is positive. Is that right?
Show the answer

No. The margins are indeed 12\tfrac12 and 12\tfrac12 for both variables, so independence would require every cell to equal 12⋅12=14\tfrac12 \cdot \tfrac12 = \tfrac14. The top left cell is 38\tfrac38, so the product law fails and the variables are dependent. In conditional form, the second variable equals 00 with probability 3/81/2=34\tfrac{3/8}{1/2} = \tfrac34 when the first equals 00, but with probability 12\tfrac12 overall. Equal margins and a full support do not settle independence. Comparing every cell with the product of its row and column totals does.

  1. Let XX and YY be independent, each equal to −1-1 or 11 with probability 12\tfrac12, and let Z=XYZ = XY. Show that XX and ZZ are independent even though ZZ is computed from XX. Are XX, YY and ZZ mutually independent?
Show the answer

The four pairs (X,Y)(X, Y) each have probability 14\tfrac14, and Z=1Z = 1 exactly when X=YX = Y, so P(Z=1)=12P(Z = 1) = \tfrac12. For XX and ZZ, the event {X=1,Z=1}\{X = 1, Z = 1\} is {X=1,Y=1}\{X = 1, Y = 1\}, with probability 14=12⋅12\tfrac14 = \tfrac12 \cdot \tfrac12, and the other three pairs of values of XX and ZZ likewise each come from exactly one pair (X,Y)(X, Y) and have probability 14\tfrac14. So the product law holds at all four cells, and XX and ZZ are independent. By symmetry YY and ZZ are independent too, so the three variables are pairwise independent. They are not mutually independent, because P(X=1,Y=1,Z=−1)=0P(X = 1, Y = 1, Z = -1) = 0 while the product of the three probabilities is 18\tfrac18. The rule about functions does not apply here, since ZZ uses both inputs, so the independence of XX and ZZ had to be checked cell by cell.

How this lesson connects

Where this leads in Statistics