Back to the on-screen lesson ·

Joint and marginal distributions

A table over two variables, the margins that come off it, testing independence cell by cell, and building the distribution of a sum.

Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.

1. What you will learn

You will read a joint distribution as a table, recover each variable's marginal distribution by adding out the other, translate an event described in words into a set of cells, and test the two variables for independence cell by cell. You will also build the distribution of a function of the two, starting with their sum.

2. One variable at a time, until now

Everything so far has described a single random variable: its mass function, its cumulative function, its mean and its spread. Two variables need one more object, because how they move together is a fact about neither of them on its own and cannot be recovered from the two separately.

3. Words for this lesson

The joint distribution of $X$ and $Y$ gives $P(X = x, Y = y)$ for every pair, or a joint density $f(x, y)$. A marginal distribution is one variable's own distribution, recovered from the joint one by adding out the other. $X$ and $Y$ are independent when the joint probability factorises into the product of the two marginals at every pair of values.

4. A table over two variables, and the margins it throws off

The joint distribution answers every question about two variables at once. For discrete variables it is a table: one cell per pair, all cells non-negative, all cells adding to $1$. Every event is a set of cells, and its probability is the sum of them.

A marginal distribution comes out by adding along a line: $$p_X(x) = \sum_y p(x, y), \qquad p_Y(y) = \sum_x p(x, y).$$ The name is literal — the totals are written in the margin of the table. The continuous version integrates instead of summing.

This direction is one-way. The joint distribution determines both margins; the margins do not determine the joint distribution. Two tables with identical margins can describe completely different relationships, which is exactly why the joint object is worth having.

Independence is the case where the two margins are enough: $p(x, y) = p_X(x) p_Y(y)$ for every pair. It has to hold everywhere — one cell agreeing proves nothing, and one cell disagreeing settles it.

Another way: table

Two indicators over twenty equally likely cases, counts shown.

$Y = 0$$Y = 1$Total
$X = 0$5510
$X = 1$5510
Total101020

Every cell is $\tfrac14$ and every margin is $\tfrac12$, and $\tfrac14 = \tfrac12 \times \tfrac12$ four times over: independent. Move one case from the top-left to the top-right and the margins are unchanged while the cells no longer factorise — which is the one-way street drawn in four numbers.

Another way: steps

  1. Draw the table and check the cells add to $1$.
  2. Add along the rows and down the columns for the margins.
  3. For an event, decide which cells it covers, then add them.
  4. For independence, compare each cell with the product of its two margins.

5. Same margins, different tables

Two joint distributions of two indicators, counts out of twenty.

$Y=0$$Y=1$$Y=0$$Y=1$
$X=0$55$X=0$82
$X=1$55$X=1$28

Both have every margin equal to $10$ out of $20$. In the first the variables are independent; in the second they agree four times in five. The margins cannot tell them apart, and a report that gives only margins has not told you how two things are related — which is usually the question that was asked.

6. Where this goes wrong

Thinking the margins determine the joint distribution. They do not, and the two tables above are the proof.

Checking independence at one cell. Every cell must factorise. In a two-by-two table one check happens to imply the rest; in any larger table it does not.

Adding in the wrong direction. $p_X$ adds out $y$: it sums along a row. Summing down the column gives the other margin.

Treating a joint probability as a conditional one. $P(X = 1, Y = 1)$ is a cell; $P(Y = 1 \mid X = 1)$ is that cell divided by its row total. The next lesson lives on that distinction.

7. Margins by adding out

  1. $p(0,0) = 0.1$, $p(0,1) = 0.2$, $p(1,0) = 0.3$, $p(1,1) = 0.4$.

    Check: they add to $1$.

  2. $p_X(0) = 0.1 + 0.2 = 0.3$ and $p_X(1) = 0.7$.

    Along the rows.

  3. $p_Y(0) = 0.1 + 0.3 = 0.4$ and $p_Y(1) = 0.6$.

    Down the columns.

8. Testing independence on that table

  1. $p_X(0) p_Y(0) = 0.3 \times 0.4 = 0.12$.

    The product of the margins.

  2. The cell itself is $0.1$.

    Not equal.

  3. So $X$ and $Y$ are not independent, and no other cell needs checking.

    One disagreement settles it.

9. Your turn: $p(0,0) = 0.2$, $p(0,1) = 0.2$, $p(1,0) = 0.3$, $p(1,1) = 0.3$; find both margins and decide independence

  1. $p_X(0) = 0.4$, $p_X(1) = 0.6$; $p_Y(0) = 0.5$, $p_Y(1) = 0.5$.

    Add along and down.

  2. $p_X(0) p_Y(0) = 0.4 \times 0.5 = 0.2$, which is the cell.

    Check one cell.

  3. Your turn: work this step out. Its working is at the end of the packet.

    The other three agree too, so the variables are independent.

10. Guided practice

Two indicators $X$ and $Y$ have the joint probabilities $P(0,0) = 3/20$, $P(0,1) = 3/20$, $P(1,0) = 7/20$ and $P(1,1) = 7/20$. Give the four margins and the total.

Probability
$P(X = 0)$
$P(X = 1)$
$P(Y = 0)$
$P(Y = 1)$
All four cells together

11. Guided practice

With the same joint distribution — $P(0,0) = 1/10$, $P(0,1) = 1/10$, $P(1,0) = 2/5$, $P(1,1) = 2/5$ — what is the probability that at least one of $X$ and $Y$ is zero?

Answer:

12. Practice

The joint probabilities are $P(0,0) = 1/10$, $P(0,1) = 1/10$, $P(1,0) = 2/5$, $P(1,1) = 2/5$. Are $X$ and $Y$ independent?

13. Practice

The joint probabilities are $P(0,0) = 3/20$, $P(0,1) = 3/20$, $P(1,0) = 7/20$, $P(1,1) = 7/20$. Give $P(X = 1)$ and $P(Y = 1)$.

$P(X = 1)$ is p and $P(Y = 1)$ is q.

14. Somewhere new

With $P(0,0) = 1/20$, $P(0,1) = 9/20$, $P(1,0) = 3/10$ and $P(1,1) = 1/5$, let $S = X + Y$. Give the mass function of $S$.

Probability
$P(S = 0)$
$P(S = 1)$
$P(S = 2)$

15. Lesson test

Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.

16. Test question

Two indicators $X$ and $Y$ over $25$ cases. Match each description to the set of cells of the joint table it covers.

The single cell $P(1,1)$The row $P(1,0) + P(1,1)$The two cells $P(0,1) + P(1,0)$Everything except the cell $P(0,0)$
Both $X$ and $Y$ are one
$X$ is one, whatever $Y$ is
Exactly one of the two is one
At least one of the two is one

17. What you can do now

You can find margins from a joint table, compute the probability of an event by adding cells, and test independence. Say in your own words why two different joint tables can have exactly the same margins.

Working for the steps left to you

9. Your turn: $p(0,0) = 0.2$, $p(0,1) = 0.2$, $p(1,0) = 0.3$, $p(1,1) = 0.3$; find both margins and decide independence, step 3