Inequalities and limit theorems exercises — exam-style with R, Chebyshev, the CLT and the continuity correction (and the 12.5 that cost me a part)

In a class mock exam I was asked for the probability of 12 or more quiet sessions, and I wrote without thinking 1 - pnorm(12.5, ...). I remembered the continuity correction as “add 0.5”, so I added it. I got 0.087 when the right answer was 0.164: almost half. “12 or more” starts at the bar for 12, which runs from 11.5 to 12.5, so the edge is 11.5. Since then I write down the integer values that belong before touching the 0.5, and that is what you will see in exercise 3.

These are exam-style exercises on inequalities and limit theorems, in the format of ME1’s EC2: one context per exercise, chained parts, paper and R mixed and the marks for each part. If you want to review first, you have the proofs and the R practice of the topic.

How to use this article

  • Do the exercises with the exam in mind. In ME1’s EC2 you have 4 hours for 50 marks, with RStudio and the data open. These three exercises add up to 40 marks plus a 2.5 bonus: give them about 3 hours.
  • Paper for what is proved, R for what is computed. Calculations with 2 decimals, as the exam asks. Whatever you do in R, keep it in a script: at the end of the exam you have to upload the .R file with the code for each exercise.
  • Before each pnorm, decide what you are talking about. One observation, a sum or a mean? The standard deviation is σ\sigma, σn\sigma\sqrt n or σ/n\sigma/\sqrt n.
  • Mark with the criteria. Each solution comes with “How it is marked” and a split of the marks. It is a guide, mine: not the official criteria.
  • Finish with the cheat sheet and “For your script”. The cheat sheet only has results (it is what you may bring handwritten: two sheets, both sides, in EC2) and “For your script” is the topic’s code ready for your .R file.

Exercise 1: the watch steps (10 marks)

Your sports watch counts the steps you take each day. After months of use, the app tells you the mean is 8000 steps a day with a standard deviation of 1500, and nothing more about the distribution. We call XX the steps of one day.

  1. (2 marks) Give a lower bound for the probability that on one day you take between 5000 and 11,000 steps.
  2. (2 marks) Give a bound for the probability that on one day you reach 16,000 steps or more, first with Markov’s inequality and then with Chebyshev’s. Which is better and why?
  3. (3 marks) If you also knew that X∼N(8000,1500)X \sim N(8000, 1500), compute with R the probability of part 1 and compare it with the bound.
  4. (3 marks) Consider the mean steps over 30 days, with independent days. Give a lower bound for the probability that this mean is less than 500 steps away from 8000 and compute that same probability approximately with the CLT. Interpret the difference.

Exercise 2: the heart-rate monitor battery (15 marks)

In each workout session your heart-rate monitor uses a fraction XX of the battery, which we model with the density

f(x)=12x2(1−x),0<x<1 f(x) = 12x^2(1 – x), \qquad 0 < x < 1

Sessions are independent and the battery is fully recharged every night.

  1. (3 marks) Check on paper that ff is a density and compute E(X)E(X) and Var(X)\text{Var}(X).
  2. (2 marks) Check the three results of the previous part with integrate.
  3. (4 marks) Let SS be the total fraction of battery used in 30 sessions (in “full charges”). Using the CLT, compute approximately P(S≥19)P(S \ge 19), that is, that in a month of 30 sessions you use 19 charges or more.
  4. (3 marks) How many sessions do you need for the mean fraction used to be within 0.05 of its mean with probability 0.95? Answer with the CLT and with Chebyshev.
  5. (3 marks) Simulate with rbeta 10,000 months of 30 sessions, estimate P(S≥19)P(S \ge 19) and draw the histogram of SS with the CLT normal on top. Is the approximation of part 3 good?

Exercise 3: the workout notifications (15 marks)

During a one-hour workout session you get phone notifications according to a Poisson with mean 1.5, independent from one session to another. You have done 40 sessions.

  1. (3 marks) Let TT be the total number of notifications in the 40 sessions. Justify with the moment generating function what the exact distribution of TT is.
  2. (4 marks) Compute approximately, with the CLT and the continuity correction, P(50<T≤70)P(50 < T \le 70), and compare it with the exact value in R.
  3. (4 marks) A session is “quiet” if no notification arrives. Compute the probability pp that a session is quiet and, with the CLT, the approximate probability of having 12 or more quiet sessions out of 40. Compare it with the exact one.
  4. (4 marks) You want to estimate pp with the proportion of quiet sessions, with an error below 0.05 and probability 0.95. How many sessions do you need if you know nothing about pp, with Chebyshev and with the CLT? And with the CLT, if you use the value of pp from part 3?

Bonus (2.5 marks)

Prove that the Chebyshev bound for k=2k = 2 cannot be improved: build a discrete variable with mean 8000 and standard deviation 1500 (the steps of exercise 1) for which P(∣X−8000∣≥3000)P(|X – 8000| \ge 3000) is exactly 1/41/4.

Solutions

Exercise 1

Before the first calculation. You are given a mean, a standard deviation “and nothing else about the distribution”. That rules out the obvious path, pnorm: you don’t know the steps are normal, so in parts 1, 2 and 4 you can’t compute probabilities, only bound them. With so little information, Markov (mean and X≥0 X \ge 0 ) and Chebyshev (mean and variance) are what works. That’s why the first step of each part is to rewrite the event in the shape the inequality asks for: X≥t X \ge t or ∣X−μ∣<kσ |X – \mu| < k\sigma . Part 3 gives you the normal precisely so you can measure how much you lose without it.

Part 1. The interval (5000,11,000)(5000, 11{,}000) is 8000±30008000 \pm 3000, and 3000=2⋅15003000 = 2 \cdot 1500: k=2k = 2. By Chebyshev:

P(5000<X<11,000)=P(∣X−8000∣<2σ)≥1−122=0.75 P(5000 < X < 11{,}000) = P(|X – 8000| < 2\sigma) \ge 1 – \frac{1}{2^2} = 0.75

On at least 75 % of the days you take between 5000 and 11,000 steps.

Part 2. Steps are ≥0\ge 0, so Markov applies:

P(X≥16,000)≤E(X)16,000=800016,000=0.5 P(X \ge 16{,}000) \le \frac{E(X)}{16{,}000} = \frac{8000}{16{,}000} = 0.5

With Chebyshev, since X≥16,000X \ge 16{,}000 implies ∣X−8000∣≥8000|X – 8000| \ge 8000:

P(X≥16,000)≤P(∣X−8000∣≥8000)≤1500280002=0.035 P(X \ge 16{,}000) \le P(|X – 8000| \ge 8000) \le \frac{1500^2}{8000^2} = 0.035

Chebyshev is much better (0.035 against 0.5) because it also uses the variance: with a standard deviation of 1500, moving 8000 steps away is moving more than 5 standard deviations away.

Why go through ∣X−8000∣≥8000 |X – 8000| \ge 8000 . Chebyshev talks about both tails at once, and the question asks about one. The trick is to enlarge the event: every day with 16,000 steps or more is 8000 or more away from the mean, and a bound for the big event also holds for the small one. Here k=8000/1500=5.33 k = 8000/1500 = 5.33 and 1/k2=0.035 1/k^2 = 0.035 .

Using k=16,000/1500 k = 16{,}000/1500 . k k measures the distance to the mean, not the value. And another classic: writing 1−1/k2 1 – 1/k^2 , which is the bound for staying close, when here you’re asked about moving away.

Part 3.

pnorm(11000, 8000, 1500) - pnorm(5000, 8000, 1500)   # if X were N(8000, 1500)

Output:

[1] 0.9544997

With the normal, 95.45 % of the days fall in the interval, against Chebyshev’s “at least 75 %”. The bound is true (0.95 ≥ 0.75), but it falls short because it does not use the shape of the distribution.

Setting up part 4. The main character changes: it’s no longer the steps of one day, but the mean of 30 days. Before writing anything, ask yourself what standard deviation Xˉ \bar X has: 1500/30=273.86 1500/\sqrt{30} = 273.86 , much smaller, because when you average, the high days and the low days cancel out. With that, Chebyshev works just like in part 1: k=500/273.86=1.83 k = 500/273.86 = 1.83 and 1/k2=0.30 1/k^2 = 0.30 .

Check you’ve got it: what do you get if in part 4 you use the standard deviation of one day, 1500?

k=500/1500=0.33 k = 500/1500 = 0.33 and a “bound” 1−1/k2=1−9=−8 1 – 1/k^2 = 1 – 9 = -8 . A probability greater than or equal to −8 -8 is true, but it says nothing. That absurd number is the sign that you’ve used the standard deviation of one observation to talk about a mean: for Xˉ \bar X it’s σ/n \sigma/\sqrt n .

Part 4. The 30-day mean has mean 8000 and variance 15002/301500^2/30. By the law of large numbers (Chebyshev on Xˉ\bar X):

P(∣Xˉ−8000∣<500)≥1−1500230⋅5002=1−0.3=0.70 P(|\bar X – 8000| < 500) \ge 1 – \frac{1500^2}{30 \cdot 500^2} = 1 – 0.3 = 0.70

With the CLT, Xˉ≈N(8000,1500/30)=N(8000,273.86)\bar X \approx N(8000, 1500/\sqrt{30}) = N(8000, 273.86):

1 - 1500^2 / (30 * 500^2)                      # Chebyshev bound
2 * pnorm(500 / (1500 / sqrt(30))) - 1         # CLT: P(|mean - 8000| < 500)

Output:

[1] 0.7
[1] 0.9321108

Chebyshev guarantees 70 % whatever happens; the CLT says that it is approximately 93 %. They do not contradict each other: 0.93 ≥ 0.70. The bound is loose because it holds for any distribution; the CLT is sharper because, with 30 days, the mean is almost normal.

How it is marked. Part 1: identifying k=2k = 2 (1 mark) and the bound with ≥\ge (1). Part 2: Markov with the condition X≥0X \ge 0 (1), Chebyshev moving to ∣X−8000∣≥8000|X – 8000| \ge 8000 and the comparison (1). Part 3: the code and 0.95 (2), the comparison (1). Part 4: the bound with σ2/n\sigma^2/n (1.5), the CLT with σ/n\sigma/\sqrt n (1), the interpretation (0.5).

Exercise 2

Part 1. f≥0f \ge 0 on (0,1)(0, 1) because x2≥0x^2 \ge 0 and 1−x>01 – x > 0. We integrate:

∫0112x2(1−x) dx=12[x33−x44]01=12(13−14)=1 \int_0^1 12x^2(1-x)\,dx = 12\left[\frac{x^3}{3} – \frac{x^4}{4}\right]_0^1 = 12\left(\frac{1}{3} – \frac{1}{4}\right) = 1
E(X)=∫0112x3(1−x) dx=12(14−15)=35=0.6 E(X) = \int_0^1 12x^3(1-x)\,dx = 12\left(\frac{1}{4} – \frac{1}{5}\right) = \frac{3}{5} = 0.6
E(X2)=∫0112x4(1−x) dx=12(15−16)=25,Var(X)=25−(35)2=125=0.04 E(X^2) = \int_0^1 12x^4(1-x)\,dx = 12\left(\frac{1}{5} – \frac{1}{6}\right) = \frac{2}{5}, \qquad \text{Var}(X) = \frac{2}{5} – \left(\frac{3}{5}\right)^2 = \frac{1}{25} = 0.04

You can also recognise a beta(3, 2): mean 33+2=0.6\frac{3}{3+2} = 0.6 and variance 3⋅252⋅6=0.04\frac{3 \cdot 2}{5^2 \cdot 6} = 0.04.

Why E(X2) E(X^2) and not the definition of variance. The obvious path, ∫01(x−0.6)2 12x2(1−x) dx \int_0^1 (x – 0.6)^2\, 12x^2(1-x)\,dx , forces you to expand a square with decimals. With E(X2)−E(X)2 E(X^2) – E(X)^2 , the three integrals are 12∫01(xa−xa+1) dx 12\int_0^1 (x^a – x^{a+1})\,dx and only the exponent changes. And the beta(3, 2) gives you a free check: its constant, 1/B(3,2) 1/B(3, 2) , is 12.

Part 2.

f <- function(x) 12 * x^2 * (1 - x)
integrate(f, 0, 1)                                 # 1: it is a density
integrate(function(x) x * f(x), 0, 1)              # E(X) = 0.6
integrate(function(x) x^2 * f(x), 0, 1)            # E(X^2) = 0.4  =>  Var = 0.4 - 0.36

Output:

1 with absolute error < 1.1e-14
0.6 with absolute error < 6.7e-15
0.4 with absolute error < 4.4e-15

Setting up part 3. The sum of 30 betas has no named distribution: no R function gives you the exact P(S≥19) P(S \ge 19) , and that’s why you use the CLT. The first thing is to decide what you’re talking about: a sum. The means add up (18) and so do the variances (1.2 1.2 ), but not the standard deviations.

Adding up the standard deviations, 30⋅0.2=6 30 \cdot 0.2 = 6 . You get P(S≥19)=0.43 P(S \ge 19) = 0.43 , more than twice the right answer.

Part 3. S=X1+⋯+X30S = X_1 + \dots + X_{30}, iid with μ=0.6\mu = 0.6 and σ2=0.04\sigma^2 = 0.04. By the CLT, S≈N(30⋅0.6,30⋅0.04)=N(18,1.10)S \approx N(30 \cdot 0.6, \sqrt{30 \cdot 0.04}) = N(18, 1.10):

P(S≥19)≈P ⁣(Z≥19−181.2)=P(Z≥0.91)=0.18 P(S \ge 19) \approx P\!\left(Z \ge \frac{19 – 18}{\sqrt{1.2}}\right) = P(Z \ge 0.91) = 0.18
1 - pnorm(19, 30 * 0.6, sqrt(30 * 0.04))           # CLT for the sum

Output:

[1] 0.1806552

In 18 % of the months you use 19 charges or more. SS is continuous: there is no continuity correction.

Setting up part 4. Now the unknown is n n . Translate the sentence first: P(∣Xˉ−0.6∣<0.05)≥0.95 P(|\bar X – 0.6| < 0.05) \ge 0.95 . With the CLT, the central 95 % of the normal reaches 1.96 standard deviations, so 1.96⋅0.2/n≤0.05 1.96 \cdot 0.2/\sqrt n \le 0.05 is enough. With Chebyshev, the bound 1−0.04n⋅0.052 1 – \frac{0.04}{n \cdot 0.05^2} has to reach 0.95. You solve for n n and round up, never to the nearest: with 61 sessions the probability is 0.949, a hair below; with 62, 0.951.

Part 4. With the CLT, n≥(1.96⋅0.20.05)2=61.5n \ge \left(\frac{1.96 \cdot 0.2}{0.05}\right)^2 = 61.5; with Chebyshev, n≥0.040.05⋅0.052=320n \ge \frac{0.04}{0.05 \cdot 0.05^2} = 320.

ceiling((qnorm(0.975) * 0.2 / 0.05)^2)             # CLT
ceiling(0.04 / (0.05 * 0.05^2))                    # Chebyshev

Output:

[1] 62
[1] 320

62 sessions with the CLT and 320 with Chebyshev: Chebyshev asks for five times more because it guarantees 95 % without assuming anything about the shape.

Part 5.

set.seed(2026)
S <- replicate(10000, sum(rbeta(30, 3, 2)))        # 10,000 months of 30 sessions
mean(S >= 19)                                      # simulated P(S >= 19)
c(mean(S), sd(S))                                  # against 18 and sqrt(1.2) = 1.0954
hist(S, freq = FALSE, breaks = 40, main = "30 sessions", xlab = "charges")
curve(dnorm(x, 18, sqrt(1.2)), add = TRUE, col = "red", lwd = 2)

Output:

[1] 0.1784
[1] 17.9877  1.0945
10,000 months of 30 sessionsDensity-scale histogram of 10,000 battery totals over 30 sessions with the beta(3, 2), between 14 and 22 charges, centred at 18, with the normal of mean 18 and standard deviation 1.10 in coral on top. Dashed line at 19: to its right there is 17.8 % simulated against 18.1 % from the CLT.0.00.10.20.30.4141516171819202122Charges used in 30 sessionsdensitysimulated: 0.178CLT: 0.181S ≥ 19
What hist and curve in part 5 draw: the histogram follows the normal, and the CLT is right to three thousandths.

The simulation gives 0.178 against 0.181 from the CLT: the approximation is good. The simulated mean and standard deviation (17.99 and 1.09) are the theoretical ones, and in the drawing the histogram follows the normal: the beta(3, 2) is only slightly skewed, so with 30 sessions the CLT works very well.

How it is marked. Part 1: density (1), E(X)E(X) (1), Var(X)\text{Var}(X) (1). Part 2: the three integrals (2). Part 3: mean and standard deviation of SS (2), standardising and the result (2). Part 4: CLT (1.5), Chebyshev (1.5); without rounding up, −0.5. Part 5: correct simulation (1), histogram with freq = FALSE and the curve (1), the comparison (1).

Exercise 3

Part 1. Each Ni∼Pois(1.5)N_i \sim \text{Pois}(1.5) has mgf MNi(t)=e1.5(et−1)M_{N_i}(t) = e^{1.5(e^t – 1)}. Since they are independent, the mgf of the sum is the product:

MT(t)=∏i=140e1.5(et−1)=e60(et−1) M_T(t) = \prod_{i=1}^{40} e^{1.5(e^t – 1)} = e^{60(e^t – 1)}

which is the mgf of a Poisson(60). Since the mgf determines the distribution, T∼Pois(60)T \sim \text{Pois}(60): E(T)=Var(T)=60E(T) = \text{Var}(T) = 60.

Part 2. TT is an integer: 50<T≤7050 < T \le 70 is the values 51 to 70, and with the continuity correction, the interval (50.5,70.5)(50.5, 70.5). With T≈N(60,60)=N(60,7.75)T \approx N(60, \sqrt{60}) = N(60, 7.75):

P(50<T≤70)≈Φ ⁣(70.5−607.75)−Φ ⁣(50.5−607.75)=Φ(1.36)−Φ(−1.23)=0.80 P(50 < T \le 70) \approx \Phi\!\left(\frac{70.5 – 60}{7.75}\right) – \Phi\!\left(\frac{50.5 – 60}{7.75}\right) = \Phi(1.36) – \Phi(-1.23) = 0.80
pnorm(70.5, 60, sqrt(60)) - pnorm(50.5, 60, sqrt(60))   # CLT with correction
ppois(70, 60) - ppois(50, 60)                           # exact

Output:

[1] 0.8023622
[1] 0.8021355

The approximation and the exact value agree to the first three digits: 0.8024 and 0.8021. 80 % of the time, in 40 sessions you get between 51 and 70 notifications.

Setting up part 3. There are two levels. Within each session, notifications are Poisson(1.5); but all you care about is whether any arrived. Each session is a Bernoulli trial with success “quiet”, of probability p=P(N=0) p = P(N = 0) , and counting successes in 40 independent sessions is a binomial. The Poisson(60) counts notifications, not sessions: it has nothing to do with this part.

Part 3. p=P(N=0)=e−1.5=0.22p = P(N = 0) = e^{-1.5} = 0.22. The number of quiet sessions is Y∼binom(40,0.2231)Y \sim \text{binom}(40, 0.2231), with mean 40p=8.9340p = 8.93 and variance 40p(1−p)=6.9340p(1-p) = 6.93. Y≥12Y \ge 12 is the values 12, 13, …: the edge is 11.5.

P(Y≥12)≈P ⁣(Z>11.5−8.936.93)=P(Z>0.98)=0.16 P(Y \ge 12) \approx P\!\left(Z > \frac{11.5 – 8.93}{\sqrt{6.93}}\right) = P(Z > 0.98) = 0.16
p <- dpois(0, 1.5)                                  # = exp(-1.5)
c(p = p, mean = 40 * p, var = 40 * p * (1 - p))
1 - pnorm(11.5, 40 * p, sqrt(40 * p * (1 - p)))      # CLT with correction
1 - pbinom(11, 40, p)                               # exact: P(Y >= 12) = 1 - P(Y <= 11)

Output:

        p      mean       var 
0.2231302 8.9252064 6.9337237 
[1] 0.1640815
[1] 0.1633048

0.1641 with the CLT and 0.1633 exact. In the exact one, P(Y≥12)=1−P(Y≤11)P(Y \ge 12) = 1 – P(Y \le 11): pbinom(11, …), not pbinom(12, …).

Setting up part 4. The estimator p^=Y/n \hat p = Y/n has variance p(1−p)/n p(1-p)/n , which depends on the very p p you want to estimate. The way out is the worst case: p(1−p) p(1-p) is a parabola with maximum 1/4 1/4 at p=0.5 p = 0.5 , so the n n you get works for any p p .

Check you’ve got it: how many sessions would Chebyshev ask for with p = 0.2231?

With p(1−p)=0.1733 p(1-p) = 0.1733 instead of 1/4 1/4 : n≥0.17330.05⋅0.052=1386.7 n \ge \frac{0.1733}{0.05 \cdot 0.05^2} = 1386.7 , that is, 1387. It drops from 2000, but it’s still far from the CLT’s 267: Chebyshev doesn’t use the fact that the mean is almost normal.

Part 4. Knowing nothing about pp, the worst case is p(1−p)=1/4p(1-p) = 1/4. With Chebyshev (proof 4): n≥14⋅0.05⋅0.052=2000n \ge \frac{1}{4 \cdot 0.05 \cdot 0.05^2} = 2000. With the CLT, n≥(1.96⋅0.50.05)2=384.2n \ge \left(\frac{1.96 \cdot 0.5}{0.05}\right)^2 = 384.2. With the CLT and p=0.2231p = 0.2231, n≥1.962 p(1−p)0.052=266.4n \ge \frac{1.96^2\, p(1-p)}{0.05^2} = 266.4.

1 / (4 * 0.05 * 0.05^2)                             # Chebyshev, unknown p
ceiling((qnorm(0.975) * 0.5 / 0.05)^2)              # CLT, unknown p
ceiling(qnorm(0.975)^2 * p * (1 - p) / 0.05^2)      # CLT, with p = 0.2231

Output:

[1] 2000
[1] 385
[1] 267

2000, 385 and 267 sessions. Knowing something about pp saves sessions: the further from 0.5, the less variance each session has.

How it is marked. Part 1: mgf of the sum as a product (2), recognising the Poisson(60) (1). Part 2: the integer values and the correction (1.5), the calculation (1.5), the exact one (1). Part 3: pp (1), mean and variance of YY (1), the 11.5 edge and the result (1), the exact one with pbinom(11, …) (1). Part 4: Chebyshev (1.5), CLT without pp (1.5), CLT with pp (1).

Bonus

Where the 1/8 comes from. For Chebyshev to be exact, the “far” probability has to sit exactly at 2σ=3000 2\sigma = 3000 (further out it would add too much variance) and the rest exactly at the mean. With a probability q q split between 5000 and 11,000, the variance is q⋅30002 q \cdot 3000^2 ; setting it equal to 15002 1500^2 , q=1/4 q = 1/4 : 1/8 1/8 at each end and 3/4 3/4 at 8000.

Take XX with three values: 8000−3000=50008000 – 3000 = 5000 with probability 1/81/8, 80008000 with probability 3/43/4 and 8000+3000=11,0008000 + 3000 = 11{,}000 with probability 1/81/8. It is symmetric about 8000, so E(X)=8000E(X) = 8000. Its variance:

Var(X)=18(−3000)2+34⋅0+18(3000)2=14⋅9,000,000=2,250,000=15002 \text{Var}(X) = \tfrac{1}{8}(-3000)^2 + \tfrac{3}{4} \cdot 0 + \tfrac{1}{8}(3000)^2 = \tfrac{1}{4} \cdot 9{,}000{,}000 = 2{,}250{,}000 = 1500^2

And ∣X−8000∣≥3000|X – 8000| \ge 3000 only happens at 5000 and 11,000: P=1/8+1/8=1/4P = 1/8 + 1/8 = 1/4, exactly the bound 1/k21/k^2 with k=2k = 2. Since there is a variable with that mean and variance that reaches it, no better bound can hold for all of them.

x <- c(5000, 8000, 11000); px <- c(1/8, 3/4, 1/8)
mu <- sum(x * px); sigma <- sqrt(sum((x - mu)^2 * px))
c(mu = mu, sigma = sigma, outside = sum(px[abs(x - mu) >= 2 * sigma]))

Output:

     mu   sigma outside 
8000.00 1500.00    0.25 

How it is marked. The variable (1), mean and standard deviation (1), the probability and the conclusion (0.5).

What’s wrong here?

Three snippets with one mistake each. Before reading the explanation, try to find it.

Snippet 1. Probability that a 20-song session (mean 3.5 and standard deviation 1.5 each) fits in 75 minutes:

pnorm(75, 20 * 3.5, 1.5)

Output:

[1] 0.9995709

The standard deviation of the sum is not 1.5, but 1.520=6.711.5\sqrt{20} = 6.71. With 1.5 the bell is so narrow that 75 is more than three standard deviations away and you get 0.9996: “no way it runs over”. The right one is pnorm(75, 70, 1.5 * sqrt(20)) = 0.77.

Snippet 2. Bound for the probability that a song lasts between 1 and 7 minutes (mean 3.5, standard deviation 1.5):

k <- (7 - 3.5) / 1.5
1 - 1 / k^2

Output:

[1] 0.8163265

The interval (1,7)(1, 7) is not centred on 3.5: it goes 2.5 below and 3.5 above. Chebyshev only talks about symmetric intervals, so you have to use the largest one that fits inside, 3.5±2.53.5 \pm 2.5, with k=2.5/1.5=1.67k = 2.5/1.5 = 1.67: the bound is 1−1/1.672=0.641 – 1/1.67^2 = 0.64, not 0.82. With the kk of the long side, the bound talks about a wider interval than the one you are asked about.

With an interval (a,b)(a, b) that is not symmetric, k=min⁡(μ−a,b−μ)/σk = \min(\mu – a, b – \mu)/\sigma. It is safe because (μ−kσ,μ+kσ)(\mu – k\sigma, \mu + k\sigma) lies inside (a,b)(a, b).

Snippet 3. The probability of 12 or more quiet sessions out of 40 (part 3 of exercise 3), as in the hook:

p <- exp(-1.5)
1 - pnorm(12.5, 40 * p, sqrt(40 * p * (1 - p)))

Output:

[1] 0.08729737

Y≥12Y \ge 12 includes 12, whose bar runs from 11.5 to 12.5. Cutting at 12.5 leaves out the whole bar for 12 and the probability drops by half: 0.087 against 0.164. For “≥k\ge k” the edge is k−0.5k – 0.5; for “≤k\le k“, k+0.5k + 0.5.

"12 or more": the edge is at 11.5Bars of the binomial of 40 sessions with probability 0.2231 of a quiet session, from 2 to 17; those of 12 or more in green. The normal with mean 8.93 and standard deviation 2.63 in violet. Green line at 11.5, the right correction, giving 0.164, and dashed red line at 12.5, the wrong one, which leaves out the bar for 12 and gives 0.087.0.000.050.100.15246810121416Quiet sessions out of 40Pright: 11.5 → 0.164wrong: 12.5 → 0.087green bars: 12 or more
The bar for 12 is the tallest of the green ones: cutting at 12.5 throws it away whole.

Practice quiz

Before moving on to the next topic, check you have got it. This quiz is here to consolidate what this article explains: the ME1 exam is not a multiple-choice test (you solve problems by hand and with R), so no mark here counts. There are 10 questions on inequalities and limit theorems: key ideas, typical mistakes and many «what does this R code print?», with the outputs from really running it. In the short answers, a decimal point or a decimal comma both work. Answer without running anything, press Check and read the explanation for each option; you can repeat it as many times as you like.

Question 1Single choice

A session has 20 independent songs, each with mean 3.5 min and standard deviation 1.5. For P(session ≤ 75 min), which command is right?

  1. pnorm(75, 20 * 3.5, 1.5 * sqrt(20))
  2. pnorm(75, 20 * 3.5, 1.5)
  3. pnorm(75, 3.5, 1.5)
  4. pnorm(75, 70, 1.5 * 20)
Solution

Answer: pnorm(75, 20 * 3.5, 1.5 * sqrt(20))

First of all: am I talking about one observation, a sum or a mean? Sum of n iid: mean nμ and standard deviation σ√n; mean: μ and σ/√n.

Question 2Short answer

Mean duration 3.5 min and standard deviation 1.5. What bound does Chebyshev give for P(1 < X < 7)? (2 decimals.)

k <- min(3.5 - 1, 7 - 3.5) / 1.5
round(1 - 1 / k^2, 2)
Solution

Answer: 0.64

The interval is not symmetric (2.5 below, 3.5 above). Chebyshev talks about centred intervals, so you use the largest one that fits: k = 2.5 / 1.5 = 1.67 and the bound is 1 − 1/1.67² = 0.64. With the long side you would get 0.82, a bound for an interval wider than the one asked for.

Question 3Single choice

Y is an integer (number of quiet sessions out of 40). With the normal approximation, where do you cut for P(Y ≥ 12)?

  1. At 11.5: 1 - pnorm(11.5, …)
  2. At 12.5
  3. At 12
  4. At 13
Solution

Answer: At 11.5: 1 - pnorm(11.5, …)

Continuity correction: for «≥ k», k − 0.5; for «≤ k», k + 0.5.

Question 4Short answer

X ≥ 0 with mean 4. What upper bound does Markov give for P(X ≥ 10)?

Solution

Answer: 0.4

Markov: P(X ≥ t) ≤ E(X)/t = 4/10 = 0.4. It only works for non-negative variables and does not need the variance.

Question 5Short answer

The mean of n = 25 iid values with σ = 1.5 has standard deviation… (2 decimals)

round(1.5 / sqrt(25), 2)
Solution

Answer: 0.3

The mean of n iid values has standard deviation σ/√n = 1.5 / 5 = 0.30: the more data, the more concentrated around μ.

Question 6Match

Match each result with what it says:

Markov
Chebyshev
Central limit theorem
Continuity correction

Definitions:

  • P(X ≥ t) ≤ E(X)/t, if X ≥ 0
  • The mean of a sample is always equal to μ
  • P(|X − μ| ≥ kσ) ≤ 1/k²
  • Sums and means of many iid are nearly normal
  • Move the cut by half a unit when approximating an integer variable
Solution
  • Markov → P(X ≥ t) ≤ E(X)/t, if X ≥ 0
  • Chebyshev → P(|X − μ| ≥ kσ) ≤ 1/k²
  • Central limit theorem → Sums and means of many iid are nearly normal
  • Continuity correction → Move the cut by half a unit when approximating an integer variable

A sample mean changes from one sample to another: what equals μ is its expectation.

Question 7True or false

True or false?

  1. Chebyshev does not need the distribution, only the mean and the standard deviation.
  2. The standard deviation of a sum of n iid is n·σ.
  3. When computing a sample size n, you round up.
  4. P(|X − μ| ≥ kσ) ≤ 1/k² is equivalent to P(|X − μ| < kσ) ≥ 1 − 1/k².
Solution
  • T — Chebyshev does not need the distribution, only the mean and the standard deviation.
  • F — The standard deviation of a sum of n iid is n·σ.
  • T — When computing a sample size n, you round up.
  • T — P(|X − μ| ≥ kσ) ≤ 1/k² is equivalent to P(|X − μ| < kσ) ≥ 1 − 1/k².

The standard deviation of the sum is σ√n (the variance is nσ²). The size is rounded up so the condition holds.

Question 8Single choice

With Chebyshev, what minimum bound do you get for P(|X − μ| < 2σ)?

  1. 0.75
  2. 0.95
  3. 0.5
  4. 0.25
Solution

Answer: 0.75

Chebyshev’s bound is weaker than the normal’s because it holds for any distribution.

Question 9Short answer

What does it print? (Approximation with continuity correction.)

p <- exp(-1.5)
round(1 - pnorm(11.5, 40 * p, sqrt(40 * p * (1 - p))), 2)
Solution

Answer: 0.16

Y ~ Bin(40; e^(−1.5)) is approximated with a normal of mean 40p and standard deviation √(40p(1 − p)). Cutting at 11.5 gives 0.16; cutting at 12.5 would lose the bar for 12 (0.087).

Question 10Single choice

When is the continuity correction needed?

  1. When a variable that only takes integer values is approximated with a normal
  2. Whenever pnorm is used
  3. Only with Chebyshev
  4. When n is small
Solution

Answer: When a variable that only takes integer values is approximated with a normal

It is the third question of «Before handing in»: is the variable an integer? If so, have I corrected towards the right side?

Try it in the R playground

Open the R playground on the site (or RStudio) and paste this script. It checks by simulation the three CLT answers of the exercises:

set.seed(2026)
m <- 10000
# Exercise 1, part 4: mean of 30 days (with a gamma of mean 8000 and sd 1500)
steps <- replicate(m, mean(rgamma(30, shape = (8000 / 1500)^2, rate = 8000 / 1500^2)))
c(simulated = mean(abs(steps - 8000) < 500), CLT = 2 * pnorm(500 / (1500 / sqrt(30))) - 1)
# Exercise 3, part 2: total notifications in 40 sessions
total <- replicate(m, sum(rpois(40, 1.5)))
c(simulated = mean(total > 50 & total <= 70), CLT = pnorm(70.5, 60, sqrt(60)) - pnorm(50.5, 60, sqrt(60)))
# Exercise 3, part 3: quiet sessions
Y <- replicate(m, sum(rpois(40, 1.5) == 0))
c(simulated = mean(Y >= 12), right = 1 - pnorm(11.5, 8.93, 2.63), wrong = 1 - pnorm(12.5, 8.93, 2.63))

Things to look at:

  1. In exercise 1 a gamma with mean 8000 and standard deviation 1500 was chosen: the CLT gets it right even though the steps are not normal.
  2. That the simulated total of notifications comes out close to 0.80.
  3. That the simulated quiet sessions are close to the right column and far from wrong.

Cheat sheet: inequalities and limit theorems

The essentials in 30 seconds. Markov: P(X≥t)≤E(X)/tP(X \ge t) \le E(X)/t if X≥0X \ge 0. Chebyshev: P(∣X−μ∣≥kσ)≤1/k2P(|X – \mu| \ge k\sigma) \le 1/k^2. Sum of nn iid: mean nμn\mu, standard deviation σn\sigma\sqrt n. Mean: μ\mu and σ/n\sigma/\sqrt n. CLT: both, almost normal for large nn. Integer: continuity correction.

I want…FormulaIn R
Bound for a tail, X≥0X \ge 0P(X≥t)≤E(X)/tP(X \ge t) \le E(X)/tmu / t
Bound at kk standard deviationsP(∣X−μ∣≥kσ)≤1/k2P(\lvert X – \mu\rvert \ge k\sigma) \le 1/k^21 / k^2
Inside boundP(∣X−μ∣<kσ)≥1−1/k2P(\lvert X – \mu\rvert < k\sigma) \ge 1 – 1/k^21 - 1 / k^2
kk of an interval (a,b)(a, b)min⁡(μ−a,b−μ)/σ\min(\mu – a, b – \mu)/\sigmamin(mu - a, b - mu) / sigma
Law of large numbersP(∣Xˉ−μ∣<c)≥1−σ2nc2P(\lvert\bar X – \mu\rvert < c) \ge 1 – \frac{\sigma^2}{nc^2}1 - sigma^2 / (n * c^2)
P(Sn≤s)P(S_n \le s), CLTΦ(s−nμσn)\Phi\big(\frac{s – n\mu}{\sigma\sqrt n}\big)pnorm(s, n * mu, sigma * sqrt(n))
P(Xˉ≤x)P(\bar X \le x), CLTΦ(x−μσ/n)\Phi\big(\frac{x – \mu}{\sigma/\sqrt n}\big)pnorm(x, mu, sigma / sqrt(n))
Binomial, CLTN(np,np(1−p))N(np, \sqrt{np(1-p)})pnorm(k + 0.5, n * p, sqrt(n * p * (1 - p)))
Poisson, CLTN(m,m)N(m, \sqrt m)pnorm(k + 0.5, m, sqrt(m))
nn for precision cc, Chebyshevn≥σ2/(αc2)n \ge \sigma^2/(\alpha c^2)ceiling(sigma^2 / (alpha * c^2))
nn for precision cc, CLTn≥(z1−α/2 σ/c)2n \ge (z_{1-\alpha/2}\,\sigma/c)^2ceiling((qnorm(1 - alpha/2) * sigma / c)^2)
nn for a proportion, unknown ppσ2≤1/4\sigma^2 \le 1/4ceiling((qnorm(0.975) * 0.5 / c)^2)

Continuity correction (integer variable):

EventEdge
≤k\le kk+0.5k + 0.5
<k< kk−0.5k – 0.5
≥k\ge kk−0.5k – 0.5
>k> kk+0.5k + 0.5

Symptom / likely cause:

SymptomLikely cause
Probability of the sum almost 1 or almost 0Standard deviation σ\sigma instead of σn\sigma\sqrt n
Chebyshev bound greater than 1k≤1k \le 1 or nn too small: the bound says nothing
Histogram of means with one barThe sample was made outside replicate
The normal stuck to the floor of the histogramMissing freq = FALSE
Binomial approximation far from pbinomMissing continuity correction, or on the wrong side

Before handing in, ask yourself:

  1. Am I talking about one observation, a sum or a mean? Which standard deviation does it get?
  2. Does the bound go with ≤\le (outside) or with ≥\ge (inside)?
  3. Is the variable an integer? If so, have I corrected, and on the right side?
  4. Have I rounded nn up?
ME1 exam coming up?The script for every topic, the printable cheat sheet and the pack for each exam, for free.See the pack

For your script

The topic’s code, commented, for your exam .R file. Your own functions and the code of the solved exercises, without statements:

# ===== Topic 7: inequalities and limit theorems =====
# --- Bounds ---
markov_bound <- function(mean, t) mean / t                  # P(X >= t) <= E(X)/t, X >= 0
cheb_outside <- function(k) 1 / k^2                         # P(|X - mu| >= k sigma) <= 1/k^2
cheb_inside <- function(k) 1 - 1 / k^2                      # P(|X - mu| < k sigma) >= 1 - 1/k^2
k_interval <- function(a, b, mu, sigma) min(mu - a, b - mu) / sigma    # non-symmetric interval
lln_bound <- function(sigma, n, c) 1 - sigma^2 / (n * c^2)  # P(|mean - mu| < c) >= ...

# --- CLT ---
clt_sum <- function(s, n, mu, sigma, tail = "left")         # P(S <= s) or P(S > s)
  if (tail == "left") pnorm(s, n * mu, sigma * sqrt(n)) else 1 - pnorm(s, n * mu, sigma * sqrt(n))
clt_mean <- function(x, n, mu, sigma, tail = "left")        # P(mean <= x) or P(mean > x)
  if (tail == "left") pnorm(x, mu, sigma / sqrt(n)) else 1 - pnorm(x, mu, sigma / sqrt(n))
clt_binom_le <- function(k, n, p) pnorm(k + 0.5, n * p, sqrt(n * p * (1 - p)))          # P(S <= k)
clt_binom_ge <- function(k, n, p) 1 - pnorm(k - 0.5, n * p, sqrt(n * p * (1 - p)))      # P(S >= k)
clt_pois_between <- function(a, b, m) pnorm(b + 0.5, m, sqrt(m)) - pnorm(a - 0.5, m, sqrt(m))  # P(a <= T <= b)

# --- Sample size (rounded up) ---
# round(…, 8) before ceiling: with sqrt() and ^2, 320 can come out as 320.0000001 and go up to 321
n_cheb <- function(sigma, c, alpha = 0.05) ceiling(round(sigma^2 / (alpha * c^2), 8))
n_clt  <- function(sigma, c, alpha = 0.05) ceiling(round((qnorm(1 - alpha / 2) * sigma / c)^2, 8))

# --- Checking the CLT by simulation (generates the data INSIDE the function) ---
check_clt <- function(generate, n, mu, sigma, m = 10000) {
  means <- replicate(m, mean(generate(n)))
  par(mfrow = c(1, 2))
  hist(means, freq = FALSE, breaks = 40, main = paste("n =", n))
  curve(dnorm(x, mu, sigma / sqrt(n)), add = TRUE, col = "red", lwd = 2)
  qqnorm(means); qqline(means, col = "red")
  c(mean = mean(means), sd = sd(means), sd_theoretical = sigma / sqrt(n))
}
# example: check_clt(function(n) rexp(n, 2), 30, 0.5, 0.5)

# --- Solved exercises ---
# Steps: N(8000, 1500) against Chebyshev; mean of 30 days
pnorm(11000, 8000, 1500) - pnorm(5000, 8000, 1500)          # 0.95 (bound: 0.75)
lln_bound(1500, 30, 500); 2 * pnorm(500 / (1500 / sqrt(30))) - 1      # 0.70 and 0.93
# Battery: density 12 x^2 (1 - x), 30 sessions
f <- function(x) 12 * x^2 * (1 - x)
mu <- integrate(function(x) x * f(x), 0, 1)$value
s2 <- integrate(function(x) x^2 * f(x), 0, 1)$value - mu^2
clt_sum(19, 30, mu, sqrt(s2), tail = "right")               # 0.18
n_clt(sqrt(s2), 0.05); n_cheb(sqrt(s2), 0.05)               # 62 and 320
# Notifications: Poisson(1.5) per session, 40 sessions
clt_pois_between(51, 70, 60); ppois(70, 60) - ppois(50, 60) # 0.80
p <- dpois(0, 1.5)
clt_binom_ge(12, 40, p); 1 - pbinom(11, 40, p)              # 0.16

What’s next?

With the CLT you already know that the mean of a sample is almost normal. The next ME1 topic is sampling distributions: what exact distribution the mean, the sample variance and their ratios have when the population is normal, and where the chi-squared, Student’s t and Snedecor’s F that you will use in confidence intervals come from.

If you want to review first, you have the theory, the proofs and the practice of this topic, and the normal distribution, where pnorm, qnorm and standardising come from.

Keep goingAll Statistics articles

Did this article help you? Here is how you can support SergioLearns →

Ready for the exam?ME1 EC2 mock exam — 4 hours with R beside you, from the normal to confidence intervals, four versions and a mark out of 50 (and why exercise 1 is worth double)