Two-Sample Tests Formula

Two-sample tests are hypothesis tests and confidence intervals for comparing parameters (means or proportions) of two independent populations.

The Formula

t=(xˉ1−xˉ2)−(μ1−μ2)0s12n1+s22n2

Ask yourself: Are the two groups made of different, unrelated subjects with no natural pairing between them?

Quick example

Method A: xˉ1=78, s1=10, n1=35. Method B: xˉ2=84, s2=12, n2=40. t=(84−78)−010235+12240=62.857+3.6=62.54≈2.36 With appropriate df, this gives evidence of a difference.

Notation

For proportions: z=(p^1−p^2)−0p^(1−p^)(1n1+1n2) where p^ is the pooled proportion.

What this formula means

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.

Comparing two independent groups is like judging two archers by their arrows. Each archer's arrows cluster around a different spot. Whether the archers really aim at different spots depends on how scattered each one's arrows are and how many arrows you have seen. A tight cluster or many arrows makes a small gap convincing.

Formal view

t=(xˉ1−xˉ2)−(μ1−μ2)0s12n1+s22n2 with df from Welch's approximation

Worked examples

Example 1

medium
Test whether two teaching methods differ in effectiveness. Method A (nA=30, xˉA=75, sA=8) vs. Method B (nB=30, xˉB=80, sB=10). Use a two-sample z-test at α=0.05.
Show solution

Answer

z=−2.14, p≈0.032<0.05. Reject H0. Methods differ significantly.

First step

1.
H0:μA=μB; Ha:μA≠μB

See the full worked solution + why-it-works coaching

SetupKey insightWhy it worksCommon pitfallConnection

Free: full solutions on 3 topics a day. No card.

Every topic, every day: the Family plan

Example 2

hard
Construct a 95% confidence interval for μA−μB given: xˉA=50, xˉB=45, sA=6, sB=8, nA=nB=25.

Example 3

medium
Compute the standard error of xˉ1−xˉ2 given s1=5,n1=25,s2=4,n2=16.

Common mistakes

  • Running a two-sample test on paired data - if subjects are matched, use the paired t-test on differences instead.
  • Using a single pooled standard deviation by default - the two-sample t-test typically uses s12/n1+s22/n2 with separate variances.
  • Choosing a t-test for proportion data - compare proportions with the two-proportion z-test, not the t-test for means.

Why this formula matters

Most comparisons in science and business are between two independent groups: patients on a drug versus a placebo, customers who saw ad A versus ad B. A two-sample test turns 'group A scored 4 points higher' into a judgment about whether 4 points means anything, given how much each group varies. The wrong test, such as a t-test on yes/no data or an independent test on paired data, gives the wrong standard error and so the wrong conclusion.

Frequently asked questions

What is the Two-Sample Tests formula?

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.

How do you use the Two-Sample Tests formula?

Use a two-sample test when there are two independent groups of different subjects, such as treatment and control, or version A and version B, and the question asks whether their means or proportions differ. Choose the t-test for averages of measurements and the two-proportion z-test for yes/no rates. If the same subjects are measured twice or matched one-to-one, use the paired t-test; for counts spread over more than two categories, use a chi-square test.

What do the symbols mean in the Two-Sample Tests formula?

For proportions: z=(p^1−p^2)−0p^(1−p^)(1n1+1n2) where p^ is the pooled proportion.

Why is the Two-Sample Tests formula important in Math?

Most comparisons in science and business are between two independent groups: patients on a drug versus a placebo, customers who saw ad A versus ad B. A two-sample test turns 'group A scored 4 points higher' into a judgment about whether 4 points means anything, given how much each group varies. The wrong test, such as a t-test on yes/no data or an independent test on paired data, gives the wrong standard error and so the wrong conclusion.

What do students get wrong about Two-Sample Tests?

The procedure for two-sample tests is the easy part; the trap is running a two-sample test on paired data. Asking "Are the two groups made of different, unrelated subjects with no natural pairing between them?" first is what keeps a correct-looking calculation from being attached to the wrong concept.

What should I learn before the Two-Sample Tests formula?

Before studying the Two-Sample Tests formula, you should understand: hypothesis testing, confidence interval, sampling distribution, central limit theorem.