SME
Grade 12 Math · Statistics

Chi-square tests for goodness of fit and independence

Use this for “A cross should give red, pink and white flowers in the ratio 1:2:1. Do the counts fit?”

Chart

X² = 0.72012345678910χ²reject H₀ (area α)p-value
Chi-square curve with df = 2.
Critical value at α = 0.05: χ² = 5.9915.
X² = 0.72: p = P(χ² ≥ 0.72) = 0.6977 ≥ α = 0.05: fail to reject H₀.
This is an example. Type your own values to start a new problem.
O₁
Red flowers counted
example
O₂
Pink flowers counted
example
O₃
White flowers counted
example
p₁
Expected share of red
example
p₂
Expected share of pink
example
p₃
Expected share of white
worked out (not typed)
n
Flowers in all
worked out (not typed)
X²
Chi-square statistic
worked out (not typed)
P
p-value
worked out (not typed)
α
Significance level
example

Formulas

p₃
=
1
−
p₁
−
p₂
0.25 = 1 − 0.25 − 0.5
n
=
O₁
+
O₂
+
O₃
100 = 22 + 54 + 24
X
2
=
(
O₁
−
n
×
p₁
)
2
÷
(
n
×
p₁
)
+
(
O₂
−
n
×
p₂
)
2
÷
(
n
×
p₂
)
+
(
O₃
−
n
×
p₃
)
2
÷
(
n
×
p₃
)
0.72
=
(22 − 100 × 0.25)
2
÷
(100
×
0.25)
+
(54 − 100 × 0.5)
2
÷
(100
×
0.5)
+
(24 − 100 × 0.25)
2
÷
(100
×
0.25)
P
=
χ
2
cdf(
X
2
,
∞,
2)
0.6977
=
χ
2
cdf(0.72,
∞,
2)

Assumptions

•
Use counts, not percents; every expected count n × p should be at least 5.
•
H₀: the shares are p₁, p₂ and p₃; df = categories − 1 = 2.
•
A large X² (a small p-value) means the counts don’t fit the shares.

Step-by-step

WE KNOW
O₁ = 22, O₂ = 54, O₃ = 24, p₁ = 0.25, p₂ = 0.5, α = 0.05
FIND
expected share of white (p₃), flowers in all (n), chi-square statistic (X²), p-value (P)
Step 1 · Find expected share of white (p₃)
Use p₃ = 1 − p₁ − p₂
The three shares make up the whole, 1.
p₃
=
1
−
0.25
−
0.5
p₃
=
0.25
Step 2 · Find flowers in all (n)
Use n = O₁ + O₂ + O₃
Add the counts for the size of the sample.
n
=
22
+
54
+
24
n
=
100
Step 3 · Find chi-square statistic (X²)
Use X² = (O₁ − n × p₁)² ÷ (n × p₁) + (O₂ − n × p₂)² ÷ (n × p₂) + (O₃ − n × p₃)² ÷ (n × p₃)
The
expected
counts
are
E
=
n
×
p:
25,
50,
25.
Add
(O − E)
2
÷
E
over
the
three
categories.
X
2
=
(22 − 100 × 0.25)
2
÷
(100
×
0.25)
+
(54 − 100 × 0.5)
2
÷
(100
×
0.5)
+
(24 − 100 × 0.25)
2
÷
(100
×
0.25)
X
2
=
(22 − 25)
2
÷
25
+
(54 − 50)
2
÷
50
+
(24 − 25)
2
÷
25
X
2
=
9
25
+
16
50
+
1
25
X
2
=
0.36
+
0.32
+
0.04
X
2
=
0.72
Step 4 · Find p-value (P)
Use P = χ²cdf(X², ∞, 2)
The area under the chi-square curve with df 2 past the statistic.
P
=
χ
2
cdf(0.72,
∞,
2)
P
=
0.6977
→
0.6977
≥
α
=
0.05:
fail
to
reject
H₀
Check
Put the numbers back in. Both sides should match.
0.25 = 1 − 0.25 − 0.5 ✓
100 = 22 + 54 + 24 ✓
0.72
=
(22 − 100 × 0.25)
2
÷
(100
×
0.25)
+
(54 − 100 × 0.5)
2
÷
(100
×
0.5)
+
(24 − 100 × 0.25)
2
÷
(100
×
0.25)
✓
0.6977
=
χ
2
cdf(0.72,
∞,
2)
✓
Topic check
See what you know: 5 questions on this topic
New questions each time. Pass to mark it complete.

Refresh

More problem types

© 2026 SME. All rights reserved.