Chi-square practice problems

By Jude Wallis · Published

This set has 8 problems on chi-square tests for two-way tables: computing expected counts, adding cell contributions to get the chi-square statistic, finding degrees of freedom, and telling a test of homogeneity from a test of independence. Solve each on paper, then open the steps.

AP Statistics: Unit 3 (topics 3.14 Setting Up a Chi-Square Test for Homogeneity or Independence, 3.15 Carrying Out a Chi-Square Test for Homogeneity or Independence). These problems cover the chi-square test for homogeneity and the chi-square test for independence on two-way tables (Unit 3 topics 3.14 and 3.15) in the Fall 2026 AP Statistics course. Unit 3 is 15 to 25% of the multiple-choice section. Chi-square goodness-of-fit is not part of this course.

What these problems build

These 8 problems build the workflow of a chi-square test on a two-way table of counts: finding the expected count in each cell, adding the cell-by-cell contributions to get the chi-square statistic χ2\chi^2 (read 'ky-square'), counting the degrees of freedom, and deciding between a test of homogeneity and a test of independence. The expected count for a cell is row total×column totaltable total\dfrac{\text{row total} \times \text{column total}}{\text{table total}}, the count the null model predicts. The statistic is χ2=(OE)2E\chi^2 = \sum \dfrac{(O - E)^2}{E}, where OO is an observed count and EE is its expected count, summed over every cell. The degrees of freedom equal (rows1)(columns1)(\text{rows} - 1)(\text{columns} - 1).

A test of homogeneity compares the distribution of one categorical variable across two or more separate samples, while a test of independence checks whether two variables are associated within a single sample; the study design tells you which one fits. The first problems drill expected counts, degrees of freedom, and the statistic on their own, then the later problems run a full test and reason about the result. For the setup and conditions, read chi-square tests explained, and check your arithmetic with the chi-square calculator. More sets are on the practice page.

Problem 1

An animal shelter records, for a random sample of 200 recently adopted pets, the species of the pet and whether the adopter signed up for a free training class.

SpeciesSigned upDid notTotal
Cat8040120
Dog701080
Total15050200

Assuming no association between species and signing up, find the expected count for all four cells and check the expected-counts condition.

Show the worked solution
  1. Each expected count is row total×column totaltable total\dfrac{\text{row total} \times \text{column total}}{\text{table total}}. The row totals are 120 and 80, the column totals are 150 and 50, and the table total is 200.

  2. Cat and signed up: 120×150200=18000200=90\dfrac{120 \times 150}{200} = \dfrac{18000}{200} = 90.

  3. Cat and did not: 120×50200=6000200=30\dfrac{120 \times 50}{200} = \dfrac{6000}{200} = 30.

  4. Dog and signed up: 80×150200=12000200=60\dfrac{80 \times 150}{200} = \dfrac{12000}{200} = 60.

  5. Dog and did not: 80×50200=4000200=20\dfrac{80 \times 50}{200} = \dfrac{4000}{200} = 20.

  6. Check the condition. The four expected counts are 90, 30, 60, and 20, and every one is greater than 5, so the expected-counts condition is met.

Expected counts: cat and signed up 90, cat and did not 30, dog and signed up 60, dog and did not 20; all exceed 5, so the condition is met.

Problem 2

For each study, name the chi-square test that fits (homogeneity or independence), state the hypotheses in words, and give the degrees of freedom.

  • Study A. A researcher takes one random sample of 250 adults and records each person's favorite coffee style (drip, espresso, or cold brew) and whether they work remotely, then asks whether coffee style and remote work are associated.
  • Study B. A district office draws separate random samples of 100 students from each of three high schools and records each student's preferred learning mode (in person, hybrid, or online), then asks whether the distribution of learning mode is the same across the three schools.
Show the worked solution
  1. Look at how the data were collected. Study A is one sample from a single population measured on two variables, which points to a test of independence. Study B is separate samples from several populations compared on one variable, which points to a test of homogeneity.

  2. Study A test and hypotheses. Chi-square test for independence. H0H_0: coffee style and remote-work status are independent (not associated) among adults. HaH_a: coffee style and remote-work status are associated.

  3. Study A degrees of freedom. The table is 3 coffee styles by 2 remote-work categories, so df=(31)(21)=2×1=2df = (3 - 1)(2 - 1) = 2 \times 1 = 2.

  4. Study B test and hypotheses. Chi-square test for homogeneity. H0H_0: the distribution of preferred learning mode is the same across the three schools. HaH_a: the distribution of learning mode is not the same across the three schools.

  5. Study B degrees of freedom. The table is 3 schools by 3 learning modes, so df=(31)(31)=2×2=4df = (3 - 1)(3 - 1) = 2 \times 2 = 4.

Study A: test of independence, H0H_0 coffee style and remote work independent vs HaH_a associated, df=2df = 2. Study B: test of homogeneity, H0H_0 same learning-mode distribution across schools vs HaH_a not the same, df=4df = 4.

Problem 3

A streaming service takes a random sample of 300 subscribers and cross-classifies each by plan tier and the device they watch on most.

PlanTVPhoneLaptopTotal
Basic1005030180
Premium504030120
Total1509060300

Find the expected count for every cell under the null hypothesis of no association, and give the degrees of freedom.

Show the worked solution
  1. Each expected count is row total×column totaltable total\dfrac{\text{row total} \times \text{column total}}{\text{table total}}, with table total 300. Row totals are 180 (basic) and 120 (premium); column totals are 150 (TV), 90 (phone), and 60 (laptop).

  2. Basic row: 180×150300=27000300=90\dfrac{180 \times 150}{300} = \dfrac{27000}{300} = 90 for TV, 180×90300=16200300=54\dfrac{180 \times 90}{300} = \dfrac{16200}{300} = 54 for phone, and 180×60300=10800300=36\dfrac{180 \times 60}{300} = \dfrac{10800}{300} = 36 for laptop.

  3. Premium row: 120×150300=18000300=60\dfrac{120 \times 150}{300} = \dfrac{18000}{300} = 60 for TV, 120×90300=10800300=36\dfrac{120 \times 90}{300} = \dfrac{10800}{300} = 36 for phone, and 120×60300=7200300=24\dfrac{120 \times 60}{300} = \dfrac{7200}{300} = 24 for laptop.

  4. Check the condition. The expected counts are 90, 54, 36, 60, 36, and 24, all greater than 5.

  5. Degrees of freedom. The table has 2 rows and 3 columns, so df=(21)(31)=1×2=2df = (2 - 1)(3 - 1) = 1 \times 2 = 2.

Expected counts (basic) 90, 54, 36 and (premium) 60, 36, 24, all above 5; df=(21)(31)=2df = (2 - 1)(3 - 1) = 2.

Problem 4

An orchard tests two pollination methods on whether each tree sets fruit. It randomly assigns 100 trees to managed bee boxes and 100 trees to hand pollination, then records the outcome for each tree.

MethodSet fruitNo fruitTotal
Bee boxes6634100
Hand5446100
Total12080200

Compute the chi-square statistic and its degrees of freedom for a test of whether the fruit-set rate differs by method.

Show the worked solution
  1. Expected counts, row×column200\dfrac{\text{row} \times \text{column}}{200}. Set-fruit column: 100×120200=60\dfrac{100 \times 120}{200} = 60 for each method. No-fruit column: 100×80200=40\dfrac{100 \times 80}{200} = 40 for each method.

  2. Bee-box contributions. Set fruit: (6660)260=3660=0.6\dfrac{(66 - 60)^2}{60} = \dfrac{36}{60} = 0.6. No fruit: (3440)240=3640=0.9\dfrac{(34 - 40)^2}{40} = \dfrac{36}{40} = 0.9.

  3. Hand contributions. Set fruit: (5460)260=3660=0.6\dfrac{(54 - 60)^2}{60} = \dfrac{36}{60} = 0.6. No fruit: (4640)240=3640=0.9\dfrac{(46 - 40)^2}{40} = \dfrac{36}{40} = 0.9.

  4. Add the four terms. χ2=0.6+0.9+0.6+0.9=3.0\chi^2 = 0.6 + 0.9 + 0.6 + 0.9 = 3.0.

  5. Degrees of freedom. (21)(21)=1(2 - 1)(2 - 1) = 1. A chi-square value of 3.0 on 1 degree of freedom gives a p-value of about 0.083, above α=0.05\alpha = 0.05, so this would not be convincing evidence of a difference.

Expected counts are 60 and 40 in every cell; χ2=0.6+0.9+0.6+0.9=3.0\chi^2 = 0.6 + 0.9 + 0.6 + 0.9 = 3.0 with df=1df = 1 (p-value about 0.083).

Problem 5

At three wetland sites, a conservation crew bands a random sample of 100 birds per site and records whether each bird is a juvenile or an adult.

SiteJuvenileAdultTotal
Site 14852100
Site 23664100
Site 33664100
Total120180300

Test at α=0.05\alpha = 0.05 whether the age distribution is the same across the three sites. Find the expected counts, the chi-square statistic, the degrees of freedom, and the decision.

Show the worked solution
  1. Hypotheses. H0H_0: the distribution of age (juvenile vs adult) is the same at all three sites. HaH_a: the age distribution is not the same across the sites. This is a chi-square test for homogeneity, because the three sites are separate samples.

  2. Expected counts, row×column300\dfrac{\text{row} \times \text{column}}{300}. Juvenile column: 100×120300=40\dfrac{100 \times 120}{300} = 40 per site. Adult column: 100×180300=60\dfrac{100 \times 180}{300} = 60 per site. All expected counts exceed 5.

  3. Juvenile contributions. Site 1: (4840)240=6440=1.6\dfrac{(48 - 40)^2}{40} = \dfrac{64}{40} = 1.6. Sites 2 and 3: (3640)240=1640=0.4\dfrac{(36 - 40)^2}{40} = \dfrac{16}{40} = 0.4 each. Juvenile total =1.6+0.4+0.4=2.4= 1.6 + 0.4 + 0.4 = 2.4.

  4. Adult contributions. Site 1: (5260)260=6460=1.0667\dfrac{(52 - 60)^2}{60} = \dfrac{64}{60} = 1.0667. Sites 2 and 3: (6460)260=1660=0.2667\dfrac{(64 - 60)^2}{60} = \dfrac{16}{60} = 0.2667 each. Adult total =1.0667+0.2667+0.2667=1.6= 1.0667 + 0.2667 + 0.2667 = 1.6.

  5. Statistic and degrees of freedom. χ2=2.4+1.6=4.0\chi^2 = 2.4 + 1.6 = 4.0, and df=(31)(21)=2df = (3 - 1)(2 - 1) = 2.

  6. Decision. The critical value for df=2df = 2 at α=0.05\alpha = 0.05 is 5.991 (the p-value is about 0.135). Since 4.0<5.9914.0 < 5.991, fail to reject H0H_0: there is not convincing evidence that the age distribution differs across the three sites.

Expected counts 40 (juvenile) and 60 (adult) per site; χ2=2.4+1.6=4.0\chi^2 = 2.4 + 1.6 = 4.0, df=2df = 2. Since 4.0<5.9914.0 < 5.991 (p about 0.135), fail to reject H0H_0; no convincing evidence the age distribution differs.

Problem 6

A transportation study compares primary commute mode in two cities. Independent random samples of 200 commuters are drawn in each city, and each commuter's main mode (bus, train, or bike) is recorded.

CityBusTrainBikeTotal
City X1056530200
City Y759530200
Total18016060400

(a) State the hypotheses and name the test. (b) Find the expected counts. (c) Compute the chi-square statistic and degrees of freedom. (d) At α=0.05\alpha = 0.05, state your conclusion in context.

Show the worked solution
  1. (a) Chi-square test for homogeneity, since the two cities are separate random samples compared on one categorical variable. H0H_0: the distribution of commute mode is the same in the two cities. HaH_a: the distribution of commute mode differs between the two cities.

  2. (b) Expected counts, row×column400\dfrac{\text{row} \times \text{column}}{400}, with each row total 200. Bus: 200×180400=90\dfrac{200 \times 180}{400} = 90. Train: 200×160400=80\dfrac{200 \times 160}{400} = 80. Bike: 200×60400=30\dfrac{200 \times 60}{400} = 30. These are the same for both cities, and all exceed 5.

  3. (c) Bus contributions. City X: (10590)290=22590=2.5\dfrac{(105 - 90)^2}{90} = \dfrac{225}{90} = 2.5. City Y: (7590)290=22590=2.5\dfrac{(75 - 90)^2}{90} = \dfrac{225}{90} = 2.5.

  4. (c) Train contributions. City X: (6580)280=22580=2.8125\dfrac{(65 - 80)^2}{80} = \dfrac{225}{80} = 2.8125. City Y: (9580)280=22580=2.8125\dfrac{(95 - 80)^2}{80} = \dfrac{225}{80} = 2.8125. Both bike contributions are (3030)230=0\dfrac{(30 - 30)^2}{30} = 0.

  5. (c) Add the terms and find df. χ2=2.5+2.8125+0+2.5+2.8125+0=10.625\chi^2 = 2.5 + 2.8125 + 0 + 2.5 + 2.8125 + 0 = 10.625, and df=(21)(31)=2df = (2 - 1)(3 - 1) = 2.

  6. (d) Conclusion. For df=2df = 2 the p-value is about 0.005, less than α=0.05\alpha = 0.05 (and the statistic 10.625 exceeds the critical value 5.991). Reject H0H_0: there is convincing evidence that the distribution of commute mode differs between City X and City Y.

(a) Homogeneity test, H0H_0 same commute-mode distribution vs HaH_a different. (b) Expected 90, 80, 30 per city. (c) χ2=10.625\chi^2 = 10.625, df=2df = 2. (d) p about 0.005 < 0.05, reject H0H_0; convincing evidence the distributions differ.

Problem 7

A random sample of 200 day hikers at a national park is classified by experience level and by whether they carry a first-aid kit.

ExperienceCarries kitNo kitTotal
Novice305080
Intermediate342660
Expert362460
Total100100200

(a) Name the appropriate test and explain why. (b) State the hypotheses. (c) Find the expected counts and the chi-square statistic with its degrees of freedom. (d) At α=0.05\alpha = 0.05, state a conclusion. (e) Would the decision change at α=0.01\alpha = 0.01?

Show the worked solution
  1. (a) Chi-square test for independence. The data come from one random sample of hikers measured on two categorical variables (experience level and kit), not from separate samples of different populations.

  2. (b) Hypotheses. H0H_0: experience level and carrying a first-aid kit are independent among the park's day hikers. HaH_a: experience level and carrying a first-aid kit are associated.

  3. (c) Expected counts, row×column200\dfrac{\text{row} \times \text{column}}{200}, each column total 100. Novice: 80×100200=40\dfrac{80 \times 100}{200} = 40 per cell. Intermediate and expert: 60×100200=30\dfrac{60 \times 100}{200} = 30 per cell. All exceed 5.

  4. (c) Novice contributions. Carries kit: (3040)240=10040=2.5\dfrac{(30 - 40)^2}{40} = \dfrac{100}{40} = 2.5. No kit: (5040)240=10040=2.5\dfrac{(50 - 40)^2}{40} = \dfrac{100}{40} = 2.5.

  5. (c) Intermediate and expert contributions. Each intermediate cell: (3430)230=1630=0.5333\dfrac{(34 - 30)^2}{30} = \dfrac{16}{30} = 0.5333. Each expert cell: (3630)230=3630=1.2\dfrac{(36 - 30)^2}{30} = \dfrac{36}{30} = 1.2.

  6. (c) Statistic and df. χ2=2.5+2.5+0.5333+0.5333+1.2+1.2=8.4667\chi^2 = 2.5 + 2.5 + 0.5333 + 0.5333 + 1.2 + 1.2 = 8.4667, and df=(31)(21)=2df = (3 - 1)(2 - 1) = 2.

  7. (d) At α=0.05\alpha = 0.05. The p-value for df=2df = 2 is about 0.0145, less than 0.05, so reject H0H_0: there is convincing evidence that experience level and carrying a first-aid kit are associated.

  8. (e) At α=0.01\alpha = 0.01. Now 0.0145>0.010.0145 > 0.01, so you fail to reject H0H_0; the same data are not strong enough to conclude an association at the stricter level, so the decision changes.

(a)/(b) Test of independence, H0H_0 experience and kit independent vs HaH_a associated. (c) χ2=8.4667\chi^2 = 8.4667, df=2df = 2. (d) p about 0.0145 < 0.05, reject H0H_0. (e) At α=0.01\alpha = 0.01, p > 0.01, so fail to reject; the decision changes.

Problem 8

A high school compares study-music preferences using separate random samples of 150 juniors and 150 seniors. Each student names their usual study music: lo-fi, classical, or none.

GradeLo-fiClassicalNoneTotal
Juniors783933150
Seniors425157150
Total1209090300

(a) Compute the chi-square statistic and degrees of freedom. (b) Identify the cell that contributes most to the statistic and interpret it in context. (c) A classmate suggests running this instead as a test of independence. Explain why a test of homogeneity is the right choice here.

Show the worked solution
  1. (a) Expected counts, row×column300\dfrac{\text{row} \times \text{column}}{300}, each row total 150. Lo-fi: 150×120300=60\dfrac{150 \times 120}{300} = 60 per grade. Classical: 150×90300=45\dfrac{150 \times 90}{300} = 45 per grade. None: 150×90300=45\dfrac{150 \times 90}{300} = 45 per grade.

  2. (a) Lo-fi contributions. Juniors: (7860)260=32460=5.4\dfrac{(78 - 60)^2}{60} = \dfrac{324}{60} = 5.4. Seniors: (4260)260=32460=5.4\dfrac{(42 - 60)^2}{60} = \dfrac{324}{60} = 5.4.

  3. (a) Classical and none contributions. Classical: juniors (3945)245=3645=0.8\dfrac{(39 - 45)^2}{45} = \dfrac{36}{45} = 0.8, seniors (5145)245=3645=0.8\dfrac{(51 - 45)^2}{45} = \dfrac{36}{45} = 0.8. None: juniors (3345)245=14445=3.2\dfrac{(33 - 45)^2}{45} = \dfrac{144}{45} = 3.2, seniors (5745)245=14445=3.2\dfrac{(57 - 45)^2}{45} = \dfrac{144}{45} = 3.2.

  4. (a) Statistic and df. χ2=5.4+0.8+3.2+5.4+0.8+3.2=18.8\chi^2 = 5.4 + 0.8 + 3.2 + 5.4 + 0.8 + 3.2 = 18.8, and df=(21)(31)=2df = (2 - 1)(3 - 1) = 2; the p-value is under 0.001, strong evidence of a difference.

  5. (b) Largest contribution. The two lo-fi cells each add 5.4, the largest single contribution. Juniors chose lo-fi far more than the null predicts (78 observed versus 60 expected) while seniors chose it far less (42 versus 60), so the lo-fi preference is where the two grades differ most.

  6. (c) Why homogeneity. The design fixed two separate samples, 150 juniors and 150 seniors, and compares the distribution of one variable (study music) across those two populations. A test of independence applies to a single sample classified by two variables at once, which is not how these data were collected.

(a) χ2=18.8\chi^2 = 18.8, df=2df = 2 (p < 0.001). (b) The lo-fi cells contribute most (5.4 each): juniors pick lo-fi much more than expected (78 vs 60), seniors much less (42 vs 60). (c) Two separate grade samples compared on one variable calls for homogeneity, not independence.