Skip to content
We use only essential cookies to keep you signed in and remember your preferences. See our Cookie Policy.
TestStop
MocksPracticeResourcesIndiaBlogPricing
Sign in
Resources › Statistical inference › 1. Joint distributions
Statistical inference · Lesson 1 of 13

Joint distributions, marginals and independence

Almost nothing in economics is about one variable alone. Income goes with schooling, prices with quantities, the return on one asset with the return on another. This lesson is about describing two random variables at once: the table that holds every pair of values, the two single-variable distributions hiding in its edges, what changes when one variable is known, and the single number, covariance, that says whether they move together.

← Statistical inference moduleLesson 1 of 13 · about 50 minutes
1Joint distributions2Sampling3CLT4Estimators5Likelihood6Intervals7Testing8Tests in practice9Two samples10Chi-square tests11ANOVA12Regression inference13Hard problems
A question to hold on to
X takes the values −1 and 1, and Y takes the values 1 to 6. In the joint table, the row for X = −1 reads 0.1, a, 0.3, 0, 0, 0 across Y = 1 to 6, and the row for X = 1 reads 0, 0, b, 0.1, 0.1, 0.1. You are told E(X) = −0.2 and E(Y) = 3.2. What is a?
DSE 2011Solved at the end ↓
New here?What is Ashanagar?The invented district behind this page's examples: 60 households, with incomes you can inspect.

Ashanagar is an invented district. The statistics lessons use it for every worked example, so you meet the same households again as the ideas build: first as a list of numbers, then as a spread, then as a population to sample from.

It has 60 households, each with a monthly income in rupees. Unless a page says otherwise, those 60 are the whole population, and a “sample” means a few of them drawn at random. Where a page needs two variables, it uses a smaller set of 12 households with the head’s years of schooling beside income.

The figures are illustrative, made up once and fixed. They are not official statistics.

Households
60
Mean income
₹28,783 a month
Median income
₹25,000 a month
Standard deviation
₹13,366
Lowest and highest
₹10,500 and ₹72,000

Meet the full data set →

In this guide
Lesson · about 50 minutes
  1. Two variables, one table
  2. The joint table and its one rule
  3. Marginals: add along the edges
  4. Conditionals: shrink the table to a row
  5. Expectation from a table
  6. Covariance and independence
  7. Joint densities
  8. The opening question, solved
  9. The lesson on one screen
  10. Check yourself
  11. Past papers, by level
01
The idea

Two variables, one table

Suppose a survey visits a hundred Ashanagar households and records two things for each: the number of earners, X (1 or 2), and the number of children in school, Y (0, 1 or 2). The households sort into six cells. This is invented data, but the shape is the shape of every real survey table.

HouseholdsY = 0Y = 1Y = 2Total
X = 1 earner14221450
X = 2 earners6182650
Total204040100

Divide every count by 100 and the table becomes a joint probability distribution: a household picked at random lands in the cell (X = 2, Y = 2) with probability 0.26. Everything in this lesson is a question you can ask of such a table. How many earners does a typical household have? What share of households send two children to school? Among two-earner households, how many send two? Do earners and schooling move together? We will answer each one, first on this table, then on the tables from past papers.

In economics

Economists rarely care about a joint distribution for its own sake. They care because a regression, a portfolio and a test of association are all built from one: the regression line of the basic statistics module is an estimate of the conditional mean of Y given X, and the risk of a portfolio depends on the covariance of its returns. This lesson builds those two ideas properly.

02
The basics

The joint table and its one rule

A discrete joint distribution assigns a probability p(x,y)=P(X=x,Y=y) to every pair of values. Only one rule applies: no probability is negative, and all of them add to 1.

The rule that fixes an unknown constant
p(x,y)≥0,x∑​y∑​p(x,y)=1
Every question that asks for k, a or b in a table is this one line.
JNU 2017 Q5 · easy
X takes the values 1 and 2, Y takes 1, 2 and 3, and the joint distribution is f(x, y) = k × x × y. What is k?
  1. 1
    List the six cells.
    The values of xy are 1, 2, 3 for X = 1 and 2, 4, 6 for X = 2.
  2. 2
    Add them up.
    1 + 2 + 3 + 2 + 4 + 6 = 18. Quicker: the sum factorises as (1 + 2)(1 + 2 + 3) = 3 × 6 = 18.
  3. 3
    Set the total to 1.
    18k = 1, so k = 1/18.
Answer
k = 1/18, option C. The factorised sum is worth remembering: whenever the formula is a product of a function of x and a function of y over a rectangle, the total is a product of two totals.
03
Reading the edges

Marginals: add along the edges

If you only care about X, ignore Y: add each row across all the values of Y. The answer sits in the margin of the table, which is where the word comes from.

Marginal distributions
P(X=x)=y∑​p(x,y),P(Y=y)=x∑​p(x,y)

In the survey, P(X = 1) = 0.14 + 0.22 + 0.14 = 0.5 and P(Y = 2) = 0.14 + 0.26 = 0.4. The marginals describe each variable on its own, and they throw away how the two are related. Two very different joint tables can have identical margins, so the margins alone never settle questions about dependence.

JNU 2017 Q6 and Q7 · easy
Continue with f(x, y) = xy ÷ 18. Find P(X = 2) and E[Y].
  1. 1
    Marginal of X at 2.
    P(X = 2) = (2 × 1 + 2 × 2 + 2 × 3) ÷ 18 = 12/18 = 2/3.
  2. 2
    Marginal of Y.
    P(Y = y) = (1·y + 2·y) ÷ 18 = y/6, so the probabilities for y = 1, 2, 3 are 1/6, 2/6, 3/6, and they add to 1.
  3. 3
    Mean of Y.
    E[Y] = 1 × 1/6 + 2 × 2/6 + 3 × 3/6 = 14/6 = 7/3.
Answer
P(X = 2) = 2/3 and E[Y] = 7/3. To find E[Y] you need only the marginal of Y, not the whole table.
04
Interactive

Conditionals: shrink the table to a row

Now suppose you are told that a household has two earners. You are no longer choosing among all six cells. You are inside the second row, and the probabilities there must be rescaled to add to 1. That rescaling is the conditional distribution.

Conditional distribution
P(Y=y∣X=x)=P(X=x)p(x,y)​
Joint over marginal. Defined only when the marginal is positive.

In the survey, P(Y = 2 | X = 2) = 0.26 ÷ 0.5 = 0.52, while P(Y = 2 | X = 1) = 0.14 ÷ 0.5 = 0.28. Two-earner households are almost twice as likely to have two children in school. The answer to “does Y depend on X?” is already visible: the conditional distribution changes when X changes.

Try it. The lab holds a table whose cells you can edit. Each cell shows the count, the joint probability, and in grey what the cell would hold if X and Y were independent. Click a row to condition on it. Pick the last preset, then edit a single cell and watch what that does to the margins, the covariance and the shading.

Type a count in any cell (0 to 99). The lab divides by the grand total of 10 to get probabilities. Click a row label to condition on that value of X.

X ↓   Y →−324P(X)
0.10.20.20.150.20.150.5
0.30.20.10.150.10.150.5
P(Y)0.40.30.31

In each cell: the count you typed, then the joint probability, then what independence would require (row total × column total). A cell is shaded when the two differ.

E[X]2
E[Y]0.6
E[XY]0
Cov(X, Y) = E[XY] − E[X]E[Y]−1.2
Var X · Var Y1 · 9.24
Correlation−0.395
Independent?No
Given X = 1: P(Y = · | X)0.2 · 0.4 · 0.4

The table of JNU 2021 Q58, in tenths. The covariance is −1.2, the keyed answer. Independence needs every cell to match its product. One shaded cell is enough to break it.

DSE 2008 Q29 · hard
The joint table (rows X = 1, 2, 3; columns Y = 1, 2, 3, 4) is: X = 1: .1, 0, .1, 0; X = 2: .3, 0, .1, .2; X = 3: 0, .1, 0, .1. Which of I to IV are true? I: P(Y = 2) > P(X = 1). II: P(Y = 1 | X = 2) = P(Y = 1 | X = 1). III: the events X = 3 and Y = 3 are mutually exclusive. IV: X and Y are independent.
  1. 1
    Margins.
    P(X = 1) = 0.2, P(X = 2) = 0.6, P(X = 3) = 0.2. P(Y = 1) = 0.4, P(Y = 2) = 0.1, P(Y = 3) = 0.2, P(Y = 4) = 0.3.
  2. 2
    I.
    P(Y = 2) = 0.1 is smaller than P(X = 1) = 0.2. False.
  3. 3
    II.
    P(Y = 1 | X = 2) = 0.3 ÷ 0.6 = 0.5 and P(Y = 1 | X = 1) = 0.1 ÷ 0.2 = 0.5. True.
  4. 4
    III.
    The cell (X = 3, Y = 3) holds 0, so the two events cannot happen together. True.
  5. 5
    IV.
    If independent, the cell (X = 3, Y = 3) would hold 0.2 × 0.2 = 0.04, but it holds 0. False.
Answer
Only II and III are true: option B. Statement II shows that the conditional can match across rows for one cell and still not be independent, since independence needs every cell to match.
05
Averages

Expectation from a table

The expected value of any function of the pair is the same sum as always: each value times its probability, now over every cell.

Expectation of g(X, Y)
E[g(X,Y)]=x∑​y∑​g(x,y)p(x,y)

Two special cases come up constantly. With g = x you get E[X], which can be found from the marginal alone. With g = xy you get E[XY], which needs the whole table. In the survey, E[X] = 1.5, E[Y] = 0 × 0.2 + 1 × 0.4 + 2 × 0.4 = 1.2, and E[XY] = 1.9, since the six cells contribute 0, 0.22, 0.28, 0, 0.36 and 1.04.

The conditional distribution has its own mean, the conditional expectation E[Y | X = x]. In the survey it is 1.0 children for one-earner households and 1.4 for two-earner ones. Average those two numbers using the shares of households, 0.5 each, and you recover the overall mean: 0.5 × 1.0 + 0.5 × 1.4 = 1.2. That is not a coincidence.

Law of iterated expectations
E[Y]=E[E[Y∣X]]=x∑​E[Y∣X=x]P(X=x)
The overall mean is the average of the group means, weighted by group size.
Why it matters

This is how combined means worked in the first module (the mean of the two groups, weighted by their sizes), now seen from the probability side. It is also the reason a regression of Y on X makes sense: the line is an estimate of the function E[Y | X = x].

06
Moving together

Covariance and independence

Covariance is the average product of the two deviations from their means, and the shortcut that uses E[XY] is the one examiners expect.

Covariance
Cov(X,Y)=E[(X−μX​)(Y−μY​)]=E[XY]−E[X]E[Y]
The same idea as the sample covariance of the basic statistics module, now with probabilities as weights.

For the survey, Cov = 1.9 − 1.5 × 1.2 = 0.1: a small positive number, the sign telling us that households with more earners tend to send more children to school.

JNU 2021 Q58 · moderate
X takes the values 1 and 3, and Y takes −3, 2 and 4. The joint probabilities are: for X = 1, 0.1, 0.2, 0.2; for X = 3, 0.3, 0.1, 0.1. Find Cov(X, Y).
  1. 1
    Margins.
    P(X = 1) = P(X = 3) = 0.5, and P(Y = −3, 2, 4) = 0.4, 0.3, 0.3.
  2. 2
    Means.
    E[X] = 0.5 + 1.5 = 2. E[Y] = −1.2 + 0.6 + 1.2 = 0.6.
  3. 3
    E[XY], row by row.
    Row X = 1: 1 × (−3 × 0.1 + 2 × 0.2 + 4 × 0.2) = 0.9. Row X = 3: 3 × (−3 × 0.3 + 2 × 0.1 + 4 × 0.1) = 3 × (−0.3) = −0.9. Total E[XY] = 0.
  4. 4
    Covariance.
    0 − 2 × 0.6 = −1.2.
Answer
Cov(X, Y) = −1.2, option D. This is the first preset in the lab above: try it and read the number off.

Independence is a stronger claim than zero covariance

Two random variables are independent when knowing one tells you nothing about the other. In a table, that means every cell is the product of its row margin and its column margin.

Independence
p(x,y)=P(X=x)P(Y=y)  for every cell

Independence forces the covariance to zero, since then E[XY] = E[X]E[Y]. The reverse is false, and it is among the most examined facts in this chapter. Let X be −1, 0 or 1 with equal chance and let Y = X². Then Y is completely fixed by X, yet E[XY] = E[X³] = 0 and E[X] = 0, so the covariance is zero. The last preset in the lab is exactly this table. Covariance picks up only straight-line association; Y = X² is a perfect association, but a curved one.

Pause and predict
A table has Cov(X, Y) = 0. Can you conclude that every cell equals the product of its margins?

Two quick checks for independence that save time in an exam:

  • Any zero cell with non-zero margins breaks it. If P(X = x) and P(Y = y) are both positive but the cell is 0, the product would be positive. This is how DSE 2008 Q29 rules out statement IV.
  • For a density, look at the region. If the density is positive only on a triangle such as 0 < x < y < 1, X and Y cannot be independent, because knowing y restricts x to (0, y).

Variances of sums, and the minimum-variance portfolio

Covariance is what makes variances of sums differ from sums of variances.

Variance of a combination
Var(aX+bY)=a2VarX+b2VarY+2abCov(X,Y)

For independent variables the last term vanishes. For a portfolio that puts a share w in asset S and 1 − w in asset T, the variance is a quadratic in w, and its minimum has a clean closed form:

The minimum-variance weight
w∗=σS2​+σT2​−2σST​σT2​−σST​​
IIT JAM 2023 Q57 · moderate
Var(RS) = 0.07, Var(RT) = 0.05 and Cov(RS, RT) = 0.04. Which w minimises the variance of wRS + (1 − w)RT?
  1. 1
    Variance as a function of w.
    V(w) = 0.07w² + 0.05(1 − w)² + 2 × 0.04 × w(1 − w).
  2. 2
    Differentiate and set to zero.
    2 × 0.07w − 2 × 0.05(1 − w) + 0.08(1 − 2w) = 0, which gives 0.14w − 0.10 + 0.10w + 0.08 − 0.16w = 0, so 0.08w = 0.02.
  3. 3
    Or use the formula.
    (0.05 − 0.04) ÷ (0.07 + 0.05 − 0.08) = 0.01 ÷ 0.04 = 0.25.
Answer
w = 0.25: a quarter in asset S and three quarters in T. S is the riskier asset, so it gets the smaller share. Had the two been uncorrelated the weight would have been 0.05 ÷ 0.12 = 0.42, so the positive covariance pushes the portfolio further away from S.
07
Interactive

Joint densities

With continuous variables the table becomes a surface f(x, y), probabilities become volumes, and every sum becomes an integral. The rules carry over word for word.

Continuous versions
∬f=1,fX​(x)=∫f(x,y)dy,f(x∣y)=fY​(y)f(x,y)​,E[X∣Y=y]=∫xf(x∣y)dx

The lab shows the density f(x, y) = (2/3)(x + 2y) on the unit square. Slide y. The left panel shows the conditional density of X given that value of y, with its mean marked, and the right panel traces that mean for every y. The other two buttons give a second density and one that factorises, where nothing moves.

00.250.50.7510.51x, given Y = 0.5
f(x | y)E[X | Y = 0.5] = 0.556
00.250.50.7510.30.40.50.60.70.8y: E[X | Y = y]
Marginal density f_Y(0.5)1
Joint density f(0.5, 0.5)1
f(0.5 | y) = joint ÷ marginal1
E[X | Y = 0.5]0.556

Knowing Y reshapes X. At y = 0.5 the conditional mean is 0.5556 (5/9, the keyed answer of GATE 2024 Q48). Because E[X | Y = y] moves with y, X and Y are not independent.

GATE 2024 Q48 · hard
f(x, y) = (2/3)(x + 2y) for 0 < x, y < 1. Find E[X | Y = 1/2].
  1. 1
    Marginal of Y.
    fY(y) = ∫₀¹ (2/3)(x + 2y) dx = (2/3)(1/2 + 2y) = (1 + 4y)/3. At y = 1/2 that is 1.
  2. 2
    Conditional density at y = 1/2.
    f(x | 1/2) = (2/3)(x + 1) ÷ 1 = (2/3)(x + 1).
  3. 3
    Its mean.
    ∫₀¹ x · (2/3)(x + 1) dx = (2/3)(1/3 + 1/2) = (2/3)(5/6) = 5/9.
Answer
5/9, option A. Notice the order: marginal first, then conditional, then the mean. Skipping the division by fY is the usual way to lose marks. Here fY(1/2) happens to equal 1, so the slip would not show.

When the region is not a square, the limits of integration carry the work. Three past questions show the pattern:

  • f = 6xy on 0 < y ≤ √x ≤ 1 (IIT JAM 2021 Q24). Given X = 2/3, y runs from 0 to √(2/3). The marginal is fX(x) = ∫₀^√x 6xy dy = 3x², so f(y | x) = 2y/x, and P(Y ≥ 1/3 | X = 2/3) = (x − 1/9) ÷ x at x = 2/3, which is 5/6.
  • f = 21x₁²x₂³ on 0 < x₁ < x₂ < 1 (JNU 2016 Q49). The marginal of X₂ is 7x₂⁶, the conditional density of X₁ is 3x₁²/x₂³ on (0, x₂), so E[X₁ | x₂] = (3/4)x₂ and the conditional variance is (3/5 − 9/16)x₂² = (3/80)x₂².
  • f = 1 on 0 < x < 1, x < y < x + 1 (IIT JAM 2023 Q40). X is uniform on (0, 1), with mean 1/2 and variance 1/12. Y has a triangular density, rising as y on (0, 1) and falling as 2 − y on (1, 2), with mean 1 and variance 1/6.
Watch out for

The mistakes examiners are fishing for

  • Forgetting to divide. A conditional density is the joint over the marginal, not the joint alone. It must integrate to 1; the joint does not.
  • Using the wrong limits. The limits of the inner integral may depend on the other variable. Draw the region first.
  • Covariance zero means independent. It does not. Independence needs every cell, or the whole density, to factorise.
  • Treating the margins as the whole story. Two different tables can share the same margins.
  • Conditioning on the wrong variable. P(Y | X) and P(X | Y) divide by different margins, and they are not equal.
08
Solving the opening question

The opening question, solved

DSE 2011 Q31 · moderate
The rows are X = −1: 0.1, a, 0.3, 0, 0, 0 and X = 1: 0, 0, b, 0.1, 0.1, 0.1 over Y = 1 to 6, with E(X) = −0.2 and E(Y) = 3.2. Find a.
  1. 1
    Probabilities add to 1.
    0.1 + a + 0.3 + b + 0.3 = 1, so a + b = 0.3.
  2. 2
    Use E(X).
    P(X = −1) = 0.4 + a and P(X = 1) = 0.3 + b, so E(X) = −(0.4 + a) + (0.3 + b) = b − a − 0.1 = −0.2, which gives b − a = −0.1.
  3. 3
    Solve the pair.
    a + b = 0.3 and b − a = −0.1 give b = 0.1 and a = 0.2.
Answer
a = 0.2, option C. E(Y) = 3.2 is not needed, but it checks the answer: 0.1 × 1 + 0.2 × 2 + 0.3 × 3 + 0.1 × 3 + 0.1 × 4 + 0.1 × 5 + 0.1 × 6 = 3.2. The same table gives b in the next question of the paper (b = 0.1), and the paper repeats it in 2017 as α and β.
09
Revise

The lesson on one screen

The lesson on one screen
Joint table
p(x, y) ≥ 0 and the total is 1. Every missing constant comes from that total. For a product formula over a rectangle, the total is a product of totals.
Marginals
Add a row across y for P(X = x), a column down x for P(Y = y). Margins say nothing about dependence.
Conditionals
P(Y = y | X = x) = joint ÷ marginal of X. Each conditional adds to 1. For densities, divide by the marginal and integrate over the right limits.
Expectation
E[g(X, Y)] = Σ g p over every cell. E[Y] = Σ E[Y | X = x] P(X = x).
Covariance
E[XY] − E[X]E[Y]. Var(aX + bY) = a² Var X + b² Var Y + 2ab Cov.
Independence
Every cell is a product of margins, or the density factorises over a rectangle. It implies Cov = 0; the reverse fails (Y = X²).
Portfolio
Minimum-variance weight w* = (σ_T² − σ_ST) ÷ (σ_S² + σ_T² − 2σ_ST).
10
Practice

Check yourself

0 of 13 correct so far

Compute

The constant
f(x, y) = k(x + y) for x = 1, 2, 3 and y = 1, 2. Find k.
A conditional
Use the Ashanagar survey table (14, 22, 14 and 6, 18, 26). Find P(Y = 2 | X = 2).
A conditional mean
From the same table, find E[Y | X = 2], the average number of children in school in two-earner households.
Covariance from a table
For the same table, find Cov(X, Y). You will need E[X], E[Y] and E[XY].
A conditional mean for a density
f(x, y) = x + y on the unit square. Find E[X | Y = 1/2].
Minimum variance
Two assets have variances 0.09 and 0.04 and covariance 0.01. Find the weight on the first that minimises the variance of the portfolio.
Variance of a combination
Var(X) = 4, Var(Y) = 9 and Cov(X, Y) = 1. Find Var(2X − 3Y).
A triangular support
f(x, y) = 2 on 0 < x < y < 1. Find E[X | Y = 0.6].

Quick questions

1Cov(X, Y) = 0. Which of these must be true?
2In a joint table, P(X = x) is found by
3f(x, y) = 8xy on 0 < x < y < 1. Are X and Y independent?
4The mean wage is ₹30,000 for women and ₹20,000 for men, and 40% of the workers are women. The overall mean is
5Independence of X and Y means that, in the joint table,
11
Real questions

Past papers, by level

Foundation

Definitions and one-step calculations. Most CUET and Hyderabad questions sit here.

4 questionsPractise →

Standard

Joint tables, standard errors and statement questions, up to JNU and IIT JAM level.

6 questionsPractise →

Delhi School level

This topic’s hardest questions, from the DSE entrance, are worked through in Lesson 13: Joint distributions.

7 questionsLesson 13 →
All 10 past-paper questions for this lesson, easiest first: practise the full set →

✦These are questions from the TestStop bank. A free account answers 10 a day, each with its worked solution; All-Access opens every set with no daily limit.

← The moduleOverview and diagnosticLesson 2 →Samples, sampling methods and the sampling distribution

Read next

All resources →
StatisticsInference 2: sampling methods and the sampling distributionPopulation and sample, parameter and statistic, probability and non-probability sampling, simple random, systematic, stratified and cluster designs, sampling bias, and the sampling distribution of the mean built from every possible sample.Complete guide · 40 minStatisticsStatistics 6: covariance, correlation and rank correlationScatter plots, covariance as an average of products, Pearson's r and what leaves it unchanged, the variance of sums, Anscombe's quartet, why zero correlation is not independence, Spearman's rank correlation and the probable error.Complete guide · 50 minStatisticsStatistical inference for economics students, from joint distributions to hypothesis testsA module in thirteen lessons: joint distributions and covariance, sampling and the sampling distribution, the standard error and the central limit theorem, estimators and maximum likelihood, confidence intervals, hypothesis tests and p-values, two-sample tests, chi-square tests, analysis of variance and regression inference, on one running example with labs to move and graded past papers.Module · 635 min