Two-Sample Z-Test Statistic

z=xˉ1−xˉ2σ12n1+σ22n2z = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\dfrac{\sigma_1^{2}}{n_1} + \dfrac{\sigma_2^{2}}{n_2}}}

Worked example: means 82 vs 76, sigma 10 each, n 25 and 20 → z = 2 — press Try an example to run it live, then adjust anything.

Enter your known values, leave one input blank, and solves for the missing one. Tap a variable’s symbol to see what it means, with a typical value. Try different units for next level excitement!

Learning zone

Two-Sample Z-Test Statistic explained

zx̄1x̄2σ1σ2

To compare two independent groups you need the standard error of the difference, and variances of independent quantities add: σ₁²/n₁ + σ₂²/n₂. Take the square root, divide the gap between the means by it, and you have a z that is read against the normal table exactly like a one-sample test. Two production lines averaging 82 and 76 with σ = 10 each and samples of 25 and 20 give a standard error of √(4 + 5) = 3, so z = 6/3 = 2.0 — just past the two-sided 5% cutoff.

The mistake to avoid is averaging the two standard errors, or worse, comparing each group's confidence interval and concluding "they overlap, so no difference". Overlapping intervals frequently hide a significant difference, because the error on the gap is smaller than the sum of the individual errors. Note also that the smaller group dominates the denominator: with n₁ = 25 and n₂ = 20 above, shrinking group 2 to 5 observations would push the standard error from 3 to 4.9 and kill the result outright, no matter how large group 1 grew. Balance your groups when you can.

Two-Sample Z-Test Statistic formula

z=xˉ1−xˉ2σ12n1+σ22n2z = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{\dfrac{\sigma_1^{2}}{n_1} + \dfrac{\sigma_2^{2}}{n_2}}}
Where
  • zz= Test statistic
  • xˉ1\bar{x}_1= Mean of sample 1
  • xˉ2\bar{x}_2= Mean of sample 2
  • σ1\sigma_1= Standard deviation 1
  • n1n_1= Size of sample 1
  • σ2\sigma_2= Standard deviation 2
  • n2n_2= Size of sample 2