Chi-Square Goodness of Fit

April 12, 2026

Problem

Are dice rolls {18, 22, 16, 20, 24, 20} consistent with fair dice? Show observed vs expected.

Explanation

The chi-square test

Tests whether observed frequencies match expected frequencies.

χ2=(OiEi)2Ei\chi^2 = \sum \frac{(O_i - E_i)^2}{E_i}

Step-by-step

Observed: {18, 22, 16, 20, 24, 20}. Total = 120. If fair: Expected = 20 each.

Step 1 — Compute χ2\chi^2:

χ2=(1820)220+(2220)220+(1620)220+020+(2420)220+020\chi^2 = \frac{(18-20)^2}{20} + \frac{(22-20)^2}{20} + \frac{(16-20)^2}{20} + \frac{0}{20} + \frac{(24-20)^2}{20} + \frac{0}{20}

=0.2+0.2+0.8+0+0.8+0=2.0= 0.2 + 0.2 + 0.8 + 0 + 0.8 + 0 = 2.0

Step 2 — Degrees of freedom: df=61=5df = 6 - 1 = 5.

Step 3 — Critical value at α=0.05\alpha = 0.05: χcrit2=11.07\chi^2_{\text{crit}} = 11.07.

Step 4 — Decision: χ2=2.0<11.07\chi^2 = 2.0 < 11.07. Fail to reject H0H_0. No evidence the die is unfair.

Try it in the visualization

Bar chart shows observed vs expected side by side. The chi-square value and p-value update as you change observed counts.

Interactive Visualization

Parameters

18.00
22.00
16.00
20.00
24.00
20.00
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
Chi-Square Goodness of Fit | MathSpin