☰

Central Limit Theorem

Central Limit Theorem: Definition, Formula and Worked Examples

Roll one die and every face is equally likely. The picture is flat. Now roll it 30 times and take the average. Do this thousands of times and plot the averages. A bell shaped curve appears, centred on 3.5. Nothing about the die changed. What changed is that you looked at averages. This is the central limit theorem.

It is one of the most useful ideas in statistics, because it lets you use the normal curve for problems where the data are not normal. Confidence intervals, margins of error and most hypothesis tests rest on it. It is also the reason why large samples are trusted.

This tutorial explains what the theorem says, its formulas for the sum and for the mean, a corrected dice example, a step by step method with a full worked question, how large a sample you need, and a Python simulation.

Central Limit Theorem Definition

Take a population with a finite mean and variance. Draw many random samples of the same size n. As n grows large enough, the distribution of the sample means gets close to a normal distribution, whatever the shape of the population.

In symbols, for independent random variables X1 to Xn with the same distribution, mean mu and variance sigma squared:

Distribution of the sum and the sample mean for large n
Quantity Distribution for large n
Sum of the values Close to normal with mean n times mu and variance n times sigma squared
Sample mean Close to normal with mean mu and variance sigma squared divided by n

Two effects as n increases:

  1. The shape becomes more normal.
  2. The spread of the sample mean shrinks. Its standard deviation is sigma divided by the square root of n. The spread of the sum grows, since its variance is n times sigma squared.

The live page says that the spread decreases, without saying that this applies to the mean only.

The conditions: the samples must be random and independent, and the population needs a finite variance. The population does not have to be normal.

Central Limit Theorem Example: Rolling a Die

Central limit theorem example of rolling a die

A fair die gives each face, 1 to 6, a probability of one in six. The mean is 3.5 and the standard deviation is 1.708.

The live page says that if about 1,000 students each roll the die, the histogram of the results moves toward a normal curve. It does not. I ran this: 1,000 students rolled once, and the counts for faces 1 to 6 were 172, 165, 172, 171, 169 and 151. The histogram is flat, which is the uniform distribution.

Now let each student roll 30 times and write down the average. I ran this too. The 1,000 averages had a mean of 3.483, a standard deviation of 0.314 (theory: 1.708 divided by the square root of 30 = 0.312), and a skew of minus 0.141, which is nearly symmetric. A histogram of these averages is bell shaped.

The sum of 30 rolls has a mean of 30 times 3.5 = 105 and a standard deviation of 9.354. The chance that the sum goes above 120, from a simulation of 200,000 trials, is 0.0488. The normal approximation gives the same, 0.0488.

Why do We Need the Central Limit Theorem?

  • Real data are rarely normal. Incomes, waiting times and defects are skewed, but their averages behave normally.
  • It justifies the Z and T tests, and confidence intervals for means.
  • It lets you answer probability questions about a sample mean: what is the chance that the average is above, below or between certain values?
  • It explains why more data helps. The standard error falls as the sample grows.

A typical word problem gives a population mean, a standard deviation and a sample size, and asks for the probability that the sample mean falls in some range. The steps below show how to solve it.

How to Calculate with the Central Limit Theorem?

  1. Identify the parts. The population mean mu, the standard deviation sigma and the sample size n. The population size is not needed unless the population is small. The value you are asking about is a sample mean, x bar.
    Central limit theorem step 1, identify the population mean, standard deviation and sample size
  2. Draw a picture (optional). Draw a normal curve centred on mu, and shade the area that the question asks about.
  3. Calculate the z score for the sample mean: z = (x bar minus mu) divided by (sigma divided by the square root of n).
    Central limit theorem step 3, calculate the z score of the sample mean
  4. Find the probability from a z table, or with software. For a greater than question, use 1 minus the table value.
  5. Write the answer in words.

The live page replaces steps 3 to 6 with a subtraction from 0.75, which is not a valid method.

Worked Example

The live page mentions 64 children and sigma = 6, but never completes the question. Here is a full version with made up numbers. A population has a mean of 20 and a standard deviation of 6. You take a sample of 64. What is the probability that the sample mean is above 21? And between 19 and 21?

  • Standard error = 6 divided by the square root of 64 = 6 divided by 8 = 0.75. This is the value that the live page calls 0.75.
  • Z score for 21 = (21 minus 20) divided by 0.75 = 1.333.
  • Probability above 21 = 1 minus 0.9088 = 0.0912, about 9.12 percent.
  • Z scores for 19 and 21 are minus 1.333 and 1.333. The area between them is 0.8176, about 81.76 percent.

Meaning: if you take many samples of 64, about 9 percent will have an average above 21, and about 82 percent will fall between 19 and 21. The sample mean tends to stay close to 20, because the standard error is only 0.75.

How Large Does n Need to be?

A common rule of thumb is n of 30 or more. It is only a guide. The more skewed the population, the bigger n you need. I tested a strongly skewed population (waiting times) with 5,000 samples for each size, and measured the skew of the sample means. A skew near 0 means a symmetric shape.

Skew of the sample means from a skewed population at different sample sizes
Sample size n Skew of the sample means Shape
2 1.43 Still clearly skewed
10 0.63 Less skewed
30 0.37 Close, but not perfect
100 0.24 Close to normal

So for a very skewed population, n = 30 is not enough for a perfect bell, though it is often good enough for a rough answer. If the population is already close to normal, even a small n works. This also means that small samples, such as 17 males or 11 seniors in the live page’s list, need a nearly normal population.

Simulate the Central Limit Theorem in Python

I ran the code below, and the output is real.

python
import numpy as np
from scipy import stats

rng = np.random.default_rng(3)

# One die: uniform, not normal. 1000 students roll once.
one = rng.integers(1, 7, 1000)
print("One roll counts 1..6:", np.bincount(one)[1:].tolist())

# Average of 30 rolls for 1000 students
avg = rng.integers(1, 7, (1000, 30)).mean(axis=1)
print("Mean of averages:", round(float(avg.mean()), 3), " sd:", round(float(avg.std()), 3),
      " theory sd:", round(float(np.std(np.arange(1, 7)) / 30 ** 0.5), 3), " skew:", round(float(stats.skew(avg)), 3))

# Sum of 30 rolls: normal with mean n*mu and variance n*sigma^2
mu, var = 3.5, 35 / 12
n = 30
print("Sum mean:", n * mu, " sum sd:", round(float((n * var) ** 0.5), 3))
sums = rng.integers(1, 7, (200000, n)).sum(axis=1)
print("P(sum > 120) simulated:", round(float((sums > 120).mean()), 4),
      " normal approx:", round(float(stats.norm.sf(120.5, n * mu, (n * var) ** 0.5)), 4))

# Children example: mean 20, sigma 6, n 64
se = 6 / 64 ** 0.5
z = (21 - 20) / se
print("SE:", se, " z:", round(z, 3), " P(mean > 21):", round(float(stats.norm.sf(z)), 4))
z1, z2 = (19 - 20) / se, (21 - 20) / se
print("P(19 < mean < 21):", round(float(stats.norm.cdf(z2) - stats.norm.cdf(z1)), 4))

# Skewed population: how n changes shape
pop = rng.exponential(10, 100000)
for k in (2, 10, 30, 100):
    m = rng.choice(pop, (5000, k)).mean(axis=1)
    print("n", k, " skew of means:", round(float(stats.skew(m)), 2))
output
One roll counts 1..6: [172, 165, 172, 171, 169, 151]
Mean of averages: 3.483  sd: 0.314  theory sd: 0.312  skew: -0.141
Sum mean: 105.0  sum sd: 9.354
P(sum > 120) simulated: 0.0488  normal approx: 0.0488
SE: 0.75  z: 1.333  P(mean > 21): 0.0912
P(19 < mean < 21): 0.8176
n 2  skew of means: 1.43
n 10  skew of means: 0.63
n 30  skew of means: 0.37
n 100  skew of means: 0.24

Common Mistakes to Avoid

Common mistakes and fixes
Mistake Fix
Thinking the data become normal The distribution of the sample mean becomes normal. The data stay as they are
Applying it to a single roll or a single value It applies to sums and averages
Saying the population must be normal It does not, for a large enough n
Using sigma instead of sigma divided by the square root of n For a sample mean, divide by the square root of n
Subtracting the z score from a number Read the probability from the z table
Saying the spread of the sum shrinks Only the spread of the mean shrinks
Trusting n = 30 for a very skewed population Check the shape, and use a bigger n
Using it for dependent or biased samples It needs random, independent samples

Practice Questions

  1. A population has mean 50 and standard deviation 10. For samples of size 25, what are the mean and the standard error of the sample mean?
  2. For the same population and n = 25, find z for a sample mean of 53.
  3. The sum of 30 dice rolls has what mean and variance?
  4. Does the central limit theorem say that a large sample of data is normal?

Answers: 1) The mean is 50. The standard error is 10 divided by 5 = 2. 2) z = (53 minus 50) divided by 2 = 1.5. 3) The mean is 105 and the variance is 30 times 2.9167 = 87.5. 4) No. The data keep their own shape. It is the distribution of the sample mean that becomes normal. These are my own answers, so please recheck them before publishing.

The central limit theorem is the reason that one curve, the normal curve, can handle so many different problems. The data keep their own shape. It is the average that becomes bell shaped, and its spread shrinks with the square root of n. Remember that, and most of inference follows.

Popular Tags:

central limit theorem example central limit theorem formula central limit theorem towards data science Central Limit Theorem tutorial