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.

Math 2 emblem with a variable, a triangle, and a ruler.
Inside this lesson 10 sections 5 questions 10 figures

SECTION 1

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.

SECTION 2

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.

SECTION 3

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.

Anatomy of a Two-Way TableEarned ADid Not Earn ARow TotalStudy AloneStudy in GroupColumn Total4060505010010090110200Joint Frequency(interior cell)Marginal Totals(row & column edges)Grand Total(bottom-right corner)Reading the TableCyan cells = joint frequencies (each combination)Amber cells = marginal totals (sum of a row or column)Green cell = grand total (sum of all data points)
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.

SECTION 4

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

JointRelativeFrequency=(cellcount)÷(grandtotal)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

MarginalRelativeFrequency=(roworcolumntotal)÷(grandtotal)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)

ConditionalRelativeFrequency=(cellcount)÷(rowtotal)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)

ConditionalRelativeFrequency=(cellcount)÷(columntotal)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.

SECTION 5

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.

Three Views of the Same Data① Raw CountsEarned ANo ATotalAlone4060100Group5050100Total90110200② Joint Relative Freq.Earned ANo ATotalAlone0.200.300.50Group0.250.250.50Total0.450.551.00→③ Conditional Relative Freq. (by row)Given…Earned ADid Not Earn AAlone40 ÷ 100 = 0.4060 ÷ 100 = 0.60Group50 ÷ 100 = 0.5050 ÷ 100 = 0.50Each row sums to 1.00 — the condition is the row category40% of alone-studiers earned A vs. 50% of group-studiers → group studymay be associated with higher A rates.
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.

SECTION 6

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. 1

    Step 1 — Set Up the Table with Raw Counts

    Place 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. 2

    Step 2 — Compute Marginal Totals

    Sum 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. 3

    Step 3 — Compute Joint Relative Frequencies

    Divide 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. 4

    Step 4 — Compute Marginal Relative Frequencies

    Divide 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. 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.
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)

Completed two-way table with counts and joint relative frequencies in parentheses

SECTION 7

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.

SECTION 8

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.

SECTION 9

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.

OnlineIn-PersonTotal
STEM6040100
Non-STEM50100150
Total110140250

Two-way table for practice problems 1–4

Question 1: CONCEPTUAL

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.
Show answer
A joint relative frequency tells you the proportion of the entire dataset that falls into one specific combination of both variables. For 'STEM + Online,' the joint relative frequency is 60 ÷ 250 = 0.24, meaning 24% of all students are both STEM and prefer online classes. A marginal relative frequency tells you the proportion for just one variable, ignoring the other. The marginal relative frequency for STEM is 100 ÷ 250 = 0.40, meaning 40% of all students are STEM, regardless of class preference. The key difference is the denominator: joint uses the grand total and looks at a single cell, while marginal uses the grand total but looks at a row or column total.

Question 2: BASIC CALCULATION

What is the joint relative frequency of non-STEM students who prefer in-person classes?
Show answer
The joint relative frequency is found by dividing the cell count by the grand total. The cell for 'Non-STEM + In-Person' is 100, and the grand total is 250. So 100 ÷ 250 = 0.40 or 40%. This means that 40% of all 250 students surveyed are non-STEM students who prefer in-person classes. This is the single largest joint frequency in the table, which tells us this is the most common combination.

Question 3: INTERMEDIATE

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?
Show answer
For STEM students: 60 ÷ 100 = 0.60, so 60% of STEM students prefer online classes. For non-STEM students: 50 ÷ 150 ≈ 0.333, so about 33.3% of non-STEM students prefer online classes. These conditional relative frequencies are quite different (60% vs. 33.3%), which suggests there may be an association between program type and class preference. STEM students appear more likely to prefer online classes than non-STEM students. However, we would need a formal hypothesis test (like chi-square) to confirm this association is statistically significant.

Question 4: APPLIED

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.
Show answer
The dean is using the marginal relative frequency (110 ÷ 250 = 0.44), which treats all students the same. However, the conditional relative frequencies tell a more nuanced story. Among STEM students, 60% prefer online (60 ÷ 100), while among non-STEM students only about 33.3% prefer online (50 ÷ 150). If STEM and non-STEM programs have different numbers of sections, a one-size-fits-all 44% conversion would over-serve non-STEM students (who mostly prefer in-person) and under-serve STEM students (who mostly prefer online). The STEM chair would argue that online conversion rates should differ by department, perhaps 60% for STEM and 33% for non-STEM, to actually match student preferences.

Question 5: CRITICAL 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.
Show answer
The classmate is confusing association with causation. A two-way table and its conditional relative frequencies can reveal whether two variables are associated — that is, whether knowing the category of one variable changes the distribution of the other. The data does show an association: tutored students earn A's at a higher rate (80% vs. 50%). However, the table cannot prove that tutoring caused the higher grades. There could be confounding variables: perhaps students who seek tutoring are already more motivated, or maybe they have more free time to study. To establish causation, you would need a controlled experiment where students are randomly assigned to tutoring or no tutoring. Two-way tables are descriptive tools that identify patterns, not causal tools that explain why those patterns exist.

SUMMARY

Lesson Summary

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