Quiz 2
Registry Synced

Week 1.2: Marginal Distributions

1674 words
8 min read

Reading compass

Now · 1. Intuition: "Summing Away" the Other Variable

Week 1.2: Marginal Distributions

Prerequisites: Joint PMF (Week 1.1: Joint Probability Mass Function (Joint PMF)) Cross-links: BSMA3012 (Linear Stat Models) — marginalisation in multivariate regression Core question: Given the full joint distribution, how do we recover the distribution of just one variable?

1. Intuition: "Summing Away" the Other Variable

The joint PMF fXY(x,y)f_{XY}(x, y) tells us everything about the pair (X,Y)(X, Y). But sometimes we only care about XX alone. How do we get fX(x)f_X(x) from fXYf_{XY}? Intuition: The event (X=x)(X = x) can be partitioned into the disjoint union of events (X=x,Y=y)(X = x, Y = y) for all possible yy. Since these events are mutually exclusive:
P(X=x)=yTYP(X=x,Y=y).\mathbb{P}(X = x) = \sum_{y \in T_Y} \mathbb{P}(X = x, Y = y).
We are summing over (or marginalising out) YY. The resulting PMF is called the marginal PMF because it appears in the margins of a contingency table.

2. Formal Definition

Definition (Marginal PMF) Let XX and YY be jointly distributed discrete random variables with joint PMF fXYf_{XY}. The marginal PMF of XX is
>fX(t)=P(X=t)=tTYfXY(t,t),tTX.>> f_X(t) = \mathbb{P}(X = t) = \sum_{t' \in T_Y} f_{XY}(t, t'), \quad t \in T_X. >
Similarly, the marginal PMF of YY is
>fY(t)=P(Y=t)=tTXfXY(t,t),tTY.>> f_Y(t) = \mathbb{P}(Y = t) = \sum_{t' \in T_X} f_{XY}(t', t), \quad t \in T_Y. >
Proof sketch: Let TY={y1,y2,,yK}T_Y = \{y_1, y_2, \dots, y_K\}. Then:
(X=t)=(X=t,Y=y1)(X=t,Y=y2)(X=t,Y=yK)P(X=t)=j=1KP(X=t,Y=yj)=j=1KfXY(t,yj).\begin{aligned} (X = t) &= (X = t, Y = y_1) \cup (X = t, Y = y_2) \cup \dots \cup (X = t, Y = y_K) \\ \mathbb{P}(X = t) &= \sum_{j=1}^K \mathbb{P}(X = t, Y = y_j) = \sum_{j=1}^K f_{XY}(t, y_j). \end{aligned}
The union is disjoint because YY can only take one value at a time.

3. Visualised: The Margins of a Table

The name "marginal" comes from where these values appear in a contingency table — they are written in the margins (the extra row and column).

Example: Toss a Fair Coin Twice

X2\X1X_2 \backslash X_101** fX2f_{X_2} **
01/41/41/2
11/41/41/2
** fX1f_{X_1} **1/21/2
  • fX1(0)=1/4+1/4=1/2f_{X_1}(0) = 1/4 + 1/4 = 1/2 (column sum)
  • fX1(1)=1/4+1/4=1/2f_{X_1}(1) = 1/4 + 1/4 = 1/2 (column sum)
  • fX2(0)=1/4+1/4=1/2f_{X_2}(0) = 1/4 + 1/4 = 1/2 (row sum)
  • fX2(1)=1/4+1/4=1/2f_{X_2}(1) = 1/4 + 1/4 = 1/2 (row sum)

4. Key Insight: Same Marginals, Different Joints

It is entirely possible for different joint PMFs to produce the same marginal PMFs. This is a critical observation — the marginals alone do not capture the dependence structure.

Example

Consider: Case 1 (Independent):
Y\XY \backslash X01fYf_Y
01/41/41/2
11/41/41/2
** fXf_X **1/21/2
Case 2 (Dependent, parameter xx):
Y\XY \backslash X01fYf_Y
0xx1/2x1/2 - x1/2
11/2x1/2 - xxx1/2
** fXf_X **1/21/2
For any x[0,1/2]x \in [0, 1/2], both marginals are fX(0)=fX(1)=1/2f_X(0)=f_X(1)=1/2, fY(0)=fY(1)=1/2f_Y(0)=f_Y(1)=1/2. But the joint distributions differ!
  • x=1/4x = 1/4 → independent case
  • x=0x = 0 → perfect negative dependence (XX and YY always differ)
  • x=1/2x = 1/2 → perfect positive dependence (XX and YY always equal)
Takeaway: The joint PMF contains strictly more information than the two marginals. Marginalisation loses information about dependence.

5. Marginalisation for Multiple RVs

For nn random variables X1,,XnX_1, \dots, X_n with joint PMF fX1Xnf_{X_1\dots X_n}:
  • Individual marginal: Sum over all other variables.
fX1(t)=t2TX2tnTXnfX1Xn(t,t2,,tn).f_{X_1}(t) = \sum_{t_2 \in T_{X_2}} \cdots \sum_{t_n \in T_{X_n}} f_{X_1\dots X_n}(t, t_2, \dots, t_n).
  • Joint marginal of a subset: Sum over the variables not in the subset.
fX1X2(t1,t2)=t3TX3tnTXnfX1Xn(t1,t2,t3,,tn).f_{X_1X_2}(t_1, t_2) = \sum_{t_3 \in T_{X_3}} \cdots \sum_{t_n \in T_{X_n}} f_{X_1\dots X_n}(t_1, t_2, t_3, \dots, t_n).
Mnemonic: Sum over everything you do NOT want.

6. Worked Examples

Example 1: Random 2-Digit Number

Y\XY \backslash X0123456789fYf_Y
01/2001/2001/2001/2001/2001/4
101/2001/2001/2001/2001/201/4
21/2001/2001/2001/2001/2001/4
301/2001/2001/2001/2001/201/4
** fXf_X **1/101/101/101/101/101/101/101/101/101/10
  • fX(x)=1/10f_X(x) = 1/10 for x=0,1,,9x = 0,1,\dots,9XUniform{0,,9}X \sim \text{Uniform}\{0,\dots,9\}
  • fY(y)=1/4f_Y(y) = 1/4 for y=0,1,2,3y = 0,1,2,3YUniform{0,1,2,3}Y \sim \text{Uniform}\{0,1,2,3\} Despite both being uniform, XX and YY are not independent (the joint is not the product of marginals).

Example 2: Triple Coin Toss

X1X_1X2X_2X3X_3fX1X2X3f_{X_1X_2X_3}
0001/8
0011/8
0101/8
0111/8
1001/8
1011/8
1101/8
1111/8
Marginal of X1X_1:
fX1(0)=f(0,0,0)+f(0,0,1)+f(0,1,0)+f(0,1,1)=1/8+1/8+1/8+1/8=1/2fX1(1)=f(1,0,0)+f(1,0,1)+f(1,1,0)+f(1,1,1)=1/2\begin{aligned} f_{X_1}(0) &= f(0,0,0) + f(0,0,1) + f(0,1,0) + f(0,1,1) = 1/8+1/8+1/8+1/8 = 1/2 \\ f_{X_1}(1) &= f(1,0,0) + f(1,0,1) + f(1,1,0) + f(1,1,1) = 1/2 \end{aligned}
So X1Bernoulli(1/2)X_1 \sim \text{Bernoulli}(1/2). Joint marginal of (X1,X2)(X_1, X_2):
fX1X2(0,0)=f(0,0,0)+f(0,0,1)=1/8+1/8=1/4fX1X2(0,1)=f(0,1,0)+f(0,1,1)=1/4fX1X2(1,0)=f(1,0,0)+f(1,0,1)=1/4fX1X2(1,1)=f(1,1,0)+f(1,1,1)=1/4\begin{aligned} f_{X_1X_2}(0,0) &= f(0,0,0) + f(0,0,1) = 1/8+1/8 = 1/4 \\ f_{X_1X_2}(0,1) &= f(0,1,0) + f(0,1,1) = 1/4 \\ f_{X_1X_2}(1,0) &= f(1,0,0) + f(1,0,1) = 1/4 \\ f_{X_1X_2}(1,1) &= f(1,1,0) + f(1,1,1) = 1/4 \end{aligned}
Note (X1,X2)(X_1, X_2) are independent and uniform — same as the 2-coin toss.

Example 3: IPL Over

From the IPL example, marginal of XX (runs) can be obtained by summing over YY:
fX(x)=y=02fXY(x,y)=y=02fY(y)fXY=y(x).f_X(x) = \sum_{y=0}^2 f_{XY}(x,y) = \sum_{y=0}^2 f_Y(y) \cdot f_{X \mid Y=y}(x).
For x=6x = 6: fX(6)=131617+1817+11617=17f_X(6) = \frac{13}{16}\cdot\frac{1}{7} + \frac{1}{8}\cdot\frac{1}{7} + \frac{1}{16}\cdot\frac{1}{7} = \frac{1}{7}.

7. Formula Summary

OperationFormulaMnemonic
Marginal of XX from (X,Y)(X,Y)fX(x)=yfXY(x,y)f_X(x) = \sum_y f_{XY}(x,y)Sum over yy
Marginal of YY from (X,Y)(X,Y)fY(y)=xfXY(x,y)f_Y(y) = \sum_x f_{XY}(x,y)Sum over xx
Joint marginal (Xi,Xj)(X_i, X_j) from nn RVsfXiXj(u,v)=othersfX1Xnf_{X_iX_j}(u,v) = \sum_{\text{others}} f_{X_1\dots X_n}Sum out the rest
Individual marginal from nn RVsfXi(t)=all othersfX1Xnf_{X_i}(t) = \sum_{\text{all others}} f_{X_1\dots X_n}Sum out everything else

8. Practice Questions

Q1 (Easy)

For the joint PMF below, find the marginal PMFs of XX and YY.
Y\XY \backslash X012
00.10.20.1
10.150.050.1
20.050.150.1
Full Solution
Marginal of XX (column sums):
  • fX(0)=0.1+0.15+0.05=0.30f_X(0) = 0.1 + 0.15 + 0.05 = 0.30
  • fX(1)=0.2+0.05+0.15=0.40f_X(1) = 0.2 + 0.05 + 0.15 = 0.40
  • fX(2)=0.1+0.1+0.1=0.30f_X(2) = 0.1 + 0.1 + 0.1 = 0.30
Marginal of YY (row sums):
  • fY(0)=0.1+0.2+0.1=0.40f_Y(0) = 0.1 + 0.2 + 0.1 = 0.40
  • fY(1)=0.15+0.05+0.1=0.30f_Y(1) = 0.15 + 0.05 + 0.1 = 0.30
  • fY(2)=0.05+0.15+0.1=0.30f_Y(2) = 0.05 + 0.15 + 0.1 = 0.30
Check: fX=0.3+0.4+0.3=1\sum f_X = 0.3+0.4+0.3 = 1, fY=0.4+0.3+0.3=1\sum f_Y = 0.4+0.3+0.3 = 1. ✓

Q2 (Medium)

For the same joint PMF, compute P(X+Y1)\mathbb{P}(X + Y \leq 1) using the marginal distributions. Can you compute it using only marginals?
Strategy Hint
The event X+Y1X+Y \leq 1 involves both variables together; you need the joint PMF, not just the marginals. Full Solution
We need the joint probabilities for pairs where x+y1x+y \leq 1:
  • (0,0)(0,0): 0.1
  • (0,1)(0,1): 0.15
  • (1,0)(1,0): 0.2
  • (0,0)(0,0) already counted
P(X+Y1)=0.1+0.15+0.2=0.45\mathbb{P}(X+Y \leq 1) = 0.1 + 0.15 + 0.2 = 0.45.
Cannot be computed from marginals alone — we need the joint.

Q3 (Hard)

Three fair dice are rolled. Let X1,X2,X3X_1, X_2, X_3 be the outcomes. Find fX1X2(i,j)f_{X_1X_2}(i,j) and fX1(i)f_{X_1}(i).
Full Solution
Since rolls are independent and uniform {1,,6}\{1,\dots,6\}:
fX1X2(i,j)=fX1(i)fX2(j)=1616=136f_{X_1X_2}(i,j) = f_{X_1}(i) \cdot f_{X_2}(j) = \frac{1}{6} \cdot \frac{1}{6} = \frac{1}{36} for all i,j{1,,6}i,j \in \{1,\dots,6\}.
fX1(i)=16f_{X_1}(i) = \frac{1}{6} for i=1,,6i = 1,\dots,6.
Alternatively, marginalise from the triple:
>fX1X2(i,j)=k=16fX1X2X3(i,j,k)=k=161216=6216=136.>> f_{X_1X_2}(i,j) = \sum_{k=1}^6 f_{X_1X_2X_3}(i,j,k) = \sum_{k=1}^6 \frac{1}{216} = \frac{6}{216} = \frac{1}{36}. >

Q4 (Exam-style)

The joint PMF of (X,Y)(X,Y) is given by fXY(x,y)=c(x+y)f_{XY}(x,y) = c \cdot (x+y) for x=1,2x = 1,2, y=1,2,3y = 1,2,3. Find cc and the marginal PMFs.
Strategy Hint
First find cc by requiring total probability = 1, then compute marginals. Full Solution
Find cc:
>1=x=12y=13c(x+y)=cx=12y=13(x+y)=c[x=12y=13x+x=12y=13y]=c[(1+2)3+2(1+2+3)]=c[33+26]=c(9+12)=21cc=121.>> \begin{aligned} 1 &= \sum_{x=1}^2 \sum_{y=1}^3 c(x+y) = c \sum_{x=1}^2 \sum_{y=1}^3 (x+y) \\ &= c \left[ \sum_{x=1}^2 \sum_{y=1}^3 x + \sum_{x=1}^2 \sum_{y=1}^3 y \right] \\ &= c \left[ (1+2) \cdot 3 + 2 \cdot (1+2+3) \right] \\ &= c \left[ 3 \cdot 3 + 2 \cdot 6 \right] = c (9 + 12) = 21c \\ \Rightarrow c &= \frac{1}{21}. \end{aligned} >
Marginal of XX:
>fX(1)=y=13121(1+y)=121[(2)+(3)+(4)]=921=37fX(2)=y=13121(2+y)=121[(3)+(4)+(5)]=1221=47>> \begin{aligned} f_X(1) &= \sum_{y=1}^3 \frac{1}{21}(1+y) = \frac{1}{21}[(2)+(3)+(4)] = \frac{9}{21} = \frac{3}{7} \\ f_X(2) &= \sum_{y=1}^3 \frac{1}{21}(2+y) = \frac{1}{21}[(3)+(4)+(5)] = \frac{12}{21} = \frac{4}{7} \end{aligned} >
Marginal of YY:
>fY(1)=121[(1+1)+(2+1)]=121(2+3)=521fY(2)=121[(1+2)+(2+2)]=121(3+4)=721=13fY(3)=121[(1+3)+(2+3)]=121(4+5)=921=37>> \begin{aligned} f_Y(1) &= \frac{1}{21}[(1+1)+(2+1)] = \frac{1}{21}(2+3) = \frac{5}{21} \\ f_Y(2) &= \frac{1}{21}[(1+2)+(2+2)] = \frac{1}{21}(3+4) = \frac{7}{21} = \frac{1}{3} \\ f_Y(3) &= \frac{1}{21}[(1+3)+(2+3)] = \frac{1}{21}(4+5) = \frac{9}{21} = \frac{3}{7} \end{aligned} >
Check: fX=3/7+4/7=1\sum f_X = 3/7+4/7=1, fY=5/21+7/21+9/21=1\sum f_Y = 5/21+7/21+9/21=1. ✓

Document outline

Keep your place and jump directly to a heading.

Table of Contents
System Normal // Awaiting Context

Intelligence Hub

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