skip to content

Limit Theorems & Simulation

Why averages settle down and why their behaviour turns normal — the law of large numbers and the central limit theorem — plus estimating probabilities by simulation when algebra is hopeless.

on this pageshow

explore

questions

23

What does the Central Limit Theorem say about the average of many independent samples?

level: juniorimportance: must knowfreq 85%

answer

  1. about the average, not the data
  2. the parent shape washes out
  3. one condition on the second moment
  4. the flat die roll becomes a bell
  5. centred at mu, variance sigma^2 over n

basics

~10 s

The Central Limit Theorem says that averaging many independent draws from almost any distribution with finite variance produces an average whose distribution is approximately normal, even when the individual observations are not remotely normal.

solid answer

~50 s

The Central Limit Theorem (CLT) is a statement about the *average*, not about the data. Take X1 ... Xn drawn independently from the same distribution with mean `mu` and finite variance `sigma^2`. The theorem says that as n grows, the distribution of the sample average `Xbar` approaches a normal distribution centred at `mu` with variance `sigma^2 / n`. Formally, the standardised quantity `sqrt(n) * (Xbar - mu) / sigma` converges in distribution to a standard normal. Two things matter. First, the shape of the parent distribution is almost irrelevant: a single roll of a fair die is flat over 1-6, yet the average of 30 rolls is close to bell-shaped. Second, the theorem is not unconditional — the draws must be independent and identically distributed and the variance must be finite. The raw observations never become normal; only the distribution of their average does.

code

python · 12 lines
python
import random, statistics
from collections import Counter

def mean_of_k(k):
    return sum(random.random() for _ in range(k)) / k

for k in (1, 2, 30):
    means = [mean_of_k(k) for _ in range(20000)]
    counts = Counter(min(int(m * 10), 9) for m in means)
    print("k =", k, " sd of the average =", round(statistics.pstdev(means), 3))
    for b in range(10):
        print("  %.1f-%.1f %s" % (b / 10, (b + 1) / 10, "#" * (counts[b] // 200)))

go deeper

for a junior

Be ready to state it in one sentence: the average of many independent draws is approximately normal whatever the data looks like. Know that it describes the average, not the observations.

for a middle

Explain the mechanics: i.i.d. draws, finite variance, and the limit N(mu, sigma^2 / n). Interviewers here expect you to distinguish the distribution of the data from the distribution of the average out loud.

for a senior

Show you know when the approximation is actually usable on real data — how skewness slows it down and what you would check before leaning on normal reasoning for a production metric.

for a principal

Own the framing: the CLT is why normal-approximation arithmetic is the default across an analytics org, and where that default quietly fails. Be ready to say which metrics you would not let it be applied to.

## The statement Let `X1, X2, ..., Xn` be independent and identically distributed (i.i.d.) random variables with a finite mean `mu = E[X]` and a finite variance `sigma^2 = Var(X)`. Define the sample average `Xbar_n = (X1 + X2 + ... + Xn) / n` The Central Limit Theorem (CLT) says that as `n -> infinity`, the standardised average `Z_n = sqrt(n) * (Xbar_n - mu) / sigma` converges **in distribution** to a standard normal, `N(0, 1)`. The practical restatement, the one you use at an interview whiteboard, is: for large n, `Xbar_n` is approximately `N(mu, sigma^2 / n)`. The same theorem covers the *sum*: `X1 + ... + Xn` is approximately `N(n*mu, n*sigma^2)`, since the sum is just n times the average. ## What each piece means **i.i.d.** — independent means one draw carries no information about another; identically distributed means every draw comes from the same distribution. Both can be relaxed in more general versions of the theorem, but the classical statement assumes them. **Finite variance** — the distribution must have a variance that is a finite number. This is the condition candidates forget, and it is the one that actually fails in practice for very heavy-tailed data. **Converges in distribution** — this is a statement about *shapes of distributions*, not about individual numbers. It says the probability that `Z_n` lands below any fixed value gets closer and closer to the standard normal probability of landing below that value. No particular realised average is guaranteed to be anything. **Approximately** — the CLT is an asymptotic result. At any finite n the normal shape is an approximation, and how good it is depends on the parent distribution, especially its skewness. ## What the CLT is not The single most common misreading is that the CLT makes *the data* normal. It does not. If you collect a million session durations from a long-tailed distribution and plot a histogram of the raw values, you get a long-tailed histogram, exactly as before — a bigger sample gives you a *better picture of the true skewed shape*, not a bell. The bell appears only when you plot the distribution of averages computed from repeated samples. A second misreading is that the CLT is about the average settling down near the true mean as data accumulates. That convergence is a different result. The CLT is finer-grained: it describes the *shape of the fluctuation* around the mean, and tells you that fluctuation is normal-shaped once rescaled by `sqrt(n)`. A third is treating the theorem as unconditional. Without finite variance there is no normal limit at all — the limit may be a different, heavy-tailed distribution, or the average may fail to stabilise entirely. ## Why the bell appears Intuitively, an average blends many independent contributions. Each draw can push the average up or down, and those pushes partly cancel. Extreme outcomes require many draws to conspire in the same direction, which is exponentially unlikely; middling outcomes can be produced in enormously many ways. That combinatorial squeeze is what produces the bell, and it is why the parent shape washes out. A classic demonstration uses the flat `Uniform(0, 1)` distribution. One draw is flat across the interval. The average of two draws is triangular, peaked at 0.5 — you can reach the middle in many ways and the endpoints in only one. By the time you average thirty draws, the histogram is visually indistinguishable from a bell centred at 0.5, and it is much narrower than the original interval, because averaging shrinks the spread by a factor of `sqrt(n)`. The same happens with a fair die. A single roll is flat: each of 1 through 6 has probability 1/6, mean 3.5, variance 35/12. The average of 30 independent rolls is bell-shaped and tightly concentrated around 3.5. Nothing about the die changed; the averaging did the work. ## Why interviewers ask it The CLT underpins most of the everyday normal-approximation reasoning in analytics: it is the reason a mean computed from a messy, non-normal metric can still be reasoned about with normal-curve arithmetic. An interviewer wants to hear the three components — i.i.d. draws, finite variance, and the conclusion about the *average* rather than the data — plus an honest note that 'large n' is not a fixed number and depends on how skewed the parent distribution is.

  • Does the CLT require the underlying population to be normally distributed?
    No — the opposite is the point. The parent distribution can be flat, skewed, discrete or bimodal; the theorem still gives an approximately normal distribution for the average. It only requires independent, identically distributed draws with a finite variance. If the parent already is normal, the average is exactly normal at every n, so the theorem adds nothing there.
  • Does the CLT apply to the sum of the draws as well as their average?
    Yes. The sum is n times the average, so it inherits the same result with rescaled parameters: for large n the sum is approximately normal with mean `n * mu` and variance `n * sigma^2`. Note the contrast — the sum's spread grows like `sqrt(n)` while the average's spread shrinks like `1 / sqrt(n)`.
  • What does convergence in distribution actually mean here?
    It means the cumulative probabilities converge, not the values. For any fixed number z, the probability that the standardised average falls below z approaches the standard normal probability of falling below z. It says nothing about any single realised average, and it does not claim the random variables themselves converge to anything.

Individual voices in a crowd are wildly different, but the crowd's average loudness is smooth and predictable. The CLT says the smoothness of the average is guaranteed, not the smoothness of any voice.

saying these in an interview costs you the question

  • Claims the raw data becomes normal as the sample grows
  • States the CLT requires a normal population to begin with
  • Says it applies to every distribution, with no finite-variance condition
  • Confuses it with the sample mean converging to the true mean
  • Treats n = 30 as a guarantee rather than a rough guideline

context

open as a page

Does the law of large numbers make black due after a roulette wheel lands red eight times?

level: juniorimportance: must knowfreq 70%

basics

~20 s

No. Spins are independent, so the chance of black is exactly what it was before the streak. The law of large numbers dilutes early results under a huge volume of later ones; it never reaches back to correct them.

open as a page

What does the law of large numbers say about the sample mean as observations accumulate?

level: juniorimportance: must knowfreq 78%

basics

~20 s

The law of large numbers says that for independent draws from one distribution with a finite mean, the average of the observations converges to that distribution's true expected value as the number of draws grows.

open as a page

What does the Markov property mean for a chain that models users as trial, paid or churned?

level: juniorimportance: must knowfreq 82%

basics

~20 s

The Markov property says the next state depends only on the current state, not on the path taken to reach it. A user in the paid state has the same transition probabilities regardless of how long ago they upgraded.

open as a page

How would you estimate pi by Monte Carlo simulation with uniform random points?

level: juniorimportance: must knowfreq 66%

basics

~20 s

Draw many independent points uniformly in the unit square and count the fraction that land inside the quarter circle of radius 1. That fraction estimates pi/4, so multiply it by 4. Accuracy improves like 1/sqrt(n).

open as a page

Why is the n = 30 rule of thumb for the Central Limit Theorem unreliable on skewed data?

level: middleimportance: must knowfreq 62%

basics

~20 s

n = 30 is a teaching guideline, not part of the theorem. The more skewed the population, the larger the sample must be — heavy right tails can need thousands of observations before the average looks normal.

open as a page

What does a Markov chain's stationary distribution tell you about a random surfer's long-run page visits?

level: middleimportance: must knowfreq 70%

basics

~20 s

A stationary distribution is a probability vector pi satisfying pi = pi P, so one more step leaves it unchanged. For an ergodic chain it is unique and gives the long-run share of steps spent on each page.

open as a page

How does inverse-transform sampling turn uniform draws into a target distribution?

level: middleimportance: must knowfreq 54%

basics

~10 s

Apply the target's inverse CDF to a Uniform(0,1) draw: X = F^-1(U) has exactly the distribution F. An exponential with rate lambda comes out as -ln(U)/lambda. Discrete variables use a cumulative-probability ladder instead.

open as a page

How do you normal-approximate a Binomial(200, 0.1) probability with a continuity correction?

level: middleimportance: should knowfreq 45%

basics

~20 s

Match the normal's mean to np = 20 and its standard deviation to sqrt(18) = 4.24, then shift the boundary half a unit: for P(X <= 25) use 25.5, giving z = 1.30 and about 0.903.

open as a page

How do you standardise a sample mean into a z-score using the Central Limit Theorem?

level: middleimportance: should knowfreq 55%

basics

~20 s

Subtract the population mean from the sample mean, then divide by sigma / sqrt(n), where sigma is the population standard deviation and n the sample size. The Central Limit Theorem says that ratio is approximately standard normal.

open as a page

What bound does Chebyshev's inequality place on how often a value falls far from the mean?

level: middleimportance: should knowfreq 35%

basics

~20 s

Chebyshev's inequality says for any distribution with a finite mean and variance, the probability of landing more than k standard deviations from the mean is at most 1 over k squared — at three standard deviations, at most one ninth.

open as a page

As fair coin flips accumulate, does the gap between the head count and tail count shrink?

level: middleimportance: should knowfreq 40%

basics

~20 s

No. The proportion of heads converges to one half, but the absolute difference between the head and tail counts typically grows as flipping continues. The law of large numbers constrains the ratio, not the raw count difference.

open as a page

Given a sunny/rainy transition matrix, how do you compute the chance of rain two days from now?

level: middleimportance: should knowfreq 62%

basics

~20 s

Raise the transition matrix to the second power. Entry (i, j) of P squared is the probability of being in state j two steps after starting in state i, so read the sunny-to-rainy entry of that matrix.

open as a page

How do you decide how many draws a Monte Carlo simulation needs?

level: middleimportance: should knowfreq 48%

basics

~20 s

Pick the precision the decision actually needs, then buy draws to reach it. Simulation error falls like 1/sqrt(n), so halving the error costs four times the draws and one extra decimal digit costs a hundred times.

open as a page

When does the law of large numbers stop protecting an insurer's aggregate profit?

level: seniorimportance: should knowfreq 32%

basics

~20 s

The law of large numbers stops protecting the book when its assumptions break: claims correlated by a shared cause, severity so heavy-tailed the average barely settles, a drifting risk mix, or capital too thin to survive the path.

open as a page

Does every finite Markov chain converge to the same long-run distribution regardless of where it starts?

level: seniorimportance: should knowfreq 45%

basics

~20 s

No. Convergence to one limiting distribution from any start requires the chain to be irreducible and aperiodic. A chain that strictly alternates between two states, or one that splits into groups that cannot reach each other, never settles.

open as a page

In a trial/paid/churned chain with churn absorbing, how do you compute the expected months until churn?

level: seniorimportance: should knowfreq 52%

basics

~20 s

Take the submatrix Q of transitions among the non-absorbing states and solve (I - Q) t = 1, where 1 is a vector of ones. The trial entry of t is the expected number of months before the user churns.

open as a page

A rejection sampler for a truncated normal accepts only 3% of proposals; why?

level: seniorimportance: should knowfreq 34%

basics

~20 s

The envelope is far too loose. Rejection sampling accepts a proposal with probability 1/M, where M is how much the envelope must be inflated to cover the target, so a box dwarfing the truncated region wastes nearly every draw. Accepted draws remain exact.

open as a page

When would you choose Monte Carlo simulation over an exact analytic calculation?

level: principalimportance: should knowfreq 30%

basics

~20 s

Simulate when the system's rules are easy to code but hopeless to integrate, when the problem is high-dimensional, or when the whole output distribution matters rather than a mean. Prefer the closed form when one exists: it is exact, instant and auditable.

open as a page

What assumptions define a Poisson process for support calls arriving through the day?

level: middleimportance: nice to knowfreq 36%

basics

~20 s

Calls must arrive one at a time, counts in non-overlapping time windows must be independent, and the average arrival rate must be constant. Those assumptions make the count in any window Poisson and the gaps between calls exponential.

open as a page

Why does the Central Limit Theorem fail for Cauchy-distributed data?

level: seniorimportance: nice to knowfreq 28%

basics

~20 s

The Cauchy has tails so heavy it has no finite mean or variance, and finite variance is exactly what the theorem requires. The average of n Cauchy draws is again exactly Cauchy, so it never narrows.

open as a page

What is the difference between the weak and strong laws of large numbers?

level: seniorimportance: nice to knowfreq 24%

basics

~20 s

The weak law is convergence in probability: at each large sample size, a big miss is unlikely. The strong law is almost sure convergence: with probability one the sequence of running averages settles at the population mean and stays.

open as a page

How does variance reduction cut Monte Carlo error without buying more draws?

level: seniorimportance: nice to knowfreq 26%

basics

~20 s

Variance reduction reshapes what you average rather than how much. Antithetic variates pair each uniform U with 1-U so their errors cancel; control variates subtract a correlated quantity whose true mean is known; common random numbers reuse one stream across competing designs.

open as a page