Weeks
Statistics 2Week 2 · Independence and Functions of One Variable (Part 1 of 2)
Week 2 · Part 1 of 2 · Notes

Statistics for
Data Science 2

Independence of two and of many random variables, and functions of one random variable: stem plots, the table method, one-to-one, many-to-one and clipping functions, with every worked example solved. This is Part 1 of 2 of the Week 2 notes.

16 chapters71 worked examples~59 min read
IndependenceJoint PMFProduct rulePairwiseTable method

Chapters

  1. 01From Independent Events to Independent Random VariablesIndependence
  2. 02Checking Independence From a Joint PMF TableIndependence
  3. 03Independence in a Real Setting: A Random 2-Digit NumberIndependence
  4. 04Independent vs Dependent: The Working RulesIndependence
  5. 05Independence: Revision SheetRevision
  6. 06Independence for n Random VariablesMany variables
  7. 07A Random 3-Digit NumberMany variables
  8. 08Even Parity: Pairwise Independent, Not IndependentMany variables
  9. 09Useful Consequences and Try TheseMany variables
  10. 10Many variables: Revision SheetRevision
  11. 11Seeing a PMF: Stem PlotsFunctions of one variable
  12. 12The Table MethodFunctions of one variable
  13. 13One-to-One FunctionsFunctions of one variable
  14. 14Many-to-One FunctionsFunctions of one variable
  15. 15Try These: Clipping FunctionsTry these
  16. 16Functions of one variable: Revision SheetRevision
01
Independence

From Independent Events to Independent Random Variables

When does knowing one random variable tell you nothing about another? The definition and the product rule.

This chapter asks one question: when does knowing the value of one random variable tell you nothing about another? The answer is independence. We carry the idea over from events, state the definition, and see that it can be tested cell by cell on a joint PMF.

1.1Recap: independent events

Two events AA and BB are independent when P(A∩B)=P(A) P(B)P(A \cap B) = P(A)\,P(B). Knowing that BB happened does not change the probability of AA.

A random variable defines events too: {X=3}\{X = 3\}, {Y≤1}\{Y \le 1\}, {X is even}\{X \text{ is even}\}. So the idea of independence extends naturally from events to random variables.

1.2The definition

Independent random variables

Let XX and YY be random variables on the same probability space, with ranges TXT_X and TYT_Y. XX and YY are independent if every event defined using XX alone is independent of every event defined using YY alone. Equivalently, with joint PMF fXYf_{XY}:

fXY(t1,t2)=fX(t1) fY(t2)for all t1∈TX, t2∈TYf_{XY}(t_1, t_2) = f_X(t_1)\, f_Y(t_2) \quad \text{for all } t_1 \in T_X,\ t_2 \in T_Y
Remember. The word all matters. The product rule must hold for every pair (t₁, t₂), not just a few of them.

1.3Compare with the factorisation that always holds

For any two random variables the joint PMF factors as a marginal times a conditional. Independence is the special case where the conditional equals the marginal:

Joint PMFConditional PMF
General (always)fXY(t1,t2)=fX(t1) fY∣X=t1(t2)f_{XY}(t_1,t_2) = f_X(t_1)\, f_{Y\mid X=t_1}(t_2)fY∣X=t1(t2)=fXY(t1,t2)fX(t1)f_{Y\mid X=t_1}(t_2) = \dfrac{f_{XY}(t_1,t_2)}{f_X(t_1)}
IndependentfXY(t1,t2)=fX(t1) fY(t2)f_{XY}(t_1,t_2) = f_X(t_1)\, f_Y(t_2)fY∣X=t1(t2)=fY(t2)f_{Y\mid X=t_1}(t_2) = f_Y(t_2)
In words

For independent X and Y the joint PMF is the product of the marginals, and every conditional PMF equals the marginal PMF. Learning X = t₁ does not change the distribution of Y at all.

1.4Going deeper

  • Symmetric (extra). XX independent of YY means YY independent of XX. The condition fXY=fXfYf_{XY} = f_X f_Y treats both the same way, so it also gives fX∣Y=t2=fXf_{X\mid Y=t_2} = f_X.
  • Support is a full grid (extra). If XX and YY are independent, then fXY(t1,t2)>0f_{XY}(t_1,t_2) > 0 exactly when fX(t1)>0f_X(t_1) > 0 and fY(t2)>0f_Y(t_2) > 0. So the non-zero cells always form a complete rectangle. A zero cell sitting where both its row total and column total are positive can never happen. This is the fast dependence test of Chapter 4.
  • Why "same probability space" (extra). The joint PMF only makes sense if both random variables are defined on the same experiment, such as the same random pick of a student.

1.5Exam tips and common mistakes

Exam tips
  • Write the target first: fXY(t1,t2)=?fX(t1) fY(t2)f_{XY}(t_1,t_2) \overset{?}{=} f_X(t_1)\,f_Y(t_2), then compute the two marginals from the table.
  • If a question gives independence, use it to fill in cells: each unknown joint value is a row marginal times a column marginal.
Common mistakes
  • Calling variables independent after checking only one or two cells.
  • Judging independence from the marginals alone: the same marginals fit both independent and dependent tables (Chapter 2, Example 3).
  • Mixing up independent with identically distributed: independence is about the joint PMF, not whether X and Y have the same marginal.

Practice questions (graded-assignment style)

Q1Using independence

Numerical Answer Type (NAT).

XX and YY are independent with fX(2)=0.3f_X(2) = 0.3 and fY(5)=0.4f_Y(5) = 0.4. Find fXY(2,5)f_{XY}(2, 5).

Solution
Idea

Joint is the product of the marginals.

  • fXY(2,5)=0.3×0.4=0.12f_{XY}(2,5) = 0.3 \times 0.4 = 0.12.
  • Answer: 0.12
Q2Conditional equals marginal

Numerical Answer Type (NAT).

XX and YY are independent, fX(1)=0.4f_X(1) = 0.4 and fY∣X=1(0)=0.7f_{Y\mid X=1}(0) = 0.7. Find fXY(1,0)f_{XY}(1, 0).

Solution
Idea

Always fXY=fX⋅fY∣Xf_{XY} = f_X \cdot f_{Y\mid X}.

  • The factorisation always holds: fXY(1,0)=0.4×0.7=0.28f_{XY}(1,0) = 0.4 \times 0.7 = 0.28.
  • By independence fY∣X=1(0)=fY(0)=0.7f_{Y\mid X=1}(0) = f_Y(0) = 0.7, so the same product is also fX(1)fY(0)f_X(1) f_Y(0).
  • Answer: 0.28
Q3Which equation?

Multiple Choice Question (MCQ): choose the one correct option.

Which equation is the definition of independence of X and Y?

1
fXY(t1,t2)=fX(t1)+fY(t2)f_{XY}(t_1,t_2) = f_X(t_1) + f_Y(t_2)
2
fXY(t1,t2)=fX(t1) fY(t2)f_{XY}(t_1,t_2) = f_X(t_1)\, f_Y(t_2) for all t1,t2t_1, t_2
3
fX=fYf_X = f_Y
4
fXY(t1,t2)=fX(t1) fY(t2)f_{XY}(t_1,t_2) = f_X(t_1)\, f_Y(t_2) for one pair t1,t2t_1, t_2
Solution
Idea

The product rule must hold for every pair.

  • Option 2 is the definition. Option 4 only asks for one pair, which is not enough.
  • Options 1 and 3 are not the definition (a sum is not a product, and equal marginals do not mean independent).
  • Answer: option 2.
Q4Consequences of independence

Multiple Select Question (MSQ): select all that apply.

Suppose X and Y are independent. Choose the correct statements.

1
Every conditional PMF fY∣X=t1f_{Y\mid X=t_1} equals fYf_Y
2
The joint PMF is the product of the marginals
3
fXf_X must equal fYf_Y
4
Learning XX changes the distribution of YY
Solution
Idea

Recall the two forms of the definition.

  • Statements 1 and 2 are the two equivalent forms.
  • Statement 3 is false: the marginals can be completely different. Statement 4 is the opposite of independence.
  • Answer: options 1 and 2.
Next · IndependenceChecking Independence From a Joint PMF Table
02
Independence

Checking Independence From a Joint PMF Table

Compare the joint PMF with the product of its marginals, with one independent and two dependent tables.

In practice the joint PMF comes as a table, and we test independence by comparing it with the product of its own marginals.

2.1How to read the table

In every table below, columns are values t1t_1 of XX, and rows are values t2t_2 of YY. The last column holds fYf_Y (the row sums) and the last row holds fXf_X (the column sums).

  1. Add each row to get f_Y and each column to get f_X. Check that both add up to 1.
  2. For a cell, multiply its column marginal and its row marginal, and compare with the entry: fX(t1) fY(t2)f_X(t_1)\, f_Y(t_2) against fXY(t1,t2)f_{XY}(t_1,t_2).
  3. One failing cell means dependent. Only when every cell matches are the variables independent.
Is any cell 0 while its row totaland column total are both > 0?YesDEPENDENTNoDoes fXY = fX · fYhold in every cell?FailsDEPENDENTYes, in every cellINDEPENDENT
Figure 1. How to decide independence from a joint table

2.2Example 2: dependent

Example 2 in 32nds: the joint PMF and the product of marginalsjoint fXYproduct fX · fYXY01016/328/3214/324/32XY01015/329/3215/323/32≠(0, 0): 16/32 against 15/32: the product rule fails
Figure 2. Example 2 in 32nds: the joint PMF and the product of the marginals

The other three cells also fail (832\tfrac{8}{32} against 932\tfrac{9}{32}, 432\tfrac{4}{32} against 532\tfrac{5}{32}, 432\tfrac{4}{32} against 332\tfrac{3}{32}). Both tables add up to 3232\tfrac{32}{32}, so a mismatch in one cell is made up by the others.

2.3The conditional view

Independence also says the conditional PMF of YY given X=t1X = t_1 equals the marginal for every t1t_1. Example 1 passes; Example 2 fails: fY∣X=0=(45,15)f_{Y\mid X=0} = (\tfrac45, \tfrac15) and fY∣X=1=(23,13)f_{Y\mid X=1} = (\tfrac23, \tfrac13), neither of which is fY=(34,14)f_Y = (\tfrac34, \tfrac14).

Does knowing X change the distribution of Y?Example 1 (independent): fY|X=t = fY1/201/21fY1/201/21fY|X=01/201/21fY|X=1Example 2 (dependent): fY|X=t differs from fY3/401/41fY4/501/51fY|X=02/301/31fY|X=1samechanges
Figure 3. Knowing X changes the distribution of Y in Example 2 but not in Example 1

2.4Going deeper

  • Fewer checks are enough in principle (extra). For an m×nm \times n table, once the cells in the first m−1m-1 rows and n−1n-1 columns match the product, the last row and column match automatically, because the marginals force the totals. In the exam still check every cell unless it is cheaper to find one failing cell.
  • Use common denominators (extra). Comparing 99/576 with 96/576 is easier than comparing decimals. Convert both sides to one denominator before deciding that two products differ.

2.5Exam tips and common mistakes

Exam tips
  • Pick the cell with the simplest numbers first (often the top-left); if it fails you are done.
  • When the table has a parameter, find the value that fixes one cell, then check that every other cell agrees.
Common mistakes
  • Using a row total as a column marginal. Multiply the total of the cell's column (f_X) by the total of its row (f_Y).
  • Stopping at a cell that matches and declaring independence.
  • Solving for the parameter from one cell but not checking the others.

Practice questions (graded-assignment style)

Q1Decide independence

Multiple Choice Question (MCQ): choose the one correct option.

The joint PMF has fXY(0,0)=0.1, fXY(1,0)=0.3, fXY(0,1)=0.4, fXY(1,1)=0.2f_{XY}(0,0) = 0.1,\ f_{XY}(1,0) = 0.3,\ f_{XY}(0,1) = 0.4,\ f_{XY}(1,1) = 0.2 (first argument XX, second YY). Are XX and YY independent?

1
Yes
2
No
3
Cannot be decided from this table
4
Only if the marginals are equal
Solution
Idea

Compute both marginals and test one cell.

  • fX(0)=0.1+0.4=0.5f_X(0) = 0.1 + 0.4 = 0.5 and fY(0)=0.1+0.3=0.4f_Y(0) = 0.1 + 0.3 = 0.4.
  • fX(0) fY(0)=0.2≠0.1=fXY(0,0)f_X(0)\,f_Y(0) = 0.2 \ne 0.1 = f_{XY}(0,0), so the variables are dependent.
  • Answer: option 2.
Q2Make it independent

Numerical Answer Type (NAT).

The joint PMF is fXY(0,0)=a, fXY(1,0)=0.2−a, fXY(0,1)=0.5−a, fXY(1,1)=0.3+af_{XY}(0,0) = a,\ f_{XY}(1,0) = 0.2 - a,\ f_{XY}(0,1) = 0.5 - a,\ f_{XY}(1,1) = 0.3 + a. For what value of aa are XX and YY independent?

Solution
Idea

Find the marginals, then fix one cell.

  • fX(0)=a+(0.5−a)=0.5f_X(0) = a + (0.5 - a) = 0.5 and fY(0)=a+(0.2−a)=0.2f_Y(0) = a + (0.2 - a) = 0.2, whatever aa is.
  • Independence needs a=fX(0)fY(0)=0.5×0.2=0.1a = f_X(0) f_Y(0) = 0.5 \times 0.2 = 0.1.
  • Check the others at a=0.1a = 0.1: 0.1=0.5×0.20.1 = 0.5 \times 0.2, 0.4=0.5×0.80.4 = 0.5 \times 0.8, 0.4=0.5×0.80.4 = 0.5 \times 0.8. All match.
  • Answer: 0.1
Q3Example 2 facts

Multiple Select Question (MSQ): select all that apply.

For the joint PMF of Example 2 (fXY(0,0)=12, fXY(1,0)=14, fXY(0,1)=fXY(1,1)=18f_{XY}(0,0) = \tfrac12,\ f_{XY}(1,0) = \tfrac14,\ f_{XY}(0,1) = f_{XY}(1,1) = \tfrac18), choose the correct statements.

1
fX(0)=58f_X(0) = \tfrac58
2
fY(0)=34f_Y(0) = \tfrac34
3
XX and YY are independent
4
fX(0) fY(0)=1532f_X(0)\,f_Y(0) = \tfrac{15}{32}
Solution
Idea

Add the columns and rows.

  • fX(0)=12+18=58f_X(0) = \tfrac12 + \tfrac18 = \tfrac58, fY(0)=12+14=34f_Y(0) = \tfrac12 + \tfrac14 = \tfrac34, and their product is 1532\tfrac{15}{32}.
  • The product differs from fXY(0,0)=1632f_{XY}(0,0) = \tfrac{16}{32}, so statement 3 is false.
  • Answer: options 1, 2 and 4.
Q4Which x?

Numerical Answer Type (NAT).

In Example 3 take x=18x = \tfrac18. What is fXY(1,0)f_{XY}(1, 0), the cell with 12−x\tfrac12 - x? (Give it as a decimal.)

Solution
Idea

Compute 12−18\tfrac12 - \tfrac18.

  • 12−18=38=0.375\tfrac12 - \tfrac18 = \tfrac38 = 0.375, not 14\tfrac14, so at this xx the variables are dependent.
  • Answer: 0.375
Next · IndependenceIndependence in a Real Setting: A Random 2-Digit Number
03
Independence

Independence in a Real Setting: A Random 2-Digit Number

A counting example where a natural pair of variables turns out to be dependent.

Here independence is tested on real numbers instead of a ready-made table. We build the joint distribution by counting, and find that a very natural pair of digits-based random variables is not independent.

3.1The experiment

Example 4Units digit and remainder mod 4

A number from 00 to 99 is picked uniformly at random. Let X = the units digit and Y = the remainder when the number is divided by 4. Are X and Y independent?

Solution
  1. Marginals. Each units digit appears in exactly 10 of the 100 numbers, and each remainder appears in exactly 25 (since 4 divides 100).
  2. So X∼Uniform{0,1,…,9}X \sim \text{Uniform}\{0,1,\dots,9\} and Y∼Uniform{0,1,2,3}Y \sim \text{Uniform}\{0,1,2,3\}.
  3. Look for an impossible pair. If the units digit is 1, the number is odd, so it cannot be a multiple of 4.
  4. Hence fXY(1,0)=0f_{XY}(1,0) = 0, but fX(1) fY(0)=110⋅14=140≠0f_X(1)\,f_Y(0) = \tfrac1{10} \cdot \tfrac14 = \tfrac1{40} \ne 0.
  5. X and Y are not independent. The units digit fixes whether the number is odd or even, and that restricts the remainder mod 4.

3.2The whole joint table, by counting

Counting how many of the 100 numbers have each (units digit, remainder) pair gives the full picture. Each cell of the figure shows how many numbers fall there.

Numbers 00 to 99 by units digit X (across) and remainder Y mod 4 (down)XY012345678905050505050105050505052505050505030505050505units digit XIndependent would need 2.5 in every cell (100 × 1/10 × 1/4).Instead half the cells are 0: an even digit allows only remainders 0 and 2.
Figure 4. Numbers 00 to 99 by units digit and remainder mod 4
  • For an even units digit the number is even, so the remainder is 0 or 2 (5 numbers each). For example units digit 2 and remainder 2: 2, 22, 42, 62, 82.
  • For an odd units digit the remainder is 1 or 3 (5 numbers each).
  • In an independent table every cell would hold 100×110×14=2.5100 \times \tfrac1{10} \times \tfrac14 = 2.5 numbers, which is not even a whole number. Here half the cells hold 0 and half hold 5.
Check. The numbers add up: 20 non-zero cells × 5 = 100. Each row total is 25 and each column total is 10, matching the marginals.

3.3Related pairs, to build intuition

Example 5Tens digit and units digit (extra)

For the same random number let X be the tens digit and Y the units digit. Are they independent?

Solution
  1. Both are Uniform{0,…,9}\text{Uniform}\{0,\dots,9\}, so each marginal value is 110\tfrac1{10}.
  2. Each pair (tens, units) is exactly one number out of 100, so every cell is 1100\tfrac1{100}.
  3. 1100=110⋅110\tfrac1{100} = \tfrac1{10} \cdot \tfrac1{10} for all 100 cells: independent.
Example 6Units digit and remainder mod 5 (extra)

Now let Y be the remainder when the number is divided by 5. Are the units digit X and Y independent?

Solution
  1. The units digit decides the remainder mod 5: the remainder is the units digit mod 5.
  2. So fXY(1,0)=0f_{XY}(1,0) = 0, but fX(1)=110f_X(1) = \tfrac1{10} and fY(0)=20100=15f_Y(0) = \tfrac{20}{100} = \tfrac15, giving a product 150≠0\tfrac1{50} \ne 0.
  3. Dependent, and more strongly than in Example 4: here X completely determines Y.

Compare the three: tens and units digits carry no information about each other (independent), the units digit says a little about the remainder mod 4 (dependent), and it says everything about the remainder mod 5 (dependent).

3.4Independence in real modelling

The same thinking applies in modelling. Let X = runs scored in a cricket over and Y = wickets taken in that over. These are not independent: an over with many wickets tends to have fewer runs. Deciding whether an independence assumption is reasonable is a routine part of building a model from real data.

  • Independent assumptions make life simple. If two variables are independent the joint PMF is just the two marginals multiplied. If they are not, you must model the whole joint table.
  • Real data is a sanity check (extra). Ask whether one variable physically limits the other, as the units digit limits the remainder. If yes, expect dependence.

3.5Exam tips and common mistakes

Exam tips
  • Ask first: does one variable restrict the values of the other? If so, look for an impossible pair and use it.
  • For uniform sample spaces, count cases instead of using probability formulas.
Common mistakes
  • Checking only the marginals: both uniform marginals look "perfectly independent" but the pair is not.
  • Forgetting that 4 divides 100, which is why each remainder appears exactly 25 times.

Practice questions (graded-assignment style)

Q1Units digit 1, remainder 0

Numerical Answer Type (NAT).

How many of the numbers 00 to 99 have units digit 1 and leave remainder 0 when divided by 4?

Solution
Idea

Units digit 1 means the number is odd.

  • An odd number cannot be a multiple of 4, so there are 0 such numbers.
  • That makes fXY(1,0)=0f_{XY}(1,0) = 0, which is the impossible pair used in Example 4.
  • Answer: 0
Q2Units digit 2, remainder 2

Numerical Answer Type (NAT).

How many of the numbers 00 to 99 have units digit 2 and remainder 2 when divided by 4?

Solution
Idea

List the numbers ending in 2.

  • The numbers ending in 2 are 2, 12, 22, ..., 92. Their remainders mod 4 alternate 2, 0, 2, 0, ...
  • The ones with remainder 2 are 2, 22, 42, 62, 82: five numbers, so f_XY(2,2) = 5/100.
  • Answer: 5
Q3Tens and units digit

Multiple Choice Question (MCQ): choose the one correct option.

For a uniformly random number from 00 to 99, the tens digit and the units digit are:

1
Independent
2
Dependent, because both come from the same number
3
Dependent, because the sum of the digits is fixed
4
Cannot be decided
Solution
Idea

Count the numbers in each (tens, units) cell.

  • Every (tens, units) pair is exactly one number, so each cell is 1100=110⋅110\tfrac1{100} = \tfrac1{10} \cdot \tfrac1{10}.
  • Coming from the same experiment does not make variables dependent.
  • Answer: option 1.
Q4Digits statements

Multiple Select Question (MSQ): select all that apply.

Choose the correct statements about X = units digit and Y = remainder mod 4.

1
fX(t)=110f_X(t) = \tfrac1{10} for each digit tt
2
fY(r)=14f_Y(r) = \tfrac14 for each remainder rr
3
fXY(1,0)=140f_{XY}(1,0) = \tfrac1{40}
4
fXY(1,0)=0f_{XY}(1,0) = 0
Solution
Idea

Use counting and the odd/even argument.

  • Statements 1 and 2 are the marginals found in Example 4.
  • Statement 4 is the impossible pair. Statement 3 is the product fX(1)fY(0)f_X(1) f_Y(0), not the joint value.
  • Answer: options 1, 2 and 4.
Next · IndependenceIndependent vs Dependent: The Working Rules
04
Independence

Independent vs Dependent: The Working Rules

The rules for proving each, the fastest checks, and the "Try these" questions worked out.

This chapter collects the working rules and uses them on the "Try these" questions of the lecture, with every step shown.

4.1The working rules

To show independenceVerify fXY(t1,t2)=fX(t1) fY(t2)f_{XY}(t_1,t_2) = f_X(t_1)\,f_Y(t_2) for every t1∈TXt_1 \in T_X, t2∈TYt_2 \in T_Y.
To show dependenceOne pair is enough: find t1,t2t_1, t_2 with fXY(t1,t2)≠fX(t1) fY(t2)f_{XY}(t_1,t_2) \ne f_X(t_1)\,f_Y(t_2).

4.2The fastest dependence check: a zero cell

Look for a cell with fXY=0f_{XY} = 0 whose row total and column total are both non-zero. Then fXY=0f_{XY} = 0 but fXfY>0f_X f_Y > 0, so the product rule fails and the variables are dependent. This is exactly what happened in Example 4 with the pair (1, 0).

Careful. A zero cell alone is not enough: if its whole row (or column) is zero, the product is also 0 and nothing fails. And the converse is false: a table with no zero cells can still be dependent (Example 2).

4.3A visual shortcut: the rows

X and Y are independent exactly when every row of the joint table is a multiple of the same row, namely fXf_X. Row t2t_2 must equal fY(t2)f_Y(t_2) times the vector fXf_X. If two rows have different shapes, the variables are dependent.

Conditional PMF of X in each row (row divided by its total)Q1: every row has the same shape (independent)Y = 01/201/411/42Y = 11/201/411/42Y = 21/201/411/42Q2(b): the rows have different shapes (dependent)Y = 04/902/913/92Y = 11/201/411/42Y = 21/301/311/32
Figure 5. Conditional PMF of X in each row: the same shape when independent

Why it works (extra). If fXY(t1,t2)=c(t2) fX(t1)f_{XY}(t_1,t_2) = c(t_2)\,f_X(t_1) in every row, then adding over t1t_1 gives fY(t2)=c(t2)⋅1f_Y(t_2) = c(t_2)\cdot 1, so c(t2)=fY(t2)c(t_2) = f_Y(t_2) and the product rule holds. Reading it the other way, row t2t_2 divided by its total is the conditional PMF fX∣Y=t2f_{X\mid Y=t_2}, and independence says that is always fXf_X.

4.4Try these: worked solutions

Example 7Try these Q1: a 3 by 3 table

Check whether X and Y are independent, given the joint PMF below.

Solution
Y\XY\backslash X012
01/61/121/12
11/41/81/8
21/121/241/24
  1. Row sums. With denominator 24: fY(0)=424+224+224=824=13f_Y(0) = \tfrac4{24} + \tfrac2{24} + \tfrac2{24} = \tfrac8{24} = \tfrac13, fY(1)=624+324+324=12f_Y(1) = \tfrac6{24} + \tfrac3{24} + \tfrac3{24} = \tfrac12, fY(2)=224+124+124=16f_Y(2) = \tfrac2{24} + \tfrac1{24} + \tfrac1{24} = \tfrac16.
  2. Column sums. fX(0)=424+624+224=12f_X(0) = \tfrac4{24} + \tfrac6{24} + \tfrac2{24} = \tfrac12, fX(1)=224+324+124=14f_X(1) = \tfrac2{24} + \tfrac3{24} + \tfrac1{24} = \tfrac14, fX(2)=14f_X(2) = \tfrac14.
  3. Sanity check. 13+12+16=1\tfrac13 + \tfrac12 + \tfrac16 = 1 and 12+14+14=1\tfrac12 + \tfrac14 + \tfrac14 = 1.
  4. Products f_X(t₁) f_Y(t₂): row 0 is 1/6, 1/12, 1/12; row 1 is 1/4, 1/8, 1/8; row 2 is 1/12, 1/24, 1/24.
  5. Compare cell by cell. All nine products match the given joint PMF exactly.
  6. Row shortcut. Every row is a multiple of fX=(12,14,14)f_X = (\tfrac12,\tfrac14,\tfrac14): row 0 is 13\tfrac13 of it, row 1 is 12\tfrac12 of it, row 2 is 16\tfrac16 of it.
  7. Answer: X and Y are independent.
Example 8Try these Q2(a): a zero cell

Decide whether X and Y are independent for this joint PMF.

Solution
Y\XY\backslash X012
001/81/8
11/81/81/8
21/81/81/8
  1. Spot the zero cell. f_XY(0,0) = 0. Now check whether its row and column have non-zero totals.
  2. Marginals. fX(0)=0+18+18=14f_X(0) = 0 + \tfrac18 + \tfrac18 = \tfrac14 and fY(0)=0+18+18=14f_Y(0) = 0 + \tfrac18 + \tfrac18 = \tfrac14.
  3. Compare. fXY(0,0)=0f_{XY}(0,0) = 0 but fX(0) fY(0)=14⋅14=116f_X(0)\,f_Y(0) = \tfrac14 \cdot \tfrac14 = \tfrac1{16}. This is the "zero cell with non-zero marginals" case.
  4. Answer (a): dependent.
Example 9Try these Q2(b): a near miss

Decide whether X and Y are independent for this joint PMF.

Solution
Y\XY\backslash X012
01/61/121/8
11/41/81/8
21/241/241/24
  1. Marginals (denominator 24): fX(0)=424+624+124=1124f_X(0) = \tfrac4{24} + \tfrac6{24} + \tfrac1{24} = \tfrac{11}{24}, fX(1)=624f_X(1) = \tfrac6{24}, fX(2)=724f_X(2) = \tfrac7{24}; fY(0)=924f_Y(0) = \tfrac9{24}, fY(1)=1224f_Y(1) = \tfrac{12}{24}, fY(2)=324f_Y(2) = \tfrac3{24}. Both sets add to 2424=1\tfrac{24}{24} = 1.
  2. Test the cell (0,0)(0,0). fX(0) fY(0)=1124⋅924=99576f_X(0)\,f_Y(0) = \tfrac{11}{24} \cdot \tfrac9{24} = \tfrac{99}{576}.
  3. Conclude. fXY(0,0)=16=96576≠99576f_{XY}(0,0) = \tfrac16 = \tfrac{96}{576} \ne \tfrac{99}{576}, so the product rule fails at (0,0)(0,0).
  4. Row shortcut agrees. Row 0 is (16,112,18)∝(4,2,3)(\tfrac16,\tfrac1{12},\tfrac18) \propto (4,2,3), while row 1 is (14,18,18)∝(2,1,1)(\tfrac14,\tfrac18,\tfrac18) \propto (2,1,1). Different shapes, so dependent.
  5. Answer (b): dependent.

This table is very close to the independent one in Q1: only two cells differ (top-right and bottom-left). Near misses like this are why every cell must be checked before claiming independence.

Example 10Sum of two coins (extra)

Two fair coins give X1,X2∈{0,1}X_1, X_2 \in \{0,1\} (1 for heads), independent of each other. Let X=X1X = X_1 and Z=X1+X2Z = X_1 + X_2. Are XX and ZZ independent?

Solution
Z\XZ\backslash X01fZf_Z
01/401/4
11/41/41/2
201/41/4
fXf_X1/21/21
  1. The four equally likely outcomes give the table above.
  2. Zero cell. fXZ(1,0)=0f_{XZ}(1,0) = 0 (if the first coin is heads, the sum cannot be 0), but fX(1)=12f_X(1) = \tfrac12 and fZ(0)=14f_Z(0) = \tfrac14, so fX(1)fZ(0)=18≠0f_X(1) f_Z(0) = \tfrac18 \ne 0.
  3. Dependent. The sum depends on the first coin even though the two coins are independent. Independence of the parts does not carry over to a variable built from them.

4.5Marginals never decide it

  • Many different joint PMFs share the same marginals. Example 1 and Example 3 (with x ≠ 1/4) have identical marginals but only one is independent.
  • The marginals tell you what the independent table would be (their product). You still have to compare it with the actual joint table.

4.6Exam tips and common mistakes

Exam tips
  • Order of attack: (1) look for a zero cell with non-zero marginals; (2) test one or two simple cells; (3) only if all pass, check the rest or use the row shortcut.
  • Keep a common denominator for the whole table (24 in Q1 and Q2).
Common mistakes
  • Declaring independence because two marginals look similar or a few cells match.
  • Treating a zero cell as proof of dependence even when its row or column total is also 0.
  • Dividing a row by the wrong total when using the row shortcut: divide by that row's own total.

Practice questions (graded-assignment style)

Q1Fastest check

Multiple Choice Question (MCQ): choose the one correct option.

A joint table has a cell equal to 0 whose row total and column total are both positive. Then X and Y are:

1
Independent
2
Dependent
3
Independent only if the marginals are uniform
4
Cannot say
Solution
Idea

Compare the cell with the product of its marginals.

  • The cell is 0 but the product of two positive marginals is positive, so the product rule fails.
  • Answer: option 2.
Q2Row shortcut

Multiple Choice Question (MCQ): choose the one correct option.

A joint table (rows Y = 0, 1, 2; columns X = 0, 1, 2) has rows (0.06, 0.09, 0.15), (0.10, 0.15, 0.25) and (0.04, 0.06, 0.10). Are X and Y independent?

1
Yes
2
No, because the rows have different totals
3
No, because there are three rows
4
Cannot say
Solution
Idea

Rows must be multiples of the same vector.

  • Row 0 is 0.03×(2,3,5)0.03 \times (2,3,5), row 1 is 0.05×(2,3,5)0.05 \times (2,3,5), row 2 is 0.02×(2,3,5)0.02 \times (2,3,5): the same shape.
  • The table adds up: 0.3+0.5+0.2=10.3 + 0.5 + 0.2 = 1, and fX=(0.2,0.3,0.5)f_X = (0.2, 0.3, 0.5) is that shape. So the product rule holds in every cell: independent. Different row totals are fine; only the shape must match.
  • Answer: option 1.
Q3Fill in using independence

Numerical Answer Type (NAT).

X and Y are independent, fX(0)=0.5f_X(0) = 0.5, fY(1)=0.4f_Y(1) = 0.4. Find fXY(0,1)f_{XY}(0, 1).

Solution
Idea

Multiply the two marginals.

  • 0.5×0.4=0.20.5 \times 0.4 = 0.2.
  • Answer: 0.2
Q4Independent or not

Multiple Select Question (MSQ): select all that apply.

Which of the following joint tables (rows Y, columns X) show independent X and Y?

1
Row 0: 1/6, 1/12, 1/12; Row 1: 1/4, 1/8, 1/8; Row 2: 1/12, 1/24, 1/24
2
Row 0: 0, 1/8, 1/8; Row 1: 1/8, 1/8, 1/8; Row 2: 1/8, 1/8, 1/8
3
Row 0: 1/6, 1/12, 1/8; Row 1: 1/4, 1/8, 1/8; Row 2: 1/24, 1/24, 1/24
4
Row 0: 1/4, 1/4; Row 1: 1/4, 1/4
Solution
Idea

Test each: zero cell, product of marginals, row shortcut.

  • Table 1 (Q1) and table 4 (Example 1) are independent.
  • Table 2 has a zero cell with non-zero marginals; table 3 fails at the cell (0,0): 99/576 against 96/576.
  • Answer: options 1 and 4.
Next · RevisionIndependence: Revision Sheet
05
Revision

Independence: Revision Sheet

One page to revise everything in this section.

The big picture

Independent events to variables
  • Events: P(A∩B)=P(A)P(B)P(A\cap B) = P(A)P(B).
  • Variables: every event from X alone is independent of every event from Y alone.
The test
  • fXY(t1,t2)=fX(t1) fY(t2)f_{XY}(t_1,t_2) = f_X(t_1)\,f_Y(t_2) for all pairs.
  • Equivalent: every conditional fY∣X=t1f_{Y\mid X=t_1} equals fYf_Y.
Reading a table
  • Columns t1t_1 of XX, rows t2t_2 of YY; last column fYf_Y, last row fXf_X.
  • One failing cell means dependent; all cells passing means independent.
Parameter tables
  • Marginals can be the same for independent and dependent tables.
  • Example 3 is independent exactly when x=14x = \tfrac14.
Digits example
  • Units digit and remainder mod 4: fXY(1,0)=0f_{XY}(1,0) = 0 but fX(1)fY(0)=140f_X(1) f_Y(0) = \tfrac1{40}, so dependent.
  • Tens and units digits: independent (extra).
Fast checks
  • Zero cell with non-zero row and column totals: dependent.
  • Independent exactly when every row is a multiple of the same vector f_X.

Revision sheet

IdeaKey point
DefinitionfXY(t1,t2)=fX(t1) fY(t2)f_{XY}(t_1,t_2) = f_X(t_1)\,f_Y(t_2) for all t1,t2t_1, t_2
Conditional viewIndependent   ⟺  fY∣X=t1=fY\iff f_{Y\mid X=t_1} = f_Y for every t1t_1
Proving independenceCheck every cell of the joint table
Proving dependenceOne failing cell is enough
Fast dependence testA zero cell with non-zero row and column totals
Row shortcutIndependent   ⟺  \iff all rows are multiples of the same vector fXf_X
Marginals aloneNever decide independence: many joint PMFs share the same marginals

Week 2 roadmap

ChaptersTopicWhere
1 to 5Independence of two random variablesthis note
6 to 10Independence of multiple random variablesthis note
11 to 16Functions of one random variablethis note
17 to 22Functions of two random variables and visualizationWeek 2 · Part 2 of 2
23 to 28Functions of multiple random variablesWeek 2 · Part 2 of 2
29 to 35Sums of random variables and convolutionWeek 2 · Part 2 of 2
36 onwardsMinimum and maximum of random variables (coming)Week 2 · Part 2 of 2
This note has Chapters 1 to 16 (independence, and functions of one variable). Chapters 17 onwards are in the next note, Week 2 · Part 2 of 2; more chapters will be added as they are sent.

Common mistakes

Checking only a few cells
  • Independence needs the product rule at every cell. Dependence needs just one failing cell.
Deciding from the marginals
  • Independent and dependent tables can share the same marginals. Always compare with the joint table.
Swapping row and column marginals
  • For a cell take its column total fXf_X times its row total fYf_Y.
Zero cell with a zero row or column
  • If the whole row or column is 0 the product is 0 as well, so no failure.
Independent parts, independent function
  • X₁, X₂ independent does not make X₁ and X₁ + X₂ independent.
Independent vs identically distributed
  • Same marginals say nothing about independence.
Next · Many variablesIndependence for n Random Variables
06
Many variables

Independence for n Random Variables

The definition for n variables and the three-tosses example.

Chapters 1 to 5 dealt with two random variables. Often there are three, ten or a hundred (all the tosses of a coin, all the digits of a number). This chapter carries independence over to n random variables.

6.1Definition for n random variables

Independent random variables (n of them)

Let X1,X2,…,XnX_1, X_2, \dots, X_n be random variables on one probability space, with the range of XiX_i written TXiT_{X_i}. They are independent if events defined using different XiX_i are mutually independent. Equivalently:

fX1X2⋯Xn(t1,…,tn)=fX1(t1) fX2(t2)⋯fXn(tn)for all ti∈TXif_{X_1X_2\cdots X_n}(t_1, \dots, t_n) = f_{X_1}(t_1)\, f_{X_2}(t_2) \cdots f_{X_n}(t_n) \quad \text{for all } t_i \in T_{X_i}

The joint PMF must split into the product of all n marginals, at every point (t1,…,tn)(t_1, \dots, t_n).

Remember. For n = 2 this is exactly the definition from Chapter 1. The new thing is that the product now has n factors, one per variable.

6.2Example: three tosses of a fair coin

All 8 outcomes of three fair tosses (1 = heads)(1,1,1)1/8(1,1,0)1/8(1,0,1)1/8(1,0,0)1/8(0,1,1)1/8(0,1,0)1/8(0,0,1)1/8(0,0,0)1/8every outcome: f(t1, t2, t3) =1/2 · 1/2 · 1/2 = 1/8
Figure 6. The 8 equally likely outcomes of three fair tosses

6.3Going deeper

  • Number of points to check (extra). The product rule must hold at all ∣TX1∣⋯∣TXn∣|T_{X_1}| \cdots |T_{X_n}| points: 23=82^3 = 8 for three tosses, 10×10×5=50010 \times 10 \times 5 = 500 in Try these Q1. This is why a structural argument (separate digits, separate tosses) is much quicker than checking cell by cell.
  • Same idea, n tosses (extra). For nn fair tosses every outcome has probability 12n\tfrac1{2^n}, and so does the product of nn factors of 12\tfrac12. For n=5n = 5 the outcome (1,0,1,1,0) has probability 132\tfrac1{32}.

6.4Exam tips and common mistakes

Exam tips
  • If the variables come from separate, repeated experiments (tosses, rolls, trials), independence is built in. Say so and multiply.
  • To disprove independence of nn variables find one point (t1,…,tn)(t_1,\dots,t_n) where the joint PMF differs from the product.
Common mistakes
  • Checking only some of the points of the product rule.
  • Using only two-at-a-time checks for three or more variables. The next chapters show why that fails.

Practice questions (graded-assignment style)

Q1Five tosses

Numerical Answer Type (NAT).

Five fair coin tosses are independent. What is the probability of the exact outcome (heads, tails, heads, heads, tails)?

Solution
Idea

Multiply five factors of 1/2.

  • (12)5=132=0.03125(\tfrac12)^5 = \tfrac1{32} = 0.03125.
  • Answer: 0.03125
Q2What must be checked?

Multiple Choice Question (MCQ): choose the one correct option.

To show X1,X2,X3X_1, X_2, X_3 are independent from the joint PMF we must check:

1
Only that each pair is independent
2
f=fX1fX2fX3f = f_{X_1} f_{X_2} f_{X_3} at every point (t1,t2,t3)(t_1,t_2,t_3)
3
f=fX1fX2fX3f = f_{X_1} f_{X_2} f_{X_3} at one point
4
Only that the three marginals are equal
Solution
Idea

The product rule must hold everywhere.

  • Option 2 is the definition. Pairwise checks alone are not enough (the next chapters show a counterexample).
  • Answer: option 2.
Q3Independent tosses

Multiple Select Question (MSQ): select all that apply.

Three fair tosses give X1,X2,X3X_1, X_2, X_3 as above. Choose the correct statements.

1
fX1X2X3(1,0,1)=18f_{X_1X_2X_3}(1,0,1) = \tfrac18
2
fX1(1)=12f_{X_1}(1) = \tfrac12
3
fX1X2X3(1,1,1)=12f_{X_1X_2X_3}(1,1,1) = \tfrac12
4
The 8 joint values add up to 1
Solution
Idea

Every outcome has probability 1/8.

  • Each of the 8 outcomes has probability 18\tfrac18, which adds to 1.
  • Statement 3 is false: 12\tfrac12 is a single marginal, not the joint value.
  • Answer: options 1, 2 and 4.
Next · Many variablesA Random 3-Digit Number
07
Many variables

A Random 3-Digit Number

Two independent pairs and one dependent pair from the digits of a number.

A random 3-digit number is a good test bed: its digits are independent of each other, but quantities built from the same digit are not.

7.1The experiment

Example 12First digit, parity and last digit

A number from 000 to 999 is chosen uniformly at random. Let XX = first digit from the left, YY = the number modulo 2, ZZ = first digit from the right. Are X,Y,ZX, Y, Z independent?

Solution
  1. Marginals. X∼Uniform{0,…,9}X \sim \text{Uniform}\{0,\dots,9\}, Z∼Uniform{0,…,9}Z \sim \text{Uniform}\{0,\dots,9\}, Y∼Uniform{0,1}Y \sim \text{Uniform}\{0,1\}.
  2. Pair (X,Z)(X,Z). Fixing the first and last digit leaves 10 choices for the middle digit, so fXZ(t1,t3)=101000=1100=110⋅110=fX(t1)fZ(t3)f_{XZ}(t_1,t_3) = \tfrac{10}{1000} = \tfrac1{100} = \tfrac1{10}\cdot\tfrac1{10} = f_X(t_1) f_Z(t_3) for every pair: XX and ZZ are independent.
  3. Pair (X,Y)(X,Y). Fixing the first digit and the parity leaves 10 middle digits and 5 last digits of the right parity: 10×5=5010 \times 5 = 50 numbers. So fXY(t1,t2)=501000=120=110⋅12=fX(t1)fY(t2)f_{XY}(t_1,t_2) = \tfrac{50}{1000} = \tfrac1{20} = \tfrac1{10}\cdot\tfrac12 = f_X(t_1) f_Y(t_2): XX and YY are independent.
  4. Pair (Y,Z)(Y,Z). The parity of the number is decided by its last digit. A number ending in 2 is even, so it can never have remainder 1 mod 2: fYZ(1,2)=0f_{YZ}(1,2) = 0, but fY(1)fZ(2)=12⋅110=120≠0f_Y(1) f_Z(2) = \tfrac12 \cdot \tfrac1{10} = \tfrac1{20} \ne 0. YY and ZZ are dependent.
  5. Conclusion. Since even one pair fails, X,Y,ZX, Y, Z are not independent.
X = first digit, Z = last digit, Y = parity of the numberafirst digit (hundreds)bmiddle digitclast digit (units)X = aY = c mod 2Z = cX, ZindependentX, YindependentY, ZDEPENDENT
Figure 7. Which digit feeds which variable

7.2Why one dependent pair is enough

If X, Y, Z were independent, then every pair among them would be independent too (Chapter 9 proves this by summing out the third variable). So a single dependent pair, here (Y, Z), rules out independence of the whole collection immediately. There was no need to look at the triple joint PMF at all.

7.3Going deeper

  • Rule of thumb (extra). Quantities built from different digits are independent (the digits are chosen independently). Quantities that read the same digit are a warning sign for dependence, as Y and Z both read the last digit.
  • But sharing is not a verdict (extra). Take XX = first digit and W=(first digit+middle digit) mod 2W = (\text{first digit} + \text{middle digit}) \bmod 2. They share the first digit, yet for every pair fXW=501000=110⋅12f_{XW} = \tfrac{50}{1000} = \tfrac1{10}\cdot\tfrac12: independent. The middle digit, which is uniform and independent, scrambles the parity completely. Always compute.
  • Why 1000 numbers (extra). 000 to 999 includes numbers like 007 and 042, so every number has exactly three digits and each digit position is uniform.

7.4Exam tips and common mistakes

Exam tips
  • Count numbers: fix the variable values, then count how many numbers fit, and divide by 1000.
  • To disprove, find an impossible combination like an odd number ending in 2.
Common mistakes
  • Concluding that all three are independent after checking only (X, Z) and (X, Y).
  • Forgetting that "number modulo 2" depends only on the last digit.

Practice questions (graded-assignment style)

Q1f_XZ(3, 7)

Numerical Answer Type (NAT).

For the random number of Example 12, find fXZ(3,7)f_{XZ}(3, 7), the probability that the first digit is 3 and the last digit is 7.

Solution
Idea

Count numbers of the form 3_7.

  • The numbers 307, 317, ..., 397 are 10 numbers, so the probability is 10/1000 = 0.01.
  • Answer: 0.01
Q2f_XY(4, 0)

Numerical Answer Type (NAT).

Find fXY(4,0)f_{XY}(4, 0): first digit 4 and the number is even.

Solution
Idea

Fix the first digit, then choose the last digit to be even.

  • Middle digit: 10 choices. Last digit: 5 even choices. So 10 × 5 = 50 numbers and the probability is 50/1000 = 0.05.
  • Answer: 0.05
Q3The dependent pair

Multiple Choice Question (MCQ): choose the one correct option.

In Example 12 which pair is dependent?

1
(X,Z)(X, Z)
2
(X,Y)(X, Y)
3
(Y,Z)(Y, Z)
4
None
Solution
Idea

Which two variables read the same digit?

  • YY (the parity) and ZZ (the last digit) both depend on the last digit: fYZ(1,2)=0f_{YZ}(1,2) = 0 but fY(1)fZ(2)=120f_Y(1) f_Z(2) = \tfrac1{20}.
  • Answer: option 3.
Q4Conclusions

Multiple Select Question (MSQ): select all that apply.

Choose the correct statements about X, Y, Z of Example 12.

1
X and Z are independent
2
X and Y are independent
3
X, Y, Z are independent
4
Y and Z are dependent
Solution
Idea

One dependent pair rules out the whole collection.

  • Statements 1, 2 and 4 are the three pair results. Statement 3 is false because the pair (Y, Z) is dependent.
  • Answer: options 1, 2 and 4.
Next · Many variablesEven Parity: Pairwise Independent, Not Independent
08
Many variables

Even Parity: Pairwise Independent, Not Independent

The key counterexample: every pair unrelated, the triple tightly tied.

Can three variables be such that any two look completely unrelated, and yet the three together are strongly tied? Yes: this is the most important counterexample of the week.

8.1The even parity PMF

Example 13Even parity

Let (X1,X2,X3)(X_1, X_2, X_3) have the joint PMF below. It is called even parity because every possible outcome contains an even number of 1s. Each Xi∼Uniform{0,1}X_i \sim \text{Uniform}\{0,1\} (each value appears in two rows). Are X1,X2,X3X_1, X_2, X_3 independent? Are they pairwise independent?

Solution
t1t_1t2t_2t3t_3fX1X2X3f_{X_1X_2X_3}
0001/4
0111/4
1011/4
1101/4
  1. Every pair is independent. Summing out the third variable, each pair has the same joint table (rows XjX_j, columns XiX_i): every cell is 14\tfrac14, and every marginal is 12\tfrac12.
  2. Xj\XiX_j\backslash X_i01fXjf_{X_j}
    01/41/41/2
    11/41/41/2
    fXif_{X_i}1/21/21
    For (X1,X2)(X_1,X_2), (X1,X3)(X_1,X_3) and (X2,X3)(X_2,X_3) every cell is 14=12⋅12\tfrac14 = \tfrac12 \cdot \tfrac12.
  3. But the three together are not independent. Take (X1,X2,X3)=(0,0,1)(X_1,X_2,X_3) = (0,0,1), which has an odd number of 1s: P(X1=0,X2=0,X3=1)=0P(X_1=0, X_2=0, X_3=1) = 0, while P(X1=0)P(X2=0)P(X3=1)=18P(X_1=0)P(X_2=0)P(X_3=1) = \tfrac18.
Even parity: the joint PMF of (X1, X2, X3)(0,0,0)1/4(0,0,1)0(0,1,0)0(0,1,1)1/4(1,0,0)0(1,0,1)1/4(1,1,0)1/4(1,1,1)0Allowed: an even number of 1s, 1/4 each. Forbidden: an odd number of 1s, probability 0.An independent triple would give 1/8 to all eight outcomes.
Figure 8. The joint PMF of the even parity triple
Pairwise independence does not imply independence

In even parity, any two variables look completely unrelated, yet the first two determine the third: X3=(X1+X2) mod 2X_3 = (X_1 + X_2) \bmod 2.

8.2The direction that does hold

X1, ..., Xnindependentevery sub-collectionindependentevery pairindependentthe reverse is falsecounterexamples: even parity and Z = XY
Figure 9. Independence implies pairwise independence, but not the reverse
  • Independent ⇒\Rightarrow pairwise independent. Every sub-collection of independent variables is independent.
  • Pairwise independent ⇏\not\Rightarrow independent. Even parity is a counterexample, and Try these Q2 gives another.

8.3Going deeper

  • Conditional view (extra). Given X1=0X_1 = 0 and X2=0X_2 = 0, the third variable is forced: P(X3=1∣X1=0,X2=0)=0P(X_3 = 1 \mid X_1 = 0, X_2 = 0) = 0, whereas P(X3=1)=12P(X_3 = 1) = \tfrac12. Independence would have said that learning X1,X2X_1, X_2 tells nothing about X3X_3, but here it tells everything.
  • Why the pair tables hide it (extra). A pair table only sees two coordinates at a time; the constraint "even number of 1s" lives in all three together.
  • Where it appears (extra). Parity checks are used to detect errors in data: the last bit is chosen so that the number of 1s is even, which is exactly this structure.

8.4Exam tips and common mistakes

Exam tips
  • To disprove independence of three variables look for a point with joint probability 0 but a positive product (an impossible outcome).
  • To show pairwise independence sum out the third variable and test each pair table.
Common mistakes
  • Believing that "every pair independent" is the same as "independent".
  • Forgetting that outcomes with probability 0 are points of the grid too. They must also satisfy the product rule, and an impossible outcome with a positive product (like (0,0,1) in even parity) is the clearest failure.

Practice questions (graded-assignment style)

Q1f(1, 1, 0)

Numerical Answer Type (NAT).

In the even parity PMF, what is the probability of the outcome (X1, X2, X3) = (1, 1, 0)?

Solution
Idea

It has two 1s, an even number.

  • (1,1,0) is one of the four allowed outcomes, so its probability is 1/4 = 0.25.
  • Answer: 0.25
Q2f(1, 1, 1)

Numerical Answer Type (NAT).

In the even parity PMF, what is f(1, 1, 1)?

Solution
Idea

Count the 1s.

  • (1,1,1) has three 1s, an odd number, so it is forbidden: probability 0. An independent triple would give 1/8.
  • Answer: 0
Q3Pairwise versus independent

Multiple Choice Question (MCQ): choose the one correct option.

For the even parity triple, which statement is true?

1
Independent and pairwise independent
2
Pairwise independent but not independent
3
Independent but not pairwise independent
4
Neither
Solution
Idea

Check pairs, then the triple.

  • Every pair table has all cells 1/4, so every pair is independent. The triple fails at (0,0,1).
  • Answer: option 2.
Q4Implications

Multiple Select Question (MSQ): select all that apply.

Choose the correct statements.

1
If X1, X2, X3 are independent then every pair among them is independent
2
If every pair among X1, X2, X3 is independent then they are independent
3
One dependent pair rules out independence of X1, X2, X3
4
Even parity is a counterexample to statement 2
Solution
Idea

Which way does the implication run?

  • Statements 1 and 3 are the same fact, used in two directions. Statement 2 is false, and even parity shows it (statement 4).
  • Answer: options 1, 3 and 4.
Next · Many variablesUseful Consequences and Try These
09
Many variables

Useful Consequences and Try These

Sub-collections, functions of independent variables, i.i.d., and the two lecture questions solved.

Two useful consequences of independence, the notion of i.i.d. variables, and the two "Try these" questions of the lecture, worked out step by step.

9.1Sub-collections of independent variables

If X1,…,XnX_1, \dots, X_n are independent, then every pair (indeed every sub-collection) is independent: just sum the product formula over the other variables. For three variables, summing out t3t_3:

fX1X2(t1,t2)=∑t3fX1(t1)fX2(t2)fX3(t3)=fX1(t1)fX2(t2)∑t3fX3(t3)=fX1(t1)fX2(t2)f_{X_1X_2}(t_1,t_2) = \sum_{t_3} f_{X_1}(t_1) f_{X_2}(t_2) f_{X_3}(t_3) = f_{X_1}(t_1) f_{X_2}(t_2) \sum_{t_3} f_{X_3}(t_3) = f_{X_1}(t_1) f_{X_2}(t_2)

The last sum is 1. So one dependent pair immediately rules out independence of the whole collection.

9.2Functions of independent variables

Functions of independent variables are independent

If XX and YY are independent, then g(X)g(X) and h(Y)h(Y) are independent for any functions g,hg, h. Reason: for values a,ba, b,

P(g(X)=a, h(Y)=b)=∑x:g(x)=a ∑y:h(y)=bfX(x)fY(y)=(∑x:g(x)=afX(x))(∑y:h(y)=bfY(y))=P(g(X)=a) P(h(Y)=b)P(g(X)=a,\ h(Y)=b) = \sum_{x: g(x)=a}\ \sum_{y: h(y)=b} f_X(x) f_Y(y) = \Big(\sum_{x: g(x)=a} f_X(x)\Big)\Big(\sum_{y: h(y)=b} f_Y(y)\Big) = P(g(X)=a)\,P(h(Y)=b)

For example, if XX and YY are independent then X2X^2 and eYe^Y are independent, and so are X mod 2X \bmod 2 and max⁡(Y,0)\max(Y, 0).

Example 14A numeric check of the function rule (extra)

Let X∼Uniform{0,1,2,3}X \sim \text{Uniform}\{0,1,2,3\} and Y∼Uniform{−1,0,1}Y \sim \text{Uniform}\{-1,0,1\} be independent. Check that g(X)=X mod 2g(X) = X \bmod 2 and h(Y)=max⁡(Y,0)h(Y) = \max(Y,0) are independent at two points.

Solution
  1. g(X)=0g(X) = 0 for X∈{0,2}X \in \{0, 2\}, so P(g=0)=12P(g=0) = \tfrac12; h(Y)=0h(Y) = 0 for Y∈{−1,0}Y \in \{-1, 0\}, so P(h=0)=23P(h=0) = \tfrac23; h(Y)=1h(Y) = 1 only for Y=1Y = 1, so P(h=1)=13P(h=1) = \tfrac13.
  2. P(g=0,h=0)=P(X∈{0,2}) P(Y∈{−1,0})=12⋅23=13=P(g=0)P(h=0)P(g=0, h=0) = P(X \in \{0,2\})\,P(Y \in \{-1,0\}) = \tfrac12 \cdot \tfrac23 = \tfrac13 = P(g=0)P(h=0).
  3. P(g=1,h=1)=12⋅13=16=P(g=1)P(h=1)P(g=1, h=1) = \tfrac12 \cdot \tfrac13 = \tfrac16 = P(g=1)P(h=1). The same works for the other points.
Careful. The rule is about a function of X alone and a function of Y alone. Two functions of the same variable are usually not independent: for X uniform on {−1, 0, 1}, X and X² have P(X = 0, X² = 1) = 0 but P(X = 0) P(X² = 1) = 1/3 · 2/3 = 2/9.

9.3i.i.d. variables

i.i.d.A collection X1,…,XnX_1, \dots, X_n is independent and identically distributed (i.i.d.) if the variables are independent and all share one distribution. Repeated tosses, rolls and trials are the standard examples.
Example 15Three i.i.d. biased tosses (extra)

Three independent tosses each land heads with probability 13\tfrac13 (so Xi∼X_i \sim Bernoulli(13)(\tfrac13), i.i.d.). Find the probability of the outcome (1, 1, 0).

Solution
  1. By independence multiply the marginals: f(1) f(1) f(0)=13⋅13⋅23f(1)\,f(1)\,f(0) = \tfrac13 \cdot \tfrac13 \cdot \tfrac23.
  2. =227= \tfrac{2}{27}.
  3. Because the tosses are identically distributed, the same formula p^k (1 − p)^(3 − k) works for any outcome with k heads. The 8 values add up to 1.

9.4Try these: worked solutions

Example 16Try these Q1: hundreds digit, tens digit and N mod 5

A number from 000 to 999 is chosen uniformly at random. Let XX = the hundreds digit, YY = the tens digit, and ZZ = the remainder when the number is divided by 5. Are X,Y,ZX, Y, Z independent?

Solution
  1. Describe the number by its digits. Write N=100A+10B+CN = 100A + 10B + C. Choosing NN uniformly from 1000 numbers is the same as choosing the digit triple (A,B,C)(A,B,C) uniformly from 10310^3 triples, each with probability 11000\tfrac1{1000}. Here X=AX = A, Y=BY = B.
  2. Simplify ZZ. 100A+10B100A + 10B is always a multiple of 5, so Z=N mod 5=C mod 5Z = N \bmod 5 = C \bmod 5 depends only on the last digit: C∈{0,5}→Z=0C \in \{0,5\} \to Z = 0, C∈{1,6}→Z=1C \in \{1,6\} \to Z = 1, and so on.
  3. Marginals. X,Y∼Uniform{0,…,9}X, Y \sim \text{Uniform}\{0,\dots,9\}. Each z∈{0,1,2,3,4}z \in \{0,1,2,3,4\} comes from exactly two last digits (zz and z+5z+5), so fZ(z)=210=15f_Z(z) = \tfrac{2}{10} = \tfrac15, Z∼Uniform{0,1,2,3,4}Z \sim \text{Uniform}\{0,1,2,3,4\}.
  4. Joint PMF. Fix X=aX = a, Y=bY = b, Z=zZ = z. Then A=aA = a, B=bB = b, and CC must be zz or z+5z+5: exactly 2 numbers. So fXYZ(a,b,z)=21000=1500f_{XYZ}(a,b,z) = \tfrac{2}{1000} = \tfrac1{500}.
  5. Compare. fX(a)fY(b)fZ(z)=110⋅110⋅15=1500f_X(a)f_Y(b)f_Z(z) = \tfrac1{10} \cdot \tfrac1{10} \cdot \tfrac15 = \tfrac1{500}, equal for every (a,b,z)(a,b,z): all 10×10×5=50010 \times 10 \times 5 = 500 points.
  6. Conclude and contrast. X,Y,ZX, Y, Z are independent. They are built from three different digits. In Example 12, "mod 2" and "last digit" both used the last digit, which created the dependence.
  7. Answer: yes, X, Y and Z are independent.
Z = N mod 5 depends only on the last digit C012345678901234each Z has exactly two last digits: Z and Z + 5so fZ(z) = 2/10 = 1/5CZ
Figure 10. Z = N mod 5 is decided by the last digit alone: two last digits for each value of Z
Example 17Try these Q2: a product of two signs

Let XX and YY be independent, each equal to +1+1 or −1-1 with probability 12\tfrac12. Define Z=XYZ = XY. Show that X,Y,ZX, Y, Z are pairwise independent but not independent.

Solution
xxyyz=xyz = xyfXYZf_{XYZ}
1111/4
1−1−11/4
−11−11/4
−1−111/4
  1. Joint PMF. (X,Y)(X,Y) takes 4 equally likely values and each determines ZZ: the table above.
  2. Marginals. Z=1Z = 1 in two rows and Z=−1Z = -1 in two rows, so ZZ is also ±1\pm1 with probability 12\tfrac12 each. Same for XX and YY.
  3. Pair (X,Y)(X,Y) is independent by assumption.
  4. Pair (X,Z)(X,Z). Given X=xX = x, the event Z=zZ = z means Y=z/x=xzY = z/x = xz. So P(X=x,Z=z)=P(X=x,Y=xz)=14=12⋅12=P(X=x)P(Z=z)P(X=x, Z=z) = P(X=x, Y=xz) = \tfrac14 = \tfrac12 \cdot \tfrac12 = P(X=x)P(Z=z) for all four choices of x,z∈{1,−1}x, z \in \{1,-1\}. Independent.
  5. Pair (Y,Z)(Y,Z). The identical argument with the roles of XX and YY swapped. Independent.
  6. All three together. Take X=1,Y=1,Z=−1X = 1, Y = 1, Z = -1. It is impossible, because 1⋅1=11 \cdot 1 = 1: P(X=1,Y=1,Z=−1)=0≠12⋅12⋅12=18P(X=1, Y=1, Z=-1) = 0 \ne \tfrac12 \cdot \tfrac12 \cdot \tfrac12 = \tfrac18.
  7. Conclude. Every pair is independent, but the triple is not: any two of the values fix the third. This is the same structure as even parity, written with ±1\pm1 instead of 0/10/1.
  8. Answer: pairwise independent, but X, Y, Z are not independent.
Z = XY with X, Y fair signs: the joint PMF of (X, Y, Z)(1,1,1)1/4(1,1,-1)0(1,-1,1)0(1,-1,-1)1/4(-1,1,1)0(-1,1,-1)1/4(-1,-1,1)1/4(-1,-1,-1)0Allowed: Z is the product of X and Y, 1/4 each. Forbidden: any other Z, probability 0.An independent triple would give 1/8 to all eight outcomes.
Figure 11. The joint PMF of (X, Y, Z = XY)

9.5Exam tips and common mistakes

Exam tips
  • Structure first: if every variable comes from its own digit, toss or trial, independence follows without a table.
  • To build a "pairwise but not independent" example, let the third variable be a function of the other two that is balanced against each of them separately (parity, product of signs).
Common mistakes
  • Applying the function rule to two functions of the same variable (X and X²).
  • Forgetting that Z = N mod 5 only sees the last digit, so it is independent of the first two digits.
  • Using i.i.d. when the tosses are independent but have different biases: identically distributed means the same distribution.

Practice questions (graded-assignment style)

Q1Joint value in Q1

Numerical Answer Type (NAT).

In Try these Q1, what is f_XYZ(a, b, z) for any digits a, b and any z in {0,1,2,3,4}? Give a decimal.

Solution
Idea

Two numbers out of 1000.

  • Exactly two numbers fit: 2/1000 = 0.002 = 1/500.
  • Answer: 0.002
Q2Mod 2 instead of mod 5

Numerical Answer Type (NAT).

Let X = hundreds digit, Y = tens digit and W = N mod 2 for a number from 000 to 999. What is f_XYW(a, b, w)? Give a decimal.

Solution
Idea

The last digit must have the right parity.

  • Five last digits have the right parity, so 5/1000 = 0.005 = 1/10 · 1/10 · 1/2: independent, like Q1.
  • Answer: 0.005
Q3Product of signs

Multiple Choice Question (MCQ): choose the one correct option.

For Z = XY with X, Y independent fair signs, which statement is true?

1
X, Y, Z are independent
2
X, Y, Z are pairwise independent but not independent
3
X and Z are dependent
4
Z is a constant
Solution
Idea

Each pair is balanced; the triple is constrained.

  • Every pair has all cells 14\tfrac14, but P(1,1,−1)=0≠18P(1,1,-1) = 0 \ne \tfrac18.
  • Answer: option 2.
Q4Functions of independent X and Y

Multiple Select Question (MSQ): select all that apply.

X and Y are independent. Which pairs are guaranteed to be independent?

1
X² and e^Y
2
X mod 2 and max(Y, 0)
3
X and X²
4
X + Y and X − Y
Solution
Idea

The rule needs a function of X alone and a function of Y alone.

  • Options 1 and 2 are a function of X and a function of Y. Option 3 uses the same variable twice, and option 4 mixes X and Y in both.
  • Answer: options 1 and 2.
Q5i.i.d. probability

Numerical Answer Type (NAT).

Three i.i.d. tosses each have P(heads)=0.2P(\text{heads}) = 0.2. Find the probability of the outcome (1,1,0)(1,1,0).

Solution
Idea

Multiply 0.2, 0.2 and 0.8.

  • 0.2×0.2×0.8=0.0320.2 \times 0.2 \times 0.8 = 0.032.
  • Answer: 0.032
Next · RevisionMany variables: Revision Sheet
10
Revision

Many variables: Revision Sheet

One page to revise everything in this section.

The big picture

n variables
  • fX1⋯Xn=fX1⋯fXnf_{X_1\cdots X_n} = f_{X_1}\cdots f_{X_n} at every point.
  • Equivalent: events from different variables are mutually independent.
Digits example
  • Example: X,ZX, Z independent; X,YX, Y independent; Y,ZY, Z dependent (both read the last digit).
  • One dependent pair rules out the whole triple.
Even parity
  • Every pair independent, triple not: (0,0,1) has probability 0 but product 1/8.
  • X3=(X1+X2) mod 2X_3 = (X_1 + X_2) \bmod 2.
Implications
  • Independent ⇒ every sub-collection independent ⇒ pairwise independent.
  • Pairwise independent does not imply independent.
Functions
  • X⊥Y⇒g(X)⊥h(Y)X \perp Y \Rightarrow g(X) \perp h(Y).
  • Not for two functions of the same variable.
Try these
  • Q1: X,Y,Z=N mod 5X, Y, Z = N \bmod 5 independent (joint 1500\tfrac1{500} at all 500 points).
  • Q2: Z = XY is pairwise independent but not independent.

Revision sheet

IdeaKey point
DefinitionfX1⋯Xn=fX1⋯fXnf_{X_1\cdots X_n} = f_{X_1}\cdots f_{X_n} at every point
Independent ⇒ pairwiseEvery sub-collection of independent variables is independent
Pairwise ⇏ independentEven parity and Z = XY are counterexamples
DisprovingOne dependent pair, or one failing point, is enough
FunctionsX⊥Y⇒g(X)⊥h(Y)X \perp Y \Rightarrow g(X) \perp h(Y)
i.i.d.Independent and identically distributed
Revision overview
DefinitionProduct of n marginals
At every point
Mutually independent events
ExamplesThree fair tosses: 1/8
3-digit number
Q1: 1/500 everywhere
DisprovingOne dependent pair
One failing point
Impossible outcome
Many variablesWeek 2
ImplicationsIndependent ⇒ pairwise
Pairwise ⇏ independent
CounterexamplesEven parity
Z = XY with signs
Third is fixed by two
ToolsFunctions of independent
i.i.d. variables
Sum out to get pairs
Revision: independence of many variables and why pairwise is not enough

Common mistakes

Pairwise equals independent
  • Pairwise independence is weaker. Even parity and Z = XY pass every pair test and still fail the triple.
Checking only a few points
  • For n variables the product rule is needed at every point of the grid.
Shared digits
  • Variables reading the same digit (parity and last digit) are dependent. Compute, do not assume.
Functions of the same variable
  • The function rule is for a function of X and a function of Y, not X and X².
Identical is not independent
  • i.i.d. needs both: independence and one common distribution.
Forgetting the impossible outcome
  • A point with joint probability 0 but a positive product is the quickest proof of dependence.
Next · Functions of one variableSeeing a PMF: Stem Plots
11
Functions of one variable

Seeing a PMF: Stem Plots

If X is random so is g(X). Stem plots show which values are possible and which are likely.

If XX is a random variable, so is Y=g(X)Y = g(X): once XX is random, anything computed from it is random too. This chapter answers the question: what is the PMF of YY? First we need a good way of looking at a PMF.

11.1Stem plots

Stem plotA stem plot draws a vertical line at each value xx the random variable can take, with height P(X=x)P(X = x). It shows at a glance which values are possible and which are likely.

11.2Two reference distributions

Two distributions are used through the whole part, so it helps to know both well.

(a) UniformX∼Uniform{0,1,…,10}X \sim \text{Uniform}\{0, 1, \dots, 10\}: P(X=x)=111P(X = x) = \tfrac1{11} for x∈{0,…,10}x \in \{0,\dots,10\}. Every stem has the same height.
(b) BinomialX∼Binomial(10,0.5)X \sim \text{Binomial}(10, 0.5): P(X=k)=(10k)(0.5)10=(10k)1024P(X = k) = \binom{10}{k}(0.5)^{10} = \dfrac{\binom{10}{k}}{1024}, k=0,1,…,10k = 0, 1, \dots, 10. The heights differ.
kk012345678910
(10k)\binom{10}{k}1104512021025221012045101
Uniform1/111/111/111/111/111/111/111/111/111/111/11
Binomial1/102410/102445/1024120/1024210/1024252/1024210/1024120/102445/102410/10241/1024
Stem plots: P(X = x) against xUniform{0, ..., 10}: flatBinomial(10, 0.5): bell-shaped02468101/1111045120210252210120451010246810xbinomial labels are P(X = x) x 1024
Figure 12. Stem plots: flat for the uniform, bell-shaped for the binomial
  • Binomial: X = 5 is the most likely value (252/1024); then 4 and 6 (210/1024 each); 3 and 7 (120/1024); and 0 and 10 are the least likely (1/1024 each).
  • Check: the binomial numerators add up to 1024 (they are the row of Pascal's triangle), and the eleven uniform stems add up to 1.

11.3Reading a stem plot

Example 18Reading probabilities off the stems (extra)

For both reference distributions find P(X≥8)P(X \ge 8) and say which value of XX is most likely.

Solution
  1. Uniform: the stems at 8, 9, 10 each have height 111\tfrac1{11}, so P(X≥8)=311P(X \ge 8) = \tfrac3{11}. All values tie for most likely.
  2. Binomial: add the stems at 8, 9, 10: 45+10+11024=561024=7128\tfrac{45 + 10 + 1}{1024} = \tfrac{56}{1024} = \tfrac7{128}.
  3. The most likely binomial value is X=5X = 5, the tallest stem, with 2521024\tfrac{252}{1024}.

11.4Going deeper

  • Stems are not the whole story (extra). A stem plot only shows heights. To get a probability of several values, add stems. To get the shape of the distribution of Y, we need to know which stems of X land where: that is the table method of the next chapter.
  • Symmetry (extra). The binomial stems are mirror images about X = 5: P(X = k) = P(X = 10 − k). This symmetry is what produces the pile-up pairs in the many-to-one example.

11.5Exam tips and common mistakes

Exam tips
  • Keep the binomial numerators 1, 10, 45, 120, 210, 252 in mind; they are reused in every example of this chapter.
  • Always check that your probabilities add up to 1 (or the numerators to 1024).
Common mistakes
  • Reading a stem height as a value of X. The horizontal position is the value; the height is the probability.
  • Writing the binomial probabilities without the 1024 denominator.

Practice questions (graded-assignment style)

Q1A binomial stem

Numerical Answer Type (NAT).

For X∼Binomial(10,0.5)X \sim \text{Binomial}(10, 0.5), what is 1024×P(X=3)1024 \times P(X = 3)?

Solution
Idea

(103)\binom{10}{3}.

  • P(X=3)=(103)/1024=120/1024P(X = 3) = \binom{10}{3}/1024 = 120/1024, so the answer is 120.
  • Answer: 120
Q2Tail probability

Numerical Answer Type (NAT).

For X∼Uniform{0,…,10}X \sim \text{Uniform}\{0,\dots,10\} find 11×P(X≥8)11 \times P(X \ge 8).

Solution
Idea

Count the stems at 8, 9, 10.

  • Three stems of height 1/11, so the probability is 3/11 and the answer is 3.
  • Answer: 3
Q3Which plot?

Multiple Choice Question (MCQ): choose the one correct option.

Which distribution has a stem plot with all stems of the same height?

1
Binomial(10, 0.5)
2
Uniform{0, ..., 10}
3
Both
4
Neither
Solution
Idea

Recall the two reference plots.

  • The uniform gives every value the same probability, 1/11. The binomial is bell-shaped.
  • Answer: option 2.
Q4Binomial stems

Multiple Select Question (MSQ): select all that apply.

For X∼Binomial(10,0.5)X \sim \text{Binomial}(10, 0.5) choose the correct statements.

1
X = 5 is the most likely value
2
P(X = 4) = P(X = 6)
3
P(X = 0) = P(X = 5)
4
The stems add up to 1
Solution
Idea

Symmetry about 5.

  • P(X = 0) is 1/1024 but P(X = 5) is 252/1024, so statement 3 is false. The others are true.
  • Answer: options 1, 2 and 4.
Next · Functions of one variableThe Table Method
12
Functions of one variable

The Table Method

How to find the PMF of any function of a random variable.

Given the PMF of XX, the table method finds the PMF of Y=g(X)Y = g(X) for any function gg, one-to-one or many-to-one.

12.1The method

The table method

To find the distribution of Y=g(X)Y = g(X):

  1. Step I. Make a table with columns xx, P(X=x)P(X = x) and y=g(x)y = g(x).
  2. Step II. Read off the range of YY (the distinct values in the yy column), and for each yy add up the probabilities of all rows with that yy:
P(Y=y)=∑x: g(x)=yP(X=x)P(Y = y) = \sum_{x:\, g(x) = y} P(X = x)
Why use it

It is simple, works for any function, and makes mistakes easy to spot: every row of X must appear in exactly one group, so the final probabilities must still add up to 1.

12.2A small worked example

Example 19Squaring a three-valued variable (extra)

XX takes the values −1,0,1-1, 0, 1 with probabilities 0.2,0.5,0.30.2, 0.5, 0.3. Find the PMF of Y=X2Y = X^2.

Solution
xxP(X=x)P(X=x)y=x2y = x^2
−10.21
00.50
10.31
  1. Step I: the table above.
  2. Step II: the range of YY is {0,1}\{0, 1\}.
  3. P(Y=1)=P(X=−1)+P(X=1)=0.2+0.3=0.5P(Y=1) = P(X=-1) + P(X=1) = 0.2 + 0.3 = 0.5 (two rows give y=1y = 1).
  4. P(Y=0)=P(X=0)=0.5P(Y=0) = P(X=0) = 0.5.
  5. Check: 0.5 + 0.5 = 1.
Table method on a small example (extra)xP(X=x)y = x²-10.2100.5010.31group by yP(Y = 1)0.2 + 0.3 = 0.5P(Y = 0)0.5rows with the same y are added; the totals add to 1
Figure 13. Rows with the same y are added together

12.3Going deeper

  • Values outside the range (extra). If yy is not in the range of YY, then P(Y=y)=0P(Y = y) = 0: no row of the table produces it.
  • The range can be smaller (extra). Y never has more distinct values than X. It has the same number exactly when g is one-to-one on the values of X.
  • Two kinds of function. One-to-one functions only move the probabilities (Chapter 13). Many-to-one functions make probabilities pile up (Chapter 14).

12.4Exam tips and common mistakes

Exam tips
  • Always write the full table, even when it is long. Then colour or tick the rows by their y value before adding.
  • Finish by adding all the new probabilities: the total must be 1.
Common mistakes
  • Listing the same y twice in the answer instead of merging its rows.
  • Forgetting a row, so the total is less than 1.

Practice questions (graded-assignment style)

Q1P(Y = 1)

Numerical Answer Type (NAT).

XX takes −1,0,1-1, 0, 1 with probabilities 0.2,0.5,0.30.2, 0.5, 0.3. Find P(X2=1)P(X^2 = 1).

Solution
Idea

Which xx give x2=1x^2 = 1?

  • x = −1 and x = 1: 0.2 + 0.3 = 0.5.
  • Answer: 0.5
Q2Distinct values

Numerical Answer Type (NAT).

XX is uniform on {1,2,3,4}\{1, 2, 3, 4\}. How many distinct values does Y=X2Y = X^2 take?

Solution
Idea

Square each value.

  • The squares are 1, 4, 9, 16: all different, so 4 values, each with probability 1/4.
  • Answer: 4
Q3The formula

Multiple Choice Question (MCQ): choose the one correct option.

In the table method, P(Y = y) equals:

1
P(X=y)P(X = y)
2
∑x: g(x)=yP(X=x)\sum_{x:\,g(x)=y} P(X = x)
3
g(P(X=x))g(P(X = x))
4
∑xP(X=x)\sum_x P(X = x)
Solution
Idea

Add the rows that land on y.

  • Option 2 is the general formula; it reduces to P(X = x) when exactly one x gives y.
  • Answer: option 2.
Q4Table method facts

Multiple Select Question (MSQ): select all that apply.

Choose the correct statements.

1
It works for any function g
2
The new probabilities must add up to 1
3
The range of Y can be larger than the range of X
4
Rows with the same y are added
Solution
Idea

Every row of X lands in exactly one group.

  • The range of Y has at most as many values as the range of X, so statement 3 is false.
  • Answer: options 1, 2 and 4.
Next · Functions of one variableOne-to-One Functions
13
Functions of one variable

One-to-One Functions

The probabilities stay; only their locations move.

If different xx always give different yy, each yy comes from exactly one xx, so P(Y=g(x))=P(X=x)P(Y = g(x)) = P(X = x). The probabilities are unchanged; they just move to new locations.

13.1Example: Y = X − 5

Y = X - 5 on the binomial: same stems, slid 5 to the left (labels: probability x 1024)X1104512021025221012045101012345678910Y = X - 51104512021025221012045101-5-4-3-2-1012345heights unchanged; only the locations move
Figure 14. Y = X − 5: the same shapes, slid 5 units to the left

13.2Example: Y = 2X

Correction (extra). The PDF titles this example "Y = 2X", but its table (1, 2, 4, 8, ..., 1024) and range show Y = 2^X. Plain Y = 2X would give the values 0, 2, 4, ..., 20. The method is the same, and the note uses 2^X as in the table.
Y = 2^X: the locations of the 11 values on a number line012825638451264076889610242^7120/10242^845/10242^910/10242^101/10241, 2, 4, ..., 64 crowd herethe same 11 probabilities, now at very uneven locationsbinomial labels are P(Y = y) x 1024
Figure 15. Y = 2^X: the same probabilities at very uneven locations
The takeaway

A one-to-one function never changes the list of probabilities; it only changes where they sit. Shifting (X−5X - 5) keeps the spacing; a non-linear map like 2X2^X squashes small values together and spreads large ones apart.

13.3Going deeper

  • Reflection (extra). For Y=−XY = -X the stems are mirrored: P(Y=−k)=P(X=k)P(Y = -k) = P(X = k). Still one-to-one, so probabilities are unchanged. The binomial is symmetric, so its picture looks the same.
  • One-to-one on the values that occur (extra). g(x)=x2g(x) = x^2 is not one-to-one on all integers, but it is one-to-one on {1,2,3,4}\{1,2,3,4\}: the values 1, 4, 9, 16 are all different, so P(Y=x2)=P(X=x)P(Y = x^2) = P(X = x).
  • Summing a shifted PMF (extra). The sum of all probabilities is still 1: no stem is added or removed.

13.4Exam tips and common mistakes

Exam tips
  • If a question asks for P(Y = y) with a one-to-one g, solve g(x) = y for x and read P(X = x).
  • Check one-to-one by listing the y values: if all are different, you are done.
Common mistakes
  • Changing the probabilities along with the locations. They stay exactly the same.
  • Assuming a non-linear map keeps equal spacing.

Practice questions (graded-assignment style)

Q1Shifted binomial

Numerical Answer Type (NAT).

X∼Binomial(10,0.5)X \sim \text{Binomial}(10, 0.5) and Y=X−5Y = X - 5. What is 1024×P(Y=−2)1024 \times P(Y = -2)?

Solution
Idea

Which x gives y = −2?

  • y=−2y = -2 comes from x=3x = 3, and 1024×P(X=3)=1201024 \times P(X = 3) = 120.
  • Answer: 120
Q2Powers of two

Numerical Answer Type (NAT).

X∼Binomial(10,0.5)X \sim \text{Binomial}(10, 0.5) and Y=2XY = 2^X. What is 1024×P(Y=32)1024 \times P(Y = 32)?

Solution
Idea

25=322^5 = 32.

  • Y=32Y = 32 means X=5X = 5, whose probability is 252/1024252/1024.
  • Answer: 252
Q3What changes?

Multiple Choice Question (MCQ): choose the one correct option.

A one-to-one function g is applied to X. What changes in the PMF?

1
The probabilities
2
The locations of the stems
3
Both
4
Neither
Solution
Idea

One x for each y.

  • The same probabilities sit at the new locations g(x).
  • Answer: option 2.
Q4One-to-one maps

Multiple Select Question (MSQ): select all that apply.

XX is Uniform{0,…,10}\{0,\dots,10\}. For which gg is Y=g(X)Y = g(X) still uniform on 11 values?

1
g(x)=x−5g(x) = x - 5
2
g(x)=2xg(x) = 2^x
3
g(x)=(x−5)2g(x) = (x-5)^2
4
g(x)=−xg(x) = -x
Solution
Idea

Which maps are one-to-one on 0, ..., 10?

  • (x−5)2(x-5)^2 is many-to-one (4 and 6 both give 1), so the result is not uniform on 11 values.
  • Answer: options 1, 2 and 4.
Next · Functions of one variableMany-to-One Functions
14
Functions of one variable

Many-to-One Functions

Probabilities pile up and the shape of the PMF can change.

When several xx values map to the same yy, their probabilities pile up on that yy. The shape of the PMF can change completely.

14.1Example: Y = (X − 5)²

Y = (X - 5)^2: the PMF of Yuniform X: no longer flatbinomial X: mode is now y = 1 (x 1024)2/112/112/112/112/11014916251/112524202409020201491625the stems pile up where two x values land on one y
Figure 17. Y = (X − 5)²: the flat uniform is no longer flat; the most likely binomial value moves from 5 (for X) to y = 1 (for Y)
Check on the PDF caption. The PDF says the most likely binomial value "moves from 0 to 1". The most likely value of X is 5 (which maps to y = 0, with 252/1024), but the most likely value of Y is y = 1 with 420/1024, because two x values land there. Both are in the table; only the wording differs.

14.2Another many-to-one example

Example 23Remainders (extra)

Find the PMF of Y=X mod 3Y = X \bmod 3 for the uniform, and of Y=X mod 2Y = X \bmod 2 for the binomial.

Solution
  1. Uniform, mod 3. y=0y = 0 from x∈{0,3,6,9}x \in \{0,3,6,9\}: 4 values; y=1y = 1 from {1,4,7,10}\{1,4,7,10\}: 4 values; y=2y = 2 from {2,5,8}\{2,5,8\}: 3 values. So P(Y=0)=P(Y=1)=411P(Y=0) = P(Y=1) = \tfrac4{11} and P(Y=2)=311P(Y=2) = \tfrac3{11} (total 1111\tfrac{11}{11}).
  2. Binomial, mod 2. Y=0Y = 0 when XX is even: 1+45+210+210+45+11024=5121024=12\tfrac{1 + 45 + 210 + 210 + 45 + 1}{1024} = \tfrac{512}{1024} = \tfrac12, so P(Y=1)=12P(Y=1) = \tfrac12 too. (Even and odd numbers of heads are equally likely.)

14.3Going deeper

  • Unevenness appears (extra). The uniform input had equal stems, but the output stems are 1/11 and 2/11. The more x values collapse onto one y, the taller its stem.
  • Information is lost (extra). From Y = 1 alone you cannot tell whether X was 4 or 6. A one-to-one function loses nothing; a many-to-one function does.
  • Symmetric input, folded output (extra). Because the binomial is symmetric about 5, squaring the distance from 5 folds the plot in half and doubles every stem except the one at 0.

14.4Exam tips and common mistakes

Exam tips
  • Circle matching y values in the table before adding, so no row is missed or used twice.
  • Mention which x values feed each y, as in "P(Y = 1) = P(X = 4) + P(X = 6)".
Common mistakes
  • Doubling y = 0 as well. It comes from the single value x = 5.
  • Leaving the uniform answer as 1/11 each because the input was uniform.

Practice questions (graded-assignment style)

Q1P(Y = 4), binomial

Numerical Answer Type (NAT).

X∼Binomial(10,0.5)X \sim \text{Binomial}(10, 0.5), Y=(X−5)2Y = (X-5)^2. What is 1024×P(Y=4)1024 \times P(Y = 4)?

Solution
Idea

Which x give y = 4?

  • x=3x = 3 and x=7x = 7: 120+120=240120 + 120 = 240.
  • Answer: 240
Q2P(Y = 25), uniform

Numerical Answer Type (NAT).

XX is uniform on {0,…,10}\{0,\dots,10\} and Y=(X−5)2Y = (X-5)^2. What is 11×P(Y=25)11 \times P(Y = 25)?

Solution
Idea

x = 0 and x = 10.

  • Two values of xx give y=25y = 25, each with probability 111\tfrac1{11}: 211\tfrac2{11}, so the answer is 2.
  • Answer: 2
Q3Most likely value of Y

Multiple Choice Question (MCQ): choose the one correct option.

For the binomial XX and Y=(X−5)2Y = (X-5)^2, the most likely value of YY is:

1
0
2
1
3
4
4
25
Solution
Idea

Compare 252, 420, 240, 90, 20, 2.

  • P(Y = 1) = 420/1024 is the largest. P(Y = 0) = 252/1024 comes from the single value x = 5.
  • Answer: option 2.
Q4Many-to-one facts

Multiple Select Question (MSQ): select all that apply.

Choose the correct statements about Y=(X−5)2Y = (X-5)^2 with uniform XX.

1
P(Y=0)=111P(Y = 0) = \tfrac1{11}
2
P(Y=9)=211P(Y = 9) = \tfrac2{11}
3
YY is uniform on its range
4
The probabilities of YY add up to 1
Solution
Idea

Count the x values for each y.

  • P(Y = 0) = 1/11 and the others are 2/11, so Y is not uniform on its range (statement 3 is false).
  • Answer: options 1, 2 and 4.
Next · Try theseTry These: Clipping Functions
15
Try these

Try These: Clipping Functions

The two lecture questions solved step by step.

The two "Try these" questions of the lecture, solved step by step. Both are clipping functions: everything beyond a cut-off collapses onto one value.

15.1Try these Q1

Example 24Try these Q1: max(X, 0)

Let X∼Uniform{−5,−4,…,5}X \sim \text{Uniform}\{-5, -4, \dots, 5\} and f(x)=xf(x) = x for x>0x > 0, f(x)=0f(x) = 0 for x≤0x \le 0. Find the distribution of Y=f(X)Y = f(X).

Solution
  1. PMF of XX. There are 11 values from −5-5 to 55, so P(X=x)=111P(X = x) = \tfrac1{11} for each.
  2. Table method. Rows x = −5, ..., 5 each with 1/11; y = 0 for the six values −5 to 0, and y = x for 1 to 5.
  3. Range of YY. The distinct yy values are {0,1,2,3,4,5}\{0,1,2,3,4,5\}.
  4. Add up probabilities for each yy. The value y=0y = 0 comes from six xx values (−5-5 to 00); each positive yy comes from exactly one xx: P(Y=0)=6⋅111=611P(Y=0) = 6 \cdot \tfrac1{11} = \tfrac6{11}, and P(Y=k)=111P(Y=k) = \tfrac1{11} for k=1,…,5k = 1,\dots,5.
  5. Check. 611+5⋅111=1\tfrac6{11} + 5 \cdot \tfrac1{11} = 1. ✓
yy012345
P(Y=y)P(Y=y)6/111/111/111/111/111/11

ff is many-to-one on the non-positive values (they all collapse to 0) and one-to-one on the positive values. Answer: P(Y=0)=611P(Y=0) = \tfrac6{11} and P(Y=k)=111P(Y=k) = \tfrac1{11} for k=1,…,5k = 1,\dots,5.

15.2Try these Q2

Example 25Try these Q2: max(X, 5)

Let X∼Uniform{−500,−499,…,500}X \sim \text{Uniform}\{-500, -499, \dots, 500\} and f(x)=max⁡(x,5)f(x) = \max(x, 5). Find the distribution of Y=f(X)Y = f(X).

Solution
  1. PMF of XX. The values run from −500-500 to 500500: that is 500+500+1=1001500 + 500 + 1 = 1001 values, so P(X=x)=11001P(X = x) = \tfrac1{1001}.
  2. Understand ff. max⁡(x,5)\max(x, 5) replaces anything below 5 by 5 and leaves values of 5 or more unchanged.
  3. Range of YY. Y∈{5,6,7,…,500}Y \in \{5, 6, 7, \dots, 500\}.
  4. Count how many xx give y=5y = 5. Every xx from −500-500 to 55 inclusive: 5−(−500)+1=5065 - (-500) + 1 = 506 values, so P(Y=5)=5061001P(Y = 5) = \tfrac{506}{1001}.
  5. The other values. Each y∈{6,…,500}y \in \{6,\dots,500\} comes only from x=yx = y, so P(Y=y)=11001P(Y = y) = \tfrac1{1001}.
  6. Check. There are 500−6+1=495500 - 6 + 1 = 495 such values: 5061001+4951001=10011001=1\tfrac{506}{1001} + \tfrac{495}{1001} = \tfrac{1001}{1001} = 1. ✓
  7. Answer: P(Y = 5) = 506/1001, and P(Y = y) = 1/1001 for y = 6, 7, ..., 500.

The stem plot of Y is one very tall stem at 5 (just over half the probability) followed by a flat run of tiny stems.

Clipped variables: the left tail collapses onto one valueQ1: Y = max(X, 0), X in {-5..5}Q2: Y = max(X, 5), X in {-500..500}6/111/111/111/111/111/11012345506/100151/1001 each... 500one tall stem, then a flat run of small ones
Figure 18. Both answers: one tall stem, then a flat run

15.3Going deeper

  • Clipping is everywhere (extra). max(X, c) models a floor (for example a minimum charge) and min(X, c) models a cap. In both, a whole tail of values collapses onto one value, which gets a big stem.
  • Counting the collapsed values (extra). When the values are consecutive integers from a to b, there are b − a + 1 of them. That is why the count is 5 − (−500) + 1 = 506 here and not 505.
  • Cap example (extra). For X uniform on {1, ..., 10} and Y = min(X, 4): Y = 1, 2, 3 each have 1/10, and Y = 4 has 7/10 (x = 4, ..., 10).

15.4Exam tips and common mistakes

Exam tips
  • For clipping, find the cut-off value first, then count how many x values are at or beyond it.
  • Test your answer by adding all probabilities: 506 + 495 = 1001.
Common mistakes
  • Off-by-one errors when counting the collapsed values (506, not 505).
  • Giving the clipped value the probability of one x only.

Practice questions (graded-assignment style)

Q1Cap at 4

Numerical Answer Type (NAT).

X is uniform on {1, 2, ..., 10} and Y = min(X, 4). Find P(Y = 4).

Solution
Idea

Which x give y = 4?

  • x = 4, 5, ..., 10 are 7 values, so P(Y = 4) = 7/10 = 0.7.
  • Answer: 0.7
Q2Absolute value

Numerical Answer Type (NAT).

XX is uniform on {−5,…,5}\{-5,\dots,5\} and Y=∣X∣Y = |X|. What is 11×P(Y=3)11 \times P(Y = 3)?

Solution
Idea

x = 3 and x = −3.

  • Two values of x give y = 3, so P(Y = 3) = 2/11 and the answer is 2.
  • Answer: 2
Q3Try these Q1 value

Numerical Answer Type (NAT).

In Try these Q1, what is 11×P(Y=0)11 \times P(Y = 0)?

Solution
Idea

Count x from −5 to 0.

  • Six values of x collapse to 0, so P(Y = 0) = 6/11.
  • Answer: 6
Q4Try these Q2 value

Numerical Answer Type (NAT).

In Try these Q2, what is 1001 × P(Y = 5)?

Solution
Idea

Count x from −500 to 5.

  • 5 − (−500) + 1 = 506 values collapse to 5.
  • Answer: 506
Q5Clipping facts

Multiple Select Question (MSQ): select all that apply.

Choose the correct statements about Y = max(X, 5) for X uniform on {−500, ..., 500}.

1
Y takes 496 distinct values
2
P(Y = 5) is a little over 1/2
3
P(Y = 6) = 1/1001
4
Y is uniform
Solution
Idea

Range 5, ..., 500 has 496 values.

  • Y is not uniform: one value has probability 506/1001 and the rest 1/1001.
  • Answer: options 1, 2 and 3.
Next · RevisionFunctions of one variable: Revision Sheet
16
Revision

Functions of one variable: Revision Sheet

One page to revise everything in this section.

The big picture

Stem plots
  • A stem of height P(X=x)P(X=x) at each value xx.
  • Uniform: flat stems. Binomial(10, 0.5): bell-shaped, tallest at 5.
Table method
  • Columns xx, P(X=x)P(X=x), y=g(x)y = g(x); group rows by yy.
  • P(Y=y)=∑x: g(x)=yP(X=x)P(Y=y) = \sum_{x:\,g(x)=y} P(X=x).
One-to-one
  • Same probabilities, new locations: P(Y=g(x))=P(X=x)P(Y=g(x)) = P(X=x).
  • X−5X - 5 slides the stems; 2X2^X spreads them unevenly.
Many-to-one
  • Probabilities pile up and the shape can change.
  • (X−5)2(X-5)^2: uniform becomes 1/11, 2/11, ...; binomial mode moves to 1.
Clipping
  • max⁡(X,c)\max(X, c): every value beyond the cut collapses onto one value.
  • Q1: 6/11 at 0. Q2: 506/1001 at 5.

Revision sheet

IdeaKey point
Stem plotA stem of height P(X=x)P(X=x) at each value xx
Table methodColumns x, P(X=x), g(x)x,\ P(X=x),\ g(x); group rows by g(x)g(x)
General formulaP(Y=y)=∑x: g(x)=yP(X=x)P(Y=y) = \sum_{x:\,g(x)=y} P(X=x)
One-to-oneSame probabilities, new locations: P(Y=g(x))=P(X=x)P(Y=g(x)) = P(X=x)
Many-to-oneProbabilities pile up; the shape of the PMF can change
Clipping, e.g. max⁡(X,c)\max(X,c)All values beyond the cut collapse onto one value
Revision overview
See a PMFStem plots
Uniform is flat
Binomial is a bell
Table methodx, P(X=x), g(x)
Group by y
Add probabilities
CheckNew PMF adds to 1
Every row used once
Functions of one variableWeek 2
One-to-oneX − 5 slides
2^X stretches
Probabilities unchanged
Many-to-one(X − 5)² folds
Pairs add up
Shape changes
Clippingmax(X, 0): 6/11 at 0
max(X, 5): 506/1001
Revision: functions of one random variable in one view

Common mistakes

Merging rows wrongly
  • Add only the rows with the same y. Check that every row of X is used exactly once.
Changing probabilities for one-to-one g
  • They stay the same; only the locations move.
Doubling the stem at y = 0
  • In (X − 5)², y = 0 comes from the single value x = 5.
Off-by-one when counting
  • From a to b inclusive there are b − a + 1 values (506, not 505).
Assuming uniform stays uniform
  • A many-to-one function can make the output uneven, as in 1/11, 2/11, ...
Forgetting to check the total
  • The final PMF must add up to 1; if not, a row was missed or counted twice.
Next: Chapters 17 to 35 (functions of two and of several variables, contours, sums and convolution) are in the second note, Week 2 · Part 2 of 2.
Back to top