01 / 20
\(\bar{x}_1\)
\(\bar{x}_2\)

\(t\)-Test for
Difference of Means

Learn how to test whether two population means are significantly different using the two-sample \(t\)-test: hypotheses, test statistic, and decision rules.

College Statistics

Why Compare Two Means?

In many real-world scenarios we want to know whether two groups differ on some measured outcome. For example: does a new drug lower blood pressure more than a placebo? Do students taught with Method A score higher than those taught with Method B?

Key Terminology

\(\mu_1, \mu_2\)
Population means for Group 1 and Group 2: the true values we want to compare.
\(\bar{x}_1, \bar{x}_2\)
Sample means: our best estimates of the population means from collected data.
\(s_1, s_2\)
Sample standard deviations: measures of spread within each sample.
\(n_1, n_2\)
Sample sizes: how many observations in each group.
SE
Standard error of the difference: quantifies sampling variability of \(\bar{x}_1 - \bar{x}_2\).

Visual Intuition

Difference? Group 1 Group 2
\(\bar{x}_1\)
\(\bar{x}_2\)

Setting Up Hypotheses

$$H_0: \mu_1 - \mu_2 = 0 \quad (\text{no difference})$$
Two-Tailed
\(H_a: \mu_1 - \mu_2 \neq 0\)
Means differ in either direction.
Left-Tailed
\(H_a: \mu_1 - \mu_2 < 0\)
Group 1 mean is less.
Right-Tailed
\(H_a: \mu_1 - \mu_2 > 0\)
Group 1 mean is greater.

The Test Statistic

$$t = \frac{(\bar{x}_1 - \bar{x}_2) - (\mu_1 - \mu_2)_0}{\sqrt{\dfrac{s_1^2}{n_1} + \dfrac{s_2^2}{n_2}}}$$

Degrees of Freedom

For the Welch's \(t\)-test (which does not assume equal variances), the degrees of freedom are approximated by the Welch-Satterthwaite formula:

$$df = \frac{\left(\dfrac{s_1^2}{n_1} + \dfrac{s_2^2}{n_2}\right)^2}{\dfrac{\left(\dfrac{s_1^2}{n_1}\right)^2}{n_1 - 1} + \dfrac{\left(\dfrac{s_2^2}{n_2}\right)^2}{n_2 - 1}}$$

Required Conditions

1
Random Samples: Both samples must be independently and randomly selected from their respective populations.
2
Independence: The two samples must be independent of each other (no pairing or matching between observations).
3
Normality / Large Samples: Either both populations are approximately normal, or both sample sizes are large (\(n_1 \ge 30\) and \(n_2 \ge 30\)) so the CLT applies.
4
10% Rule: Each sample should be less than 10% of its population to ensure independence of observations within a sample.

Pooled vs Welch's \(t\)-Test

Pooled \(t\)-Test Welch's \(t\)-Test
Variance Assumption \(\sigma_1^2 = \sigma_2^2\) No assumption needed
SE Denominator Uses pooled \(s_p^2\) Uses \(\frac{s_1^2}{n_1} + \frac{s_2^2}{n_2}\)
Degrees of Freedom \(n_1 + n_2 - 2\) Welch-Satterthwaite (smaller)
When to Use Equal variances confirmed Default choice (safer)

How to Apply the Test

1
State hypotheses: Write \(H_0: \mu_1 - \mu_2 = 0\) and choose \(H_a\) (two-tailed, left, or right).
2
Check conditions: Verify random, independent, normal/large, and 10% conditions.
3
Compute the test statistic: Calculate \(t = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{s_1^2/n_1 + s_2^2/n_2}}\).
4
Find the p-value: Use the \(t\)-distribution with the appropriate df.
5
Make a decision: If \(p\text{-value} < \alpha\), reject \(H_0\). State your conclusion in context.

Example 1: Study Hours

A professor wants to know if students in the morning section study more hours per week than students in the evening section.

Morning Section
\(n_1 = 35\), \(\bar{x}_1 = 14.2\) hrs, \(s_1 = 3.8\)
Evening Section
\(n_2 = 40\), \(\bar{x}_2 = 12.5\) hrs, \(s_2 = 4.1\)

Example 1: Solution

1
Compute SE: \(\text{SE} = \sqrt{\frac{3.8^2}{35} + \frac{4.1^2}{40}} = \sqrt{\frac{14.44}{35} + \frac{16.81}{40}} = \sqrt{0.4126 + 0.4203} = \sqrt{0.8329} \approx 0.913\)
2
Compute \(t\): \(t = \frac{14.2 - 12.5}{0.913} = \frac{1.7}{0.913} \approx 1.862\)
3
df \(\approx 72\) (via Welch-Satterthwaite). For a right-tailed test: \(p\text{-value} \approx 0.033\)

Example 2: Drug Trial

A clinical trial tests whether a new medication reduces systolic blood pressure more than a placebo.

Treatment Group
\(n_1 = 50\), \(\bar{x}_1 = -8.3\) mmHg, \(s_1 = 5.2\)
Placebo Group
\(n_2 = 50\), \(\bar{x}_2 = -3.1\) mmHg, \(s_2 = 6.0\)

Example 2: Solution

1
SE: \(\sqrt{\frac{5.2^2}{50} + \frac{6.0^2}{50}} = \sqrt{0.5408 + 0.72} = \sqrt{1.2608} \approx 1.123\)
2
\(t\): \(\frac{-8.3 - (-3.1)}{1.123} = \frac{-5.2}{1.123} \approx -4.630\)
3
df \(\approx 95\). Left-tailed \(p\text{-value} < 0.0001\).

Visualizing the Decision

\(t = 0\)
\(t_{\text{crit}}\)
Reject \(H_0\)
Fail to reject \(H_0\)
\(t_{\text{obs}}\)
Right-Tailed Test Decision Region

Common Mistakes

✕ Using Paired Test
The two-sample \(t\)-test requires independent groups. If subjects are matched or measured twice, use a paired \(t\)-test instead.
✕ Wrong Tail Direction
If \(H_a: \mu_1 < \mu_2\), you need a left-tailed p-value. Using the wrong tail doubles or halves the p-value and changes your conclusion.
✕ Ignoring Conditions
Skipping the normality/large-sample check or the independence assumption makes the test invalid. Always verify conditions first.

Question 1 of 5

What does the null hypothesis \(H_0\) state in a two-sample \(t\)-test for difference of means?

Question 2 of 5

Given \(\bar{x}_1 = 20\), \(\bar{x}_2 = 17\), \(s_1 = 4\), \(s_2 = 5\), \(n_1 = 25\), \(n_2 = 25\), what is the test statistic \(t\)?

Question 3 of 5

A researcher obtains \(t = 2.15\) with \(df = 48\) on a two-tailed test at \(\alpha = 0.05\). The critical value is \(t_{0.025} \approx 2.01\). What is the correct conclusion?

Question 4 of 5

Which condition is not required for the two-sample \(t\)-test?

Question 5 of 5

If both sample sizes are doubled (from \(n\) to \(2n\)) while all other values stay the same, what happens to the standard error?