Week 1.1: Joint Probability Mass Function (Joint PMF)
2240 words
11 min read
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 1.1: Joint Probability Mass Function (Joint PMF) > **Prerequisites:** BSMA1002 (Stats 1) — Probability, PMF, random variables > **Cross-links:** BSMA3012 (Linear Stat Models) — multivariate analysis > **Core question:** When two or more random variables live in the same experiment, how do we describe their _j...

Week 1.1: Joint Probability Mass Function (Joint PMF)
Prerequisites: BSMA1002 (Stats 1) — Probability, PMF, random variables Cross-links: BSMA3012 (Linear Stat Models) — multivariate analysis Core question: When two or more random variables live in the same experiment, how do we describe their joint behaviour?
1. Intuition: Why Joint Distributions?
In Stats 1, we studied random variables one at a time. But real experiments produce multiple measurements simultaneously:
- A cricket over: runs scored (X) and wickets lost (Y)
- A patient: height (X) and weight (Y)
- A stock: today's return (X1), yesterday's return (X2) The value of one variable can influence the other. A wicket tends to reduce runs. Taller people tend to weigh more. Stocks cluster.
Key idea: The joint distribution of X and Y captures the full probabilistic relationship — not just how each behaves alone, but how they co-vary.
2. Formal Definition
2.1 Joint PMF (Two Discrete RVs)
Suppose X and Y are discrete random variables defined on the same probability space, with ranges TX and TY respectively.
>fXY(t1,t2)=P(X=t1 and Y=t2),t1∈TX,t2∈TY.>Definition (Joint PMF) The joint probability mass function of X and Y, denoted fXY, is
Properties:
- 0≤fXY(t1,t2)≤1
- t1∈TX∑t2∈TY∑fXY(t1,t2)=1
- The joint PMF completely determines all probabilistic relationships between X and Y.
Notation: We write P(X=t1,Y=t2) as shorthand for P(X=t1 and Y=t2).
3. Visualising Joint PMF: The Contingency Table
The joint PMF is most commonly displayed as a two-way table (also called a contingency table). Rows correspond to values of Y, columns to values of X:
| X\Y | y1 | y2 | … | ym |
|---|---|---|---|---|
| x1 | p11 | p12 | … | p1m |
| x2 | p21 | p22 | … | p2m |
| ⋮ | ⋮ | ⋮ | ⋱ | ⋮ |
| xn | pn1 | pn2 | … | pnm |
where pij=P(X=xi,Y=yj) and ∑i,jpij=1.
4. Worked Examples
Example 1: Toss a Fair Coin Twice
Let X1=1 if first toss is heads (0 otherwise), X2=1 if second toss is heads (0 otherwise).
Since the coin is fair and tosses are independent, each of the 4 outcomes has probability 1/4.
Joint PMF table:
| X2\X1 | 0 | 1 |
|---|---|---|
| 0 | 1/4 | 1/4 |
| 1 | 1/4 | 1/4 |
Verification: Sum of all entries =1/4+1/4+1/4+1/4=1. ✓
Example 2: Random 2-Digit Number (00–99)
Select a number uniformly from {00,01,…,99}. Define:
- X = digit in the units place (0–9)
- Y = remainder when the number is divided by 4 (0–3)
fXY(0,0)=1005=201Question: What is P(X=0,Y=0)? Solution: We need numbers ending in 0 that are divisible by 4. Numbers ending in 0 that are multiples of 4: {00,20,40,60,80} — 5 numbers.
Full joint PMF table:
| Y\X | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 1/20 | 0 | 1/20 | 0 | 1/20 | 0 | 1/20 | 0 | 1/20 | 0 |
| 1 | 0 | 1/20 | 0 | 1/20 | 0 | 1/20 | 0 | 1/20 | 0 | 1/20 |
| 2 | 1/20 | 0 | 1/20 | 0 | 1/20 | 0 | 1/20 | 0 | 1/20 | 0 |
| 3 | 0 | 1/20 | 0 | 1/20 | 0 | 1/20 | 0 | 1/20 | 0 | 1/20 |
Observations:
- X and Y are not independent — knowing X tells us something about Y (e.g., if X is odd, Y must be odd too).
- Both marginals are uniform: X∼Uniform{0,…,9}, Y∼Uniform{0,1,2,3}.
Example 3: Die Roll + Coin Tosses (Hierarchical Experiment)
(Y∣X=t)∼Binomial(t,21) fY∣X=t(y)=(yt)(21)t,y=0,1,…,t.Throw a fair die. Let X be the number shown. Toss a fair coin X times. Let Y be the number of heads. Step 1 — Marginal of X: X∼Uniform{1,2,3,4,5,6}, so fX(t)=61. Step 2 — Conditional of Y given X=t: Given X=t, we toss a coin t times, so
Step 3 — Joint PMF: Using the factorization fXY(t,y)=fX(t)⋅fY∣X=t(y),
For instance:
5. Joint PMF for More Than Two RVs
The definition extends naturally to n random variables X1,X2,…,Xn:
>fX1…Xn(t1,…,tn)=P(X1=t1,…,Xn=tn),ti∈TXi.>Definition (Joint PMF for n RVs)
Example — Toss a fair coin thrice:
| X1 | X2 | X3 | fX1X2X3 |
|---|---|---|---|
| 0 | 0 | 0 | 1/8 |
| 0 | 0 | 1 | 1/8 |
| 0 | 1 | 0 | 1/8 |
| 0 | 1 | 1 | 1/8 |
| 1 | 0 | 0 | 1/8 |
| 1 | 0 | 1 | 1/8 |
| 1 | 1 | 0 | 1/8 |
| 1 | 1 | 1 | 1/8 |
6. Formula Summary
| Concept | Formula | Example |
|---|---|---|
| Joint PMF (2 RVs) | P(X=x,Y=y)=fXY(x,y) | Coin toss: fX1X2(0,0)=1/4 |
| Total probability | ∑x∑yfXY(x,y)=1 | ∑i=01∑j=011/4=1 |
| Factorization | fXY(x,y)=fX(x)⋅fY∣X=x(y) | Die+coin: 1/6⋅(yt)(1/2)t |
| Joint PMF ( n RVs) | fX1…Xn(t1,…,tn)=P(⋂iXi=ti) | Triple coin: each outcome =1/8 |
7. Practice Questions
Q1 (Easy)
A fair coin is tossed 3 times. Let X = number of heads in first 2 tosses, Y = number of heads in last 2 tosses. Find the joint PMF of X and Y.
Strategy HintList all 8 outcomes. Count heads in positions (1,2) for X, positions (2,3) for Y. Full SolutionSample space: {HHH,HHT,HTH,HTT,THH,THT,TTH,TTT}, each with probability 1/8.Compute (X,Y) for each:
| Outcome | X | Y |
|---|---|---|
| HHH | 2 | 2 |
| HHT | 2 | 1 |
| HTH | 1 | 1 |
| HTT | 1 | 0 |
| THH | 1 | 2 |
| THT | 1 | 1 |
| TTH | 0 | 1 |
| TTT | 0 | 0 |
Now count joint probabilities:
| X\Y | 0 | 1 | 2 |
|---|---|---|---|
| 0 | 1/8 | 1/8 | 0 |
| 1 | 1/8 | 2/8 | 1/8 |
| 2 | 0 | 1/8 | 1/8 |
Check: sum =1/8+1/8+1/8+2/8+1/8+1/8+1/8=8/8=1. ✓
Q2 (Medium)
A random 3-digit number from 000 to 999 is selected uniformly. Define X = first digit (hundreds place), Y = number modulo 2, Z = last digit (units place). Find P(X=0,Y=0,Z=0).
>P(X=0,Y=0,Z=0)=100010=1001.>Strategy HintX=0 means the number is in 000–099. Y=0 means even. Z=0 means ends in 0. Count numbers in 000–099 that are even and end in 0. Full SolutionNumbers in 000–099 are {00,01,…,99} (100 numbers). Among these, those ending in 0 and even: {00,10,20,30,40,50,60,70,80,90} — 10 numbers.
Alternatively, compute via independence: X and Z are independent uniform {0,…,9}, Y depends on Z only. fXYZ(0,0,0)=fX(0)⋅fZ(0)⋅P(Y=0∣Z=0)=(1/10)(1/10)(1)=1/100.
Q3 (Hard — IPL Data)
In an IPL powerplay over, let X = number of runs, Y = number of wickets. Suppose:
Find P(X=6,Y=0) and P(X=6).
>fXY(6,0)=fY(0)⋅fX∣Y=0(6)=1613⋅71=11213.>Strategy HintUse factorization fXY(x,y)=fY(y)⋅fX∣Y=y(x). For P(X=6), sum over all y. Full SolutionPart 1: P(X=6,Y=0)
>P(X=6)=fXY(6,0)+fXY(6,1)+fXY(6,2)=1613⋅71+81⋅71+161⋅71=11213+561+1121=11213+2+1=11216=71.>Part 2: P(X=6)
So P(X=6)=1/7.
Q4 (Easy)
For the random 2-digit number example (Example 2), verify that ∑x=09∑y=03fXY(x,y)=1.
Full SolutionFrom the table: each of the 40 cells has probability 1/20 or 0. The non-zero cells are exactly those where x mod 2 = y mod 2 (both even or both odd). There are 20 such cells (5 even x values × 2 even y values + 5 odd x values × 2 odd y values). Each has 1/20.Sum =20×1/20=1. ✓
Q5 (Medium)
For the triple coin toss, find the joint PMF of X=X1+X2 (sum of first two) and Y=X2+X3 (sum of last two).
Strategy HintList all 8 outcomes, compute (X,Y) for each, then count frequencies. Full SolutionOutcomes: HHH→(2,2), HHT→(2,1), HTH→(1,1), HTT→(1,0), THH→(1,2), THT→(1,1), TTH→(0,1), TTT→(0,0).Joint PMF table:
| X\Y | 0 | 1 | 2 |
|---|---|---|---|
| 0 | 1/8 | 1/8 | 0 |
| 1 | 1/8 | 2/8 | 1/8 |
| 2 | 0 | 1/8 | 1/8 |
Sum =8/8=1. ✓
Q6 (Hard)
Let X∼Uniform{1,2,3} and independently Y∼Uniform{1,2}. Find the joint PMF of X and Y.
Full SolutionSince X and Y are independent: fXY(x,y)=fX(x)⋅fY(y).fX(x)=1/3 for x=1,2,3. fY(y)=1/2 for y=1,2.So fXY(x,y)=1/3⋅1/2=1/6 for all x∈{1,2,3},y∈{1,2}.
| Y\X | 1 | 2 | 3 |
|---|---|---|---|
| 1 | 1/6 | 1/6 | 1/6 |
| 2 | 1/6 | 1/6 | 1/6 |
Check: 3×2×1/6=1. ✓
Q7 (Exam-style)
A fair die is rolled twice. Let X = maximum of the two rolls, Y = minimum of the two rolls. Find P(X=5,Y=3).
>P(X=5,Y=3)=362=181.>Strategy HintThe ordered pairs that give max=5, min=3 are (3,5) and (5,3). Count the unordered outcomes carefully. Full SolutionThere are 6×6=36 equally likely ordered outcomes.X=5,Y=3 occurs when the two rolls are 3 and 5. The ordered pairs are (3,5) and (5,3).
Q8 (Medium)
For the 2-digit number example, compute P(X≤4,Y=1).
Full SolutionY=1 means the number modulo 4 is 1. X≤4 means units digit is 0,1,2,3,4.From the joint PMF table, for Y=1:
- X=0: 0
- X=1: 1/20
- X=2: 0
- X=3: 1/20
- X=4: 0
Sum =1/20+1/20=1/10.
Q9 (Hard — Three RVs)
Let X1,X2,X3 be i.i.d. Bernoulli(p). Find the joint PMF and verify it sums to 1.
>P(Xi=0)=1−p,P(Xi=1)=p.>Full SolutionSince Xi are independent and identically distributed Bernoulli(p):
>fX1X2X3(t1,t2,t3)=p∑ti(1−p)3−∑ti.>Joint PMF (using independence):
>(t1,t2,t3)∈{0,1}3∑p∑ti(1−p)3−∑ti=(p+(1−p))3=13=1.>Sum over all 8 outcomes:
where the identity ∑k=03(k3)pk(1−p)3−k=(p+(1−p))3 is used.
Q10 (Exam-style)
For the IPL example (Q3), find P(Y=0∣X=8).
>fX(8)=fXY(8,0)+fXY(8,1)+fXY(8,2)=1613⋅71+81⋅71+161⋅71=11213+1122+1121=11216=71.>Strategy HintUse Bayes' theorem: P(Y=0∣X=8)=fXY(8,0)/fX(8). Compute fX(8) by summing over Y. Full SolutionFirst compute fX(8):
>P(Y=0∣X=8)=fX(8)fXY(8,0)=1/713/112=11213⋅17=1613.>Now:
Next topic: Week 1.2: Marginal Distributions — Summing over rows and columns to get marginal PMFs. Join Discord NextWeek 1.2: Marginal Distributions