SME
Grade 12 Math · Problem type

Two-sample t-test for means

Use this for “Do two groups have different means?” from two independent samples.

Chart

t = 2.1213−2.828402.8284−3−2−10123tDifference x̄₁ − x̄₂ (cm) if H₀ is truereject H₀ (area α)p-value
t curve with df = 35 (solid) over the normal (dashed): nearly the same; t⋆ = 2.03 for 95%, where z⋆ = 1.96.
The curve is centered at μ = 0 with standard error SE = 1.4142 cm.
Red outline: the rejection region, area α = 0.05, past t = −2.0301 and t = 2.0301.
Test statistic t = 2.1213.
Amber: the p-value, 0.0411 < α = 0.05: reject H₀.
This is an example. Type your own values to start a new problem.
d (cm)
=
x̄₁ (cm)
−
x̄₂ (cm)
SE (cm)
=
s₁
2
n₁
+
s₂
2
n₂
t
=
d (cm)
SE (cm)
df
Degrees of freedom
worked out (not typed)
P
p-value
worked out (not typed)
α
Significance level
example

Formulas

d
=
x̄₁
−
x̄₂
3 = 52 − 49
SE
=
√(
s₁
2
n₁
+
s₂
2
n₂
)
1.4142
=
√(
6
2
36
+
6
2
36
)
df
=
min(
n₁
,
n₂
)
−
1
35 = min(36, 36) − 1
t
=
d
SE
2.1213
=
3
1.4142
P
=
2
×
(1
−
tcdf(|
t
|,
df))
0.04105 = 2 × (1 − tcdf(|2.1213|, 35))

Assumptions

•
Two independent random samples, or two groups assigned at random; H₀: μ₁ = μ₂, Hₐ: μ₁ ≠ μ₂.
•
The statistic follows a t curve; by hand, df is the smaller sample size minus 1 (a safe, low choice); a calculator’s 2-SampTTest uses a larger df and a slightly smaller P.
•
With random assignment, a significant difference is evidence the treatment caused it.

Step-by-step

WE KNOW
x̄₁ = 52 cm, s₁ = 6 cm, n₁ = 36, x̄₂ = 49 cm, s₂ = 6 cm, n₂ = 36, α = 0.05
FIND
difference of the means, x̄₁ − x̄₂ (d), standard error of d (SE), degrees of freedom (df), test statistic (t), p-value (P)
Step 1 · Find difference of the means, x̄₁ − x̄₂ (d)
Use d = x̄₁ − x̄₂
The difference the samples show.
d
=
52
−
49
d
=
3
cm
Step 2 · Find standard error of d (SE)
Use SE = √(s₁² ÷ n₁ + s₂² ÷ n₂)
The variances of two independent means add; the root gives the spread of the difference.
SE
=
√(
6
2
36
+
6
2
36
)
SE
=
√(
36
36
+
36
36
)
SE
=
√
1 + 1
SE
=
√
2
SE = 1.4142 cm
Step 3 · Find degrees of freedom (df)
Use df = min(n₁, n₂) − 1
Use one less than the smaller sample: fewer degrees of freedom, a wider curve, a safe p-value.
df
=
n₁
−
1
df = 36 − 1
df = 35
Step 4 · Find test statistic (t)
Use t = d ÷ SE
H₀ says the difference is 0: count how many standard errors it is from 0.
t
=
3
1.4142
t
=
2.1213
Step 5 · Find p-value (P)
Use P = 2 × (1 − tcdf(|t|, df))
Hₐ
says
“not
equal”,
so
both
tails
of
the
t
curve
past
|
t
|
count;
tcdf(
t
,
df)
is
the
area
left
of
t
.
P
=
2
×
(1
−
tcdf(|2.1213|,
35))
P
=
0.04105
→
0.04105
<
α
=
0.05:
reject
H₀
Check
Put the numbers back in. Both sides should match.
3 = 52 − 49 ✓
1.4142
≈
√(
6
2
36
+
6
2
36
)
✓
35 = 36 − 1 ✓
2.1213
≈
3
1.4142
✓
0.04105 = 2 × (1 − tcdf(|2.1213|, 35)) ✓
Topic check
See what you know: 5 questions on this topic
New questions each time. Pass to mark it complete.

Refresh

Related lessons

© 2026 SME. All rights reserved.