Chi-squared test and confidence intervals (IB Math AI HL)
Updated October 2026
Quick answer: For a χ² test for independence, the expected frequency in each cell is row total × column total ÷ grand total, the degrees of freedom are (rows − 1)(columns − 1), and you reject H₀ if the p-value is less than the significance level.
HL AI extends SL AI's chi-squared with confidence intervals for the population mean. Practise the t-distribution CDF on your GDC.
Practise Chi-squared test and confidence intervals with AI marking
Open the full HL AI engine — every question in this unit is worked through with instant AI-graded feedback on your handwritten workings.
H₀: the variables are independent. H₁: they are not independent. State both in context.
Expected frequency = row total × column total ÷ grand total. Every expected frequency should be at least 5: if not, combine rows or columns (and the degrees of freedom fall).
Independence test: df = (r − 1)(c − 1). Goodness-of-fit test: df = number of categories − 1, less one more for each parameter estimated from the data.
Reject H₀ if the p-value is below the significance level, or if χ²calc is above the critical value. Never say H₀ is 'proved'.
Confidence intervals for a mean: use the GDC's t-interval when the population standard deviation is unknown and the z-interval when it is known.
Worked example
200 students were asked whether they prefer tea or coffee. DP1: 40 tea, 60 coffee. DP2: 25 tea, 75 coffee. Test at the 5% level whether preference is independent of year group.
H₀: preference is independent of year group. H₁: it is not.
Expected: tea = 65 × 100 ÷ 200 = 32.5 for each year, coffee = 135 × 100 ÷ 200 = 67.5 for each year. All are above 5.
df = (2 − 1)(2 − 1) = 1.
GDC: χ²calc = 5.13 (3 s.f.) and p = 0.0235.
0.0235 < 0.05, so reject H₀: there is evidence that drink preference depends on year group.
Answer: χ² = 5.13, p = 0.0235: reject H₀ at the 5% level.
How do you work out degrees of freedom for a chi-squared test?
For a test for independence, df = (rows − 1)(columns − 1), after combining any cells with expected frequencies below 5. For goodness of fit, df = categories − 1, minus one for each parameter you estimated from the data.
Where can I practise chi-squared test and confidence intervals questions?
On the Chi-Square Goodness of Fit, Independence and Error Types questions page: 20 exam-style HL AI questions with full mark schemes, plus free step-by-step worked examples.
Can I use my calculator for chi-squared test and confidence intervals?
Yes: a GDC is allowed on every HL AI paper, so practise the calculator method as well as the working. The t-tests and χ² tests and Confidence intervals guides give the keystrokes for the TI-84 Plus CE, TI-Nspire CX II and Casio fx-CG50.