Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.



1Joint Probability Distributions

1.1Discrete Case

EXAMPLE: Smartphone Defects. A quality inspector checks smartphones for two types of defects: screen defects (Y1Y_1) and battery defects (Y2Y_2). Each phone has 0 or 1 of each type. The joint distribution is:

y2=0y_2 = 0y2=1y_2 = 1Row Total
y1=0y_1 = 00.800.050.85
y1=1y_1 = 10.100.050.15
Col Total0.900.101.00

Reading: p(0,0)=0.80p(0, 0) = 0.80 means 80% of phones have neither defect. p(1,1)=0.05p(1, 1) = 0.05 means 5% have both.

1.2Continuous Case

EXAMPLE: Joint Continuous Distribution. Let f(y1,y2)=2(1y1)f(y_1, y_2) = 2(1 - y_1) for 0y110 \leq y_1 \leq 1, 0y210 \leq y_2 \leq 1.

Verification: 01012(1y1)dy2dy1=012(1y1)[y2]01dy1=012(1y1)dy1=[2y1y12]01=21=1.\int_0^1\int_0^1 2(1-y_1)\, dy_2\, dy_1 = \int_0^1 2(1-y_1)[y_2]_0^1\, dy_1 = \int_0^1 2(1-y_1)\, dy_1 = [2y_1 - y_1^2]_0^1 = 2 - 1 = 1. \checkmark

Find P(Y1+Y21)P(Y_1 + Y_2 \leq 1):

P(Y1+Y21)=0101y12(1y1)dy2dy1=012(1y1)2dy1=[2(1y1)33]01=23P(Y_1 + Y_2 \leq 1) = \int_0^1 \int_0^{1-y_1} 2(1-y_1)\, dy_2\, dy_1 = \int_0^1 2(1-y_1)^2\, dy_1 = \left[-\frac{2(1-y_1)^3}{3}\right]_0^1 = \frac{2}{3}

1.3Non-Rectangular Support Regions: Where Students Get Lost

The example above had a rectangular support: 0y110 \leq y_1 \leq 1, 0y210 \leq y_2 \leq 1. The limits of integration were constants, and life was easy. Most interesting joint distributions don’t have rectangular support. The region where f(y1,y2)>0f(y_1, y_2) > 0 is often a triangle, wedge, or other shape — and getting the integration limits right is the single most important skill in this chapter.

1.4Section Exercises: Joint Distributions

J.1. Let f(y1,y2)=cf(y_1, y_2) = c for 0y2y120 \leq y_2 \leq y_1 \leq 2. Find cc, then find P(Y11)P(Y_1 \leq 1).

J.2. Let f(y1,y2)=2f(y_1, y_2) = 2 for 0<y1<10 < y_1 < 1, 0<y2<1y10 < y_2 < 1-y_1. Verify it integrates to 1. Find P(Y1>0.5)P(Y_1 > 0.5).

J.3. Let f(y1,y2)=e(y1+y2)f(y_1, y_2) = e^{-(y_1+y_2)} for y1>0y_1 > 0, y2>0y_2 > 0. (a) Verify it’s a valid joint PDF. (b) Is the support rectangular? (c) Find P(Y1+Y2<1)P(Y_1 + Y_2 < 1).

J.4. Let f(y1,y2)=6(1y2)f(y_1, y_2) = 6(1-y_2) for 0<y1<y2<10 < y_1 < y_2 < 1. (a) Verify. (b) Find P(Y1<0.25,Y2>0.5)P(Y_1 < 0.25, Y_2 > 0.5).


2Marginal Distributions

EXAMPLE (Discrete marginals). From the smartphone table, the marginal of Y1Y_1 (screen defects) is:

p1(0)=0.80+0.05=0.85,p1(1)=0.10+0.05=0.15p_1(0) = 0.80 + 0.05 = 0.85, \quad p_1(1) = 0.10 + 0.05 = 0.15

This is the row totals column — the distribution of screen defects ignoring battery status.

EXAMPLE (Rectangular support). For f(y1,y2)=2(1y1)f(y_1, y_2) = 2(1-y_1) on [0,1]2[0,1]^2:

f1(y1)=012(1y1)dy2=2(1y1),0y11f_1(y_1) = \int_0^1 2(1-y_1)\, dy_2 = 2(1-y_1), \quad 0 \leq y_1 \leq 1
f2(y2)=012(1y1)dy1=[2y1y12]01=1,0y21f_2(y_2) = \int_0^1 2(1-y_1)\, dy_1 = [2y_1 - y_1^2]_0^1 = 1, \quad 0 \leq y_2 \leq 1

So Y2Uniform(0,1)Y_2 \sim \text{Uniform}(0,1) but Y1Y_1 has the triangular density 2(1y1)2(1-y_1).

2.1Section Exercises: Marginal Distributions

MG.1. For f(y1,y2)=3(y1+y2)f(y_1, y_2) = 3(y_1 + y_2) on the triangle 0y110 \leq y_1 \leq 1, 0y21y10 \leq y_2 \leq 1-y_1 (from Example M.2 with c=3c = 3), find f1(y1)f_1(y_1) and f2(y2)f_2(y_2). Verify each integrates to 1.

MG.2. For f(y1,y2)=24y1y2f(y_1, y_2) = 24y_1 y_2 on y1>0y_1 > 0, y2>0y_2 > 0, y1+y2<1y_1 + y_2 < 1, find f1(y1)f_1(y_1).

MG.3. For f(y1,y2)=2ey1y2f(y_1, y_2) = 2e^{-y_1-y_2} on 0<y1<y2<0 < y_1 < y_2 < \infty, find both marginals. (Hint: For f1f_1, y2y_2 ranges from y1y_1 to \infty.)


3Conditional Distributions

EXAMPLE (Discrete). From the smartphone data: P(Y1=1Y2=1)=p(1,1)p2(1)=0.050.10=0.50.P(Y_1 = 1 | Y_2 = 1) = \frac{p(1,1)}{p_2(1)} = \frac{0.05}{0.10} = 0.50.

Among phones with battery defects, 50% also have screen defects — much higher than the unconditional rate of 15%. The two defect types are associated.

3.1Section Exercises: Conditional Distributions

CD.1. For f(y1,y2)=ey1f(y_1,y_2) = e^{-y_1} on 0y2y1<0 \leq y_2 \leq y_1 < \infty (Example M.3), find f(y2y1)f(y_2|y_1) and E(Y2Y1=y1)E(Y_2|Y_1 = y_1).

CD.2. For f(y1,y2)=3(y1+y2)f(y_1,y_2) = 3(y_1+y_2) on the triangle 0y110 \leq y_1 \leq 1, 0y21y10 \leq y_2 \leq 1-y_1, find f(y1y2)f(y_1|y_2). What is its support for a given y2y_2?

CD.3. If f(y1y2)=f1(y1)f(y_1|y_2) = f_1(y_1) for all y2y_2, prove that Y1Y_1 and Y2Y_2 are independent.


4Independence of Random Variables

Checking the smartphone example: p(0,0)=0.80p(0,0) = 0.80 but p1(0)p2(0)=0.85×0.90=0.7650.80p_1(0) \cdot p_2(0) = 0.85 \times 0.90 = 0.765 \neq 0.80. Not independent. The defects are associated.

Checking f(y1,y2)=2(1y1)f(y_1,y_2) = 2(1-y_1) on [0,1]2[0,1]^2: Support is rectangular ✓. Does ff factor? f=2(1y1)1=g(y1)h(y2)f = 2(1-y_1) \cdot 1 = g(y_1) \cdot h(y_2) ✓. Independent!

Checking f(y1,y2)=6y1f(y_1,y_2) = 6y_1 on 0<y1<y2<10 < y_1 < y_2 < 1: Support is triangular (NOT rectangular). Dependent — no calculation needed! We confirmed this: E(Y1Y2=y2)=2y2/3E(Y_1|Y_2 = y_2) = 2y_2/3, which depends on y2y_2.


5Expected Values for Multivariate Distributions

EXAMPLE. For the smartphone data, E(Y1+Y2)=(y1+y2)p(y1,y2)E(Y_1 + Y_2) = \sum\sum (y_1+y_2)p(y_1,y_2):

=(0+0)(0.80)+(1+0)(0.10)+(0+1)(0.05)+(1+1)(0.05)=0+0.10+0.05+0.10=0.25= (0+0)(0.80)+(1+0)(0.10)+(0+1)(0.05)+(1+1)(0.05) = 0 + 0.10 + 0.05 + 0.10 = 0.25

Note: E(Y1)=0(0.85)+1(0.15)=0.15E(Y_1) = 0(0.85)+1(0.15) = 0.15 and E(Y2)=0(0.90)+1(0.10)=0.10E(Y_2) = 0(0.90)+1(0.10) = 0.10. So E(Y1+Y2)=0.25=0.15+0.10=E(Y1)+E(Y2)E(Y_1+Y_2) = 0.25 = 0.15 + 0.10 = E(Y_1) + E(Y_2). Linearity of expectation holds — even when the variables are not independent.


6Covariance and Correlation

Key fact: If Y1Y_1 and Y2Y_2 are independent, then E(Y1Y2)=E(Y1)E(Y2)E(Y_1 Y_2) = E(Y_1)E(Y_2), so Cov(Y1,Y2)=0\text{Cov}(Y_1, Y_2) = 0.

The converse is FALSE. Zero covariance does not imply independence. Covariance only detects linear association.

EXAMPLE (Smartphone). E(Y1Y2)=(0)(0)(0.80)+(1)(0)(0.10)+(0)(1)(0.05)+(1)(1)(0.05)=0.05E(Y_1 Y_2) = (0)(0)(0.80)+(1)(0)(0.10)+(0)(1)(0.05)+(1)(1)(0.05) = 0.05.

Cov(Y1,Y2)=0.05(0.15)(0.10)=0.050.015=0.035>0.\text{Cov}(Y_1, Y_2) = 0.05 - (0.15)(0.10) = 0.05 - 0.015 = 0.035 > 0.

Positive covariance: screen and battery defects tend to occur together.


7Variance of Linear Combinations

EXAMPLE: Portfolio Risk (Solving the Opening Problem).

Stock A: μA=0.12\mu_A = 0.12, σA=0.20\sigma_A = 0.20. Stock B: μB=0.08\mu_B = 0.08, σB=0.15\sigma_B = 0.15. Portfolio: R=0.6YA+0.4YBR = 0.6Y_A + 0.4Y_B.

Expected return: E(R)=0.6(0.12)+0.4(0.08)=0.072+0.032=0.104=10.4%E(R) = 0.6(0.12) + 0.4(0.08) = 0.072 + 0.032 = 0.104 = 10.4\%

Variance (if independent, ρ=0\rho = 0):

V(R)=(0.6)2(0.04)+(0.4)2(0.0225)=0.0144+0.0036=0.018V(R) = (0.6)^2(0.04) + (0.4)^2(0.0225) = 0.0144 + 0.0036 = 0.018
σR=0.018=0.1342=13.42%\sigma_R = \sqrt{0.018} = 0.1342 = 13.42\%

Variance (if ρ=0.5\rho = 0.5): Cov(YA,YB)=ρσAσB=0.5(0.20)(0.15)=0.015\text{Cov}(Y_A, Y_B) = \rho \sigma_A \sigma_B = 0.5(0.20)(0.15) = 0.015

V(R)=0.018+2(0.6)(0.4)(0.015)=0.018+0.0072=0.0252V(R) = 0.018 + 2(0.6)(0.4)(0.015) = 0.018 + 0.0072 = 0.0252
σR=0.0252=0.1587=15.87%\sigma_R = \sqrt{0.0252} = 0.1587 = 15.87\%

Positive correlation increases risk. This is why diversification (low or negative ρ\rho) reduces portfolio volatility.


8Conditional Expectation


9Conditional Variance and the Law of Total Variance

9.1Section Exercises: Conditional Variance

CV.1. For independent Y1,Y2Y_1, Y_2 with V(Y1)=σ2V(Y_1) = \sigma^2, show that Eve’s Law gives V(Y1)=σ2V(Y_1) = \sigma^2 (the first term equals σ2\sigma^2 and the second equals 0).

CV.2. Let NPoisson(λ)N \sim \text{Poisson}(\lambda) and given N=nN = n, let XN=nBinomial(n,p)X | N=n \sim \text{Binomial}(n, p). Use Eve’s Law to find V(X)V(X). (Hint: E(XN)=NpE(X|N) = Np, V(XN)=Np(1p)V(X|N) = Np(1-p).)


10The Bivariate Normal Distribution

The formula looks intimidating, but you rarely need to evaluate it directly. What matters are the properties.

10.1Key Properties of the Bivariate Normal

Why Property 3 is remarkable: For general distributions, Cov=0\text{Cov} = 0 does NOT imply independence — it only rules out linear association. The bivariate normal is special: uncorrelated does mean independent. This is because the joint PDF factors when ρ=0\rho = 0:

When ρ=0\rho = 0, the exponent becomes 12[(y1μ1σ1)2+(y2μ2σ2)2]-\frac{1}{2}\left[\left(\frac{y_1-\mu_1}{\sigma_1}\right)^2 + \left(\frac{y_2-\mu_2}{\sigma_2}\right)^2\right], which is a sum of two terms — one depending only on y1y_1, the other only on y2y_2. So f(y1,y2)=f1(y1)f2(y2)f(y_1,y_2) = f_1(y_1) \cdot f_2(y_2).

Why Property 2 matters for regression: The conditional mean E(Y1Y2=y2)=μ1+ρσ1σ2(y2μ2)E(Y_1|Y_2 = y_2) = \mu_1 + \rho\frac{\sigma_1}{\sigma_2}(y_2 - \mu_2) is a linear function of y2y_2. This is the theoretical foundation of simple linear regression — the “best prediction” of Y1Y_1 given Y2Y_2 is a straight line with slope ρσ1/σ2\rho\sigma_1/\sigma_2.

#| label: bvn-sim
# Simulate bivariate normal to visualize
set.seed(2026)
n <- 5000
mu1 <- 64; mu2 <- 70; s1 <- 2.5; s2 <- 3; rho <- 0.50

Z1 <- rnorm(n); Z2 <- rnorm(n)
Y1 <- mu1 + s1 * Z1
Y2 <- mu2 + s2 * (rho * Z1 + sqrt(1 - rho^2) * Z2)

plot(Y2, Y1, pch = '.', col = rgb(0.2,0.4,0.8,0.3),
     xlab = "Husband height (in)", ylab = "Wife height (in)",
     main = paste("Bivariate Normal, ρ =", rho))
abline(lm(Y1 ~ Y2), col = "red", lwd = 2)
cat("Sample cor =", round(cor(Y1, Y2), 3), " (theory:", rho, ")\n")
cat("Regression: slope =", round(coef(lm(Y1~Y2))[2], 3),
    " theory: rho*s1/s2 =", round(rho*s1/s2, 3), "\n")

10.2Section Exercises: Bivariate Normal

BN.1. If (Y1,Y2)BVN(10,20,4,9,0.6)(Y_1, Y_2) \sim \text{BVN}(10, 20, 4, 9, 0.6), find E(Y1Y2=25)E(Y_1|Y_2=25) and V(Y1Y2=25)V(Y_1|Y_2=25).

BN.2. Show that when ρ=0\rho = 0, the bivariate normal PDF factors into f1(y1)f2(y2)f_1(y_1) \cdot f_2(y_2), confirming independence.

BN.3. For the heights example (M.10), find E(Y2Y1=60)E(Y_2|Y_1 = 60) — the expected husband’s height given a 60-inch wife.

BN.4. What fraction of the total variance of Y1Y_1 is “explained” by Y2Y_2 when ρ=0.8\rho = 0.8? When ρ=0.3\rho = 0.3?


11The Multinomial Distribution (Optional)

Note the negative covariance: if more trials fall in category ii, fewer are available for category jj.


12Seeing It in R: Joint Distributions

#| label: joint-sim
#| fig-cap: "Simulated joint distribution with triangular support"

# Simulate from f(y1,y2) = 6*y1 on 0 < y1 < y2 < 1
# Method: rejection sampling
set.seed(2026)
n_sim <- 50000
y1 <- runif(n_sim); y2 <- runif(n_sim)
accept <- (y1 < y2) & (runif(n_sim) < 6*y1 / 6)  # max of 6y1 is 6
y1_acc <- y1[accept]; y2_acc <- y2[accept]

# Scatter plot shows the triangular support
plot(y1_acc[1:2000], y2_acc[1:2000], pch = '.', col = "steelblue",
     xlab = expression(y[1]), ylab = expression(y[2]),
     main = "Joint distribution: f = 6y1 on 0 < y1 < y2 < 1")
abline(0, 1, col = "red", lwd = 2)  # y1 = y2 boundary

# Verify marginals
cat("Simulated E(Y1) =", round(mean(y1_acc), 4), " Theory: 0.5000\n")
cat("Simulated E(Y2) =", round(mean(y2_acc), 4), " Theory: 0.7500\n")
cat("Simulated Cov(Y1,Y2) =", round(cov(y1_acc, y2_acc), 4), "\n")
cat("Simulated Cor(Y1,Y2) =", round(cor(y1_acc, y2_acc), 4), "\n")
#| label: portfolio-sim
# Portfolio simulation: see diversification in action
set.seed(42)
n <- 100000
mu_A <- 0.12; sigma_A <- 0.20
mu_B <- 0.08; sigma_B <- 0.15

# Independent stocks
A <- rnorm(n, mu_A, sigma_A)
B_ind <- rnorm(n, mu_B, sigma_B)

# Correlated stocks (rho = 0.5)
Z1 <- rnorm(n); Z2 <- rnorm(n)
B_corr <- mu_B + sigma_B * (0.5*Z1 + sqrt(1-0.25)*Z2)
A_corr <- mu_A + sigma_A * Z1

R_ind <- 0.6*A + 0.4*B_ind
R_corr <- 0.6*A_corr + 0.4*B_corr

cat("Independent: E(R) =", round(mean(R_ind),4), " SD(R) =", round(sd(R_ind),4), "\n")
cat("Corr (ρ=0.5): E(R) =", round(mean(R_corr),4), " SD(R) =", round(sd(R_corr),4), "\n")
cat("Theory (ind): E=0.104, SD=0.1342\n")
cat("Theory (ρ=.5): E=0.104, SD=0.1587\n")


13Chapter Summary

  1. Joint distributions describe the probability behavior of multiple random variables simultaneously. Joint PMFs sum to 1; joint PDFs integrate to 1.

  2. Marginal distributions are obtained by summing out (discrete) or integrating out (continuous) the other variable(s).

  3. Conditional distributions update probabilities given the value of another variable: f(y1y2)=f(y1,y2)/f2(y2)f(y_1|y_2) = f(y_1,y_2)/f_2(y_2).

  4. Independence means f(y1,y2)=f1(y1)f2(y2)f(y_1, y_2) = f_1(y_1) f_2(y_2) for all values — the joint factors into marginals.

  5. Covariance =E(Y1Y2)E(Y1)E(Y2)= E(Y_1 Y_2) - E(Y_1)E(Y_2) measures linear association. Zero for independent RVs, but zero covariance does NOT imply independence.

  6. Correlation ρ=Cov(Y1,Y2)/(σ1σ2)[1,1]\rho = \text{Cov}(Y_1,Y_2)/(\sigma_1\sigma_2) \in [-1,1] standardizes covariance.

  7. Variance of a linear combination: V(aiYi)=ai2σi2+2i<jaiajCov(Yi,Yj)V(\sum a_i Y_i) = \sum a_i^2 \sigma_i^2 + 2\sum_{i<j} a_i a_j \text{Cov}(Y_i, Y_j).

  8. The Multinomial distribution generalizes the Binomial to k>2k > 2 categories.