AP® Biology exam preparation · Skim version

The Chi-Square Test

About 2 min to skim · 3 figures

Read the full lesson → Skim the whole course →

This idea at other levels

This lesson teaches the chi-square test at high school level. Simpler: read a short high school version in the lesson. Deeper: Probability, Crosses and the Chi-Square Test (college core).

The guiding idea

Thirty-seven of 60 flies walk to one side of a chamber. Is that a preference, or the kind of lopsided split chance makes all the time?

Chi-square measures how far observed counts sit from the counts a chance-only null hypothesis predicts, and you reject the null only when a gap that large would turn up by chance less than 5% of the time.

From the film: What Chance Looks Like

  • Chi-square asks how often chance alone would put counts this far from the null: less than 1 time in 20 (above the critical value), reject the null; more often, fail to reject it.
  • 37 of 60 flies on the humid side gives χ² = 3.27, below the 1-df critical value of 3.84, so you fail to reject the null.
  • Failing to reject is not proof: the flies may still prefer humid air, but 60 flies are not enough to rule out chance.
  • The same 61.7% share in 120 flies doubles χ² to 6.53, past 3.84, so you reject the null (0.01 < p < 0.05).
  • Chi-square takes counts, never percentages, because percentages throw away the sample size.

From the film: Crosses and Cells

  • In the corn cross, 291 purple and 109 yellow kernels give χ² = 1.08, below the 1-df critical value of 3.84, so you fail to reject 3:1; the same miss of 9 weighs three times as much in the smaller class.
  • Degrees of freedom are outcome categories minus one: a four-class testcross of 400 offspring has 3, not 399.
  • The testcross gives χ² = 151.54, past 11.34, so you reject 1:1:1:1; the excess of parental classes is consistent with linkage, not proof of it.
  • For treated against control root tips, pool both groups for the expected counts (161 and 39 per group): χ² = 5.16, so you reject the null with 0.01 < p < 0.05. Using the control alone as expected overstates the evidence.
  • Rejecting says chance is a poor explanation, not why: more cells entering mitosis and cells staying in mitosis longer both fit.
  1. AI-generated illustration: a horizontal glass tube with damp cotton at the left end and a dish of drying crystals at the right end, a cluster of fruit flies released at the middle, and after the trial more flies resting on the damp-cotton half than on the crystal half.
    Flies released in the middle of a two-condition tube settle on one side or the other, and 37 against 23 (simulated counts) looks like a preference, but the test asks whether chance alone could split 60 flies that unevenly. AI-generated illustration
  2. The five-step routine

  3. Worked problem 1: a monohybrid cross

  4. Worked problem 2: when the ratio breaks

    AI-generated illustration: a schematic testcross of a heterozygous AaBb plant with a homozygous aabb tester using plain vertical chromosome bars. The main panel shows an AaBb chromosome pair (one bar carrying A and B, its partner carrying a and b) crossed with an aabb pair (two bars carrying a and b), leading to four offspring classes: two parental classes (AB with 165 offspring, ab with 158) and two recombinant classes with swapped two-tone bars (Ab with 39, aB with 38), with a dashed bracket and question mark linking A and B on one bar. Two lower insets compare the independent-assortment null model (genes on separate chromosome pairs giving 1:1:1:1, 100 each) with linked genes close on one chromosome giving 77 of 400 recombinants.
    In an AaBb × aabb testcross, independent assortment predicts 100 offspring in each of four classes; the excess of parental AB (165) and ab (158) over recombinant Ab (39) and aB (38) rejects 1:1:1:1 and is consistent with, but does not prove, linkage. AI-generated illustration
  5. Worked problem 3: treated against control (mitotic index)

    AI-generated illustration: experimental design for scoring onion root-tip mitosis. The main panel shows two side-by-side groups: onion root tips in a water control beaker leading to a circular microscope field of rectangular plant cells (200 scored: 170 interphase, 30 mitosis), and onion root tips in a test-solution beaker leading to a second microscope field with visibly more dividing cells (200 scored: 152 interphase, 48 mitosis). Bottom-left inset zooms into two stained rectangular plant cells comparing interphase (smooth round nucleus) and mitosis (condensed dividing chromosomes). Bottom-right inset shows both 200-cell groups pooled into 400 cells (322 interphase, 78 mitosis) to set one shared null expectation of 161 interphase and 39 mitosis per group.
    Scoring 200 stained onion root-tip cells per group finds more cells in mitosis in the test solution (48 vs 30), and pooling all 400 cells sets one shared null expectation (161 interphase, 39 mitosis per group), though rejecting the null does not show whether more cells entered mitosis or stayed there longer. AI-generated illustration
  6. Worked problem 4: a fruit-fly choice chamber

  7. What the verdict means, and what it does not

  8. Before the exam

  9. Going deeper

Try the Predict questions again

Five Predict questions from this lesson, on their own. Answer each one first, then open its check.

  1. Back to the 60 flies in the humid-or-dry tube. Which is the null hypothesis: “the flies prefer the humid side” or “the flies show no preference”?

    From: The five-step routine

    Check your prediction

    “The flies show no preference, so equal numbers end up on each side, and any difference is due to chance.” That gives expected counts of 30 and 30. “The flies prefer the humid side” is the research (alternative) hypothesis: it is what the students suspect, but it does not say how many flies to expect, so it cannot be tested directly. Naming the alternative when asked for the null is one of the most common slips on this skill.

  2. A cross produces 400 offspring in four phenotype classes. How many degrees of freedom does its chi-square test have?

    From: The five-step routine

    Check your prediction

    Three: four categories minus one. The number of offspring does not enter the degrees of freedom. A common wrong answer is 399, the sample size minus one, which belongs to a different calculation (the standard deviation on the same sheet).

  3. A 3:1 ratio predicts 300 purple kernels and 100 yellow. This ear is 9 purple kernels short. Is that a reason to doubt the 3:1 model?

    From: Worked problem 1: a monohybrid cross

    Check your prediction

    No. χ² = 1.08, well below the 1-df critical value of 3.84. A miss of 9 kernels in 400 is the kind of gap chance makes all the time.

  4. Nearly two flies in three chose the humid side. At p = 0.05, do the students have evidence of a preference?

    From: Worked problem 4: a fruit-fly choice chamber

    Check your prediction

    Not at p = 0.05. 3.27 < 3.84, so p > 0.05: fail to reject the null. Splits this uneven turn up over 5% of the time when 60 flies choose sides at random.

    That verdict feels harsh when 37 against 23 looks like a preference. It may well be one. The test says only that 60 flies are not enough to rule out chance.

  5. The students repeat the test with 120 new flies: 74 on the humid side and 46 on the dry side, the same 61.7% proportion. Same verdict?

    From: Worked problem 4: a fruit-fly choice chamber

    Check your prediction

    No. Expected counts are 60 and 60. χ² = (74 − 60)²/60 + (46 − 60)²/60 = 196/60 + 196/60 = 3.267 + 3.267 ≈ 6.53. With 1 df, 6.53 > 3.84, so p < 0.05: reject the null. Just below 6.63, so 0.01 < p < 0.05.

    Only the sample size changed, not the proportion, yet the same lopsidedness became too large for chance. This is the clearest picture of what the first run’s “fail to reject” meant: not enough evidence yet, never no preference.

Read the full lesson → Skim the whole course →