Quiz 2

Week 2.3: Independence of Random Variables

873 words
4 min read
Python Week 1: the first filter for runtime behavior
Visual companion
Python
Type and operator map

Python Week 1: the first filter for runtime behavior

View
Revision summary

What this note is really saying

Short form

# Week 2.3: Independence of Random Variables > **Prerequisites:** Joint PMF ([Week 1.1: Joint Probability Mass Function (Joint PMF)](/notes/01-foundation-bsma1004-stats-2-week01-01-joint-pmf)), Marginal Distributions ([Week 1.2: Marginal Distributions](/notes/01-foundation-bsma1004-stats-2-week01-02-marginal-distrib...

Week 2.3: Independence of Random Variables

Prerequisites: Joint PMF (Week 1.1: Joint Probability Mass Function (Joint PMF)), Marginal Distributions (Week 1.2: Marginal Distributions) Cross-links: BSMA1002 (Stats 1) — independence of events Core question: When does knowing one random variable tell us nothing about another?

1. Intuition: The Product Condition

In Stats 1, events AA and BB are independent if P(AB)=P(A)P(B)\mathbb{P}(A \cap B) = \mathbb{P}(A)\mathbb{P}(B). For random variables, independence means every event involving XX alone is independent of every event involving YY alone. The practical equivalent: the joint PMF factorises into the product of the marginals:
>fXY(x,y)=fX(x)fY(y)for all x,y.>> f_{XY}(x,y) = f_X(x) \cdot f_Y(y) \quad \text{for all } x,y. >
If this holds, XX and YY are independent. If it fails for any (x,y)(x,y), they are dependent.

2. Formal Definition

Definition (Independence of two RVs) XX and YY are independent if for all xTXx \in T_X, yTYy \in T_Y:
>fXY(x,y)=fX(x)fY(y).>> f_{XY}(x,y) = f_X(x) \cdot f_Y(y). >
Equivalently: the conditional PMF equals the marginal PMF:
>fYX=x(y)=fY(y)for all x with fX(x)>0.>> f_{Y \mid X = x}(y) = f_Y(y) \quad \text{for all } x \text{ with } f_X(x) > 0. >
Definition (Mutual independence of nn RVs) X1,,XnX_1,\dots,X_n are mutually independent if for all tiTXit_i \in T_{X_i}:
>fX1Xn(t1,,tn)=i=1nfXi(ti).>> f_{X_1\dots X_n}(t_1,\dots,t_n) = \prod_{i=1}^n f_{X_i}(t_i). >

3. How to Check Independence

Recipe:
  1. Compute marginal PMFs fXf_X and fYf_Y by summing over the other variable.
  2. For every (x,y)(x,y) pair, check if fXY(x,y)=fX(x)fY(y)f_{XY}(x,y) = f_X(x) \cdot f_Y(y).
  3. If any pair violates this, XX and YY are dependent.
Shortcut: If there exists a cell (x,y)(x,y) where fXY(x,y)=0f_{XY}(x,y) = 0 but fX(x)>0f_X(x) > 0 and fY(y)>0f_Y(y) > 0, then XX and YY are dependent.

Examples

Y\XY \backslash X01fYf_Y
01/41/41/2
11/41/41/2
** fXf_X **1/21/2
Check: fXY(0,0)=1/4=(1/2)(1/2)=fX(0)fY(0)f_{XY}(0,0) = 1/4 = (1/2)(1/2) = f_X(0)f_Y(0). All 4 cells check out → Independent.
Y\XY \backslash X01fYf_Y
001/21/2
11/201/2
** fXf_X **1/21/2
Check: fXY(0,0)=0(1/2)(1/2)=1/4f_{XY}(0,0) = 0 \neq (1/2)(1/2) = 1/4Dependent.

4. Important Properties

If XX and YY are independent:
  1. g(X)g(X) and h(Y)h(Y) are independent for any functions g,hg, h.
  2. E[XY]=E[X]E[Y]E[XY] = E[X]E[Y]
  3. Var(X+Y)=Var(X)+Var(Y)\operatorname{Var}(X+Y) = \operatorname{Var}(X) + \operatorname{Var}(Y)
  4. Cov(X,Y)=0\operatorname{Cov}(X,Y) = 0 (but the converse is false!)
  5. MX+Y(t)=MX(t)MY(t)M_{X+Y}(t) = M_X(t) \cdot M_Y(t) (moment generating functions multiply) For mutually independent X1,,XnX_1,\dots,X_n:
  • Functions of non-overlapping subsets are independent
  • Example: g(X1,X2)g(X_1,X_2) is independent of h(X3,X4)h(X_3,X_4)

5. i.i.d. Random Variables

Definition (i.i.d.) X1,,XnX_1,\dots,X_n are independent and identically distributed (i.i.d.) if:
  1. They are mutually independent.
  2. All have the same marginal distribution: fXi=fXf_{X_i} = f_X. The i.i.d. assumption underlies most of statistical inference — it models repeated independent draws from the same population. Example: Repeated tosses of the same coin produce i.i.d. Bernoulli(pp) random variables.

6. Pairwise vs Mutual Independence

Warning: Pairwise independence does NOT imply mutual independence. Example (Even parity): X1,X2,X3X_1, X_2, X_3 each Uniform{0,1}\{0,1\}, but the triple has even parity (sum is even).
X1X_1X2X_2X3X_3Probability
0001/4
0111/4
1011/4
1101/4
  • Any pair is independent (check: fX1X2(0,0)=1/4=(1/2)(1/2)f_{X_1X_2}(0,0)=1/4 = (1/2)(1/2)).
  • But the triple is dependent: fX1X2X3(0,0,1)=0(1/2)(1/2)(1/2)=1/8f_{X_1X_2X_3}(0,0,1) = 0 \neq (1/2)(1/2)(1/2) = 1/8.

7. Mermaid: Independence Flowchart

(Diagram)

8. Practice Questions

Q1 (Easy)

Test whether XX and YY are independent from the joint PMF below:
Y\XY \backslash X012
01/91/91/9
11/91/91/9
21/91/91/9
Full Solution
Marginals: fX(x)=1/3f_X(x) = 1/3 for x=0,1,2x=0,1,2, fY(y)=1/3f_Y(y) = 1/3 for y=0,1,2y=0,1,2.
fXY(x,y)=1/9=(1/3)(1/3)=fX(x)fY(y)f_{XY}(x,y) = 1/9 = (1/3)(1/3) = f_X(x)f_Y(y) for all 9 cells → Independent.

Q2 (Medium)

For the random 2-digit number (Example 2 in Week 1.1: Joint Probability Mass Function (Joint PMF)), are XX and YY independent?
Full Solution
From the joint table: fXY(0,0)=1/20f_{XY}(0,0) = 1/20, fX(0)=1/10f_X(0) = 1/10, fY(0)=1/4f_Y(0) = 1/4.
fX(0)fY(0)=(1/10)(1/4)=1/401/20f_X(0)f_Y(0) = (1/10)(1/4) = 1/40 \neq 1/20Dependent.
Indeed, fXY(1,0)=0f_{XY}(1,0) = 0 while fX(1)fY(0)=(1/10)(1/4)=1/40f_X(1)f_Y(0) = (1/10)(1/4) = 1/40 confirms dependence.

Q3 (Hard — Even Parity)

Verify that X1X_1 and X2X_2 are independent in the even parity example, but X1,X2,X3X_1,X_2,X_3 are not mutually independent.
Full Solution
From the table: fX1X2(0,0)=1/4f_{X_1X_2}(0,0) = 1/4, fX1(0)=1/2f_{X_1}(0) = 1/2, fX2(0)=1/2f_{X_2}(0) = 1/21/4=(1/2)(1/2)1/4 = (1/2)(1/2)fX1X2(0,1)=1/4=(1/2)(1/2)f_{X_1X_2}(0,1) = 1/4 = (1/2)(1/2)fX1X2(1,0)=1/4=(1/2)(1/2)f_{X_1X_2}(1,0) = 1/4 = (1/2)(1/2)fX1X2(1,1)=1/4=(1/2)(1/2)f_{X_1X_2}(1,1) = 1/4 = (1/2)(1/2)
So pairwise independent.
But fX1X2X3(0,0,1)=0(1/2)3=1/8f_{X_1X_2X_3}(0,0,1) = 0 \neq (1/2)^3 = 1/8. Not mutually independent.

Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.