Inequalities and limit theorems — theory with the gym playlist, Chebyshev, the law of large numbers and the CLT (and the 20 songs that “easily fit”)
On my first spinning day I swore to my friend that the 20 songs on my playlist easily fit into 75 minutes. Each song lasts 3.5 minutes on average with a standard deviation of 1.5, so the session lasts 70 on average. I ran pnorm(75, 70, 1.5) and got 0.9996: “no way it runs over”. On the third day, the last song was still playing when the instructor switched off the lights. My mistake was the standard deviation: 1.5 belongs to one song, and the one of a sum of 20 is . With the right one, the probability drops to 0.77: roughly one session in four runs over.
This topic is about what you can say about a variable, and above all about a sum or a mean of many, without knowing its exact distribution. First two bounds that always hold, Markov’s inequality and Chebyshev’s; then the two theorems that hold up all the inference of EC2: the law of large numbers (the mean approaches ) and the central limit theorem (the mean is distributed almost like a normal). We carry on from transformations and joint distributions: sums of independent variables and their means and variances are the same, and the normal is the one from the normal distribution. The proofs, step by step, are in the inequalities and limit theorems proofs.
Table of Contents
Before you start. For this topic you need to know what the mean and the variance of a variable are (topic 4), how the mean and the variance of a sum of independent variables come out (topic 6), and how to use the normal: standardise, read the table and pnorm (topic 5). The topic has three parts, in this order. First, two bounds that hold even when you don’t know the distribution: Markov (it only uses the mean) and Chebyshev (it uses the variance too). Then, what happens when you add up or average many variables: the law of large numbers says where the mean goes, and the central limit theorem says what shape it spreads with around that point (a normal). And at the end, two exam uses: the continuity correction for integer variables and how many observations you need for a given precision. All the way through we use the same playlist of songs that last 3.5 minutes on average. If you get lost, ask yourself whether you are talking about one song, the whole session or the mean of the session: almost every mistake in this topic is mixing up those three.
The playlist that comes with us
You go to the gym with the “Workout” playlist of your music app, on shuffle. Only one thing about each song matters to us: how long it lasts. We call the length, in minutes, of a song picked at random.
The model for the whole topic: no song is shorter than 2 minutes, most are around 3 and a few (remixes, extended versions) go to 7 or 8. That is captured like this:
It is an exponential shifted by 2 minutes. Its density is for , and what you will need from it is its mean and variance:
l <- 2/3 # rate of the exponential part fX <- function(x) l * exp(-l * (x - 2)) # density of one song, x >= 2 integrate(fX, 2, Inf) # must give 1 mu <- integrate(function(x) x * fX(x), 2, Inf)$value v <- integrate(function(x) (x - mu)^2 * fX(x), 2, Inf)$value round(c(mean = mu, var = v, sd = sqrt(v)), 2)
Output:
1 with absolute error < 8.6e-06 mean var sd 3.50 2.25 1.50
The density integrates to 1 and the mean and variance are those of the formulas: 3.5 minutes on average, 1.5 standard deviation. The data are made up, but the shape is that of real song lengths: skewed, with a long tail to the right.
The drawing shows why this example works for this topic: the length of a song looks nothing like a normal. It starts abruptly at 2 minutes, falls quickly and has a long tail. Even so, we will be able to compute probabilities for a 20-song session with pnorm. That is the miracle of the central limit theorem.
What you know without knowing the distribution
Imagine the app only tells you two numbers: the mean length of the songs on the playlist and their standard deviation. You know nothing else about the shape. Can you say anything about the probability that a song lasts more than 7 minutes? Yes: a bound. Worse than the exact value, but safe for any distribution.
Markov’s inequality
Before the formula, do the sum with songs. Take 100 songs from the playlist. If the mean is 3.5 minutes, together they add up to 350. That is all you know.
How many of those 100 can last 7 minutes or more? Suppose it were 60. Those 60 alone would add up to at least minutes, more than the 350 there are in total. Impossible. The maximum comes from sharing out the 350 minutes in the sneakiest way: a few songs last exactly 7 and the rest, 0. That fits . At most 50 out of 100, half. With other thresholds:
| Threshold (minutes) | At most, songs out of 100 that reach | Proportion | Why |
|---|---|---|---|
| 5 | 0.70 | 71 songs of 5 minutes already add up to 355, more than 350 | |
| 7 | 0.50 | 51 songs of 7 minutes add up to 357 | |
| 10 | 0.35 | The higher the threshold, the fewer songs fit | |
| 14 | 0.25 | With a threshold of four times the mean, at most one in four |
The proportion is always the mean divided by the threshold, . That is Markov’s inequality. And look at what holds it up: for the long songs to use up as little as possible, the rest last 0, not less. If a duration could be negative, it would make up for the long ones and the argument would break. That is why Markov asks for . The same thing, with letters:
If is a non-negative variable with finite mean, for any :
Read it like this: if the mean is 3.5, there cannot be many very long songs, because they would push the mean up. At most half of the songs can last 7 minutes or more (if it were more than half, the mean would exceed 3.5).
3.5 / 7 # Markov bound for P(X >= 7) 1 - pexp(7 - 2, 2/3) # the truth: X - 2 is an exp(2/3)
Output:
[1] 0.5 [1] 0.03567399
The bound says “at most 50 %”. The truth is 3.57 %. The bound is true, but very loose: it uses nothing but the mean. That is why Markov is hardly ever used to compute, but as a step to prove the next one.
Check you’ve got it: what does Markov say about the probability that a song lasts 3 minutes or more?
Nothing useful. The sum gives , which is true, but no probability goes above 1. With the 100 songs you can see why: you would need 117 songs of 3 minutes to use up the 350 minutes, and there are only 100. Markov only says something when the threshold is above the mean, and the further away, the more it says.
Applying Markov to a variable that can be negative. If takes negative values, the bound can be false: with uniform on , the mean is 0.5 and Markov would “say” , when the truth is . Negative values lower the mean without taking probability away from the tail. Before using Markov, check that .
Chebyshev’s inequality
Before the formula, the same argument as with Markov, but looking at something else: how far each song is from the mean. 100 songs again. The variance, 2.25, is the mean of the squared distances to 3.5, so across the 100 they add up to of squared distance.
Why squared? Because signed distances cancel out: the short songs are below 3.5 and the long ones above, and the mean of is always 0. Squared, they all add up.
How many songs can be 3 minutes or more away from the mean, that is, last 0.5 or less or 6.5 or more? Each one contributes at least to that total of 225. At most fit: 25 %. With other distances:
| Distance from the mean | In standard deviations, | At most, songs out of 100 | Why |
|---|---|---|---|
| 1.5 | 1 | It says nothing: all 100 could be exactly one standard deviation away | |
| 2.25 | 1.5 | It is the 0.4444 in the R table further down | |
| 3 | 2 | Each one uses up 9 of the 225 | |
| 4.5 | 3 | One in nine, |
It is Markov applied to the squared distance, , which is never negative; that is why here you don’t need to ask for . And the proportion that comes out is always : it depends neither on the mean nor on the variance, only on how many standard deviations you move away. Now, the formula:
If besides the mean you know the variance , the bound improves a lot. For any :
The usual thing is to measure the distance in standard deviations, , and then you get a form that depends on nothing:
With : any variable with finite variance leaves at most 25 % of its probability more than two standard deviations from its mean, and at least 75 % inside. With , at most 11.1 % outside and at least 88.9 % inside.
In the drawing, the green band is and the coral tail is what falls outside. Below there is nothing (no song lasts less than 2 minutes); above, the tail of songs longer than 6.5 minutes. Chebyshev promises that tail is at most 0.25. It is 0.05.
How loose is the bound? Compare it with the truth for the song and with what would happen if the length were normal:
k <- c(1.5, 2, 3) bound <- 1 / k^2 # Chebyshev: holds for any X song <- 1 - pexp(1.5 + 1.5 * k, 2/3) # exact: only the upper tail (X >= 2) normal <- 2 * pnorm(-k) # if X were normal round(data.frame(k, bound, song, normal), 4)
Output:
k bound song normal 1 1.5 0.4444 0.0821 0.1336 2 2.0 0.2500 0.0498 0.0455 3 3.0 0.1111 0.0183 0.0027
How to read it
- Each row is a distance.
k = 2is “more than two standard deviations from the mean”, that is, outside the interval . boundis the worst that can happen. 0.25 with : no distribution with that mean and variance leaves more than 25 % outside.songis what happens with our playlist. 0.0498 with : 5 % of the songs last more than 6.5 minutes. Five times less than the bound allows.normalis what would happen if the length were normal. 0.0455 with , the famous 95 % inside. With , 0.0027 (99.7 % inside), forty times less than the bound.
The Chebyshev bound is not “wrong”: it is the best possible if you only know and , because there are odd distributions that reach it (you will see one in the bonus of the exercises). The price of holding for all of them is being loose for almost all of them.
To go from an interval to , set the end equal to . What does Chebyshev say about songs between 1.25 and 5.75 minutes? , so and the probability is at least . It only works if the interval is symmetric about the mean.
With data: the 75 % rule
Chebyshev also holds for a data set, with its mean and standard deviation : at least of the data fall in , whatever their shape. With a sample of 60 songs from the app:
set.seed(2026) playlist <- 2 + rexp(60, 2/3) # 60 songs from the playlist m <- mean(playlist); s <- sd(playlist) round(c(mean = m, sd = s), 2) mean(abs(playlist - m) < 2 * s) # inside mean ± 2s mean(abs(playlist - m) < 3 * s) # inside mean ± 3s
Output:
mean sd 3.81 2.11 [1] 0.9333333 [1] 0.9833333
This sample came out with somewhat longer songs (mean 3.81 and ). Inside there are 93.3 % of the songs (Chebyshev guaranteed 75 %) and inside , 98.3 % (it guaranteed 88.9 %). If your data were normal you would expect 95 % and 99.7 %: the 68-95-99.7 rule is only for the normal; the 75 % one always holds.
The sum and the mean of many songs
A session is not one song: it is . We call their lengths, independent and all with the distribution of (they are iid, independent and identically distributed). How long the session lasts is the sum, and the typical length of a song in that session, the mean:
From what you saw in topic 6 (expectation of a sum, variance of a sum of independent variables):
The two standard deviations are the ones to remember, because they are the hook’s mistake:
sigma <- 1.5; n <- c(1, 5, 20, 100) round(sigma * sqrt(n), 2) # standard deviation of the sum round(sigma / sqrt(n), 3) # standard deviation of the mean
Output:
[1] 1.50 3.35 6.71 15.00 [1] 1.500 0.671 0.335 0.150
With 20 songs, the session has a standard deviation of 6.71 minutes (not 1.5) and the mean of those 20 songs, of 0.335 minutes. The sum spreads out with ; the mean concentrates with . To make the mean twice as precise you need four times the songs.
The law of large numbers
The law in one sentence: if you repeat the same experiment many times, independently, and take the mean of what comes out, that mean ends up as close as you like to the true mean , with a probability as close to 1 as you like. It asks for three things, and it pays to know which, because in the exam they can ask you whether it applies:
- Independent. Each song knows nothing about the previous ones. If the songs depended on each other, the formula would stop holding.
- With the same distribution. All from the same playlist, with the same . If halfway through the session you switch to a list of 40-minute podcasts, which would the mean be heading for?
- Finite variance, in the version proved in ME1. It is what lets you use Chebyshev.
What it doesn’t say: that the mean ever becomes exactly 3.5, or from which song on it is close. It says that the probability of being far goes to 0; what that means, at the end of this section.
If the mean of songs has standard deviation , which goes to 0, the mean must end up stuck to . The law of large numbers says it with a probability: if are iid with mean and variance , for any ,
It is Chebyshev applied to , whose variance is . This kind of convergence is called convergence in probability: moves away from by more than you want with a probability that tends to 0. With the playlist and minutes (15 seconds):
| Bound: | |
|---|---|
| 50 | |
| 200 | |
| 1000 |
This is how it looks in a single playlist: 2000 songs in a row and, after each one, the mean of those so far.
set.seed(2026) x <- 2 + rexp(2000, 2/3) # 2000 songs in a row running_mean <- cumsum(x) / seq_along(x) # mean of the first n round(running_mean[c(1, 10, 50, 200, 1000, 2000)], 3) plot(running_mean, type = "l", log = "x", xlab = "n", ylab = "mean") abline(h = 3.5, lty = 2)
Output:
[1] 2.596 4.073 3.981 3.643 3.561 3.547
How to read it
- 2.596 with one song: the first lasted 2.6 minutes. A single song says almost nothing about the mean.
- 4.073 and 3.981 with 10 and 50: two long remixes early on pull the mean up. With few songs, an extreme value weighs a lot.
- 3.643, 3.561 and 3.547 with 200, 1000 and 2000: the mean goes down towards 3.5 and moves less and less. In the drawing (horizontal axis on a log scale, as in the
plot), the line zigzags at first and flattens on the dashed 3.5.
cumsum(x) / seq_along(x) is the trick to get all the means at once: cumsum gives the running sums and seq_along(x) the to divide by.
“I’ve had five short songs in a row, so long ones are due to make up for it”. The law of large numbers does not say that: songs are independent and the sixth knows nothing about the previous five. The mean approaches 3.5 because the five short ones end up diluted among hundreds of ordinary songs, not because long ones come to compensate. It is the gambler’s fallacy.
The relative frequency of topic 2 is the same law. If is 1 when you skip song and 0 otherwise, each is a Bernoulli with mean and is the proportion of skipped songs, which approaches . That is why it makes sense to define probability as “the frequency in the long run”.
What it means for the mean to “converge”
In calculus, converging is simple: the sequence 1, 0.5, 0.33, 0.25… gets closer to 0 and, from some point on, never moves away again. With means of songs it can’t work like that. It is always possible, although extremely rare, to get a hundred long remixes in a row and see the mean shoot up. What does go to 0 is the probability of that happening.
The definition, in three steps:
- You fix a tolerance . Here, 15 seconds: .
- For each , you work out a number: the probability that the mean of songs falls outside .
- You look at that sequence of numbers. If it goes to 0, and the same happens with any other tolerance you choose, converges in probability to .
With the playlist you can actually compute it, because the sum of exponentials is a gamma (you will use it in the 20-song session, with pgamma):
| Chebyshev bound for falling outside, | Real probability of falling outside | Why | |
|---|---|---|---|
| 20 | 1.8 | 0.45 | The bound is above 1: it says nothing. With 20 songs, almost half of the sessions have a mean more than 15 seconds away from 3.5 |
| 50 | 0.72 | 0.24 | The bound now says something, but the truth is three times smaller |
| 200 | 0.18 | 0.02 | Only 2 in 100 lists of 200 songs fall outside |
| 1000 | 0.04 | 0.00 | About 3 in 10 million: practically impossible, but not zero |
The bound is the table above seen from the other side (). Both columns go to 0. The real one gets there sooner, but computing it requires knowing the distribution; Chebyshev doesn’t, and that is why it proves the law in general.
The word converge appears twice in this topic, with different meanings. Here, the mean gets closer to a number, : the question is “where does it go?”. In the central limit theorem, what gets closer is a whole distribution, that of to that of the : the question is “what shape does it spread with?”.
Check you’ve got it: you have listened to 2000 songs and your mean is 3.547. Does that contradict the law of large numbers?
No. The law doesn’t say the mean is 3.5, but that it is very unlikely to be far away. 3.547 is 0.047 minutes from 3.5, less than 3 seconds, within any reasonable tolerance, like the 15 seconds in the table. And it is what you would expect: with 2000 songs the standard deviation of the mean is , so 3.547 is only 1.4 standard deviations away from 3.5.
The central limit theorem
The law of large numbers says where the mean goes. The central limit theorem (CLT) says how it spreads around that place: like a normal, whatever the distribution of each .
Before the statement, the idea in words. A session is a sum of 20 songs. For it to last a very long time, almost all of them would have to come out long at once, and for it to be very short, almost all short. Both things are extremely rare: the probability that a song goes over 5 minutes is , and that all 20 do at once, , a number with 17 zeros after the decimal point. The usual thing is a mix: some long and some short that balance out. There are a huge number of mixes that give about 70 minutes and very few that give an extreme session. That is why the sum piles up in the center and thins out on both sides, almost symmetric even though each song isn’t.
What the theorem adds is that this bell is precisely a normal, and that to use it you only need two numbers from each song: its mean and its standard deviation. The recipe for every exercise:
- Sum or mean? Are they asking about the total (the session) or the average (the typical song of the session)?
- Its mean and its standard deviation. For the sum, and . For the mean, and .
- The normal with those two numbers. pnorm, or standardise and read the table.
Now, the formal statement:
If are iid with mean and finite variance , the standardised variable
has a distribution function that approaches, as , that of an . This is called convergence in distribution. In practice it is used like this, for large :
(with the course notation, , the same one pnorm uses).
Why standardise, if the law of large numbers already says that goes to ? Because, without standardising, the distribution of gets squashed: its standard deviation goes from 1.5 to 0.335 with 20 songs and to 0.15 with 100, and in the limit everything ends up at the point 3.5. There you can’t see any shape any more. is a magnifying glass: it subtracts to center and divides by so that the width stays 1 for any . With that glass on, what appears as grows is the bell. The law and the theorem don’t contradict each other: one looks without the glass and the other, with it.
To see it with the playlist, we simulate 10,000 times the mean of songs, for and 20:
set.seed(2026)
mean_of <- function(n) mean(2 + rexp(n, 2/3)) # the mean of n songs
par(mfrow = c(2, 2))
for (n in c(1, 2, 5, 20)) {
m <- replicate(10000, mean_of(n))
hist(m, freq = FALSE, breaks = 40, main = paste("n =", n), xlab = "mean")
curve(dnorm(x, 3.5, 1.5 / sqrt(n)), add = TRUE, lwd = 2)
cat("n =", n, " mean:", round(mean(m), 3), " sd:", round(sd(m), 3),
" theoretical:", round(1.5 / sqrt(n), 3), "\n")
}
Output:
n = 1 mean: 3.545 sd: 1.522 theoretical: 1.5 n = 2 mean: 3.481 sd: 1.055 theoretical: 1.061 n = 5 mean: 3.496 sd: 0.67 theoretical: 0.671 n = 20 mean: 3.499 sd: 0.334 theoretical: 0.335
How to read it
meanalways close to 3.5: the mean of the means does not depend on , because .sdequal totheoretical: 1.522 against 1.5; 1.055 against 1.061; 0.67 against 0.671; 0.334 against 0.335. The simulation confirms .- The shape, in the drawing: with the histogram is the song itself, a slide that looks nothing like the bell. With it already has a hump, but skewed. With the bell almost fits, although the right tail is still longer. With , the histogram and the normal with mean 3.5 and standard deviation 0.335 are almost the same curve.
Nobody has changed the distribution of the songs: each one is still a shifted exponential. What becomes normal is the mean of many.
The 20-song session
Now the hook done properly. With , :
The same calculation, without skipping anything:
| Step | What you do | Calculation | Why |
|---|---|---|---|
| 1 | You decide which variable you are talking about | , the session | They ask whether the whole session fits: it is a total, not a typical song |
| 2 | Mean and standard deviation of one song | , | From the model at the start |
| 3 | Those of the sum | ; | The mean is multiplied by ; the standard deviation only by , because what gets multiplied by is the variance |
| 4 | You check you can use the CLT | , iid | Independent songs from the same playlist, and within the course rule |
| 5 | You standardise | 75 minutes is 0.75 standard deviations above the mean of the session | |
| 6 | You read the table | The table gives the area to the left of | |
| 7 | You say it in the problem | 0.77 | 77 % of sessions fit in 75 minutes; almost one in four runs over |
There is no continuity correction step: the duration is continuous. When you need it, in the section on discrete variables.
Check you’ve got it: what is the probability that the mean duration of the 20 songs is at most 3.75 minutes?
The same, 0.77. The mean being at most 3.75 is the same as the session lasting at most minutes: it is the same event said another way. With the mean it comes out the same: its standard deviation is , and . If the two routes give you different numbers, you have mixed up and .
Here there is a stroke of luck you will hardly ever have: the exact value can be computed. is the sum of 20 independent exponentials with rate 2/3, which is a gamma(20, 2/3) (you proved it in topic 6). So we compare:
mu <- 3.5; sigma <- 1.5; n <- 20 pnorm(75, n * mu, sigma * sqrt(n)) # CLT: S ≈ N(70, 6.71) pgamma(75 - 40, shape = 20, rate = 2/3) # exact: S - 40 is a gamma(20, 2/3) pnorm(75, n * mu, sigma) # the hook's mistake
Output:
[1] 0.7719717 [1] 0.7826581 [1] 0.9995709
How to read it
- 0.7719717 with the CLT: 77 % of the sessions fit in 75 minutes; almost one in four runs over.
- 0.7826581 exact: the approximation is off by one hundredth. In the drawing, the exact gamma (violet) is slightly skewed to the right and the normal (coral) is symmetric, but the two areas up to 75 almost coincide.
- 0.9995709 with the standard deviation of one song: a very narrow bell, with almost all its area before 75. It is the hook’s calculation, and it can cost you a whole exam part.
Standardising the sum with or with . The sum goes with and the mean with . If in doubt, think of the units of the problem: 20 songs of 3.5 minutes cannot vary by only 1.5 minutes in total.
When is “large”?
The CLT is a limit: it does not say from which the approximation is good. It depends on how far each is from being normal:
- If the are already normal, is exactly normal for any (topic 5). You do not need the CLT.
- If they are symmetric (a uniform, for example), with or 12 it already works very well.
- If they are skewed, like our songs, you need more: with it was off by one hundredth.
- The rule used in the course is or 30; in the exam, if the statement gives and says “approximately” or “using the CLT”, use it and say so.
The CLT requires finite variance. There are distributions (the Cauchy, for example) whose mean of observations has exactly the same distribution as a single one: it never concentrates nor becomes normal. It does not come up in ME1, but it is the reason for that condition.
Discrete variables: the continuity correction
The CLT holds for discrete variables too. If is a Bernoulli, their sum is a binomial and the CLT says that, for large , .
With the playlist: you skip each song with probability , independently. In 40 songs, what is the probability of skipping 8 or fewer? Skipped: , with mean 10 and standard deviation .
n <- 40; p <- 0.25 pbinom(8, n, p) # exact pnorm(8, n * p, sqrt(n * p * (1 - p))) # CLT without correction pnorm(8.5, n * p, sqrt(n * p * (1 - p))) # CLT with continuity correction
Output:
[1] 0.2998323 [1] 0.2326044 [1] 0.2919412
How to read it
- 0.2998323 exact: 30 % of the time you skip 8 songs or fewer.
- 0.2326044 uncorrected: the normal falls short by almost 7 hundredths. The drawing shows why: each value of the binomial is a bar of width 1, and the bar for 8 runs from 7.5 to 8.5. Cutting at 8, the normal leaves out half a bar.
- 0.2919412 with the correction: cutting at 8.5 the normal picks up the whole bar and the approximation is eight thousandths away.
The continuity correction is just that: to approximate an integer variable with the normal, each value becomes the interval . The four translations that come up most:
| Discrete | Approximated with |
|---|---|
Before adding or subtracting 0.5, write the event with and and with the integer values that really belong. is the values 0 to 7, so the edge is 7.5, not 8.5.
The correction, step by step and by hand
In the paper exam you don’t have pnorm: you have the table. This is how the 0.29 of the skipped songs comes out:
| Step | Calculation | Why |
|---|---|---|
| 1. Is it an integer? | , skipped songs: 0, 1, 2… | It counts things, so there is a correction |
| 2. Mean and standard deviation | ; | It is a sum of 40 Bernoulli with |
| 3. The event with integers | : 0, 1, …, 8 are in | 8 is in, so its whole bar is in |
| 4. The edge | 8.5 | The bar of 8 ends at 8.5 |
| 5. Standardise | You subtract the mean and divide by the standard deviation | |
| 6. Table | The table only has positive : you use symmetry |
Without step 4 you would have standardised with 8: and , the 0.2326 from R that fell short.
Check you’ve got it: with the ads, T ~ Pois(60), what edge do you use to approximate P(T > 70) and what do you get?
First, with integers: means 71, 72, 73…, that is, . The bar of 71 starts at 70.5, so the edge is 70.5. You standardise with mean 60 and standard deviation : and . The exact one, 1 – ppois(70, 60), is also 0.09. If they give it to you as , the edge is still 70.5; adding 0.5 without first writing the integers would give 71.5 and leave out the bar of 71.
The same happens with a Poisson, because a Poisson is the sum of independent Poisson: for large , . If the free version of the app plays 2 ads per session on average, in 30 sessions you get , and . The exact one, ppois(50, 60), is 0.108.
How many songs do you need? The sample size
A typical exam question the other way round: how many songs do you need to listen to so that their mean length is within 15 seconds ( minutes) of the true one with probability 0.95? It can be answered with the two tools of the topic, and they give very different answers.
With Chebyshev (always holds, even if you know nothing about the shape): it is enough that .
With the CLT (for large , almost normal): it is enough that is standard deviations of the mean, .
sigma <- 1.5; c0 <- 0.25 ceiling(sigma^2 / (0.05 * c0^2)) # Chebyshev ceiling((qnorm(0.975) * sigma / c0)^2) # CLT
Output:
[1] 720 [1] 139
Chebyshev asks for five times as many songs. Both answers are right for what they ask: Chebyshev guarantees 95 % whatever happens; the CLT achieves it “approximately”, which with 139 songs is more than enough. In the exam, use the one the statement asks for; if it says nothing and comes out large, the CLT.
Rounding down. If you get , the answer is 139: with 138 you do not make it. ceiling() rounds up.
Bounds, normal or CLT: which to use
| What you know | What you can say | With |
|---|---|---|
| Only the mean and | A bound for a tail | Markov |
| The mean and the variance | A bound for | Chebyshev |
| The exact distribution of | The exact probability | p… of that distribution |
| normal | The exact probability of , and | pnorm (topic 5) |
| Mean and variance of each , large | An approximation for and | CLT + pnorm |
| The above, and the are integers | A better approximation | CLT + continuity correction |
In R: what you need
| I want… | In R |
|---|---|
| The Chebyshev bound at standard deviations | 1 / k^2 |
| with the CLT | pnorm(s, n * mu, sigma * sqrt(n)) |
| with the CLT | pnorm(x, mu, sigma / sqrt(n)) |
| Continuity correction, | pnorm(k + 0.5, n * p, sqrt(n * p * (1 - p))) |
| Simulate 10,000 means of | replicate(10000, mean(rexp(n, l))) |
| The running means | cumsum(x) / seq_along(x) |
| Compare with the normal | hist(m, freq = FALSE) + curve(dnorm(x, mu, sigma / sqrt(n)), add = TRUE) and qqnorm(m) |
| The minimum | ceiling(...) |
What is proved in this topic
All of it, step by step and checked with R, in the inequalities and limit theorems proofs:
- Markov’s inequality, splitting the integral of the mean in two pieces.
- Chebyshev’s inequality, applying Markov to , and its forms with .
- The weak law of large numbers, with Chebyshev applied to .
- The law for relative frequencies and the that guarantees a precision with unknown .
- The two faces of the CLT: why and are the same variable.
- The CLT with the moment generating function (the idea of the proof).
- The Poisson and the binomial become normal, with the mgf.
- The sample size with Chebyshev and with the CLT.
Typical mistakes
Mixing up , and . One song: . The session (sum): . The session mean: . It is the hook’s mistake.
Saying the CLT makes normal. Each song is still a shifted exponential even if you listen to a thousand. What becomes normal is the sum or the mean.
Using the Chebyshev bound as if it were the probability. “The probability is 0.75” is wrong; “the probability is at least 0.75” is right. And watch the direction: the inside one is a lower bound () and the outside one, an upper bound ().
Applying Chebyshev to an interval that is not centred on the mean. If the interval is and the mean is 3.5, there is no single . Use the of the nearer side (the symmetric interval that fits inside) or, if you are asked for a bound on a tail, the side that applies.
Forgetting the continuity correction in a binomial or a Poisson, or applying it to a continuous variable. You only correct when the variable you approximate takes integer values.
Try it in the R playground
Open the R playground on the site (or RStudio) and paste this script. It brings together the bounds, the law of large numbers and the CLT for the session:
set.seed(2026) song <- function(n) 2 + rexp(n, 2/3) # lengths of n songs # 1. Chebyshev against the truth, at two standard deviations x <- song(100000) c(bound = 1 / 2^2, simulated = mean(abs(x - 3.5) >= 3)) # 2. The running mean approaches 3.5 running_mean <- cumsum(x[1:2000]) / (1:2000) plot(running_mean, type = "l", log = "x"); abline(h = 3.5, lty = 2) # 3. 10,000 sessions of 20 songs: how many fit in 75 minutes? sessions <- replicate(10000, sum(song(20))) c(simulated = mean(sessions <= 75), CLT = pnorm(75, 70, 1.5 * sqrt(20))) hist(sessions, freq = FALSE, breaks = 40) curve(dnorm(x, 70, 1.5 * sqrt(20)), add = TRUE, lwd = 2)
Things to look at:
- That the simulated proportion outside comes out close to 0.05, far below the bound of 0.25.
- That the running mean line zigzags at first and flattens on 3.5.
- That the simulated proportion of sessions that fit comes out close to 0.78 (the exact one), with the CLT at 0.77.
- Change
sum(song(20))tosum(song(3))and 75 to 15: with 3 songs the histogram is still skewed and the CLT is further off.
Summary
| Result | What it says | Formula |
|---|---|---|
| Markov | Bound for a tail if | |
| Chebyshev | Bound for moving away from the mean | |
| Sum and mean | Center and spread | : , ; : , |
| Law of large numbers | approaches | |
| CLT | and are almost normal | , |
| Continuity correction | For integer variables | |
| Sample size | for a precision | Chebyshev ; CLT |
Three ideas to take away:
- Chebyshev holds for everything and that is why it is loose. It gives a safe bound with only and ; if you know the distribution, compute the real probability.
- The mean concentrates with and the sum spreads with . Before each
pnorm, ask yourself which of the two you are talking about. - The CLT turns almost any sum into a normal. With mean, variance and large you already have
pnorm; if the variable is an integer, correct with ± 0.5.
Now it is time to see the calculations on the computer: in the inequalities and limit theorems practice in R you check the bounds with 100,000 songs, watch the law of large numbers at work and repeat the CLT of practical 9 with histograms and quantile-quantile plots.
Next step: proofsInequalities and limit theorems proofs — step by step with the playlist, Markov, Chebyshev, the law of large numbers and the CLT with the mgf (and the bound I wrote the wrong way round)Did this article help you? Here is how you can support SergioLearns →



