Confidence Interval for Difference of Two Means (Z-Distribution)

Use this calculator to estimate the confidence interval for the difference between two population means when both population standard deviations are known (rare but theoretically important).

When to Use This Calculator

  • Two independent samples from two different populations
  • Both population standard deviations (σ) are known (rarely true in practice)
  • Large sample sizes (typically n₁, n₂ ≥ 30, or normal populations assumed)
  • Comparing average values between two groups (e.g., product A vs product B)
  • Want to know if one mean is likely higher/lower than the other

Note: In practice, use the t-distribution version instead (when σ is unknown), which is more common.

How to Use This Calculator

Step 1: Enter Sample 1 mean and sample size

Step 2: Enter Sample 2 mean and sample size

Step 3: Enter both population standard deviations (σ₁ and σ₂)

Step 4: Select the confidence level (typically 95%)

Step 5: Click “Calculate”

Step 6: Results show:

  • Standard Error of difference
  • Z-critical value
  • Margin of Error
  • Lower and Upper Confidence Limits for the difference
Confidence Interval Calculator for Difference of means
  Sample 1 Sample 2
Sample Mean
Sample Size
Population Standard Deviation
Confidence Level ($1-\alpha$)
Results
Standard Error of Diff. of Means:
Z-critical value: ($Z_{\alpha/2}$)
Margin of Error: ($E$)
Lower Confidence Limits:
Upper Confidence Limits:

Theory & Formula

The $100(1-\alpha)%$ confidence interval for difference of two means (σ₁, σ₂ known) is:

$$CI = (\overline{x}_1 - \overline{x}2) \pm z{\alpha/2} \times \sqrt{\frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2}}$$

Where:

  • $\overline{x}_1, \overline{x}_2$ = sample means
  • $\sigma_1, \sigma_2$ = known population standard deviations
  • $n_1, n_2$ = sample sizes
  • $z_{\alpha/2}$ = z-critical value

Standard Error: $SE = \sqrt{\frac{\sigma_1^2}{n_1} + \frac{\sigma_2^2}{n_2}}$


Assumptions

  1. Two independent samples - no relationship between observations
  2. Population SDs are known - σ₁ and σ₂ are known (rare)
  3. Large samples OR normal populations - n₁, n₂ ≥ 30 or populations approximately normal
  4. Random samples - data collected without bias

Worked Example

Scenario: Comparing average salary between two departments. Department 1: n₁=50, mean=$52,000, σ₁=$5,000. Department 2: n₂=45, mean=$48,000, σ₂=$4,500.

Solution:

  • $SE = \sqrt{\frac{5000^2}{50} + \frac{4500^2}{45}} = \sqrt{500000 + 450000} = 976.24$
  • For 95% CI: $z_{0.025} = 1.96$
  • $E = 1.96 \times 976.24 = 1,913$
  • $CI = (52000 - 48000) \pm 1913 = 4000 \pm 1913 = [2,087, 5,913]$

Interpretation: We’re 95% confident that Department 1’s mean salary is between $2,087 and $5,913 higher than Department 2.


Key Differences: Z vs T for Two Means

Feature Z-Distribution (σ known) T-Distribution (σ unknown)
When to Use Both σ known (rare) Both σ unknown (typical)
Critical Values Smaller Larger (wider CI)
Intervals Narrower Wider
Real-world Almost never used Standard choice

Recommendation: Use t-distribution version for real data.


Tutorial: CI for Two Means T-Distribution Version: CI for Two Means (T-Distribution)