Resources For Teachers For Tutors For Students & Parents Pricing
Year 10 Maths - 10A Statistics

Two-Way Tables and Categorical Variables

20 practice questions 0 video lessons Theory + worked examples
Create a free accountTrack your progress and save your work as you go.
Create free account

Theory

A two-way table sorts people by two categorical variables at once. This Year 10A maths page shows how to read, complete and build a two-way table, use row percentages to decide whether two variables are associated, and find probabilities from the table, including when you are told which group the person is in and whether two events are independent. It is Level 10 content in the Year 10A course (Victorian Curriculum 10A) and Year 10 content in the Australian Curriculum. Curriculum: VC2M10ST03 / AC9M10ST04.

A two-way table sorts data by two attributes at once, such as year group (rows) and pet (columns). Each person is counted in exactly one inner cell.

The row totals add across and the column totals add down. The grand total in the corner is the total number surveyed.

"\(A\) and \(B\)" is one inner cell. "\(A\) or \(B\)" means \(A\), or \(B\), or both: add the cells, counting any cell only once.

When the question tells you the group first ("a Year 7 student is chosen", "of those who had lessons"), the sample space is restricted to that row or column. Divide by that row or column total, not the grand total. This is called conditional probability.

Two categorical variables are associated if the percentages in one row differ from those in another, for example if boys and girls answer a question differently. If the row percentages are about the same, there is no association.

Two events are independent if knowing one does not change the probability of the other: \(P(A \mid B) = P(A)\).

A two-way table with totalsA two-way table of 60 people by gender and drink. Male: tea 12, coffee 8, total 20. Female: tea 15, coffee 25, total 40. Totals: tea 27, coffee 33, grand total 60. Rows add across and columns add down. TeaCoffeeTotalMale12820Female152540Total273360 rows add across columns add down
Each row total is the sum across its row; each column total is the sum down its column. The corner cell is the grand total.
Restricting the sample space to one rowThe same table with the Female row highlighted. If the person is known to be female, only the 40 females count, so the probability of coffee is 25 out of 40, which is five eighths. TeaCoffeeTotalMale12820Female152540Total273360 given female: only this row counts P(coffee | female) = 25/40 = 5/8
When you are told which group the person is in, divide by that row (or column) total, not the grand total.

For a person chosen at random from the whole table, and from one known group:

\[P(\text{event}) = \dfrac{\text{cell or cells}}{\text{grand total}}\]
\[P(\text{event} \mid \text{group}) = \dfrac{\text{cell in that group}}{\text{group total}}\]
P=cellgroup total
Percentages. "What percentage of those who \(\dots\)" uses that group's total: \(\dfrac{\text{cell}}{\text{group total}} \times 100\%\).
From a percentage to a number. If \(40\%\) of \(250\) people are adults, there are \(0.4 \times 250 = 100\) adults and \(150\) children.
"Not". "Adult but not in first class" means add the adult cells in every other class, or take the adult total minus the first-class adults.
Check the table. The row totals and the column totals must both add to the grand total.
\[\text{row percentage} = \dfrac{\text{cell}}{\text{row total}} \times 100\%\]
Testing independence. Of \(150\) students, \(50\) are in Year \(9\) and \(20\) of them play a sport; \(40\) of the \(100\) Year \(10\) students play a sport. \(P(\text{sport} \mid \text{Year 9}) = \dfrac{20}{50} = 0.4\), \(P(\text{sport} \mid \text{Year 10}) = \dfrac{40}{100} = 0.4\) and \(P(\text{sport}) = \dfrac{60}{150} = 0.4\). They are all equal, so playing a sport is independent of year group. If they differ, the events are not independent.
A missing cell for independence. Make the unknown row match the other row. If \(20\) of the \(50\) people in one row say yes, and the other row has \(x\) yes and \(24\) no, solve \(\dfrac{x}{x + 24} = \dfrac{20}{50} = 0.4\): \(x = 0.4x + 9.6\), so \(0.6x = 9.6\) and \(x = 16\). Check: \(\dfrac{16}{40} = 0.4\).
An unknown in the table. If the cells are \(2x\), \(x + 5\), \(x\) and \(x - 3\) and the grand total is \(122\), then \(5x + 2 = 122\), so \(x = 24\). Substitute back to fill every cell, then answer the question.
β€œOr” from a table. For β€œin row \(A\) or column \(B\) (or both)”, add the whole row \(A\) and the cells of column \(B\) that are not in row \(A\). With row \(A\) holding \(30\) of \(100\) people and \(12\) more people in column \(B\), the probability is \(\dfrac{42}{100} = \dfrac{21}{50}\).
Percentages of different groups. In a town of \(600\) homes, \(40\%\) are rented. \(25\%\) of rented homes and \(60\%\) of owned homes have solar panels. Turn each percentage into a count of its own row: \(0.25 \times 240 = 60\) and \(0.6 \times 360 = 216\). A home with solar panels is rented with probability \(\dfrac{60}{276} = \dfrac{5}{23}\).

How to complete a two-way table

  1. Draw the table with a Total row and a Total column.
  2. Put in every number you are given (change percentages or probabilities to numbers first).
  3. Fill a gap in any row or column that has only one missing value, by subtracting from its total.
  4. Repeat until the table is full, then check both sets of totals.

How to find a probability from the table

  1. Decide the denominator. Anyone at all: the grand total. A known group: that row or column total.
  2. Find the numerator: the cell ("and") or the cells ("or", counting each cell once).
  3. Divide and simplify.

How to decide on an association or independence

  1. Find the row percentages (or row probabilities), each with its own row total.
  2. Compare them. Clearly different: associated, so not independent. Equal: no association, independent.
  3. Answer in context, quoting the percentages.
Example 1 β€” Completing a table
Eighty students were asked whether they use a laptop in class.
Uses a laptopDoes notTotal
Year 9\(18\)\(?\)\(40\)
Year 10\(?\)\(?\)\(?\)
Total\(44\)\(?\)\(80\)
Complete the table. A student is chosen at random. Find the probability that the student is in Year 10 and does not use a laptop.
Solution

Fill each gap from a row or column that has only one gap.

\(\text{Year 9, does not}\)\(=\)\(40 - 18 = 22\)
\(\text{Year 10, laptop}\)\(=\)\(44 - 18 = 26\)
\(\text{Does not, total}\)\(=\)\(80 - 44 = 36\)
\(\text{Year 10, does not}\)\(=\)\(36 - 22 = 14\)
Uses a laptopDoes notTotal
Year 9\(18\)\(22\)\(40\)
Year 10\(26\)\(14\)\(40\)
Total\(44\)\(36\)\(80\)
\(P\)\(=\)\(\dfrac{14}{80} = \boldsymbol{\dfrac{7}{40}}\)
P=740
Example 2 β€” Is there an association?
A survey of \(250\) adults asked whether they exercise regularly.
Exercises regularlyDoes notTotal
Under 40\(72\)\(48\)\(120\)
40 and over\(65\)\(65\)\(130\)
(i) What percentage of each age group exercises regularly?
(ii) Is there an association between age group and exercising regularly?
(iii) Why compare percentages and not the counts \(72\) and \(65\)?
Solution

(i) Divide by each row's own total.

\(\text{under 40}\)\(:\)\(\dfrac{72}{120} \times 100\% = \mathbf{60\%}\)
\(\text{40 and over}\)\(:\)\(\dfrac{65}{130} \times 100\% = \mathbf{50\%}\)

(ii) Yes. The row percentages differ: in this group, adults under \(40\) are more likely to exercise regularly (\(60\%\) compared with \(50\%\)). If there were no association, the two percentages would be about equal.

(iii) The groups are different sizes (\(120\) and \(130\)), so counts are not a fair comparison. Percentages put both groups on the same scale.

Example 3 β€” When the group is given
A shop surveyed \(200\) customers.
SatisfiedNot satisfiedTotal
Online\(72\)\(18\)\(90\)
In store\(88\)\(22\)\(110\)
Total\(160\)\(40\)\(200\)

(i) An online customer is chosen. Find the probability that they were satisfied.
(ii) A customer who was not satisfied is chosen. Find the probability that they bought in store.
Solution

(i) Only the Online row counts: \(90\) customers.

\(P\)\(=\)\(\dfrac{72}{90} = \boldsymbol{\dfrac{4}{5}}\)

(ii) Only the Not satisfied column counts: \(40\) customers.

\(P\)\(=\)\(\dfrac{22}{40} = \boldsymbol{\dfrac{11}{20}}\)
P=1120

Dividing by \(200\) would answer a different question: the chance a random customer is both.

Example 4 β€” Turning probabilities into numbers
A festival had \(400\) people. For a person chosen at random, \(P(\text{local}) = 0.35\) and \(P(\text{local and bought food}) = 0.2\). Also, \(170\) visitors (non-locals) bought food. A person who bought food is chosen. Find the probability that they are a local.
Solution

Change each probability to a number of people by multiplying by \(400\).

\(\text{locals}\)\(=\)\(0.35 \times 400 = 140\)
\(\text{locals with food}\)\(=\)\(0.2 \times 400 = 80\)
Bought foodNo foodTotal
Local\(80\)\(60\)\(140\)
Visitor\(170\)\(90\)\(260\)
Total\(250\)\(150\)\(400\)

Only the Bought food column counts: \(80 + 170 = 250\) people.

\(P\)\(=\)\(\dfrac{80}{250} = \boldsymbol{\dfrac{8}{25}}\)
P=825

Common pitfalls

Pick the right denominator. "A girl is chosen" means divide by the number of girls, not by everyone in the table.
Do not count a cell twice. For "\(A\) or \(B\)", adding the whole \(A\) row and the whole \(B\) column counts the \(A\)-and-\(B\) cell twice. Subtract it once.
Use the inner cells, not the totals. "Boys who walk" is one inner cell; the Boys total includes boys who do not walk.
Change everything to numbers first. Probabilities like \(0.3\) of \(200\) people become \(60\) people before they go in the table.
Compare percentages, not counts. A bigger group can have more people with a feature even when a smaller share of it does. Use each row's own total.

Frequently asked questions

What is a two-way table?

It is a table that sorts data by two attributes at once, with one attribute down the side and the other across the top, plus row and column totals.

How do you find a probability from a two-way table?

Divide the number in the cell or cells you want by the total of the group you are choosing from. For anyone at all, that is the grand total.

How do you fill in missing values in a two-way table?

Find a row or column with only one gap and subtract the known values from its total. Keep going until the table is full, then check the totals.

What does 'given that' mean in probability?

It means you already know which group the person is in. Only that row or column counts, so divide by its total.

How do you work out an 'or' probability from a two-way table?

Add the cells where either event happens, counting the cell where both happen only once, then divide by the total.

How do you tell if two categorical variables are associated?

Work out the percentage with the feature in each row, using each row's own total. If the percentages are clearly different, the variables are associated; if they are about the same, they are not.