Most experiments produce several numbers at once, and those numbers are often related. This week builds the tools to describe such relationships.
1.1Why one random variable is not enough
Most real experiments produce several related quantities at once.
This week builds tools to describe several random variables on the same probability space, and how they relate to each other.
Example: toss a coin thrice
Xi=1 if toss i is Heads, 0 if Tails, i=1,2,3. All three are defined on the same three tosses, so they live on the same probability space. Together X1,X2,X3 fully describe the outcome. Here they are independent of each other; this will not always be true.
Figure 1. Three random variables on the same three tosses
Example: a random 2-digit number
Pick a 2-digit number 00–99. X = units digit, Y = remainder mod 4. Direct counting shows X∼Uniform{0,…,9} and Y∼Uniform{0,1,2,3}.
The key catch
If X=1 (the number ends in 1, so it is odd), then Y=0 is impossible: a multiple of 4 is always even. So X and Y are not independent: knowing X changes what is possible for Y.
Example: an IPL powerplay over
X = runs in an over, Y = wickets in the over. Intuition: if Y=0 (no wicket), X tends to be larger, because the batting side was not interrupted. Modelling exactly this kind of dependency is the goal of the chapter.
Figure 2. Runs and wickets in an over depend on each other
The whole point of the topic
Sometimes one random variable changes what you can say about another. Joint, marginal and conditional distributions are the tools that capture that relationship.
Example 1Spot the dependence
A fair die is thrown once. X = the number shown, Y=1 if the number is even and 0 otherwise. Are X and Y independent?
Solution
No. If X=3 then Y=0 for sure; if X=4 then Y=1 for sure. Knowing X completely determines Y, so they are as dependent as two variables can be.
1.2Going deeper: random variables on one experiment
A random variable is a function of the outcome. Several random variables on one experiment are several functions of the same outcome. For three tosses, X1,X2,X3 are the tosses, and S=X1+X2+X3 (number of Heads) is one more random variable on the same space.
Independent means no information is carried.X and Y are independent when learning X never changes what you can say about Y. In terms of the PMFs, fXY=fXfY in every cell.
If one determines the other, they are dependent. If Y is a function of X (like "even or odd" of a die roll), then knowing X fixes Y, so they are dependent unless Y is a constant.
The fastest proof of dependence is one impossible combination: P(X=a,Y=b)=0 although P(X=a)>0 and P(Y=b)>0.
Three or more variables. Mutual independence means the whole joint factorises: f(t1,t2,t3)=f(t1)f(t2)f(t3). The joint PMF, not the separate PMFs, carries the relationships.
1.3Exam tips and common mistakes
Exam tips
To show dependence, find one impossible combination or one cell where the product rule fails.
To show independence, you must check every cell (or give a structural reason such as separate tosses).
Say which experiment the random variables live on before comparing them.
Common mistakes
Assuming two variables are independent because their names look unrelated. Use the table.
Checking only one cell and declaring independence.
Forgetting that a variable that is a function of another is dependent on it.
Practice questions (graded-assignment style)
Q1Which pair is independent?
Multiple Choice Question (MCQ): choose the one correct option.
Two fair dice are thrown. Which pair of random variables is independent?
1
X = first die, Y = sum of the two dice
2
X = first die, Y = second die
3
X = larger of the two, Y = smaller of the two
4
X = first die, Y=2X
Solution
Idea
Independent variables come from separate, non-interacting parts of the experiment.
Option 1: if the first die is 6 the sum is at least 7, so the first die changes the sum.
Option 2: the two throws do not influence each other, so they are independent.
Option 3: if the larger is 1 the smaller must be 1, so they depend on each other.
Option 4: Y is a function of X, so it is dependent.
Answer: option 2.
Q2Tens and units digits
Multiple Choice Question (MCQ): choose the one correct option.
A number is picked uniformly from 00,01,…,99. X = tens digit, Y = units digit. Which statement is true?
1
They are dependent, because they come from the same number.
2
They are independent, because every cell has 1001=101⋅101.
3
They are dependent, because X decides Y.
4
They are independent only if the number is even.
Solution
Idea
Test the product rule, not the story.
All 100 pairs (tens, units) are equally likely, so each cell is 1/100.
Each digit is uniform on {0,…,9}, so fXfY=101⋅101=1001 in every cell.
Answer: option 2.
Q3One variable from the other
Multiple Select Question (MSQ): select all that apply.
A fair die is thrown. X = the number shown, Y=1 if X is even and 0 otherwise. Choose the correct statements.
1
Knowing X decides Y.
2
P(Y=1∣X=4)=1.
3
X and Y are independent.
4
Y∼Bernoulli(21).
Solution
Idea
Check what each statement says about the table.
Option 1 is true: Y is a function of X.
Option 2 is true: 4 is even.
Option 3 is false: for example P(X=3,Y=1)=0 while P(X=3)>0 and P(Y=1)>0.
Option 4 is true: 3 of the 6 faces are even.
Answer: options 1, 2 and 4.
Q4An impossible cell
Multiple Choice Question (MCQ): choose the one correct option.
P(X=1)>0 and P(Y=0)>0, but P(X=1,Y=0)=0. What follows?
1
X and Y are independent.
2
X and Y are dependent.
3
Nothing can be said.
4
Y is a constant.
Solution
Idea
Compare with the product rule.
Independence needs P(X=1,Y=0)=P(X=1)P(Y=0)>0.
The cell is 0, so the product rule fails and the variables are dependent.
Answer: option 2.
Revision overview
Same probability spaceSeveral random variables defined on one experiment Coin thrice: X₁, X₂, X₃
Independent?Coin tosses: yes Not always true
Why Multiple VariablesWeek 1 · Part 1
2-digit numberX = units digit, Y = mod 4 X = 1 makes Y = 0 impossible So not independent
The toolsJoint, marginal, conditional PMFs capture the relationship
Revision: why we need several random variables, on one page
The joint PMF gives the probability of every pair of values at once. It is the complete description of two random variables on the same experiment.
2.1The joint PMF
Definition: joint PMF
fXY(t1,t2)=P(X=t1,Y=t2),t1∈TX,t2∈TY
It is usually shown as a table: X's values across the top, Y's values down the side.
Two properties
Every entry is between 0 and 1.
All entries add up to 1.
Figure 3. What a joint PMF is, and the two rules it must obey
Comma means "and".P(X=t1,Y=t2) is the probability of the event (X=t1)∩(Y=t2). Summing a joint PMF over a region of the table gives the probability of that region.
Example: toss a fair coin twice
X1,X2 mark Heads (1) / Tails (0) on two independent tosses. fX1X2(0,0)=P(X1=0)P(X2=0)=21×21=41, and the same logic gives every other cell.
Figure 4. Independent fair tosses: every cell is 1/4
Example: a random 2-digit number
fXY(0,0): units digit 0 and divisible by 4 gives {00,20,40,60,80}, so 1005=201.
fXY(1,0): units digit 1 can never make a multiple of 4, so 0.
fXY(4,2): {14,34,54,74,94}, so 1005=201.
Every cell works out to 0 or 201. There are 10×4=40 cells in the table, and exactly 20 of them are nonzero: for each units digit, the tens digit can only produce two different remainders mod 4. And 20×201=1: a valid joint PMF.
Figure 5. The joint PMF of the units digit and the remainder mod 4
A correction. The source notes say "the 40 nonzero cells sum to 1". That cannot be: 40 cells of 201 would sum to 2. The table has 40 cells in total, of which 20 are nonzero.
2.2Going deeper: using a joint PMF table
Reading regions. The probability of any event about (X,Y) is the sum of the cells it contains. For P(X+Y=3), add the cells on the diagonal where the coordinates sum to 3; for P(X<Y), add the cells above the diagonal.
Finding unknown constants. Step 1: all cells add to 1. Step 2: if a probability is given, write it as a second sum. Step 3: solve the two equations together (as in GA Q7).
A function of two variables. To get the PMF of Z=g(X,Y), group the cells by the value of g and add each group. For two fair coins, Z=X1+X2 gives P(Z=0)=41, P(Z=1)=21, P(Z=2)=41.
Building a table. If the variables are independent, multiply marginals. If the experiment is a selection without replacement, count: fXY(x,y)=(nN)(xa)(yb)(n−x−yc).
Size of the table.∣TX∣×∣TY∣ cells. Many may be 0, and the nonzero ones must still add up to 1.
2.3Exam tips and common mistakes
Exam tips
Always verify that all cells add up to 1 before using the table.
Write the region as a list of cells first, then add them.
For selection problems, divide by the total number of ways, (nN).
Common mistakes
Multiplying marginals to fill a table when the variables are not independent.
Adding cells for the wrong region (for example X≥1 instead of X>1).
Forgetting that the normalising sum covers all cells, including those equal to 0.
Practice questions (graded-assignment style)
Q1Find the constant
Numerical Answer Type (NAT).
fXY(x,y)=kx+y for x,y∈{1,2}. Find k.
Solution
Idea
All cells add up to 1.
The numerators are 2,3,3,4, which add up to 12.
So k12=1 and k=12.
Answer: 12
Q2A diagonal probability
Numerical Answer Type (NAT).
With the same fXY(x,y)=12x+y, find P(X+Y=3).
Solution
Idea
Add the cells where x+y=3.
The cells are (1,2) and (2,1), each with numerator 3.
P=123+3=21.
Answer: 0.5
Q3PMF of a sum
Multiple Choice Question (MCQ): choose the one correct option.
Two fair coins are tossed independently. X1,X2 are 1 for Heads and 0 for Tails. What is the PMF of Z=X1+X2 at z=0,1,2?
1
31,31,31
2
41,21,41
3
21,0,21
4
21,41,41
Solution
Idea
Group the four equally likely cells by the value of the sum.
Z=0: only (0, 0), so 41.
Z=1: (0, 1) and (1, 0), so 42.
Z=2: only (1, 1), so 41.
Answer: option 2.
Q4Valid joint PMFs
Multiple Select Question (MSQ): select all that apply.
A joint PMF has four cells. Which lists of cell values are valid?
1
0.2, 0.3, 0.1, 0.4
2
0.5, 0.3, 0.3, −0.1
3
0.25, 0.25, 0.25, 0.25
4
0.3, 0.3, 0.3, 0.3
Solution
Idea
Every cell is in [0, 1] and they add to 1.
List 1: all in range, sum 1.0, valid.
List 2: a negative entry, invalid.
List 3: sum 1.0, valid.
List 4: sum 1.2, invalid.
Answer: options 1 and 3.
Q5Draw without replacement
Numerical Answer Type (NAT).
A bag has 3 red, 2 blue and 1 green ball. Two balls are drawn without replacement. X = number of red, Y = number of blue. Find fXY(1,1).
Solution
Idea
Count selections.
Total pairs: (26)=15.
One red and one blue: 3×2=6.
fXY(1,1)=156=0.4.
Answer: 0.4
Revision overview
Definitionf_XY(t₁, t₂) = P(X = t₁, Y = t₂) Table: X across, Y down
PropertiesEach entry in [0, 1] All entries add up to 1
Fair coin twiceIndependent: multiply Every cell = ¼
Joint PMFWeek 1 · Part 2
2-digit numberCells are 0 or 1/20 20 nonzero cells sum to 1 f(1, 0) = 0
GA Q7Normalise, use P(...) given a = 1/42, b = 2 f(1,1) = 1/14
From the joint PMF we can always recover each variable on its own by summing out the other. The reverse is not possible.
3.1Marginal PMF
Definition: marginal PMF
The PMF of X alone (ignoring Y) is its marginal PMF. It is found by summing the joint PMF over all values of the other variable. This is called marginalisation.
fX(t)=t′∑fXY(t,t′)fY(t)=t′∑fXY(t′,t)
One-way street
Joint → marginal is unique.Marginal → joint is not: many different joint PMFs can share the same marginals (shown below).
Example: toss a fair coin twice
Sum down the columns for fX1, across the rows for fX2:
Figure 7. Row sums and column sums are the marginals
Example: marginals from a joint PMF
Figure 8. Check the table adds up to 1, then sum rows and columns
Same marginals, different joints
Both tables below give marginals 21,21 for X1 and X2. Case I (independent): every cell =41. Case II: for any x between 0 and 21, f(0,0)=x, f(0,1)=21−x, f(1,0)=21−x, f(1,1)=x.
Figure 9. Marginals do not pin down the dependence structure
Case II at the extremes.x=41 is Case I. x=21 makes X1=X2 always (the coins always agree); x=0 makes them always different. All three have the same marginals.
Example: marginals and an independence check
For the random 2-digit number, summing the table confirms X∼Uniform{0,…,9} and Y∼Uniform{0,1,2,3}, matching the direct counting. Independence would need fXY=fXfY in every cell. At (0,0): fXY(0,0)=201 but fX(0)fY(0)=101⋅41=401. Since 201=401, they are not independent, matching the earlier intuition.
Test for independence
X and Y are independent exactly when fXY(t,t′)=fX(t)fY(t′) for every cell. One failing cell is enough to show they are dependent.
Example 2Marginals and independence
The joint PMF of X,Y∈{0,1} is f(0,0)=0.1, f(0,1)=0.3, f(1,0)=0.2, f(1,1)=0.4. Find both marginals and decide whether X,Y are independent.
Solution
fX(0)=0.1+0.3=0.4, fX(1)=0.2+0.4=0.6.
fY(0)=0.1+0.2=0.3, fY(1)=0.3+0.4=0.7.
Check (0,0): fX(0)fY(0)=0.4×0.3=0.12=0.1. So not independent.
3.2Going deeper: marginals and independence from a table
Margins of the table. Add each column to get one marginal and each row to get the other. They are written in the margins, hence the name, and each must add to 1.
One-way street. The joint gives the marginals uniquely, but the marginals alone cannot give the joint. Two tables can share the same margins and differ inside (Case I and Case II).
Independence gives the joint back. Only when X and Y are independent can the joint be rebuilt from the marginals, by multiplying: fXY=fXfY.
Quick dependence test. A zero cell whose row and column marginals are both positive proves dependence at once.
Full independence test. Compute fX(t)fY(t′) for every cell and compare with fXY. Stop at the first mismatch.
3.3Exam tips and common mistakes
Exam tips
Add columns for the marginal of X (across the top) and rows for the marginal of Y (down the side).
Always check that each marginal adds up to 1.
To prove independence, show the product rule in every cell.
Common mistakes
Summing along the wrong direction and getting the marginal of the other variable.
Believing that equal marginals mean equal joint tables.
Declaring independence after checking a single cell.
Practice questions (graded-assignment style)
Q1A marginal
Numerical Answer Type (NAT).
X,Y∈{0,1} with f(0,0)=0.2, f(0,1)=0.2, f(1,0)=0.3, f(1,1)=0.3. Find fX(1).
Solution
Idea
Sum over all values of Y.
fX(1)=f(1,0)+f(1,1)=0.3+0.3=0.6.
Answer: 0.6
Q2Independent or not?
Multiple Choice Question (MCQ): choose the one correct option.
For the same table, are X and Y independent?
1
Yes, because the product rule holds in every cell.
2
No, because f(0,0)=f(1,1).
3
No, because the marginals are unequal.
4
Cannot be decided.
Solution
Idea
Compute the marginals first: fX=(0.4,0.6) and fY=(0.5,0.5).
fX(0)fY(0)=0.4⋅0.5=0.2=f(0,0), and fX(0)fY(1)=0.2=f(0,1).
fX(1)fY(0)=0.6⋅0.5=0.3=f(1,0), and fX(1)fY(1)=0.3=f(1,1).
All four cells match, so they are independent.
Answer: option 1.
Q3Joint and marginal
Multiple Select Question (MSQ): select all that apply.
Choose the correct statements.
1
The joint PMF determines both marginals.
2
The two marginals always determine the joint PMF.
3
A zero cell with both marginals positive shows dependence.
4
If X and Y are independent, then fXY=fXfY.
Solution
Idea
Joint to marginal is one-way.
Option 1 is true.
Option 2 is false: Case I and Case II share marginals.
Option 3 is true: independence would need a positive product.
Option 4 is true.
Answer: options 1, 3 and 4.
Q4Same marginals, different joint
Numerical Answer Type (NAT).
Case II table with x=0.1: f(0,0)=x, f(0,1)=21−x, f(1,0)=21−x, f(1,1)=x. Find f(1,0).
Solution
Idea
Substitute x.
f(1,0)=21−0.1=0.4.
Both marginals are still 21,21, but X1,X2 are no longer independent.
Answer: 0.4
Revision overview
Marginalisationf_X(t) = Σ f_XY(t, t′) Sum over the other variable Row and column sums
One-wayJoint → marginal: unique Marginal → joint: not unique
Marginal PMFWeek 1 · Part 3
Same marginalsIndependent: all ¼ Case II: x, ½−x, ½−x, x Different dependence
Independence checkf_XY = f_X · f_Y in every cell 2-digit number: 1/20 ≠ 1/40
Once we know something about one variable, the distribution of another changes. The conditional PMF tells us exactly how: take the relevant slice of the joint and rescale it to total 1.
4.1Conditional PMF
Figure 10. Conditioning on an event, and on another random variable
Given an event A
fX∣A(t)=P(A)P((X=t)∩A)
The range of (X∣A) can differ from the range of X, depending on what A restricts.
Figure 11. Condition on X = 0: divide the first column by its total 3/8
fY∣X=0(0)=3/81/4=32, fY∣X=0(1)=3/81/8=31 (32+31=1 ✓: still a valid PMF).
fX∣Y=1(0)=1/21/8=41.
Why it is a valid PMF. Each column of the joint adds up to fX(t), so dividing that column by fX(t) makes its entries add up to 1. A conditional PMF is just a column (or row) of the joint, rescaled to total 1.
4.2Worked problems
Example: throw a die and toss coins
X∼Uniform{1,…,6} and (Y∣X=t)∼Binomial(t,21): throw a die, then toss that many fair coins and let Y be the number of heads. Then fY∣X=t(t′)=(t′t)(21)t, and joint = marginal × conditional:
fXY(t,t′)=61⋅(t′t)(21)t
Figure 12. Each column is a binomial scaled by 1/6
Takeaway
When "one variable given another" is a familiar named distribution, joint = marginal × conditional builds the whole table without listing raw outcomes.
Example: a Poisson number of coin tosses
N∼Poisson(λ); given N=n, toss a fair coin n times and let X = number of Heads. Then
Figure 13. A Poisson count thinned by a fair coin is Poisson with half the rate
How the sum collapses. Pull out k!e−λ(λ/2)k and substitute m=n−k: what is left is ∑m≥0m!(λ/2)m=eλ/2, which leaves e−λ/2.
Neat result
X∼Poisson(λ/2): a Poisson "sample size" with fair-coin trials halves the rate.
4.3Going deeper: conditioning as filtering and rescaling
The recipe. To get fY∣X=t, take the column (or row) of the joint where X=t, and divide every entry by that column total fX(t). The new entries add up to 1.
Conditioning on an event. Keep only the outcomes in A and divide by P(A). The range of (X∣A) can be smaller than the range of X.
Bayes with PMFs.fX∣Y=y(x)=fY(y)fY∣X=x(y)fX(x), where the denominator comes from total probability. This turns "given the cause, the effect" into "given the effect, the cause".
Hierarchical experiments. When stage 2 depends on stage 1 (die, then that many coins), build the joint as marginal × conditional.
Thinning (extra). If N∼Poisson(λ) and each of the N items is kept independently with probability p, then the number kept is Poisson(λp).
Undefined case. Conditioning on a value with probability 0 divides by 0, so it is undefined (the assignment convention reports 0).
4.4Exam tips and common mistakes
Exam tips
Write the conditional as "joint ÷ marginal of what is given" before substituting numbers.
Check that your conditional PMF adds up to 1.
Read the notation: fY∣X=t means the PMF of YgivenX=t.
Common mistakes
Dividing by the wrong marginal, or swapping fY∣X and fX∣Y.
Forgetting to rescale, so the entries of the "conditional" do not add up to 1.
Conditioning on an impossible value as if it were fine.
Practice questions (graded-assignment style)
Q1A conditional from a table
Numerical Answer Type (NAT).
X,Y∈{0,1} with f(0,0)=41, f(0,1)=81, f(1,0)=81, f(1,1)=21. Find fY∣X=1(1).
Solution
Idea
Take the column X = 1 and divide by its total.
fX(1)=81+21=85.
fY∣X=1(1)=5/81/2=54=0.8.
Answer: 0.8
Q2The conditional formula
Multiple Choice Question (MCQ): choose the one correct option.
Which formula gives fY∣X=t(t′)?
1
fX(t)fXY(t,t′)
2
fY(t′)fXY(t,t′)
3
fX(t)fY(t′)
4
fXY(t,t′)fX(t)
Solution
Idea
Divide by the marginal of the variable you condition on.
We condition on X=t, so we divide by fX(t).
Option 2 conditions on Y instead.
Answer: option 1.
Q3Die and coins
Numerical Answer Type (NAT).
X∼Uniform{1,…,6} and (Y∣X=t)∼Binomial(t,21). Find P(Y=0∣X=3).
Solution
Idea
Use the binomial PMF with t = 3.
(03)(21)0(21)3=81=0.125.
Answer: 0.125
Q4Joint from a conditional
Multiple Select Question (MSQ): select all that apply.
In the same die-and-coins setup, choose the correct statements.
1
P(Y=4∣X=3)=0.
2
fXY(3,1)=161.
3
fXY(2,2)=241.
4
fY∣X=3(3)=61.
Solution
Idea
Joint = marginal × conditional, with marginal 1/6.
Option 1: with 3 coins Y≤3, so it is 0.
Option 2: 61⋅(13)(21)3=61⋅83=161.
Option 3: 61⋅(22)(21)2=241.
Option 4: fY∣X=3(3)=(21)3=81, not 61.
Answer: options 1, 2 and 3.
Q5Bayes with PMFs
Numerical Answer Type (NAT).
A bag is chosen at random: bag 1 or bag 2, each with probability 21. The chance of a red ball is 0.2 in bag 1 and 0.6 in bag 2. A red ball is drawn. Find the probability that it came from bag 1.
Solution
Idea
Joint over total.
P(red)=0.5⋅0.2+0.5⋅0.6=0.4.
P(bag 1∣red)=0.40.5⋅0.2=0.40.1=0.25.
Answer: 0.25
Revision overview
Given an eventf_{X|A}(t) = P((X = t) ∩ A) / P(A) Range can shrink
Given a variablef_{Y|X=t}(t′) = f_XY(t, t′) / f_X(t) A rescaled column of the joint
When an experiment happens in stages, the distribution of the final quantity is a weighted mixture of the conditional distributions. This is the law of total probability applied to PMFs.
5.1Law of total probability with distributions
If we know the marginal of Y and every conditional (X∣Y=y), we can rebuild the marginal of X. This is the law of total probability, written with PMFs:
fX(t)=y∑fY(y)⋅fX∣Y=y(t)
Same thing as marginalisation. Since fY(y)fX∣Y=y(t)=fXY(t,y), this is just fX(t)=∑yfXY(t,y), with the joint written as marginal × conditional.
Example: IPL powerplay over
y
0
1
2
fY(y)
1613
81
161
(X∣Y=0)∼Uniform{6,…,12}
(X∣Y=1)∼Uniform{2,…,8}
(X∣Y=2)∼Uniform{0,…,6}
Each conditional has 7 equally likely values, so each conditional PMF equals 71 where it applies. Combining with fX(t)=∑fY(y)fX∣Y=y(t):
Figure 15. The mixture rises towards 6–8 runs and then falls
t
0
1
2
3
4
5
6
7
8
9
10
11
12
112⋅fX(t)
1
1
3
3
3
3
16
15
15
13
13
13
13
Check. The numerators over 112 add up to 1+1+3+3+3+3+16+15+15+13+13+13+13=112, so fX is a valid PMF. Plotting fX(t) shows a rise towards t=6–8 and a fall after: "no-wicket overs" push runs higher.
GA Q5A card, then balls
Draw a card. If it is a face card, draw 2 balls from bag A (4 red, 5 blue, 6 green). If not, draw 3 balls from bag B (8 red, 10 blue, 2 green). Y = number of red balls drawn. Find fY(1).
Solution
Figure 16. Tree: card, then red-ball probability
P(Face)=5212=133, P(Not face)=1310.
Bag A (15 balls), exactly 1 red of 2: P(Y=1∣Face)=(215)(14)(111)=10544.
Bag B (20 balls), exactly 1 red of 3: P(Y=1∣Not face)=(320)(18)(212)=9544.
Y∼Bernoulli(41). (X∣Y=0)∼Uniform{1,2} and (X∣Y=1)∼Uniform{2,3}. Find the PMF of X.
Solution
fX(1)=43⋅21=83.
fX(2)=43⋅21+41⋅21=84=21.
fX(3)=41⋅21=81.
Check: 83+84+81=1 ✓.
5.2Going deeper: a PMF as a weighted mixture
Picture.fX is a weighted average of the conditional PMFs fX∣Y=y, with weights fY(y). The weights add up to 1, so the result is again a PMF.
Method. Draw a tree: first stage branches with probabilities fY(y), then for each branch the chance of the value you want. Multiply along each path and add the paths that lead to that value.
Support. A value is possible for X if it is possible under at least one branch. The support of the mixture is the union of the conditional supports.
Overlap adds. A value allowed by several branches collects a contribution from each (like fX(2) in the IPL example).
Then reverse it. Once you have fX(t), Bayes gives the probability of a branch given the outcome: P(Y=y∣X=t)=fX(t)fY(y)fX∣Y=y(t).
5.3Exam tips and common mistakes
Exam tips
Draw the tree and label every branch with its probability before computing.
Check that the branch weights add up to 1 and that the final PMF adds up to 1.
For "which branch did it come from" questions, use the total as the denominator.
Common mistakes
Forgetting to multiply by the branch weight, and adding conditional PMFs directly.
Leaving out a branch that also allows the value.
Using a branch weight that is not a probability (weights must add to 1).
Practice questions (graded-assignment style)
Q1A mixture value
Numerical Answer Type (NAT).
Y∼Bernoulli(31). (X∣Y=0)∼Uniform{1,2} and (X∣Y=1)∼Uniform{2,3}. Find fX(2).
Solution
Idea
Both branches allow X = 2.
P(Y=0)=32, P(Y=1)=31.
fX(2)=32⋅21+31⋅21=31+61=21.
Answer: 0.5
Q2Two coins
Numerical Answer Type (NAT).
A fair coin picks coin A (Heads probability 0.9) or coin B (Heads probability 0.3), then the chosen coin is tossed once. Find the probability of Heads.
Solution
Idea
Weight each coin by 1/2.
P(H)=0.5⋅0.9+0.5⋅0.3=0.45+0.15=0.6.
Answer: 0.6
Q3Reverse the mixture
Numerical Answer Type (NAT).
In the same two-coin experiment, the toss shows Heads. Find the probability that coin A was chosen.
Solution
Idea
Branch contribution divided by the total.
P(A∣H)=0.60.5⋅0.9=0.60.45=0.75.
Answer: 0.75
Q4Facts about mixtures
Multiple Select Question (MSQ): select all that apply.
Choose the correct statements about fX(t)=∑yfY(y)fX∣Y=y(t).
1
The weights fY(y) add up to 1.
2
A value is possible for X if it is possible under at least one branch.
3
It is the same as marginalisation of the joint PMF.
4
fX need not add up to 1.
Solution
Idea
It is just marginalisation written with conditionals.
Options 1, 2 and 3 are true.
Option 4 is false: ∑tfX(t)=∑yfY(y)⋅1=1.
Answer: options 1, 2 and 3.
Revision overview
Formulaf_X(t) = Σ f_Y(y) · f_{X|Y=y}(t) Marginal rebuilt from conditionals
Why it worksf_Y · f_{X|Y} = f_XY So it is marginalisation
Total Probability with PMFsWeek 1 · Part 5
IPL overY: 13/16, 1/8, 1/16 Each X|Y uniform on 7 values f_X(0) = 1/112, f_X(12) = 13/112
GA Q5Face: 44/105 · not face: 44/95 f_Y(1) ≈ 0.4529
Nothing conceptually new happens with three or more variables: the joint PMF has one more argument, and a marginal is still "sum out everything you do not keep".
6.1Joint PMF of more than two random variables
fX1,…,Xn(t1,…,tn)=P(X1=t1 and … and Xn=tn)
The two-variable definition extends directly: nothing conceptually new.
Example: toss a fair coin thrice
All 8 combinations of (t1,t2,t3) are equally likely, so each cell is 81.
Figure 17. Three coins: every combination has probability 1/8
Example: a random 3-digit number 000–999
X = first digit, Y = number mod 2, Z = last digit. fXYZ(0,0,0): starts 0, even, ends 0, so {000,010,…,090}: 100010=1001. fXYZ(1,0,1)=0: a number ending in 1 is always odd, so Y=0 is impossible.
fXYZ(t1,t2,t3)={01001if the parity of t3 does not match t2otherwise
Check.t1 can be any of 10 digits, t3 any of 10 digits, and t2 is then forced by the parity of t3: 10×10=100 nonzero cells of 1001, which add up to 1.
Why this gets hard fast
For a 6-ball IPL over with runs X1,…,X6∈{0,…,8}, a full joint table needs 96 entries if every value 0 to 8 is allowed (the source writes 86): impossible by hand. Marginalisation and conditioning make it manageable.
6.2Marginal PMF with more than two variables
Same idea as before: sum the joint PMF over every value of all other variables.
fX1(t)=t2′,…,tn′∑fX1,…,Xn(t,t2′,…,tn′)
Example: coin thrice
fX1(0): 4 rows have t1=0, each 81, so 4×81=21. Same for fX1(1)=21.
Example: random 3-digit number
Figure 18. Each marginal is uniform
Any fixed first digit: 100 of 1000 numbers, so fX(x)=101 for each x and X is uniform. Y∼Uniform{0,1} (500 even, 500 odd). Z∼Uniform{0,…,9}.
Example: IPL powerplay, over 1 (real data)
1598 first-overs: ball 1 had 957 dots, 429 singles, 57 twos, 5 threes, 138 fours, 8 fives, 4 sixes. So P(X1=0)=1598957≈0.5989, P(X1=1)=1598429≈0.2685, P(X1=4)=1598138≈0.0864. Doing this for all 6 balls gives a full table of marginals fX1,…,fX6.
Figure 19. Marginal PMF of the runs on ball 1 (counts add up to 1598)
Check.957+429+57+5+138+8+4=1598 ✓. The source also reports that sixes and fours are most likely on ball 4 and dot balls least common on ball 6 ("batters open up as the over wears on"); that comes from the full 6-ball table, which the notes do not print.
6.3Marginalisation with three or more variables
You can also marginalise down to a pair from a joint over three variables: sum over whichever is left out.
fX1X2(t1,t2)=t3′∑fX1X2X3(t1,t2,t3′)
Example: marginalising a 3-variable joint PMF
Figure 20. Nine combinations of (t₁, t₂, t₃), each 1/9
t1
t2
t3
f
0
0
0
91
0
0
1
91
0
0
2
91
0
1
1
91
0
1
2
91
1
0
0
91
1
0
2
91
1
1
0
91
1
1
1
91
Sum out t3 to get fX1X2, then do the same for the other pairs:
Figure 21. The three pairwise marginals of the same joint PMF
Check one.fX1X2(0,0): the rows (0,0,0),(0,0,1),(0,0,2) all have t1=t2=0, so 3×91=31 ✓. Every pair table adds up to 1.
Pick the variables you want; sum out everything else.
Example 4Marginalise a three-variable PMF
Three fair coins give X1,X2,X3. Find fX1X3 and say whether X1 and X3 are independent.
Solution
fX1X3(a,c)=∑t281=82=41 for each of the four pairs (a,c).
fX1(a)fX3(c)=21⋅21=41, equal in every cell, so independent.
6.5Going deeper: tables with three or more variables
Size. If each of n variables takes m values, the joint table has mn cells. Three variables on {0,1,2} give 27 cells; a 6-ball over gives 96, far too many to write down.
Marginals step by step. To keep (X1,X2) from a 3-variable joint, sum out t3. To keep only X1, sum out t2 and t3. Summing in stages gives the same answer as summing all at once.
Pairwise is not mutual (a classic). Let X1,X2 be independent fair bits and X3=X1⊕X2 (their sum mod 2). Each pair is independent, but f(0,0,1)=0=81, so the three are not mutually independent.
Support counting. Count the nonzero cells before assigning probabilities. Here there are 4 nonzero cells of 41 each, out of 8.
Which variables are kept? Always list them first: the formula sums over all the others.
6.6Exam tips and common mistakes
Exam tips
Write down which variables you keep and which you sum out.
Check each pairwise table adds up to 1.
For independence of three variables, test f(t1,t2,t3)=f(t1)f(t2)f(t3) in every cell.
Common mistakes
Summing over the kept variable instead of the others.
The same "joint ÷ what you condition on" recipe works however many variables are involved. The only new thing is bookkeeping.
7.1Conditioning with several variables
Figure 22. Three common conditioning patterns
Recipe
Joint of everything ÷ (marginal or joint) of what you condition on.
Example: conditioning with four variables
12 equally likely (121 each) rows of (X1,X2,X3,X4):
t1
t2
t3
t4
0
0
0
0
0
0
0
1
0
0
1
1
0
0
2
0
0
1
1
0
0
1
1
1
0
1
2
0
1
0
0
1
1
0
2
0
1
0
2
1
1
1
0
1
1
1
1
0
(a) (X1∣X2=0): 7 rows have t2=0, so P(X2=0)=127; of these, 4 have t1=0 and 3 have t1=1. P(X1=0∣X2=0)=74, P(X1=1∣X2=0)=73.
(b) (X1∣X3=0,X4=1): 3 rows match (t3,t4)=(0,1); 1 has t1=0 and 2 have t1=1. P(X1=0∣X3=0,X4=1)=31, P(X1=1∣⋅)=32.
(c) (X3,X4∣X1=0): 7 rows have t1=0, so P(X1=0)=127; tally each (t3,t4) among those 7:
Figure 23. A conditional joint PMF: the 7 rows with t₁ = 0, each (t₃, t₄) counted
The step to remember. Conditioning is just filtering the rows and recounting. After filtering, the remaining rows are equally likely again, so each conditional probability is a simple count ratio.
GA Q6Which identity is always true?
Which is always correct? (1) fXYZ=fX∣Y,Z⋅fYZ; (2) fXYZ=fX∣Y,Z⋅fY∣X⋅fX; (3) fX(x)=∑xfXY(x,y); (4) fXY=fX⋅fY.
Solution
(1): this is the conditioning definition rearranged. Always true.
(2): mixes the conditioning variables incorrectly. False. (The correct chain would be fX∣Y,Z⋅fY∣Z⋅fZ, or fZ∣X,Y⋅fY∣X⋅fX.)
(3): sums over the wrong variable (it should sum over y, not x). False.
(4): holds only if X,Y are independent. Not general. False.
Answer: Option 1
7.2Going deeper: conditioning on several variables
One recipe for every pattern. Conditional = joint of everything that appears ÷ joint (or marginal) of what is given. For example fX∣Y,Z=fYZfXYZ and fXY∣Z=fZfXYZ.
Filter, then count. If the original rows are equally likely, conditioning means keeping the rows that match the given values; the survivors are still equally likely, so each conditional probability is a count ratio.
Identities that are always true.fXYZ=fX∣Y,ZfYZ=fX∣Y,ZfY∣ZfZ. Each factor conditions on everything after it in the chain.
Identities that need independence.fXY=fXfY holds only when X,Y are independent.
More given values shrink the range. The more you condition on, the fewer rows survive, so the conditional range can only get smaller.
7.3Exam tips and common mistakes
Exam tips
Match the denominator to exactly the variables that appear after the bar.
Count rows after filtering; do not reuse the original denominator.
To test a claimed identity, ask whether it is just the definition of conditional probability rearranged.
Common mistakes
Dividing by the joint of everything instead of the joint of the given variables.
Writing a factor that does not condition on all the variables that come after it.
Using fXY=fXfY without independence.
Practice questions (graded-assignment style)
Q1Condition on one variable
Numerical Answer Type (NAT).
Six equally likely rows of (X1,X2,X3): (0,0,0),(0,0,1),(0,1,1),(1,0,0),(1,1,0),(1,1,1). Find P(X1=0∣X3=1).
Solution
Idea
Filter the rows with X3=1.
Rows with X3=1: (0,0,1),(0,1,1),(1,1,1), that is 3 rows.
Two of them have X1=0, so the probability is 32≈0.67.
Answer: 0.67
Q2A conditional joint
Numerical Answer Type (NAT).
In the same six rows, find P(X1=1,X2=1∣X3=0).
Solution
Idea
Filter the rows with X3=0.
Rows with X3=0: (0,0,0),(1,0,0),(1,1,0), 3 rows.
Only (1,1,0) has X1=X2=1, so the probability is 31≈0.33.
Answer: 0.33
Q3Always true
Multiple Choice Question (MCQ): choose the one correct option.
Which identity is always true?
1
fXYZ=fX∣Y,ZfY∣ZfZ
2
fXYZ=fX∣Y,ZfYfZ
3
fX∣Y,Z=fZfXYZ
4
fXY=fXfY
Solution
Idea
Each factor conditions on everything after it.
Option 1 is the chain rule.
Option 2 drops the conditioning of Y on Z (true only with independence).
Option 3 should divide by fYZ.
Option 4 needs independence.
Answer: option 1.
Q4Facts about conditioning
Multiple Select Question (MSQ): select all that apply.
Choose the correct statements.
1
A conditional PMF adds up to 1 over the free variable.
2
The range of (X∣A) can be smaller than the range of X.
3
Conditioning on a probability-0 value is well defined.
4
If the rows are equally likely, the rows that survive filtering are equally likely.
Solution
Idea
Conditioning is filtering and rescaling.
Options 1, 2 and 4 are true.
Option 3 is false: the formula divides by 0.
Answer: options 1, 2 and 4.
Revision overview
RecipeJoint of everything ÷ (marginal or joint) of the conditioning variables
A joint PMF over many variables can be written as a product of one marginal and a chain of conditionals, in any order. This is how big joint distributions are built from small, simple pieces.
8.1Factoring the joint PMF
A complicated joint PMF can be factored into simpler conditional and marginal pieces, like factoring a number into smaller parts.
Why it works. Each step is "joint = conditional × marginal" applied to what is left: fX1…X4=fX1∣X2X3X4⋅fX2X3X4, then fX2X3X4=fX2∣X3X4⋅fX3X4, and so on. This is the chain rule of probability for random variables.
Figure 24. Joint, marginal and conditional PMFs, and how to move between them
Example: factoring a 3-variable joint PMF
Using the earlier 9-row table: fX1X2X3=fX3⋅fX2∣X3⋅fX1∣X2,X3. At (0,0,0): fX3(0)=93, fX2∣X3=0(0)=32, fX1∣X2=0,X3=0(0)=21, and 93⋅32⋅21=91 ✓ matches the table.
Order doesn't matter
You can peel off the variables in any sequence and still get a valid factorisation:
fX1X2X3=fX1⋅fX2∣X1⋅fX3∣X1,X2. At (0,0,0): fX1(0)=95, fX2∣X1=0(0)=53, fX3∣X1=0,X2=0(0)=31, and 95⋅53⋅31=91 ✓: same answer, different route.
Figure 25. Two factorisations of the same cell give the same 1/9
Why bother? When the dependence has a simple structure, the conditional pieces are small and familiar (for example (Y∣X=t)∼Binomial(t,21)), so the huge joint table never has to be written out.
Example 5Factor and multiply back
Use the 9-row table to compute fX1X2X3(1,1,1) as fX3(1)⋅fX2∣X3=1(1)⋅fX1∣X2=1,X3=1(1) and check it against 91.
Solution
Rows with t3=1: (0,0,1),(0,1,1),(1,1,1): fX3(1)=93.
Among them t2=1: (0,1,1),(1,1,1): fX2∣X3=1(1)=32.
Among those t1=1: only (1,1,1): fX1∣X2=1,X3=1(1)=21.
Product: 93⋅32⋅21=91 ✓.
8.2Going deeper: the chain rule as a calculation tool
Idea. Peel one variable at a time: fX1X2X3=fX1fX2∣X1fX3∣X1,X2. Each factor conditions on all earlier variables.
Any order works. There are n! orders for n variables (6 for three variables). Choose the order whose factors are easiest to compute.
Sequential draws. Drawing without replacement is naturally a chain. From 3 red and 2 blue, P(red, red)=53⋅42=103: the second factor conditions on the first draw.
Named pieces. If the conditionals are familiar distributions (Uniform, Binomial, Poisson), the factorisation builds the joint without ever listing the table.
Checking. Multiply the factors for one cell and compare with the table entry. Two different orders must give the same number.
8.3Exam tips and common mistakes
Exam tips
Start from one marginal, then multiply conditionals that each condition on all earlier variables.
For draws without replacement, update the counts after each draw.
Verify one cell with two different orders if time permits.
Common mistakes
Dropping a variable from the conditioning part of a factor.
Using the plain marginals fX1fX2fX3 when the variables are not independent.
Forgetting the last factor is a marginal, not a conditional.
Practice questions (graded-assignment style)
Q1Two draws
Numerical Answer Type (NAT).
A bag has 3 red and 2 blue balls. Two are drawn without replacement. Find P(both red).
Solution
Idea
Chain rule: first draw, then second given the first.
P(1st red)=53.
P(2nd red∣1st red)=42.
Product: 53⋅42=206=0.3.
Answer: 0.3
Q2Three draws in order
Numerical Answer Type (NAT).
From the same bag (3 red, 2 blue) three balls are drawn without replacement. Find the probability of the order red, blue, red.
Solution
Idea
Update the counts after every draw.
1st red: 53. Left: 2 red, 2 blue.
2nd blue: 42. Left: 2 red, 1 blue.
3rd red: 32.
Product: 53⋅42⋅32=6012=0.2.
Answer: 0.2
Q3Number of orders
Multiple Choice Question (MCQ): choose the one correct option.
In how many different orders can fX1X2X3 be factored using the chain rule?
1
3
2
6
3
9
4
1
Solution
Idea
Count the orderings of three variables.
3!=3×2×1=6.
Answer: option 2.
Q4Valid factorisations
Multiple Select Question (MSQ): select all that apply.
Which are valid factorisations of fX1X2X3 in general?
1
fX1fX2∣X1fX3∣X1,X2
2
fX3fX2∣X3fX1∣X2,X3
3
fX1fX2fX3
4
fX1∣X2,X3fX2∣X3fX3
Solution
Idea
Each factor must condition on all variables that come after (or before) it in the chain.
Options 1, 2 and 4 are chain-rule orders.
Option 3 is valid only when the three variables are independent.
Six more problems that pull the whole week together: conditionals from named distributions, joint tables, a function of two variables, drawing without replacement, Bayes with a binomial, and Poisson splitting.
Work through these on your own; each solution is hidden behind a button.
P1Which statement is wrong?
X∼Uniform{1,…,6}; Y = number of times a 2 shows in X throws of a die. One statement is wrong. Which? (a) P(Y=2∣X=2)=61 (b) P(Y=2∣X=4)=6352 (c) P(Y=5∣X=6)=655 (d) P(Y=6∣X=5)=665
Solution
(Y∣X=t)∼Binomial(t,61), so Y can never exceed X.
(d) claims P(Y=6∣X=5)=665, but with only 5 throws Y=6 is impossible: the true value is 0.
Look at (a) too.P(Y=2∣X=2)=(61)2=361, not 61, so (a) as printed is also false. The intended odd-one-out is (d), because it is impossible rather than merely mis-computed. If this appears on an exam, choose (d).
Visitors to a yoga academy each day: Poisson(mean 30). Each visitor is a girl or a boy independently, 50/50. Find P(10 boys and 15 girls) on a given day.
Solution
Figure 28. Poisson splitting
Poisson splitting: the boy-count B and girl-count G are independent Poisson, each with mean 30×0.5=15.
Why independent? Compare with the Poisson thinning example of Part 4: there only the Heads were kept, giving Poisson(λ/2). Here both outcomes are kept, and the two counts turn out to be independent Poisson variables. Verify: P(B=b,G=g)=(b+g)!e−3030b+g(bb+g)(21)b+g=b!e−1515b⋅g!e−1515g, a product.