Back to homeMathematics · AP Statistics · Change subject
Start for free
AP Stats · Mathematics
Chance and Probability · Probability

Two-Way (Contingency) Tables

Before you start, make sure you know: Conditional probability (Algebra 2)
Before you start, make sure you know: Contingency tables (Algebra 2)

Your school nurse gives you a rapid strep test, and it comes back positive. The test correctly flags 90% of kids who have strep. Does that mean there is a 90% chance you are sick? The answer surprises most people, and a simple table is all you need to find it. A two-way table (also called a contingency table) sorts people by two characteristics at once. Once you can fill one in and read it, every probability in this section is just a fraction of numbers from the table.

Building and completing a table

In a two-way table, one variable runs down the rows and the other across the columns. The margins (the "Total" row and column) show the totals for each variable alone. The interior cells show how many individuals fall in both categories at once.

Two-way table for breakfast habits with fruit and cereal. Some cells are given and others are question marks to fill in. Cereal No cereal Total Fruit No fruit Total 40 ? 100 ? ? ? 120 ? 200
Practice★☆☆Not started
In a study on the use of social media in a high school, 100 12th-grade students have been surveyed about their preferred platform. The data are collected in the…

In a study on the use of social media in a high school, 100 12th-grade students have been surveyed about their preferred platform. The data are collected in the following contingency table, although some values have been erased:

TikTok Instagram Total Boys Girls Total 25 35 ? ? 100 ? ? ? ?

Given that there is a total of 45 boys and 55 girls:

  1. a) Complete the missing values in the table.
  2. b) If we choose a student at random, what is the probability that their preferred network is TikTok?
  3. c) What is the probability that it is a girl who prefers Instagram?
Solve
Practice★☆☆Not started
A group of 200 teenagers was asked whether they have cereal or fruit for breakfast. The results were: 120 have cereal, 100 have fruit, and 40 have both. a) Complete the…

A group of 200 teenagers was asked whether they have cereal or fruit for breakfast. The results were: 120 have cereal, 100 have fruit, and 40 have both.

  1. a) Complete the following contingency table to organize the data:
Fruit No Fruit Total Cereal No Cereal Total 40 120 100 200
  1. b) What is the probability that a teenager has neither cereal nor fruit for breakfast?
  2. c) Given that a teenager has cereal for breakfast, what is the probability that they also have fruit?
Solve
Practice★☆☆Not started
In a pickleball tournament organized by the local recreation department, 80 people participate. It is known that 32 are men and the rest are women. Of the men, 20 are…

In a pickleball tournament organized by the local recreation department, 80 people participate. It is known that 32 are men and the rest are women. Of the men, 20 are registered, while of the women only 12 are registered.

  1. a) Organize the information into a contingency table.
  2. b) If we select a participant at random, calculate the probability that they are not registered.
  3. c) What is the probability that the participant is a woman given that she is registered?
Solve

Starting from percentages: a made-up population

Many problems give percentages instead of counts: "40% are men, and 25% of them drive." You can still build a table. Choose a convenient total such as 100, 1,000, or 10,000, and turn each percentage into a count. The answers do not depend on the total you pick. They are ratios, so the size cancels.

Table for 1,000 students by lunch type and bus use, with the lunch-buyers row highlighted. Bus No bus Total Buys lunch Brings lunch Total 150 450 600 200 200 400 350 650 1,000 25% of 600 is 150: a percent of the row, not of 1,000
Practice★☆☆Not started
A survey has been carried out on transportation habits for going to college. $40\%$ of the students are men ($H$) and $60\%$ are women ($M$). $25\%$ of the men commute…

A survey has been carried out on transportation habits for going to college. $40\%$ of the students are men ($H$) and $60\%$ are women ($M$). $25\%$ of the men commute by car ($C$), while $15\%$ of the women use this mode of transportation.

  1. a) If we consider a sample of 100 people, construct the contingency table with the absolute values.
  2. b) Calculate the probability that a person chosen at random is a woman and does not use a car.
  3. c) Calculate the probability that, being a man, he does not use a car.
Solve
Practice★★☆Not started
The success of an advertising campaign on social media is analyzed. Of the people who saw the ad, $40\%$ did so on Instagram and $60\%$ on TikTok. It is known that…

The success of an advertising campaign on social media is analyzed. Of the people who saw the ad, $40\%$ did so on Instagram and $60\%$ on TikTok. It is known that $15\%$ of those who saw it on Instagram bought the product, while on TikTok $10\%$ did so.

  1. a) Transfer these percentages to a contingency table of $1000$ people.
  2. b) Calculate the probability that a person chosen at random has bought the product.
  3. c) Given that a person has bought the product, on which social network is it more probable that they saw the ad?
40% 60% 15% 85% 10% 90% 1000 400 600 60 340 60 540 Instagram TikTok Buys Does not buy Buys Does not buy Instagram TikTok Total Buys Does not buy Total 60 60 120 340 540 880 400 600 1000
Solve
Practice★★☆Not started
In a high school, $60\%$ of the seniors are women. It is known that $20\%$ of the women participate in the debate club, while $10\%$ of the men also do so. a) Construct…

In a high school, $60\%$ of the seniors are women. It is known that $20\%$ of the women participate in the debate club, while $10\%$ of the men also do so.

  1. a) Construct a contingency table of relative frequencies (probabilities).
  2. b) If we select a student at random, what is the probability that they belong to the debate club?
  3. c) If the chosen student does not belong to the debate club, what is the probability that they are a man?
M = Women H = Men D = Debate D′ = No Debate M H D D′ D D′ 0.6 0.4 0.2 0.8 0.1 0.9 P(M ∩ D) = 0.12 P(M ∩ D′) = 0.48 P(H ∩ D) = 0.04 P(H ∩ D′) = 0.36 D D′ Total M H Total 0.12 0.48 0.60 0.04 0.36 0.40 0.16 0.84 1.00
Solve

Completing a table of probabilities

Sometimes the table holds probabilities instead of counts. The rules are the same, but the grand total is $1$ (or 100%). Use the totals to fill in whatever is missing, one cell at a time. Begin with a cell that has only one unknown.

Completed probability table for music students by instrument and level. The three given values are highlighted. Advanced Beginner Total Piano Guitar Total 0.20 0.40 0.60 0.15 0.25 0.40 0.35 0.65 1.00 Highlighted numbers were given in the problem; the rest come from adding and subtracting.
Practice★★☆Not started
A survey has been carried out on voting intention and the main social concern (Environment, Economy or Health), obtaining the following partial table of probabilities: |…

A survey has been carried out on voting intention and the main social concern (Environment, Economy or Health), obtaining the following partial table of probabilities:

Concern Party A Party B Totals
Environment $0,15$ $0,10$
Economy $0,25$ $0,45$
Health $0,12$
Totals $1,00$
  1. a) Complete the contingency table.
  2. b) Calculate the probability that a voter for Party A is concerned about Health.
  3. c) Are the events "Voting for Party B" and "Being concerned about the Environment" independent? Justify your answer mathematically.
Solve
Practice★☆☆Not started
In a language school, students are divided by level (Basic or Advanced) and by language (English or German). The probability that a student is at the advanced level is…

In a language school, students are divided by level (Basic or Advanced) and by language (English or German). The probability that a student is at the advanced level is $0,4$. The probability that they study English is $0,7$. It is known that the probability that a student studies German and is at the basic level is $0,2$.

  1. a) Create a contingency table with probabilities (where the total is $1$).
  2. b) Calculate the probability that a student chosen at random is at the advanced level and studies English.
  3. c) If a student studies English, what is the probability that they are at the basic level?
Solve
Practice★★☆Not started
An e-commerce platform classifies its customers into "Frequent" and "Occasional", and their purchases into "Electronics" or "Fashion". It is known that $30\%$ of the…

An e-commerce platform classifies its customers into "Frequent" and "Occasional", and their purchases into "Electronics" or "Fashion". It is known that $30\%$ of the customers are Frequent. Of all the purchases made, $40\%$ are Electronics. Furthermore, $10\%$ of the total customers are Frequent who have bought Fashion.

  1. a) Construct the complete contingency table of probabilities.
  2. b) What is the probability that a frequent customer buys Electronics?
  3. c) Given that a customer has bought Electronics, what is the probability that they are an Occasional customer?
Solve

Marginal, joint, and "or" probabilities

Once the table is complete, every probability is a fraction of table entries. Here is a survey of 150 students about the sport they most like to watch.

Basketball Football Total
Underclass 40 35 75
Upperclass 30 45 75
Total 70 80 150
Table of 150 students by class level and favorite sport. One interior cell is highlighted as a joint probability and one total as a marginal. Basketball Football Total Underclass Upperclass Total 40 35 75 30 45 75 70 80 150 Blue cell: joint (upperclass AND basketball) Orange cell: marginal (football)
Practice★☆☆Not started
A streaming platform analyzes the preferences of its users according to their age. A random sample is selected and the following results are obtained: | | Movies |…

A streaming platform analyzes the preferences of its users according to their age. A random sample is selected and the following results are obtained:

Movies Series Total
Under 25 years old $0,15$ $0,35$ $0,50$
Over 25 years old $0,30$ $0,20$ $0,50$
Total $0,45$ $0,55$ $1,00$

Calculate the following probabilities when choosing a user at random:

  1. a) $P(\text{Series})$, that is, the probability that they prefer series.
  2. b) $P(\text{Movies} \cap \text{Under 25 years old})$.
  3. c) $P(\text{Over 25 years old} \cup \text{Movies})$.
Solve
Practice★☆☆Not started
Observe the following table which classifies the employees of a company according to their department and whether they have requested to work from home: Calculate with…

Observe the following table which classifies the employees of a company according to their department and whether they have requested to work from home:

Dept. Mode Sales (V) R&D (I) Total Work from home (T) In-person (P) Total 12 18 28 22 30 50 40 40 80

Calculate with reasoning using the table:

  1. a) $P(T | V)$, the probability that an employee works from home if they belong to the Sales department.
  2. b) $P(I | T)$, the probability that an employee is from R&D given that they have requested to work from home.
  3. c) Which is more likely: that a Sales employee works from home or that an R&D employee works from home?
Solve
Practice★★☆Not started
A sports center offers Yoga, Pilates and Crossfit classes. The distribution of the $300$ members according to activity and age group is as follows: | Activity | Young…

A sports center offers Yoga, Pilates and Crossfit classes. The distribution of the $300$ members according to activity and age group is as follows:

Activity Young (16-30) Adults (>30)
Yoga $20$ $50$
Pilates $30$ $60$
Crossfit $110$ $30$
  1. a) If we choose a member at random, what is the probability that they practice Yoga or are Young?
  2. b) Among Adult members, which activity is the most probable?
  3. c) If a Crossfit practitioner is chosen, what is the probability that they are Young?
Solve

Conditional probability read from a table

Phrases like "given that," "of those who," or "if we know that" signal a conditional probability. Once you know the condition, you only look at one row or column.

Same table of 150 students with the underclass row highlighted to show that conditioning limits the cases to one row. Basketball Football Total Underclass Upperclass Total 40 35 75 30 45 75 70 80 150 Given underclass: only this row counts P(basketball | underclass) = 40/75
Practice★☆☆Not started
A sporting goods store classifies its sneaker sales according to type (Running or Trail) and gender (Men's or Women's). In one day they sold 50 pairs: | | Running |…

A sporting goods store classifies its sneaker sales according to type (Running or Trail) and gender (Men's or Women's). In one day they sold 50 pairs:

Running Trail Total
Men's 18 12 30
Women's 15 5 20
Total 33 17 50

Calculate the probability that when choosing a sale at random:

  1. a) The sneakers are Trail.
  2. b) They are women's given that they are Running.
  3. c) They are Trail given that it is a men's sale.
Solve
Practice★★☆Not started
In a study on the digital content consumption habits among $200$ teenagers, it has been observed that $120$ are subscribed to a streaming platform. Of those who are…

In a study on the digital content consumption habits among $200$ teenagers, it has been observed that $120$ are subscribed to a streaming platform. Of those who are subscribed, $80$ prefer watching shows over movies. Among those who do not pay for a subscription, $30$ prefer movies.

  1. a) Organize the above information into a contingency table.
  2. b) If we choose a teenager at random, what is the probability that they prefer watching shows?
  3. c) Given that the chosen teenager prefers movies, what is the probability that they are not subscribed to any platform?
Series Movies Total Subscribed Not subscribed Total 80 30 120 200 - - - - -
Solve
Practice★★☆Not started
In a medical study on the efficacy of a vaccine, the following data are obtained from a sample of $1000$ patients: | | Became ill | Did not become ill | Totals | | :---…

In a medical study on the efficacy of a vaccine, the following data are obtained from a sample of $1000$ patients:

Became ill Did not become ill Totals
Vaccinated $20$ $600$
Unvaccinated $280$
Totals $1000$
  1. a) Complete the table.
  2. b) Calculate the probability of becoming ill having been vaccinated.
  3. c) Calculate the probability of becoming ill not having been vaccinated.
  4. d) In light of the results, do you consider the vaccine to be effective? Justify your answer by comparing the conditional probabilities.
Solve

Using a table to check independence

Two events are independent if knowing one happened does not change the probability of the other.

Two bars showing that 40 percent of juniors and 40 percent of seniors have a job, so job and grade are independent. Juniors 40% have a job Seniors 40% have a job Same 40% in each row, so the variables are independent

Independence also works in reverse. If you are told two events are independent, you can fill in a table.

Practice★★☆Not started
A technology company analyzes the relationship between the use of a new model of wireless earphones and customer satisfaction. Of the $500$ users surveyed, $350$ bought…

A technology company analyzes the relationship between the use of a new model of wireless earphones and customer satisfaction. Of the $500$ users surveyed, $350$ bought the "Pro" model and the rest the "Basic" model. It is known that event $S$ (being satisfied) and event $M$ (Pro model) are independent. If the probability of being satisfied is $P(S) = 0,8$:

  1. a) Complete the contingency table with the expected number of people for each category.
  2. b) Calculate the probability that a user has bought the "Basic" model and is not satisfied.
  3. c) What does it mean in this context for the events to be independent?
Solve
Practice★★★Not started
In a survey carried out at a music festival about musical genre preference and age, the following data has been obtained from a sample of $200$ attendees: | | Pop ($P$)…

In a survey carried out at a music festival about musical genre preference and age, the following data has been obtained from a sample of $200$ attendees:

Pop ($P$) Rock ($R$) Indie ($I$)
Under 25 years old ($M$) $40$ $30$
25 years old or over ($A$) $50$

Given that the total number of Pop lovers is $65$, that those under 25 years old represent $45\%$ of the total sample, and that the events "Being under 25 years old" and "Indie" are independent:

  1. a) Complete the contingency table with the absolute values.
  1. b) Calculate the probability that an attendee chosen at random is over 25 years old and likes Indie.
  1. c) If an attendee likes Rock, what is the probability that they are under 25 years old?
Solve
Practice★★★Not started
In a study on the streaming content consumption habits of young people aged between 18 and 22, the following data has been obtained: $65\%$ of the young people are…

In a study on the streaming content consumption habits of young people aged between 18 and 22, the following data has been obtained:

  • $65\%$ of the young people are subscribed to Netflix ($N$).

  • $40\%$ are subscribed to Disney+ ($D$).

  • The probability that a young person is not subscribed to either of the two platforms is $0,25$.

  1. a) Create a contingency table expressing the values in terms of probability.
  1. b) A young person is chosen at random and turns out to be subscribed to Netflix. Calculate the probability that they are also subscribed to Disney+.
  1. c) Determine whether having a subscription to Netflix is independent of having a subscription to Disney+.
Solve

Reversing the condition: tests and screenings

Real problems usually tell you $P(\text{positive} \mid \text{sick})$, which is how well the test works. But what you want is $P(\text{sick} \mid \text{positive})$. These are different probabilities. A table with a made-up population of 10,000 turns the "reverse" into a simple fraction.

Table of 10,000 students by strep status and test result, with the positive column highlighted. Positive Negative Total Strep No strep Total 900 100 1,000 450 8,550 9,000 1,350 8,650 10,000 Given positive: only this column counts P(strep | positive) = 900/1,350

Back to the nurse's office: the test catches 90% of students who have strep, but a positive result means only about a 67% chance of having strep, not 90%. The reason is that most students do not have strep, so even a small false-positive rate produces many false alarms (450) next to the true positives (900).

Practice★★★Not started
A cybersecurity department analyzes the email traffic of a large technology company. It is known that $12\%$ of the emails entering the server are phishing* (fraud)…

A cybersecurity department analyzes the email traffic of a large technology company. It is known that $12\%$ of the emails entering the server are phishing (fraud) attempts. The smart filtering system labels the emails as "Suspicious" or "Safe".

The system is capable of correctly detecting $95\%$ of the phishing emails. However, due to overzealousness, $3\%$ of legitimate emails are incorrectly labeled as "Suspicious".

  1. a) Organize the information in a contingency table using a theoretical sample of $10\,000$ emails.
  1. b) If an employee receives an email labeled as "Suspicious", what is the probability that it is actually a legitimate email?
  1. c) Are the events "Phishing Email" and "Labeled as Suspicious" independent events? Justify your answer by calculating probabilities.
12% 88% 95% 5% 3% 97% Total Emails 10 000 Phishing ? Legitimate ? Suspicious ? Safe ? Suspicious ? Safe ? a) Contingency Table Suspicious Safe Total Phishing ? ? ? Legitimate ? ? ? Total ? ? 10 000 b) A posteriori probability P(Legitimate | Suspicious) = ? c) Independence Analysis P(Phishing ∩ Susp.) ≟ P(Phishing) · P(Susp.)
Solve
Practice★★★Not started
A new antigen test is being tested for a recent variant of a virus. Clinical data indicates that the test is positive in $98\%$ of people who are actually infected…

A new antigen test is being tested for a recent variant of a virus. Clinical data indicates that the test is positive in $98\%$ of people who are actually infected ($I$). On the other hand, the test gives a "false positive" (positive in healthy people, $S$) in $4\%$ of cases. In the current population, it is estimated that $5\%$ of people have the virus.

  1. a) Create a contingency table for a sample of $10\,000$ people.
  1. b) If a person takes the test and tests positive, what is the actual probability that they are infected? Comment on the result obtained in relation to the reliability of the test.
  1. c) If the test is negative, what is the probability that the person is actually healthy?
5% 95% 98% 2% 4% 96% 10 000 ? ? ? ? ? ? Infected (I) Healthy (S) Test (+) Test (-) Test (+) Test (-) Infected (I) Healthy (S) Total Test (+) Test (-) Total ? ? ? ? ? ? ? ? 10 000 b) Actual probability if positive: P(I | +) = ? c) Actual probability if negative: P(S | -) = ?
Solve
Practice★★★Not started
A community college offers two vocational programs: Web Application Development ($DAW$) and Marketing and Advertising ($MK$). $55\%$ of the students are enrolled in…

A community college offers two vocational programs: Web Application Development ($DAW$) and Marketing and Advertising ($MK$). $55\%$ of the students are enrolled in $DAW$.

It has been found that $20\%$ of the students in $DAW$ and $15\%$ of those in $MK$ drop out of their studies before finishing the first year.

  1. a) Construct the contingency table associated with this institution.
  1. b) If we choose a student at random from those who have dropped out of the program, what is the probability that they were enrolled in Marketing and Advertising?
  1. c) Is dropping out of studies independent of the program the student is enrolled in? Justify your answer by comparing $P(Abandono)$ with $P(Abandono | DAW)$.
Solve

Putting it all together

Harder problems combine everything: group percentages, conditional percentages, a reversed condition, and an independence check. Follow the same routine every time.

Five-step routine for solving two-way table problems from percentages. 1. Pick a total N 2. Split the rows 3. Split each row by % 4. Add the columns 5. Read the probability
Practice★★★Not started
A secondhand clothing sales platform analyzes the behavior of its users. $60\%$ of the users are "Recurring Buyers" ($C$), while the rest are "Sporadic Buyers". It is…

A secondhand clothing sales platform analyzes the behavior of its users. $60\%$ of the users are "Recurring Buyers" ($C$), while the rest are "Sporadic Buyers".

It is observed that $70\%$ of recurring buyers use the mobile app for their transactions, whereas only $30\%$ of sporadic buyers use it (preferring the web).

  1. a) If we select a user at random, what is the probability that they use the web to make their purchases?
  1. b) If we know that a user has made a purchase through the web, what is the probability that they are a recurring buyer?
  1. c) Represent the situation using a contingency table for a population of $500$ users.
0.6 0.4 0.7 0.3 0.3 0.7 Users Recurring Sporadic App Web App Web 0.6 × 0.7 = ? 0.6 × 0.3 = ? 0.4 × 0.3 = ? 0.4 × 0.7 = ? N=500 App Web Total Recurring Sporadic Total ? ? ? ? ? ? ? ? 500 a) P(Web) = ? b) P(Recurrente | Web) = ?
Solve
Practice★★★Not started
A gym offers two types of activities: Weightlifting ($M$) and Group Classes ($C$). $40\%$ of the members are women. It is known that $70\%$ of women opt for group…

A gym offers two types of activities: Weightlifting ($M$) and Group Classes ($C$). $40\%$ of the members are women. It is known that $70\%$ of women opt for group classes, while $80\%$ of men prefer weightlifting.

  1. a) If we choose a member at random, what is the probability that they prefer weightlifting?
  1. b) If we select a member who prefers group classes, what is the probability that they are a man?
  1. c) Determine whether the member's sex and the preference for weightlifting are independent events. Explain your mathematical reasoning.
Solve
Practice★★★Not started
In a study on the use of electric vehicles ($E$) and gas-powered vehicles ($C$) in a city, $1\,200$ drivers are analyzed. $25\%$ of the drivers have an electric vehicle.…

In a study on the use of electric vehicles ($E$) and gas-powered vehicles ($C$) in a city, $1\,200$ drivers are analyzed. $25\%$ of the drivers have an electric vehicle. Of the electric vehicle drivers, $60\%$ live in single-family homes ($U$), whereas among gas-powered vehicle drivers, this percentage drops to $20\%$.

  1. a) Calculate the probability that a driver chosen at random lives in a single-family home.
  1. b) If a driver lives in a single-family home, what is the probability that they own an electric vehicle?
  1. c) Are the events "Owning an electric vehicle" and "Living in a single-family home" independent? Prove this by comparing the relevant probabilities.
E C U Uᶜ U Uᶜ Total: 1,200 Electric Gas-powered Single-family Other Single-family Other 0,25 0,75 0,60 0,40 0,20 0,80 P(E ∩ U) = 0.15 P(E ∩ Uᶜ) = 0.10 P(C ∩ U) = 0.15 P(C ∩ Uᶜ) = 0.60
Solve

Summary

See all the exercises in this section