☰ IB Maths AI HL · course menu
Topics
IB Maths AI HL · free cheatsheet
Hypothesis Testing cheatsheet (IB Maths AI HL)
Every step of a hypothesis test — stating H0 and H1, the chi-squared tests for independence and goodness of fit, and the t- and z-tests for a population mean — for IB Mathematics Applications & Interpretation HL, with the GDC doing the heavy lifting. Written by an IB-certified teacher.
What this cheatsheet covers
Hypothesis testing is the capstone of the Statistics & Probability strand in IB Mathematics Applications & Interpretation HL, and it is AI at its most practical: it is the formal machinery for deciding whether real data show a genuine effect or just random noise. Does a new teaching method actually raise marks? Are voting preference and age group associated? Do accident counts follow a Poisson model? A calculator is always allowed, so the GDC does the heavy lifting — you enter the data and read off the $\chi^2$ or $t$ statistic and the p-value. The marks live in stating the hypotheses, choosing the right test, and writing the in-context conclusion — not in grinding the arithmetic.
This cheatsheet condenses SL 4.11 · AHL 4.18–4.19 onto one page — null and alternative hypotheses, significance levels, expected frequencies, the $\chi^2$ tests for independence and goodness of fit, the $t$-test and $z$-test for a population mean, and the p-value / critical-value decision — and flags the traps that quietly cost marks (degrees of freedom, where expected frequencies come from, the direction of $p<\alpha$, and $\sigma$ versus $s$).
Null & alternative hypotheses, significance
SL 4.11Null hypothesis:$H_0$ — "no effect": the variables are independent, the data fit the model, or $\mu=\mu_0$.Alternative:$H_1$ — an effect exists: the variables are associated, the data do not fit, or the mean has changed.Significance level:$\alpha$ — the risk you accept of rejecting a true $H_0$; usually $\alpha=0.05$ (5%), written as a decimal.Decision rule:reject $H_0$ when $p<\alpha$; otherwise there is insufficient evidence to reject it.
Every test weighs a null hypothesis against an alternative, then uses the sample evidence to decide between them.
Observed & expected frequencies
SL 4.11From a proportion:$E=n\times p$ — the sample size times the proportion $H_0$ predicts for that category.From a percentage:turn the % into a fraction over 100 first: $E=n\times\dfrac{\%}{100}$.Contingency cell:$E=\dfrac{(\text{row total})\times(\text{column total})}{\text{grand total}}$ — for a test of independence.
Every $\chi^2$ test compares the observed counts $O$ with the expected counts $E$ that $H_0$ predicts. Getting $E$ right is the whole game.
The $\chi^2$ statistic & degrees of freedom
SL 4.11Test statistic:$\chi^2_{\text{calc}}=\displaystyle\sum\frac{(O-E)^2}{E}$ — summed over every cell or category.df (goodness of fit):$\text{df}=k-1$ for $k$ categories.df (independence):$\text{df}=(r-1)(c-1)$ for an $r\times c$ table.
Both $\chi^2$ tests use the same statistic — a running total of how far each observed count sits from its expected count.
The $\chi^2$ test for independence
SL 4.11
This tests whether two categorical variables are associated. $H_0$: the variables are independent; $H_1$: they are not. Consider a small survey of $100$ people — drink choice against age group:
| Observed $O$ | Latte | Espresso | Row total |
|---|---|---|---|
| Under 30 | 30 | 20 | 50 |
| 30 or over | 20 | 30 | 50 |
| Column total | 50 | 50 | 100 |
Each expected value comes from the margins: for the "Under 30, Latte" cell, $E=\dfrac{50\times50}{100}=25$ — and by symmetry all four expected cells are $25$ here.
The $\chi^2$ goodness-of-fit test
SL 4.11Equally likely:each $E=\dfrac{n}{k}$ — $n$ data split evenly across $k$ categories.Stated proportions:$E_i=n\times p_i$ — scale each model proportion by the sample size.Statistic & df:$\chi^2=\displaystyle\sum\frac{(O-E)^2}{E}$, with $\text{df}=k-1$.
Goodness of fit asks whether observed counts match a claimed model — a fair die, a stated set of proportions, or a distribution. $H_0$: the data fit the model; $H_1$: they do not.
Fitting a distribution: a Poisson example
SL 4.11Model probability:$P(X=k)=\dfrac{e^{-\lambda}\lambda^{k}}{k!}$ — for a Poisson with mean $\lambda$.Expected frequency:$E_k=n\,P(X=k)$ — scale each probability by the sample size $n$.Then, as always:$\chi^2=\displaystyle\sum\frac{(O-E)^2}{E}$, compared against $\alpha$.
A goodness-of-fit test really shines when the model is a probability distribution such as a Poisson. The distribution supplies the expected frequencies — a probability-distribution calculation feeding straight into the hypothesis test.
Critical values & the rejection region
AHL 4.18p-value method:reject $H_0 \iff p<\alpha$.Critical-value method:reject $H_0 \iff \chi^2_{\text{calc}}>\chi^2_{\text{crit}}$.
There are two equivalent ways to reach a verdict, and they always agree.
The $t$-test for a population mean
AHL 4.18Hypotheses:$H_0:\mu=\mu_0$ against $H_1:\mu\neq\mu_0$ (two-tailed), or $\mu>\mu_0$ / $\mu<\mu_0$ (one-tailed).Statistic:$t=\dfrac{\bar{x}-\mu_0}{s/\sqrt{n}}$ — but read $t$ and the p-value straight off the GDC's $t$-test.Decision:reject $H_0 \iff p<\alpha$.
To test a claim about a mean $\mu$ when the population standard deviation is unknown, use a $t$-test — the GDC does it from either the raw data or the summary statistics.
Known $\sigma$: the $z$-test & confidence interval
AHL 4.19Test statistic:$z=\dfrac{\bar{x}-\mu_0}{\sigma/\sqrt{n}}$, where $\dfrac{\sigma}{\sqrt{n}}$ is the standard error.Decision:reject $H_0 \iff p<\alpha$ (equivalently $|z|>z_{\text{crit}}$).95% CI for $\mu$:$\bar{x}\pm1.96\,\dfrac{\sigma}{\sqrt{n}}$ — use $2.576$ in place of $1.96$ for a 99% interval.
When the population standard deviation $\sigma$ is known, the sample mean is tested with a $z$-statistic, and the same standard error builds a confidence interval.
Exam attack plan
All sections
| Question cue | What to do | Watch for |
|---|---|---|
| "State the hypotheses" | $H_0$ = no effect / independent / $\mu=\mu_0$; put the claim in $H_1$ | $H_0$ always carries the equality |
| "Test for independence" | $E=\dfrac{\text{row}\times\text{col}}{\text{grand}}$; $\text{df}=(r-1)(c-1)$; GDC for $\chi^2$, $p$ | Use the margins for $E$, not the observed cell |
| "Goodness of fit" | $E=np_i$ (or $n/k$); $\text{df}=k-1$; $\chi^2=\sum\frac{(O-E)^2}{E}$ | Big $\chi^2$ / small $p$ = does not fit |
| "Show the expected frequency is …" | $\dfrac{\text{row total}\times\text{column total}}{\text{grand total}}$ | Read the totals off the edge of the table |
| "$t$-test for a mean ($\sigma$ unknown)" | GDC $t$-test; reject if $p<\alpha$ | Match one- / two-tailed to $H_1$ |
| "$z$-test / $\sigma$ known" | $z=\dfrac{\bar{x}-\mu_0}{\sigma/\sqrt{n}}$; reject if $p<\alpha$ | Divide by $\sqrt{n}$, not $n$ |
| "Reach a conclusion" | Compare $p$ with $\alpha$ (or $\chi^2_{\text{calc}}$ with $\chi^2_{\text{crit}}$) | Reject if $p<\alpha$; then state it in context |
| "Confidence interval for $\mu$" | $\bar{x}\pm1.96\,\sigma/\sqrt{n}$ | $1.96$ for 95%, $2.576$ for 99% |
Worked Example — $\chi^2$ Test for Independence
Question (AI HL Paper 2 style — 9 marks)
A tutor surveys $200$ students, recording their year group and preferred study method. The results are:
| Observed | Notes | Videos | Practice | Total |
|---|---|---|---|---|
| Year 12 | 28 | 22 | 30 | 80 |
| Year 13 | 22 | 38 | 60 | 120 |
| Total | 50 | 60 | 90 | 200 |
Test, at the $5\%$ significance level, whether preferred study method is independent of year group.
(a) State the null and alternative hypotheses.
(b) Show that the expected frequency of Year 12 students who prefer Notes is $20$.
(c) Write down the number of degrees of freedom.
(d) Find the $\chi^2$ statistic and the p-value.
(e) State, with a reason, your conclusion.
Solution
- (a) $H_0$: study method is independent of year group; $H_1$: study method is not independent of (is associated with) year group. (A1)(A1)
- (b) $E=\dfrac{(\text{row total})\times(\text{column total})}{\text{grand total}}=\dfrac{80\times50}{200}=20$. (M1)(A1) (Built from the margins $80$ and $50$, never from the observed $28$.)
- (c) A $2\times3$ table gives $\text{df}=(2-1)(3-1)=2$. (A1)
- (d) Entering the $2\times3$ observed matrix into the GDC's $\chi^2$-test gives $\chi^2_{\text{calc}}=7.28$ (3 s.f.) and $p=0.0263$ (3 s.f.). (M1)(A1) (By hand, $\chi^2=\tfrac{(28-20)^2}{20}+\tfrac{(22-24)^2}{24}+\tfrac{(30-36)^2}{36}+\tfrac{(22-30)^2}{30}+\tfrac{(38-36)^2}{36}+\tfrac{(60-54)^2}{54}=7.28$.)
- (e) Since $p=0.0263<0.05$ — equivalently $\chi^2_{\text{calc}}=7.28>\chi^2_{\text{crit}}=5.991$ — we reject $H_0$. (M1)(A1) There is significant evidence that preferred study method depends on year group.
Examiner's note: the two marks students throw away here are the hypotheses (write them in words, with the equality-flavoured statement as $H_0$) and the conclusion in context — "reject $H_0$" alone is not enough; you must say what that means for the study. Quote $\chi^2$ and $p$ to 3 s.f., and remember the p-value and critical-value routes always agree.
Common Student Questions
- Which hypothesis gets the "equals", $H_0$ or $H_1$?
- Do I use the p-value or the critical value to decide?
- How do I find the degrees of freedom?
- When do I use a $t$-test rather than a $z$-test?
- My expected frequency is less than 5 — does that matter?
Which hypothesis gets the "equals", $H_0$ or $H_1$?
Do I use the p-value or the critical value to decide?
How do I find the degrees of freedom?
When do I use a $t$-test rather than a $z$-test?
My expected frequency is less than 5 — does that matter?
Your next step



