Hypothesis Testing: The p-value

April 12, 2026

Problem

A coin is flipped 100 times and lands heads 60 times. Is it fair? Compute the p-value and show the rejection region.

Explanation

What is hypothesis testing?

Hypothesis testing asks: "Is the observed result significantly different from what we'd expect by chance?" We set up a null hypothesis (the default assumption), compute how unlikely our data would be under that assumption, and decide whether to reject it.

Step-by-step: Is this coin fair?

Step 1 — State the hypotheses.

H0H_0: p=0.5p = 0.5 (the coin is fair — null hypothesis).

HaH_a: p0.5p \neq 0.5 (the coin is biased — alternative hypothesis).

Step 2 — Collect data. 100 flips, 60 heads. p^=60/100=0.60\hat{p} = 60/100 = 0.60.

Step 3 — Compute the test statistic. Under H0H_0, p^\hat{p} has mean p0=0.5p_0 = 0.5 and standard error p0(1p0)/n\sqrt{p_0(1-p_0)/n}:

z=p^p0p0(1p0)/n=0.600.500.25/100=0.100.05=2.0z = \frac{\hat{p} - p_0}{\sqrt{p_0(1-p_0)/n}} = \frac{0.60 - 0.50}{\sqrt{0.25/100}} = \frac{0.10}{0.05} = 2.0

Step 4 — Find the p-value. This is the probability of observing a test statistic as extreme as z=2.0|z| = 2.0 under H0H_0 (two-tailed):

p-value=P(Z>2.0)=2×P(Z>2.0)=2×0.0228=0.0456p\text{-value} = P(|Z| > 2.0) = 2 \times P(Z > 2.0) = 2 \times 0.0228 = 0.0456

Step 5 — Compare to significance level α=0.05\alpha = 0.05.

p-value=0.0456<0.05=αp\text{-value} = 0.0456 < 0.05 = \alpha

Decision: Reject H0H_0. There is statistically significant evidence that the coin is biased.

What the p-value means

The p-value is the probability of seeing results at least as extreme as ours, assuming the null hypothesis is true. A small p-value (<α< \alpha) means the data is unlikely under H0H_0 — evidence against it.

  • p-value < 0.05: "statistically significant" (reject H0H_0)
  • p-value ≥ 0.05: "not significant" (fail to reject H0H_0 — this does NOT prove H0H_0 is true)

Try it in the visualization

Adjust the number of flips and heads. The normal curve shows the test statistic, rejection region (red shading), and p-value. When p < α, the decision flips to "reject."

Interactive Visualization

Parameters

100.00
60.00
0.05
Two-tailed
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
Hypothesis Testing: The p-value | MathSpin