Introductory Statistics / Module 4, From Samples to Populations / Lesson 2
Confidence Intervals for a Mean
Learn to build and interpret confidence intervals for a mean, see what 95% confidence really means in a live simulator, and plan the sample size you need, with worked examples, graded practice and full answers.
- Statistics
- First-year university and advanced high school
- About 60 minutes
- Interval coverage simulator, worked examples and practice
1Learning goal: what you will be able to do
A sample mean is a single guess at the population mean. A confidence interval turns that guess into a range, with an honest statement of how often the method works. By the end of this lesson you will be able to build and interpret a confidence interval for a mean, and to plan the sample size needed for a target precision.
Learning outcomes
- FoundationDistinguish a point estimate from an interval estimate, and name the parts of an interval: estimate, critical value, standard error and margin of error.
- CoreConstruct a confidence interval for a mean when the population standard deviation is known, at 90%, 95% and 99% confidence.
- CoreInterpret the confidence level correctly, explain how sample size and confidence level change the width, and calculate the sample size for a target margin of error.
- ExtensionUse the t distribution when σ is unknown, and construct an interval for a proportion.
Where this lesson fits
This is the second lesson of Module 4 in Introductory Statistics. It uses the standard error from the first lesson to quantify uncertainty. The next lesson, on hypothesis tests, uses the same ingredients to answer yes-or-no questions.
- Module 4, Lesson 1: Sampling distributions and the Central Limit TheoremOpen
- Module 4, Lesson 2: Confidence intervals for a meanThis lesson
- Module 5, Lesson 1: Hypothesis tests for a meanOpen
- Module 5, Lesson 2: Inference for proportionsPlanned
Where this topic appears in courses
Confidence intervals are standard in a first university statistics course, in AP Statistics (the units on estimating with confidence intervals), in the IB Mathematics higher level options, and in applied courses in economics, psychology, health sciences and engineering. Introductory courses usually teach the known-σ interval first, then the t interval. This lesson supports, and does not replace, your own syllabus and instructor.
2A familiar example: the weather forecast
A forecaster says "tomorrow’s high will be 24°C." Another says "between 21 and 27°C." Which forecast is more useful, and which is more likely to be right?
Predict first: which forecast is more likely to be correct, and what is the trade-off?
Think about how precise each claim is.
The range is far more likely to be right, but it says less. A single number (24) is almost never exactly correct. A wide range almost always captures the truth, but a range of −10 to 50°C is certain to be right and tells you nothing. Every honest estimate balances precision (narrow) against confidence (likely to be right). A confidence interval makes that balance explicit and measurable.
Statisticians do the same with a sample mean. A point estimate such as x̄ = 48 is one number. An interval estimate such as 44.1 to 51.9 adds the uncertainty. The width of the interval comes from the standard error you met in the last lesson. The confidence level says how often the method captures the true mean when used over and over.
Use the simulator below to see this long-run behaviour with your own eyes. The true mean is 100 and is known to the simulator, but not to the intervals.
Try it: the interval coverage simulator
Each press draws 50 random samples and builds a confidence interval from each. Blue intervals contain the true mean (dashed line). Red intervals miss it. Change the confidence level or the sample size and watch what changes. The sample means are generated from a normal population with μ = 100 and σ = 15.
Things to notice: about 95 in every 100 intervals are blue at the 95% level, but any single batch of 50 can differ by a few. A higher confidence level gives wider intervals and fewer misses. A larger n gives narrower intervals while the capture rate stays about the same.
3Clear explanation
Anatomy of a confidence interval
Every interval for a mean has the same shape:
estimate ± margin of error, where margin of error = critical value × standard error
For a mean with known population standard deviation σ, the interval is
x̄ ± z* × σ/√n
Here x̄ is the sample mean, σ/√n is the standard error, and z* is the critical value: the number of standard errors that captures the chosen middle percentage of a normal curve.
| Confidence level | Critical value z* | Meaning |
|---|---|---|
| 90% | 1.645 | The middle 90% of the normal curve lies within 1.645 standard errors of the mean |
| 95% | 1.960 | The middle 95% lies within 1.96 standard errors |
| 99% | 2.576 | The middle 99% lies within 2.576 standard errors |
How to interpret the confidence level
The 95% describes the method, not one particular interval. If you repeated the whole process (take a sample, build an interval) many times, about 95% of the intervals would contain the true mean. Once you have a specific interval such as (44.1, 51.9), the true mean is either inside it or not; you do not know which. The accepted wording is: "We are 95% confident that the true mean lies between 44.1 and 51.9."
Avoid this wording: "There is a 95% probability that the mean is between 44.1 and 51.9." The mean is a fixed number, not a random one. The randomness is in the sample, and so in the interval.
What makes an interval wider or narrower
- Higher confidence gives a wider interval. To be surer of capturing the mean you must cast a wider net (99% is wider than 95%).
- A larger sample gives a narrower interval. The standard error σ/√n shrinks as n grows, but only with the square root: to halve the width you need four times the data.
- More variable data gives a wider interval. A larger σ means a larger standard error.
Planning the sample size
To get a margin of error of at most E, solve z* × σ/√n ≤ E for n:
n ≥ (z* × σ / E)2, rounded up
Conditions
- Random sample from the population. No interval can repair a biased sample, as the lesson on sampling distributions showed.
- Independence. Observations do not influence each other. With sampling without replacement, check that n is no more than 10% of the population.
- Normal population or large n. The interval relies on x̄ being approximately normal. This holds for a normal population at any n, and by the Central Limit Theorem for large n (a common guide is 30 or more, more if the data are strongly skewed).
When σ is unknown: the t interval
In practice σ is rarely known, so we estimate it with the sample standard deviation s. This adds extra uncertainty, so we replace z* with a slightly larger critical value t* from the Student t distribution, which depends on the degrees of freedom, df = n − 1:
x̄ ± t* × s/√n
| df | 4 | 9 | 15 | 24 | 29 | Large (∞) |
|---|---|---|---|---|---|---|
| t* for 95% | 2.776 | 2.262 | 2.131 | 2.064 | 2.045 | 1.960 |
As the sample grows the t values approach the z value 1.96. For small samples the t interval is noticeably wider, which is the honest price of not knowing σ.
Extension: an interval for a proportion
For a sample proportion p̂ the interval is p̂ ± z* × √(p̂(1 − p̂)/n). It needs at least 10 successes and 10 failures in the sample. News reports of poll results quote exactly this: the "margin of error" of a poll is the half-width of a 95% interval for a proportion.
Common mistakes
| Mistake | Why it is wrong | Fix |
|---|---|---|
| "95% of the data lie in the interval" | The interval is about the mean, not individual values | Say "confident that the mean lies in" |
| "There is a 95% chance the mean is in this interval" | The mean is fixed; the confidence describes the method | Use the 95% confident wording |
| Using σ instead of σ/√n | That is the spread of individuals, not of the mean | Always use the standard error |
| Rounding n to the nearest whole number | It can leave you with a margin that is slightly too big | Round up |
| Using z when σ is unknown and n is small | The interval is too narrow and under-covers | Use t with n − 1 degrees of freedom |
| Trusting an interval from a biased sample | The method assumes random sampling | Check how the data were collected first |
4Worked examples
Read each example with a pencil in hand. Cover the steps, attempt the first line yourself, then compare. Every interval is followed by a sentence in plain language, because stating what the result means is part of the answer.
Example 1 Foundation 4 marks: a 95% interval, σ known
A coffee shop samples 36 customers at random. The mean spend is $48. Spending has a known standard deviation of $12. Construct a 95% confidence interval for the mean spend of all customers.
- Conditions. Random sample, 36 is a small part of all customers, and n ≥ 30. The interval is reasonable.
- Standard error = 12/√36 = 12/6 = 2.
- Margin of error = 1.96 × 2 = 3.92.
- Interval = 48 ± 3.92 = (44.08, 51.92).
Answer: (44.08, 51.92). We are 95% confident that the mean spend of all customers is between $44.08 and $51.92.
Example 2 Core 3 marks: raising the confidence level
Use the same data to construct a 99% interval and compare the widths.
- The standard error is still 2. The 99% critical value is 2.576.
- Margin of error = 2.576 × 2 = 5.152.
- Interval = 48 ± 5.152 = (42.85, 53.15) to two decimal places.
- Width: 99% gives 10.30; 95% gave 7.84. More confidence costs precision.
Answer: (42.85, 53.15), wider than the 95% interval.
Example 3 Core 3 marks: the effect of sample size
The shop instead samples 144 customers and again finds a mean of $48. Construct the 95% interval and compare with Example 1.
- Standard error = 12/√144 = 12/12 = 1.
- Margin = 1.96 × 1 = 1.96. Interval = 48 ± 1.96 = (46.04, 49.96).
- Width = 3.92, exactly half of the 7.84 in Example 1.
- The sample size was multiplied by 4 (36 to 144), so the width was divided by √4 = 2.
Answer: (46.04, 49.96). Four times the data halves the width.
Example 4 Core 4 marks: choosing the sample size
The shop wants a 95% margin of error of at most $2, with σ = $15. How many customers must be sampled?
- Require 1.96 × 15/√n ≤ 2.
- √n ≥ 1.96 × 15/2 = 14.7.
- n ≥ 14.72 = 216.09.
- Round up: n = 217.
- Check: with 217 the margin is 1.96 × 15/√217 = 1.9958, within 2. With 216 it is 2.0004, which is just over.
Answer: 217 customers. Rounding 216.09 down to 216 would miss the target.
Example 5 Core 4 marks: reading an interval
A 95% confidence interval for the mean time (in hours) a battery lasts is (4.1, 5.3). (a) State the sample mean and margin of error. (b) Is a manufacturer’s claim of 5 hours consistent with the data? (c) What about a claim of 6 hours?
- (a) The centre is (4.1 + 5.3)/2 = 4.7, so x̄ = 4.7. The margin is (5.3 − 4.1)/2 = 0.6.
- (b) 5 lies inside (4.1, 5.3), so a mean of 5 hours is plausible given the data.
- (c) 6 is outside the interval, so the data are not consistent with a mean of 6 at the 95% level.
- This reasoning is the doorway to hypothesis testing, which the next lesson in this course develops.
Answer: x̄ = 4.7 hours, margin 0.6. The 5-hour claim is plausible; the 6-hour claim is not.
Example 6 Extension 5 marks: a t interval
A random sample of 16 packets has mean mass 50 g and sample standard deviation s = 8 g. The population is approximately normal and σ is unknown. Construct a 95% confidence interval for the mean.
- σ is unknown, so use t. Degrees of freedom = 16 − 1 = 15, and t* = 2.131.
- Standard error = s/√n = 8/4 = 2.
- Margin = 2.131 × 2 = 4.262.
- Interval = 50 ± 4.262 = (45.74, 54.26).
- Compare with the z value: 1.96 × 2 = 3.92. The t interval is wider because we estimated σ.
Answer: (45.74, 54.26) grams.
Example 7 Extension 4 marks: an interval for a proportion
In a random poll of 400 voters, 55% support a proposal. Construct a 95% interval for the true proportion and say whether the data show a majority.
- Conditions. 400 × 0.55 = 220 successes and 180 failures, both at least 10.
- SE = √(0.55 × 0.45/400) = √0.00061875 = 0.02487.
- Margin = 1.96 × 0.02487 = 0.0488.
- Interval = 0.55 ± 0.0488 = (0.501, 0.599).
Answer: (0.501, 0.599). The whole interval is above 0.5, so the poll indicates a majority, but only just: the lower end is barely over 50%.
5Learner practice
Work each question on paper first, then enter your answer. You get two tries on each question. Two questions generate new numbers every time. Use the critical values given in the explanation.
Which is the best interpretation of "a 95% confidence interval for the mean is (44.1, 51.9)"?
A sample of n = 36 comes from a population with σ = 15. Find the margin of error for a 95% confidence interval for the mean.
A random sample of 25 has mean 72 from a population with σ = 10. Find the lower limit of the 95% confidence interval for the mean.
A researcher quadruples the sample size, keeping the confidence level and σ the same. What happens to the width of the interval?
The same data produce a 90%, a 95% and a 99% confidence interval. Which statement is true?
A random sample of 16 from an approximately normal population has x̄ = 50 and s = 8 (σ unknown). Using t* = 2.131, find the margin of error of the 95% confidence interval. Answers within 0.02 are accepted.
A 95% confidence interval for a mean is (4.1, 5.3). Find the margin of error.
6Answer explanations
Attempt every question before you open these. A right answer with a wrong method is luck, so read each explanation even when you were correct. Questions 3 and 6 show their own worked solution as soon as you answer.
Question 1: interpreting a 95% interval
Answer: we are 95% confident that the true mean lies in the interval, because the method captures the mean in 95% of repeated samples.
Why the others fail: the interval is about the mean, not about 95% of individual values (a). The interval is built around the sample mean, so the sample mean is not uncertain; it is the centre (b). The population mean is fixed, not changing (d).
Question 2: margin of error for σ = 15, n = 36
SE = 15/√36 = 15/6 = 2.5. Margin = 1.96 × 2.5 = 4.9.
A common slip is using σ directly: 1.96 × 15 = 29.4. That would be the margin for predicting one observation, not for estimating the mean.
Question 3: generated margin of error
Find the standard error, pick the critical value that matches the confidence level (1.645, 1.96 or 2.576), then multiply. Use New numbers to practise all three levels.
Question 4: lower limit
SE = 10/√25 = 2. Margin = 1.96 × 2 = 3.92. Lower limit = 72 − 3.92 = 68.08. The upper limit is 75.92.
Question 5: quadrupling the sample size
Answer: the width is halved. Width is proportional to 1/√n. With 4n the factor becomes 1/√(4n) = 1/(2√n), half the original. Dividing by 4 would need 16 times the sample.
Question 6: generated sample size
Solve 1.96σ/√n ≤ E for n, which gives (1.96σ/E)2. Round up, because rounding down leaves the margin slightly above the target.
Question 7: 90%, 95% and 99% intervals
Answer: the 99% interval is the widest. Higher confidence needs a larger critical value (1.645, 1.96, 2.576), so the margin and the width grow. There is no free lunch: more confidence costs precision.
Question 8: the t margin of error
SE = 8/√16 = 2. Margin = 2.131 × 2 = 4.262. With the z value the margin would have been 1.96 × 2 = 3.92, so ignoring that σ is unknown would make the interval too narrow.
Question 9: the margin from an interval
Width = 5.3 − 4.1 = 1.2. The margin is half the width: 0.6. Equivalently, the centre is 4.7 and 4.7 + 0.6 = 5.3.
7Short recap
- A point estimate is one number. A confidence interval is estimate ± margin of error.
- Margin of error = critical value × standard error. For a mean with known σ, SE = σ/√n.
- Critical values: 1.645 (90%), 1.96 (95%), 2.576 (99%).
- The confidence level describes the method over repeated samples. It is not the probability that one interval contains the mean.
- Higher confidence widens the interval. More data narrows it, by the square root of n.
- Sample size: n ≥ (z*σ/E)2, rounded up.
- When σ is unknown, use s and the t distribution with n − 1 degrees of freedom.
- Check the conditions: random sample, independence, and a normal population or large n.
Tick what you can now do
If you ticked fewer than four, return to the matching worked example, redo it without looking, then try the generated questions again. The next lesson, Hypothesis Tests for a Mean, turns this reasoning into formal tests.
Related lessons and Encyclopedia entries
- Sampling Distributions and the Central Limit Theorem: the previous lesson, which explains the standard error used here.
- Confidence interval and Margin of error: the Encyclopedia entries on these ideas.
- Statistical significance and p-value: where intervals and tests meet.
- Nonresponse bias: one reason an interval can be precise yet wrong.
- Ecological Sampling virtual lab: practise random sampling and estimating a population mean from quadrats.
References and further reading
Titles and publishers only. Search each site for the title to reach the exact page.
- OpenStax, Introductory Statistics 2e, the chapter on confidence intervals. Free and open textbook. https://openstax.org/
- Diez, D. M., Barr, C. D. and Çetinkaya-Rundel, M., OpenIntro Statistics, the chapter on foundations for inference. https://www.openintro.org/
- Freedman, D., Pisani, R. and Purves, R., Statistics, the chapters on confidence intervals. W. W. Norton.
- MIT OpenCourseWare, 18.05 Introduction to Probability and Statistics, notes on confidence intervals. https://ocw.mit.edu/