Margin of error and sample size practice problems

By Jude Wallis · Updated

These eight problems run the margin of error formula both directions: forward from a critical value and standard error to a margin, and backward from a target margin to the sample size you need. Every sample size rounds up unless it lands exactly on a whole number.

AP Statistics: Unit 3 (topics 3.3 Constructing a Confidence Interval for a Population Proportion, 3.4 Justifying a Claim Based on a Confidence Interval for a Population Proportion). Topic 3.3 in the Fall 2026 course asks you to calculate the margin of error and estimate a sample size from it, topic 3.4 covers how sample size and confidence level change the interval width, and the sample size formula for a mean in problem 7 is standard college content that the AP course does not cover.

What these problems build

These eight problems work the margin of error formula in both directions. Forward, you take a critical value (z-star, written zz^*) and a standard error and produce the margin of error. Backward, you name the margin of error you want and solve for the sample size that delivers it:

n=(zME)2p(1p)n = \left(\frac{z^*}{ME}\right)^2 p^*(1 - p^*)

Two rules do most of the work. A sample size always rounds up to the next whole person or unit, because rounding down leaves the margin of error above your target. And when you have no prior estimate of the proportion, you use the conservative planning value (p-star, written pp^*) p=0.5p^* = 0.5, which maximizes p(1p)p^*(1 - p^*) at 0.25 and so gives the largest sample any true proportion could demand.

For the interval machinery behind all of this, read how to calculate a confidence interval. Check your margins against the margin of error calculator and your sample sizes against the sample size calculator. The matching AP topic page is 3.3 Constructing a Confidence Interval for a Population Proportion.

Use the standard critical values 1.645, 1.96, and 2.576, keep the standard error to at least four decimals until the last step, and round every sample size up unless it lands exactly on a whole number. When the arithmetic is solid, move on to interpreting confidence intervals, where the answers are sentences.

Problem 1

A streaming service surveys a random sample of 400 subscribers and finds that 320 finished the new season within a week. Treat the sample as under 10% of all subscribers. Find the margin of error for a 95% confidence interval for the true proportion who finish within a week, then write the interval.

Show the worked solution
  1. Sample proportion (p-hat, written p^\hat{p}): p^=320400=0.8\hat{p} = \frac{320}{400} = 0.8.

  2. Check the large counts condition: np^=400(0.8)=32010n\hat{p} = 400(0.8) = 320 \geq 10 and n(1p^)=400(0.2)=8010n(1 - \hat{p}) = 400(0.2) = 80 \geq 10.

  3. Standard error (the typical sample-to-sample spread of p^\hat{p}): SE=p^(1p^)n=0.8(0.2)400=0.16400=0.0004=0.02SE = \sqrt{\frac{\hat{p}(1 - \hat{p})}{n}} = \sqrt{\frac{0.8(0.2)}{400}} = \sqrt{\frac{0.16}{400}} = \sqrt{0.0004} = 0.02.

  4. Critical value for 95% confidence: z=1.96z^* = 1.96.

  5. Margin of error: ME=zSE=1.96×0.02=0.0392ME = z^* \cdot SE = 1.96 \times 0.02 = 0.0392.

  6. Interval: 0.8±0.0392=(0.7608, 0.8392)0.8 \pm 0.0392 = (0.7608,\ 0.8392).

The margin of error is 0.0392, about 3.9 percentage points, and the 95% interval is (0.761, 0.839)(0.761,\ 0.839).

Problem 2

A polling firm wants a 95% confidence interval for the proportion of registered voters who plan to vote in a local election. The margin of error must be no more than 0.03 (3 percentage points), and the firm has no prior estimate of the proportion. How many voters must it survey?

Show the worked solution
  1. With no prior estimate, use the conservative planning value p=0.5p^* = 0.5, so p(1p)=0.5(0.5)=0.25p^*(1 - p^*) = 0.5(0.5) = 0.25.

  2. Rearranging ME=zp(1p)nME = z^*\sqrt{\frac{p^*(1 - p^*)}{n}} for nn gives $n=(zME)2p(1p)n = \left(\frac{z^*}{ME}\right)^2 p^*(1 - p^*)$

  3. For 95% confidence z=1.96z^* = 1.96, and the target is ME=0.03ME = 0.03.

  4. The quotient 1.960.03=65.3333\frac{1.96}{0.03} = 65.3333 repeats, so square the ratio as a fraction instead of squaring a rounded decimal: (1.960.03)2=1.9620.032=3.84160.0009=4268.4444\left(\frac{1.96}{0.03}\right)^2 = \frac{1.96^2}{0.03^2} = \frac{3.8416}{0.0009} = 4268.4444.

  5. Multiply by 0.25: 4268.4444×0.25=1067.11114268.4444 \times 0.25 = 1067.1111.

  6. Round up, never down. A sample of 1067 would leave the margin of error a hair above 0.03, so the answer is 1068.

The firm needs 1068 voters. This is the calculation behind national polls that report about 3 points of margin from a sample near 1,000.

Problem 3

A campus dining service ran a pilot survey last year and found that about 40% of students bought lunch on campus at least three days a week. It now wants a 95% confidence interval with a margin of error of 0.05. Using the pilot result as the planning value, how many students should it survey?

Show the worked solution
  1. Use the pilot result as the planning value: p=0.40p^* = 0.40, so p(1p)=0.40×0.60=0.24p^*(1 - p^*) = 0.40 \times 0.60 = 0.24.

  2. Apply n=(zME)2p(1p)n = \left(\frac{z^*}{ME}\right)^2 p^*(1 - p^*) with z=1.96z^* = 1.96 and ME=0.05ME = 0.05.

  3. Divide: 1.960.05=39.2\frac{1.96}{0.05} = 39.2.

  4. Square: (39.2)2=1536.64(39.2)^2 = 1536.64.

  5. Multiply by 0.24: 1536.64×0.24=368.79361536.64 \times 0.24 = 368.7936.

  6. Round up: 369 students.

They should survey 369 students. A trustworthy prior estimate lets you get by with a smaller sample than the conservative p=0.5p^* = 0.5 would require.

Problem 4

A city wants a 90% confidence interval for the proportion of households that compost, with a margin of error of 0.04.

(a) The city has no prior data. Find the required sample size. (b) A neighboring city with similar demographics found 20% composting. Using p=0.20p^* = 0.20, find the required sample size. (c) Explain why the answer in (a) is the larger one, and why that makes p=0.5p^* = 0.5 the safe default.

Show the worked solution
  1. For 90% confidence, z=1.645z^* = 1.645, and ME=0.04ME = 0.04, so 1.6450.04=41.125\frac{1.645}{0.04} = 41.125.

  2. Square it once and reuse it: (41.125)2=1691.265625(41.125)^2 = 1691.265625.

  3. (a) With no prior data use p=0.5p^* = 0.5, giving p(1p)=0.25p^*(1 - p^*) = 0.25: 1691.265625×0.25=422.81641691.265625 \times 0.25 = 422.8164. Round up to 423 households.

  4. (b) With p=0.20p^* = 0.20, p(1p)=0.20×0.80=0.16p^*(1 - p^*) = 0.20 \times 0.80 = 0.16: 1691.265625×0.16=270.60251691.265625 \times 0.16 = 270.6025. Round up to 271 households.

  5. (c) The only factor that changed is p(1p)p^*(1 - p^*). As a function of pp^* that product is a downward-opening parabola peaking at p=0.5p^* = 0.5, where it equals 0.25. Every other planning value gives a smaller product and therefore a smaller nn.

  6. So p=0.5p^* = 0.5 returns the largest sample size any true proportion could demand. If your planning value is wrong, a sample built on p=0.5p^* = 0.5 still meets the target margin of error, while one built on p=0.20p^* = 0.20 may fall short.

(a) 423 households. (b) 271 households. (c) p(1p)p^*(1 - p^*) peaks at 0.25 when p=0.5p^* = 0.5, so that choice gives the largest and therefore safest sample size.

Problem 5

A transit agency surveyed a random sample of 500 riders and reported a 95% margin of error of about 0.044 for the proportion who ride daily, based on p^=0.50\hat{p} = 0.50.

(a) Verify that margin of error. (b) The agency wants to cut the margin of error in half. How many riders does it need? (c) How many would it need to cut the original margin of error to one third?

Show the worked solution
  1. (a) SE=0.50(0.50)500=0.25500=0.0005=0.022361SE = \sqrt{\frac{0.50(0.50)}{500}} = \sqrt{\frac{0.25}{500}} = \sqrt{0.0005} = 0.022361.

  2. ME=1.96×0.022361=0.04383ME = 1.96 \times 0.022361 = 0.04383, which rounds to 0.044.

  3. Hold zz^* and the planning proportion fixed. Then ME=zp(1p)nME = z^*\sqrt{\frac{p^*(1 - p^*)}{n}} is proportional to 1n\frac{1}{\sqrt{n}}, so nn is proportional to 1ME2\frac{1}{ME^2}.

  4. (b) Dividing the margin of error by 2 multiplies nn by 22=42^2 = 4: n=4×500=2000n = 4 \times 500 = 2000 riders.

  5. Check it: SE=0.252000=0.000125=0.011180SE = \sqrt{\frac{0.25}{2000}} = \sqrt{0.000125} = 0.011180, and 1.96×0.011180=0.021911.96 \times 0.011180 = 0.02191, half the original margin of error.

  6. (c) Dividing the margin of error by 3 multiplies nn by 32=93^2 = 9: n=9×500=4500n = 9 \times 500 = 4500 riders.

  7. Check it: SE=0.254500=0.0000555556=0.0074536SE = \sqrt{\frac{0.25}{4500}} = \sqrt{0.0000555556} = 0.0074536, and 1.96×0.0074536=0.014611.96 \times 0.0074536 = 0.01461, one third of 0.04383.

(a) About 0.044. (b) 2000 riders. (c) 4500 riders. Precision costs you the square: halving the margin of error takes four times the data, and cutting it to a third takes nine times.

Problem 6

A logistics team samples 2500 packages and finds p^=0.50\hat{p} = 0.50 arriving on time.

(a) Find the margin of error at 90%, 95%, and 99% confidence. (b) The team is now planning a fresh study and wants a margin of error of 0.02 using p=0.5p^* = 0.5. Find the required sample size at each of those three confidence levels. (c) State the trade-off in one sentence.

Show the worked solution
  1. (a) SE=0.50(0.50)2500=0.252500=0.0001=0.01SE = \sqrt{\frac{0.50(0.50)}{2500}} = \sqrt{\frac{0.25}{2500}} = \sqrt{0.0001} = 0.01. The standard error does not depend on the confidence level, so it is the same for all three.

  2. At 90%, z=1.645z^* = 1.645 and ME=1.645×0.01=0.01645ME = 1.645 \times 0.01 = 0.01645. At 95%, z=1.96z^* = 1.96 and ME=1.96×0.01=0.0196ME = 1.96 \times 0.01 = 0.0196. At 99%, z=2.576z^* = 2.576 and ME=2.576×0.01=0.02576ME = 2.576 \times 0.01 = 0.02576.

  3. (b) Apply n=(z0.02)2(0.25)n = \left(\frac{z^*}{0.02}\right)^2 (0.25) three times.

  4. 90%: 1.6450.02=82.25\frac{1.645}{0.02} = 82.25, then (82.25)2=6765.0625(82.25)^2 = 6765.0625, then 6765.0625×0.25=1691.26566765.0625 \times 0.25 = 1691.2656. Round up to 1692.

  5. 95%: 1.960.02=98\frac{1.96}{0.02} = 98, then 982=960498^2 = 9604, then 9604×0.25=24019604 \times 0.25 = 2401 exactly. Nothing to round up, so 2401.

  6. 99%: 2.5760.02=128.8\frac{2.576}{0.02} = 128.8, then (128.8)2=16589.44(128.8)^2 = 16589.44, then 16589.44×0.25=4147.3616589.44 \times 0.25 = 4147.36. Round up to 4148.

  7. (c) A higher confidence level uses a larger critical value, so at a fixed sample size the margin of error grows, and at a fixed margin of error the required sample size grows.

(a) 0.01645, 0.0196, and 0.02576. (b) 1692, 2401, and 4148. Moving from 90% to 99% confidence at the same margin of error costs about 2.5 times the sample. (c) Higher confidence buys a wider net for the same data, so at a fixed margin of error it costs more observations, and at a fixed sample size it costs precision.

Problem 7

A hospital wants to estimate the mean wait time in its urgent care clinic. Past records put the population standard deviation at about σ=12\sigma = 12 minutes (sigma, the standard deviation of the whole population).

(a) How many patients must be sampled so a 95% confidence interval has a margin of error of at most 2 minutes? (b) How many for a margin of error of at most 1 minute?

Use n=(zσME)2n = \left(\frac{z^*\sigma}{ME}\right)^2. Sample size planning for a mean is standard college statistics; the AP course covers the sample size rearrangement only for a proportion, in topic 3.3.

Show the worked solution
  1. (a) For 95% confidence z=1.96z^* = 1.96, with σ=12\sigma = 12 and ME=2ME = 2.

  2. Numerator: zσ=1.96×12=23.52z^*\sigma = 1.96 \times 12 = 23.52.

  3. Divide by the target margin: 23.522=11.76\frac{23.52}{2} = 11.76.

  4. Square: (11.76)2=138.2976(11.76)^2 = 138.2976. Round up to 139 patients.

  5. (b) Same numerator, new target: 23.521=23.52\frac{23.52}{1} = 23.52, and (23.52)2=553.1904(23.52)^2 = 553.1904. Round up to 554 patients.

  6. The quadrupling shows up again: 4×138.2976=553.19044 \times 138.2976 = 553.1904. Quadruple the unrounded value and round up once at the end. Quadrupling the rounded 139 would give 556, which overshoots by two patients.

(a) 139 patients. (b) 554 patients. Halving the target margin of error multiplied the requirement by 4.

Problem 8

A student council surveys a random sample of 250 students at a large high school and finds 150 support moving the start time later. Treat the sample as under 10% of the student body.

(a) Find the margin of error for a 95% confidence interval. (b) The council wants a margin of error of 0.04. Using this year's result as the planning value, how many students should it survey? (c) How many would it need using the conservative p=0.5p^* = 0.5 instead? (d) Show that rounding down in part (b) would miss the target.

Show the worked solution
  1. (a) p^=150250=0.6\hat{p} = \frac{150}{250} = 0.6. Large counts hold: np^=250(0.6)=15010n\hat{p} = 250(0.6) = 150 \geq 10 and n(1p^)=250(0.4)=10010n(1 - \hat{p}) = 250(0.4) = 100 \geq 10.

  2. SE=0.6(0.4)250=0.24250=0.00096=0.030984SE = \sqrt{\frac{0.6(0.4)}{250}} = \sqrt{\frac{0.24}{250}} = \sqrt{0.00096} = 0.030984.

  3. ME=1.96×0.030984=0.06073ME = 1.96 \times 0.030984 = 0.06073, about 6.1 percentage points.

  4. (b) Planning value p=0.6p^* = 0.6, so p(1p)=0.24p^*(1 - p^*) = 0.24. Then 1.960.04=49\frac{1.96}{0.04} = 49 and 492=240149^2 = 2401.

  5. 2401×0.24=576.242401 \times 0.24 = 576.24, so round up to 577 students.

  6. (c) With p=0.5p^* = 0.5: 2401×0.25=600.252401 \times 0.25 = 600.25, so round up to 601 students. That is larger because 0.25>0.240.25 > 0.24.

  7. (d) At n=576n = 576: SE=0.24576=0.00041667=0.020412SE = \sqrt{\frac{0.24}{576}} = \sqrt{0.00041667} = 0.020412, so ME=1.96×0.020412=0.040008ME = 1.96 \times 0.020412 = 0.040008, which sits above the 0.04 target.

  8. At n=577n = 577: SE=0.24577=0.00041594=0.020395SE = \sqrt{\frac{0.24}{577}} = \sqrt{0.00041594} = 0.020395, so ME=1.96×0.020395=0.039974ME = 1.96 \times 0.020395 = 0.039974, just under the target. That is why the rule is always to round up.

(a) About 0.0607. (b) 577 students. (c) 601 students. (d) A sample of 576 gives a margin of error of 0.040008, above target, while 577 gives 0.039974, below it.