Two-Sample Tests Examples in Math

Start with the recap, study the fully worked examples, then use the practice problems to check your understanding of Two-Sample Tests.

This page combines explanation, solved examples, and follow-up practice so you can move from recognition to confident problem-solving in Math.

Concept Recap

Hypothesis tests and confidence intervals for comparing parameters (means or proportions) of two independent populations. The two-sample t-test compares means; the two-proportion z-test compares proportions.

You have two separate groupsβ€”say, students taught with Method A vs Method Bβ€”and want to know if there's a real difference. Unlike paired tests where the same subjects appear in both groups, here the groups are completely independent. You compare the two sample statistics and ask: 'Is the gap between these groups larger than what random variation alone would produce?'

Read the full concept explanation β†’

How to Use These Examples

  • Read the first worked example with the solution open so the structure is clear.
  • Try the practice problems before revealing each solution.
  • Use the related concepts and background knowledge badges if you feel stuck.

What to Focus On

Core idea: The test statistic measures the observed difference relative to how much variability you'd expect from sampling alone. Conditions: independent random samples, approximately normal sampling distributions (check sample sizes), and the two samples must be independent of each other.

Common stuck point: Students mix up paired and two-sample designs. Key question: are the observations in the two groups linked (paired) or completely separate (two-sample)?

Worked Examples

Example 1

medium
Test whether two teaching methods differ in effectiveness. Method A (n_A=30, \bar{x}_A=75, s_A=8) vs. Method B (n_B=30, \bar{x}_B=80, s_B=10). Use a two-sample z-test at \alpha=0.05.

Solution

  1. 1
    H_0: \mu_A = \mu_B; H_a: \mu_A \neq \mu_B
  2. 2
    SE of difference: SE = \sqrt{\frac{s_A^2}{n_A} + \frac{s_B^2}{n_B}} = \sqrt{\frac{64}{30} + \frac{100}{30}} = \sqrt{\frac{164}{30}} = \sqrt{5.47} \approx 2.34
  3. 3
    z-statistic: z = \frac{\bar{x}_A - \bar{x}_B}{SE} = \frac{75 - 80}{2.34} = \frac{-5}{2.34} \approx -2.14
  4. 4
    Two-tailed p-value: p = 2 \times P(Z < -2.14) \approx 2(0.016) = 0.032 < 0.05 β†’ Reject H_0

Answer

z = -2.14, p \approx 0.032 < 0.05. Reject H_0. Methods differ significantly.
The two-sample z-test compares means of two independent groups. The SE of the difference combines both groups' variability. With p=0.032, we have statistically significant evidence that Method B outperforms Method A (80 vs 75 average).

Example 2

hard
Construct a 95% confidence interval for \mu_A - \mu_B given: \bar{x}_A=50, \bar{x}_B=45, s_A=6, s_B=8, n_A=n_B=25.

Practice Problems

Try these problems on your own first, then open the solution to compare your method.

Example 1

easy
When should a two-sample t-test be used instead of a z-test, and what is the key assumption about the two groups?

Example 2

hard
Two independent samples: Group 1 (n=20, \bar{x}=100, s=15), Group 2 (n=20, \bar{x}=95, s=20). Calculate the t-statistic and df for a Welch's t-test (unequal variances).

Background Knowledge

These ideas may be useful before you work through the harder examples.

hypothesis testingconfidence intervalsampling distributioncentral limit theorem