Mathwords logoMathwords

Two-Sample z-Interval — Definition, Formula & Example

A two-sample z-interval is a range of plausible values for the difference between two population parameters, built from two independent samples. In AP Statistics it almost always means the two-proportion z-interval, which estimates p1−p2p_1 - p_2.

Given independent random samples of sizes n1n_1 and n2n_2 with sample proportions p^1\hat{p}_1 and p^2\hat{p}_2, a level-CC two-proportion z-interval for p1−p2p_1 - p_2 is (p^1−p^2)±z∗⋅SE(\hat{p}_1 - \hat{p}_2) \pm z^* \cdot SE. Here z∗z^* is the standard normal critical value with central area CC, and SESE uses the unpooled sample proportions. It requires the Random condition, the 10% condition for each sample, and the Large Counts condition: n1p^1n_1\hat{p}_1, n1(1−p^1)n_1(1-\hat{p}_1), n2p^2n_2\hat{p}_2, and n2(1−p^2)n_2(1-\hat{p}_2) must each be at least 10. A two-sample z-interval for μ1−μ2\mu_1 - \mu_2 also exists, but it needs both population standard deviations to be known. That rarely happens, so a two-sample t-interval is used for means instead.

Key Formula

(p^1−p^2)±z∗p^1(1−p^1)n1+p^2(1−p^2)n2(\hat{p}_1 - \hat{p}_2) \pm z^* \sqrt{\frac{\hat{p}_1(1-\hat{p}_1)}{n_1} + \frac{\hat{p}_2(1-\hat{p}_2)}{n_2}}
Where:
  • p^1,p^2\hat{p}_1, \hat{p}_2 = sample proportions of successes in samples 1 and 2
  • n1,n2n_1, n_2 = sample sizes
  • z∗z^* = critical value for the confidence level (1.96 for 95%)

Worked Example

Problem: In a random sample of 200 students at School A, 120 support a later start time. In an independent random sample of 200 students at School B, 100 support it. Construct a 95% confidence interval for pA−pBp_A - p_B. Assume each school has more than 2,000 students.
Step 1: Find the sample proportions and check conditions. The samples are random and independent. Each sample is less than 10% of its school. The counts are 120, 80, 100, and 100, which are all at least 10.
p^A=120200=0.60,p^B=100200=0.50\hat{p}_A = \frac{120}{200} = 0.60, \quad \hat{p}_B = \frac{100}{200} = 0.50
Step 2: Compute the standard error.
SE=0.60(0.40)200+0.50(0.50)200=0.00245≈0.0495SE = \sqrt{\frac{0.60(0.40)}{200} + \frac{0.50(0.50)}{200}} = \sqrt{0.00245} \approx 0.0495
Step 3: Compute the margin of error, then build the interval around 0.60−0.50=0.100.60 - 0.50 = 0.10. Keep the unrounded standard error in this step.
ME=1.96(0.0495)≈0.0970,0.10±0.0970⇒(0.0030, 0.1970)ME = 1.96(0.0495) \approx 0.0970, \quad 0.10 \pm 0.0970 \Rightarrow (0.0030,\ 0.1970)
Answer: We are 95% confident that the true proportion of students who support a later start is between 0.0030 and 0.1970 higher at School A than at School B. Every value in the interval is positive, so the data give convincing evidence that support is higher at School A.

Why It Matters

On the AP Statistics exam, free-response questions often ask you to compare two groups, such as treatment versus control or two regions. A full-credit answer must name the procedure, check all three conditions, and interpret the interval in context. Medical trials and A/B tests on websites use this exact calculation to estimate how much one option outperforms another.

Common Mistakes

Mistake: Using the pooled proportion p^c=x1+x2n1+n2\hat{p}_c = \frac{x_1 + x_2}{n_1 + n_2} in the standard error.
Correction: Pooling belongs to the two-proportion z-test, which assumes p1=p2p_1 = p_2. An interval makes no such assumption, so use each sample's own p^\hat{p} in the standard error.

Related Terms