MathematicsGrade 8–13

Two-way tables and Venn diagrams

A two-way table, a Venn diagram and a tree diagram show the same data and are linked. Change one and the others follow.

Loading simulation …

What is it about?

Class 9a was asked: do you have a pet (AA)? Do you have siblings (BB)? Each person falls into exactly one of four cells:

BB B‾\overline{B} Total
AA 1010 44 1414
A‾\overline{A} 99 77 1616
Total 1919 1111 3030

This is a two-way table. The inner cells are the intersections A∩BA \cap B, A∩B‾A \cap \overline{B}, A‾∩B\overline{A} \cap B, A‾∩B‾\overline{A} \cap \overline{B}. The margins hold the totals ∣A∣|A|, ∣A‾∣|\overline{A}|, ∣B∣|B|, ∣B‾∣|\overline{B}| and the grand total. Dividing everything by 3030 gives probabilities (relative frequencies).

A Venn diagram shows the same data: the circles AA and BB lie in the sample space Ω\Omega; here the areas are even proportional to the counts. So does a tree diagram: first split by AA, then by BB. The second-stage branches carry shares like 1014\frac{10}{14} – “of the 1414 with a pet, 1010 have siblings”.

Events:

  • Intersection A∩BA \cap B (“AA and BB”): one cell.
  • Union A∪BA \cup B (“AA or BB”, or both): three cells.
  • Complement A‾\overline{A}: everything except AA, so P(A‾)=1−P(A)P(\overline{A}) = 1 - P(A).

For the union, the cell A∩BA \cap B must not be counted twice – this is the addition rule:

P(A∪B)=P(A)+P(B)−P(A∩B)=1430+1930−1030=2330.P(A \cup B) = P(A) + P(B) - P(A \cap B) = \frac{14}{30} + \frac{19}{30} - \frac{10}{30} = \frac{23}{30}.

The reversed tree starts with BB. Its leaves are the same four cells – only in a different order and with different shares on the branches: 1930⋅1019=1030\frac{19}{30} \cdot \frac{10}{19} = \frac{10}{30}.

Complete the table: every row and every column is a sum. If you know two of the three values in a row or column, the third follows by adding or subtracting. In the view “Complete the table” only four values are known – tap a “?”: if it can already be worked out, the value appears with its calculation, otherwise you get a hint.

Reverse the tree with probabilities: often P(A)P(A) and the conditional probabilities PA(B)P_A(B) and PA‾(B)P_{\overline{A}}(B) are given. The product rule gives the table, the sum rule gives P(B)P(B) and from that the reversed tree:

P(B)=P(A)⋅PA(B)+P(A‾)⋅PA‾(B),PB(A)=P(A∩B)P(B).P(B) = P(A) \cdot P_A(B) + P(\overline{A}) \cdot P_{\overline{A}}(B), \qquad P_B(A) = \frac{P(A \cap B)}{P(B)}.

With P(A)=0.4P(A) = 0.4, PA(B)=0.7P_A(B) = 0.7 and PA‾(B)=0.2P_{\overline{A}}(B) = 0.2 you get P(B)=0.4⋅0.7+0.6⋅0.2=0.40P(B) = 0.4 \cdot 0.7 + 0.6 \cdot 0.2 = 0.40 and PB(A)=0.280.40=0.70P_B(A) = \frac{0.28}{0.40} = 0.70. With “counts” the table shows natural frequencies, e.g. out of 100100 people: 2828, 1212, 1212, 4848.

Unit square: the square has area 11. It is split vertically in the ratio P(A):P(A‾)P(A) : P(\overline{A}), then each column horizontally by PA(B)P_A(B) or PA‾(B)P_{\overline{A}}(B). Each part is a path probability. If both horizontal lines are at the same height, then PA(B)=PA‾(B)=P(B)P_A(B) = P_{\overline{A}}(B) = P(B): AA and BB are (stochastically) independent, and P(A∩B)=P(A)⋅P(B)P(A \cap B) = P(A) \cdot P(B). Randomly drawn people land as dots in the square – their relative frequencies are close to the areas.

Try it

  1. Hover over a cell of the table (or tap it): the same subset lights up in the Venn diagram and in the tree. Load example
  2. Choose the events A∩BA \cap B, A∪BA \cup B and A‾\overline{A} one after another. Which cells belong to each? A or B
  3. Change the counts with the sliders. How do the circles change?
  4. Turn the tree around (“Tree starts with B”). Why do the branches show different fractions, but the leaves the same numbers? Reversed tree
  5. Switch to percent and look at the survey of 200 teenagers. 200 teenagers
  6. Complete the table step by step. Which “?” can you work out first, which only at the very end? Complete the table
  7. Compare the two trees: which numbers match, which do not? Tap a leaf. Reverse the tree
  8. In the unit square, drag both horizontal lines to the same height. What does the calculation show now? Then draw 100100 people. Unit square

Tasks

Task 1: Complete the table

Load task

Of 3030 people, 1414 have a pet and 1919 have siblings; 1010 have both. Complete the two-way table.

Show solution

A∩B‾A \cap \overline{B}: 14−10=414 - 10 = 4, A‾∩B\overline{A} \cap B: 19−10=919 - 10 = 9, A‾\overline{A}: 30−14=1630 - 14 = 16, A‾∩B‾\overline{A} \cap \overline{B}: 16−9=716 - 9 = 7. Show in simulation

Task 2: Addition rule

Load task

Find the probability that a randomly chosen person has a pet or siblings – once with the addition rule and once via the complement.

Show solution

Addition rule: 1430+1930−1030=2330≈76.7 %\frac{14}{30} + \frac{19}{30} - \frac{10}{30} = \frac{23}{30} \approx 76.7\,\%. Complement “neither”: 1−730=23301 - \frac{7}{30} = \frac{23}{30} ✓. Show in simulation

Task 3: Exactly one

Load task

In the survey of 200200 teenagers, 8080 are in a sports club, 9898 play an instrument and 4646 do both. What percentage do exactly one of the two?

Show solution

Sports club only: 80−46=3480 - 46 = 34, instrument only: 98−46=5298 - 46 = 52. Together 8686 out of 200200, so 43 %43\,\%. Show in simulation

Task 4: Reversed tree

Load task

Draw the tree that starts with BB (siblings) and fill in all branch probabilities. Check on one path that you get the same leaf probability as in the first tree.

Show solution

First stage: P(B)=1930P(B) = \frac{19}{30}, P(B‾)=1130P(\overline{B}) = \frac{11}{30}. Second stage: 1019\frac{10}{19} and 919\frac{9}{19}, and 411\frac{4}{11} and 711\frac{7}{11}. Path B∩AB \cap A: 1930⋅1019=1030\frac{19}{30} \cdot \frac{10}{19} = \frac{10}{30} – the same as 1430⋅1014\frac{14}{30} \cdot \frac{10}{14} in the first tree. Show in simulation

Task 5: Reverse the tree

Load task

P(A)=0.4P(A) = 0.4, PA(B)=0.7P_A(B) = 0.7, PA‾(B)=0.2P_{\overline{A}}(B) = 0.2. Find P(B)P(B) and PB(A)P_B(A). How many out of 100100 people belong to A∩BA \cap B?

Show solution

P(B)=0.4⋅0.7+0.6⋅0.2=0.28+0.12=0.40P(B) = 0.4 \cdot 0.7 + 0.6 \cdot 0.2 = 0.28 + 0.12 = 0.40 and PB(A)=0.280.40=0.70P_B(A) = \frac{0.28}{0.40} = 0.70. Out of 100100 people, 2828 belong to A∩BA \cap B. Show in simulation

Task 6: Independent?

Load task

For 5050 people: ∣A∩B∣=12|A \cap B| = 12, ∣A∣=30|A| = 30, ∣B∣=20|B| = 20. Show that P(A∩B)=P(A)⋅P(B)P(A \cap B) = P(A) \cdot P(B). What does this mean?

Show solution

1250=0.24\frac{12}{50} = 0.24 and 3050⋅2050=0.6⋅0.4=0.24\frac{30}{50} \cdot \frac{20}{50} = 0.6 \cdot 0.4 = 0.24 ✓. The share of BB is the same within AA as within A‾\overline{A} (1230=820=40 %\frac{12}{30} = \frac{8}{20} = 40\,\%): AA and BB do not influence each other (statistically) – they are independent. In the unit square the lines are then at the same height. Show in unit square

Task 7: Explore the unit square

Load task

Set P(A)=0.4P(A) = 0.4 and drag PA(B)P_A(B) and PA‾(B)P_{\overline{A}}(B) both to 0.60.6. Find P(A∩B)P(A \cap B) and P(A)⋅P(B)P(A) \cdot P(B). What happens if you move only one line?

Show solution

P(A∩B)=0.4⋅0.6=0.24P(A \cap B) = 0.4 \cdot 0.6 = 0.24 and P(B)=0.6P(B) = 0.6, so P(A)⋅P(B)=0.24P(A) \cdot P(B) = 0.24 – equal, AA and BB are independent. If you move only one line, the two values are no longer equal. Example PA‾(B)=0.2P_{\overline{A}}(B) = 0.2: P(A∩B)=0.24P(A \cap B) = 0.24 stays, but P(B)=0.24+0.6⋅0.2=0.36P(B) = 0.24 + 0.6 \cdot 0.2 = 0.36 and P(A)⋅P(B)=0.144P(A) \cdot P(B) = 0.144. The events are then dependent. Show in simulation

Ideas for the classroom

  • Use: Lower secondary (two-way table, Venn diagram, addition rule) and upper secondary (conditional probability, reversed tree).
  • Your own survey: two yes/no questions in class quickly give your own two-way table, which you can enter with the sliders.
  • Switching representations: the synchronised highlighting can help students find each number of one representation in the others.
  • Common stumbling blocks:
    • In A∪BA \cup B, the cell A∩BA \cap B is counted twice.
    • “AA or BB” is understood as “exactly one of the two”.
    • On second-stage branches, shares of the grand total are used instead of shares of the subgroup (1030\frac{10}{30} instead of 1014\frac{10}{14}).
    • In the reversed tree, the first-stage branches are simply copied.
    • PA(B)P_A(B) and PB(A)P_B(A) are confused (in Task 5 both happen to be 0.70.7 – that is not always the case).
  • Unit square: it works well for “seeing” independence before the formula P(A∩B)=P(A)⋅P(B)P(A \cap B) = P(A) \cdot P(B) is introduced.