MATH 2 • STATISTICS & PROBABILITY

Two-Way Tables & Frequencies — I can create a two-way table from data and compute joint, marginal, and conditional relative frequencies.

Organize categorical data into rows and columns to uncover hidden patterns and relationships between two variables.

Historical Context & Motivation

Humans have been organizing information into tables for thousands of years, but the idea of using a table to compare two categorical variables at the same time is surprisingly modern. Before two-way tables existed, researchers struggled to show how two different categories—like gender and voting preference, or age group and product choice—related to each other. The development of these tables gave scientists, doctors, and social researchers a powerful tool for spotting patterns in data without complicated math.

1700s
Early Frequency Tables
Mathematicians like Abraham de Moivre began using simple frequency tables to organize data about mortality rates and population statistics.
1900
Karl Pearson's Chi-Square Test
Karl Pearson introduced the chi-square test, which relies on two-way tables (called contingency tables) to determine whether two categorical variables are independent or related.
1930s
Rise of Survey Research
Gallup and other polling organizations popularized the cross-tabulation of survey results, making two-way tables a standard tool in social science and marketing.
Today
Modern Data Analytics
Two-way tables underpin modern data dashboards, machine learning confusion matrices, and medical research studies that compare treatment outcomes across patient groups.

The central question a two-way table answers is straightforward: How are two categorical variables distributed together, and is there a relationship between them? By the end of this lesson, you will be able to build a two-way table from raw data and extract three types of relative frequencies that reveal different layers of the story your data is telling.

Core Principles & Definitions

Before diving into calculations, you need a solid grasp of the vocabulary. A two-way table (also called a contingency table) displays the counts for every combination of two categorical variables. One variable defines the rows and the other defines the columns. The cells inside the table hold the counts, and the edges hold the totals.

1

Joint Frequency

The count (or relative frequency) in a single interior cell of the table. It shows how many data points fall into one specific combination of the two variables.
2

Marginal Frequency

The total count (or relative frequency) for one category of a single variable, found by summing an entire row or an entire column. These totals appear in the margins of the table.
3

Conditional Relative Frequency

The proportion of a joint cell relative to its row total or column total. It answers: 'Given that we are in this row (or column), what fraction falls in this cell?'
4

Grand Total

The total number of data points in the entire table, found in the bottom-right corner. Every relative frequency is ultimately computed using this value or a marginal total.
KEY TAKEAWAY
Think of a two-way table like a seating chart at a school dance. The rows might be grade level (freshman, sophomore, etc.) and the columns might be whether the student is dancing or sitting. A joint frequency tells you how many sophomores are dancing. A marginal frequency tells you how many sophomores there are total. And a conditional relative frequency tells you what percentage of sophomores are dancing. Same data, different questions.

Visual Explanation — Anatomy of a Two-Way Table

The diagram below shows a two-way table for a survey of 200 students who were asked about their preferred study method (alone or in a group) and whether they earned an A on the last exam. Study the layout carefully—notice where the joint frequencies, marginal totals, and grand total are placed.

The interior cyan cells show joint frequencies—counts for each specific combination. The amber cells along the edges are marginal totals (row and column sums). The green cell at the bottom-right is the grand total of all 200 students.

Notice that each row total equals the sum of its interior cells: 40 + 60 = 100 for students who study alone, and 50 + 50 = 100 for students who study in a group. Similarly, each column total is the sum down that column: 40 + 50 = 90 students earned an A, and 60 + 50 = 110 did not. The grand total—200—can be found by adding either the row totals (100 + 100) or the column totals (90 + 110). This internal consistency is your best error-check when building tables.

Mathematical Framework

Once you have a two-way table of raw counts, you can convert those counts into three types of relative frequencies. Each one divides a count by a different total, and each answers a different question.

JOINT RELATIVE FREQUENCY
Joint Relative Frequency = (cell count) ÷ (grand total)
Divide any interior cell by the grand total. This tells you what fraction of all data points falls into that specific combination. For example, 40 ÷ 200 = 0.20, meaning 20% of all students both study alone and earned an A.
MARGINAL RELATIVE FREQUENCY
Marginal Relative Frequency = (row or column total) ÷ (grand total)
Divide a row total or column total by the grand total. This tells you the overall proportion for one category of one variable. For example, 90 ÷ 200 = 0.45, meaning 45% of all students earned an A regardless of study method.
CONDITIONAL RELATIVE FREQUENCY (BY ROW)
Conditional Relative Frequency = (cell count) ÷ (row total)
Divide an interior cell by its row total. This answers: 'Given that a student studies alone, what proportion earned an A?' For example, 40 ÷ 100 = 0.40, so 40% of alone-studiers earned an A.
CONDITIONAL RELATIVE FREQUENCY (BY COLUMN)
Conditional Relative Frequency = (cell count) ÷ (column total)
Divide an interior cell by its column total. This answers: 'Given that a student earned an A, what proportion studied alone?' For example, 40 ÷ 90 ≈ 0.444, so about 44.4% of A-earners studied alone.
⚠️ Common Mistake Alert
Students often confuse joint and conditional relative frequencies. Remember: if you divide by the grand total, you get a joint relative frequency. If you divide by a row or column total, you get a conditional relative frequency. The denominator is everything.

Detailed Breakdown — Comparing Frequency Types

Let's see all three frequency types side by side using the study-method data. The diagram below transforms the same raw data into a joint relative frequency table, then shows how conditional relative frequencies are computed by row. Comparing these three views of the same data is the key to mastering two-way tables.

Table ① shows raw counts. Table ② divides every cell by the grand total (200) to get joint relative frequencies. Table ③ divides each cell by its row total to get conditional relative frequencies, revealing that 50% of group-studiers earned an A compared to only 40% of alone-studiers.

In the joint relative frequency table (②), notice that all four interior cells plus the four cells add up to 1.00 (or equivalently, both marginal row totals sum to 1.00, and both marginal column totals sum to 1.00). In the conditional table (③), each row sums to 1.00 because we are asking about the distribution within that specific row. If you computed conditional frequencies by column instead, each column would sum to 1.00.

Worked Example — Building a Two-Way Table from Scratch

A school surveyed 150 students about whether they play a sport (Yes or No) and whether they have a part-time job (Yes or No). The raw data shows: 45 play a sport and have a job, 30 play a sport but have no job, 25 do not play a sport but have a job, and 50 neither play a sport nor have a job. Let's construct the two-way table and compute all three types of relative frequencies.

Full Two-Way Table Analysis
1
Step 1 — Set Up the Table with Raw CountsPlace one variable (Sport: Yes/No) along the rows and the other (Job: Yes/No) along the columns. Fill in the four interior cells with the given counts: 45, 30, 25, and 50.
Interior cells: Sport+Job = 45, Sport+No Job = 30, No Sport+Job = 25, No Sport+No Job = 50
2
Step 2 — Compute Marginal TotalsSum each row: Sport row = 45 + 30 = 75. No Sport row = 25 + 50 = 75. Sum each column: Job column = 45 + 25 = 70. No Job column = 30 + 50 = 80. The grand total = 75 + 75 = 150 (or 70 + 80 = 150).
Row totals: 75, 75. Column totals: 70, 80. Grand total: 150.
3
Step 3 — Compute Joint Relative FrequenciesDivide each interior cell by the grand total of 150. Sport+Job: 45 ÷ 150 = 0.30. Sport+No Job: 30 ÷ 150 = 0.20. No Sport+Job: 25 ÷ 150 ≈ 0.167. No Sport+No Job: 50 ÷ 150 ≈ 0.333.
30% of all students both play a sport and have a job.
4
Step 4 — Compute Marginal Relative FrequenciesDivide each marginal total by 150. Sport: 75 ÷ 150 = 0.50. No Sport: 75 ÷ 150 = 0.50. Job: 70 ÷ 150 ≈ 0.467. No Job: 80 ÷ 150 ≈ 0.533.
50% of students play a sport; about 46.7% have a job.
5
Step 5 — Compute Conditional Relative Frequencies (by Row)To find the conditional relative frequency of having a job given that a student plays a sport, divide 45 by the sport row total of 75: 45 ÷ 75 = 0.60. For no job given sport: 30 ÷ 75 = 0.40. For having a job given no sport: 25 ÷ 75 ≈ 0.333. For no job given no sport: 50 ÷ 75 ≈ 0.667.
60% of student-athletes have a job, compared to only 33.3% of non-athletes. This suggests a possible association between playing a sport and holding a part-time job.
Completed two-way table with counts and joint relative frequencies in parentheses
Has JobNo JobTotal
Plays Sport45 (0.30)30 (0.20)75 (0.50)
No Sport25 (0.167)50 (0.333)75 (0.50)
Total70 (0.467)80 (0.533)150 (1.00)

Strengths, Limitations & When to Use Each Frequency

Each type of relative frequency answers a different question, and choosing the wrong one can lead to misleading conclusions. The table below summarizes when to use each type and what pitfalls to watch for.

Frequency TypeBest ForLimitation
Joint Relative FrequencySeeing how common a specific combination is within the entire datasetDoes not reveal the internal distribution within a single category; can be misleading when marginal totals are very unequal
Marginal Relative FrequencyUnderstanding the overall breakdown of one variable, ignoring the otherHides all information about how the two variables interact; gives no insight into association
Conditional Relative FrequencyComparing distributions across groups to detect possible associations between variablesAssociation does not prove causation; small sample sizes within a row or column can make proportions unreliable
KEY TAKEAWAY
Think of it like a playlist. The joint relative frequency tells you what percentage of all songs are pop songs you like. The marginal relative frequency tells you what percentage of all songs are pop. The conditional relative frequency tells you what percentage of pop songs you actually like. Same data, three different lenses.

Connection to Advanced Topics

Two-way tables are your entry point into a much larger world of statistical analysis. Once you are comfortable computing conditional relative frequencies, you are only a short step away from formal hypothesis testing and probability theory. The table below shows how the concepts you learned today connect to what comes next.

This LessonAdvanced Connection
Joint relative frequencyJoint probability P(A ∩ B) in probability theory; used in Bayesian analysis
Marginal relative frequencyMarginal probability P(A); foundation of probability distributions
Conditional relative frequencyConditional probability P(A | B); directly connects to Bayes' theorem
Comparing conditional frequencies across rowsChi-square test of independence; determines if an observed association is statistically significant

In AP Statistics and college-level courses, you will use the chi-square test to determine whether the differences you observe in conditional relative frequencies are large enough to be considered statistically significant, or whether they could have occurred just by chance. You will also encounter Simpson's Paradox, a fascinating phenomenon where an association that appears in several groups can reverse or disappear when the groups are combined. Both of these ideas rely heavily on the two-way table skills you are building right now.

Practice Problems

Use the following two-way table for Problems 1–4. A school asked 250 students whether they prefer online or in-person classes and whether they are in STEM or non-STEM programs.

Two-way table for practice problems 1–4
OnlineIn-PersonTotal
STEM6040100
Non-STEM50100150
Total110140250
PROBLEM 1CONCEPTUAL
Explain in your own words the difference between a joint relative frequency and a marginal relative frequency. Use the cell 'STEM + Online = 60' from the table to illustrate your answer.
PROBLEM 2BASIC CALCULATION
What is the joint relative frequency of non-STEM students who prefer in-person classes?
PROBLEM 3INTERMEDIATE
Compute the conditional relative frequency of preferring online classes given that a student is in a STEM program. Then compute the conditional relative frequency of preferring online classes given that a student is in a non-STEM program. What do these two numbers suggest about an association between program type and class preference?
PROBLEM 4APPLIED
The school is considering adding more online sections. A dean argues: 'Since 110 out of 250 students prefer online classes (44%), we should convert 44% of all sections to online.' A STEM department chair disagrees. Using conditional relative frequencies, explain why the chair might push back and what the chair's argument would be.
PROBLEM 5CRITICAL THINKING
A classmate builds a two-way table from survey data and finds that the conditional relative frequency of earning an A given that a student uses tutoring is 0.80, while the conditional relative frequency of earning an A given no tutoring is 0.50. The classmate concludes: 'Tutoring causes students to earn A's.' Identify the flaw in this reasoning and explain what two-way tables can and cannot tell us.

Lesson Summary

A two-way table organizes data for two categorical variables into rows and columns, with interior cells holding joint frequencies (counts for each combination), edges holding marginal totals (row and column sums), and a grand total in the bottom-right corner. Dividing a cell by the grand total gives a joint relative frequency, dividing a row or column total by the grand total gives a marginal relative frequency, and dividing a cell by its row or column total gives a conditional relative frequency.

Conditional relative frequencies are especially powerful because they let you compare how a variable is distributed within different groups, which is the first step toward detecting an association between two categorical variables. Always remember that association does not imply causation. These skills connect directly to conditional probability and the chi-square test of independence that you will encounter in more advanced statistics courses.

Varsity Tutors • Math 2 • Two-Way Tables & Frequencies