Visual walkthrough — Confidence intervals — derivation for mean, proportion
This page dives under the parent note. The engine humming underneath everything is the Central Limit Theorem, and the "wobble" we keep measuring is the Standard Error.
Step 1 — One sample is a fuzzy guess
WHAT. We have a huge population with some true average value we call (Greek letter "mu", just a name for the true mean we cannot see). We grab items, measure them, and average: Here is the -th measurement, means "add them all up", is how many we took, and (read "X-bar") is their average — our point estimate.
WHY. is our best single guess for . But if a friend grabbed a different handful, they'd get a slightly different . So is not one fixed number — it jitters from sample to sample.
PICTURE. Below, the true mean is the yellow line. Each blue dot is one possible from one possible sample. They scatter around — never all landing exactly on it.

Step 2 — Collect the jitters: the sampling distribution
WHAT. If we imagine drawing sample after sample forever and piling up all the values, they form a smooth hill — the sampling distribution of the mean. Its centre sits at , and its spread is measured by a number called the standard error: ("sigma") is the spread of a single measurement; is the square-root of the sample size.
WHY divide by ? Averaging cancels out flukes. More items ( bigger) → the high ones and low ones cancel more → the hill of gets narrower. The maths, and here is exactly where the i.i.d. assumption from Step 1 earns its keep: variances of independent variables add. Because the are independent, (this additivity is false without independence — correlated terms would carry extra cross-terms). Dividing the sum by scales variance by , giving ; take the square root and you get .
PICTURE. Watch the hill get taller and skinnier as grows from 4 to 100. Same centre , shrinking width.

Step 3 — Why the hill is a bell (the CLT)
WHAT. No matter what shape the individual measurements have (skewed, lumpy, uniform), the hill of averages approaches a normal bell curve as grows. This is the Central Limit Theorem.
WHY it matters. A bell curve is fully described by just two numbers — its centre and its width. So once we believe is approximately bell-shaped, we can compute how far typically strays from . That single fact is what makes the whole interval possible.
PICTURE. Start with a lopsided population (left). Average samples of size . The distribution of those averages (right) is a clean symmetric bell centred at .

Step 4 — Rescale to a universal ruler: the score
WHAT. Every bell curve is a stretched/shifted copy of one master bell — the standard normal, centre , width . We move to it by subtracting the centre and dividing by the width: Term by term: is how far our estimate landed from the truth; dividing by measures that distance in standard-error units. So answers: "how many SE's away from did I land?"
WHY. Different problems have different , , . Converting to erases all of that — now one fixed picture works for every problem.
PICTURE. The raw bell (blue, messy units) maps onto the standard bell (green, centred at 0). The same point becomes "so many steps from centre".

Step 5 — Carve out the central 95% ()
WHAT. Choose a confidence level . For 95%, . We find the number such that the central band from to holds probability :
WHY split in half? We want to exclude the extreme 5% total, but the bell has two tails. Leaving in each tail keeps the middle at . Using the whole in one tail would be a one-sided bound — a different question.
PICTURE. The green bell with a shaded central band (), and two small red tails ( each). The band edges are labelled .

Step 6 — Flip the inequality to trap
WHAT. We now do plain algebra inside the probability statement, one line at a time. Start by substituting : Line 1 — multiply every part by . This quantity is positive (a standard deviation over a positive root), so multiplying by it keeps every pointing the same way: Line 2 — subtract from every part. Subtraction shifts all three pieces equally; directions unchanged: Line 3 — multiply every part by . Multiplying by a negative number reverses the direction of an inequality (if , then : the smaller number becomes the larger once signs flip). So both become , and the left/right ends swap roles: Line 4 — read it left-to-right (rewrite the same chain smallest-first):
WHY. Step 5 was a statement about where falls relative to . But is what we don't know! Isolating in the middle turns the same fact into a band around our estimate — the half-width is the margin of error.
PICTURE. On the number line: sits in the centre; arrows of length reach left and right; the shaded band is the interval. The true (yellow) happens to sit inside — this time.

Step 7 — What "95% confidence" looks like (the crucial subtlety)
WHAT. The interval is random because is random. Some intervals land so they cover ; a few (about 5%) miss.
WHY this is the whole point. "95% confidence" is a statement about the procedure over many samples, not about one computed interval. Once you have , that fixed range either contains the fixed or it doesn't — probability or .
PICTURE. Twenty intervals stacked vertically, each from its own sample. The yellow vertical line is . Green intervals cross it (hit); red ones miss. Roughly 1 in 20 is red.

Step 8 — Degenerate & edge cases
WHAT & WHY, case by case:
- unknown, small → use . We replace with the sample SD just defined. Since is itself a jittery guess (it tends to underestimate for small ), the true statistic has fatter tails — the Student's t-distribution with degrees of freedom. Then . Scope caveat: the -interval gives exact coverage only when the underlying population is itself (at least approximately) normally distributed — that normality is the assumption that makes follow an exact law. For heavily non-normal populations, both the -interval and its coverage are only approximate and rely on large (via the CLT) instead. As , the normal, so the two methods agree.
- . SE : the band collapses onto , which itself homes in on . Certainty in the limit.
- . SE : no averaging happened, so the interval is as wide as one raw measurement — the formula still speaks, just uselessly wide (and is undefined here, since ).
- Proportion (0/1 data). A success/failure trial (a Bernoulli variable) has mean and variance , so is just a sample mean of 0's and 1's. Everything above transfers: , valid when and (enough of each for the bell to appear).
PICTURE. Left: the bell (red) sitting fatter-tailed over the normal (green) — wider critical marks. Right: the band converging to the band as climbs.

The one-picture summary
Everything on one canvas: population → sample → bell of centred at with width → central carved by → flipped into a band around that traps .

Recall Feynman retelling — the whole walkthrough in plain words
You taste a few spoons of a giant soup pot to guess its true saltiness , stirring first so each spoon is an independent, fair sample. One handful of spoons gives an average — close but not exact (Step 1). If many friends each taste their own spoons, all their averages pile into a hill centred on the true saltiness, and — because the spoons are independent — the hill is skinnier the more spoons each taste, that skinniness being (Step 2). For a big enough handful the hill becomes bell-shaped (Step 3 — only approximately, and only when the handful is large enough). We measure "how far off am I" in units of that skinniness, calling it (Step 4). On the master bell we mark the middle 95%, cutting 2.5% off each end — the edge marks are (Step 5). Rearranging " is within 1.96 skinny-units of " into " is within 1.96 skinny-units of " — carefully flipping the inequality when we multiply by — gives a band around our guess (Step 6). Draw twenty friends' bands: about nineteen cross the true line, one misses — that is what 95% confidence means, a property of the method, not of your one band (Step 7). If you don't know the spread and took few spoons, measure the spread of your own spoons with and use the fatter-tailed ruler (trusting the pot's saltiness is roughly bell-shaped); for yes/no questions the very same recipe uses (Step 8).
Connections
- Central Limit Theorem — why the hill of averages is a bell (Step 3).
- Standard Error — the shrinking width (Step 2).
- Student's t-distribution — the fatter-tailed ruler when is estimated (Step 8).
- Hypothesis Testing — outside the CI ⇔ reject at level .
- Bernoulli & Binomial Distributions — the 0/1 variance behind proportions.
- Sample Size Determination — invert to solve for .