Asiman Data School

Module 2, topic 17, week 9, Tuesday

Probability distributions (normal, binomial, Poisson) and sampling

From single events to whole quantities: random variables with their mean and spread, the binomial, Poisson and normal distributions, z-scores and the normal table, then samples, the standard error and the central limit theorem. Worked by hand.

Introduction: from single events to whole quantities

The fifth lesson of Module 2, and the second one on probability. The last lesson gave a probability to a single event: "the sum of two dice is 7", "the email is spam". Real questions are about a quantity: how many customers will buy, how many calls will come in an hour, how tall a person is, how long a delivery takes. Such a quantity has many possible values, and each value has its own probability. All these probabilities together are a probability distribution. This guide teaches the three distributions that appear most often in data science: the binomial distribution (how many successes in a fixed number of tries), the Poisson distribution (how many events in a period of time) and the normal distribution (the bell curve of measurements). Then it turns to sampling: what happens when we see only a part of the whole, how much a sample can be trusted, and why the average of a large sample is so reliable. Every idea comes as a definition and worked examples calculated by hand. Then the guide walks through 26 solved problems from the easiest to the hardest, and at the end there are 40 practice problems with a hint and a full solution for each.

You need the last lesson (probability rules, combinations C(n,k)C(n, k), independent events, the expected value) and a calculator with the keys for powers and square roots. As in the whole module, the work is done by hand; Python appears only in one short part near the end.

What you will learn

  1. 1.What a random variable is, and the difference between discrete and continuous quantities
  2. 2.A probability distribution as a table, and the cumulative probability "at most"
  3. 3.The expected value, the variance and the standard deviation of a random variable, and the rules for calculating with them
  4. 4.The Bernoulli and the binomial distribution: the conditions, the formula, the mean and the spread
  5. 5.The Poisson distribution for counts in time or space, and how it replaces the binomial for rare events
  6. 6.Other distributions worth knowing: uniform, geometric, hypergeometric and exponential
  7. 7.Continuous distributions: a probability as an area under a curve
  8. 8.The normal distribution, the 68-95-99.7 rule, z-scores and the table of the standard normal distribution
  9. 9.The normal curve as an approximation of the binomial, and sums of normal quantities
  10. 10.Populations and samples, the ways of choosing a sample, and bias
  11. 11.The sampling distribution of the mean, the standard error, the law of large numbers and the central limit theorem
  12. 12.Where distributions and sampling appear in machine learning
Notation used in this lesson
WrittenMeaning
XX, YYrandom variables (quantities whose value depends on chance)
P(X=k)P(X = k)the probability that XX takes the value kk
P(X≤k)P(X \le k)the probability that XX is at most kk (a cumulative probability)
E(X)E(X) or μ\muthe expected value (the mean) of XX; μ\mu is the Greek letter mu
Var⁡(X)\Var(X) or σ2\sigma^2the variance of XX
σ\sigmathe standard deviation, the square root of the variance; σ\sigma is the Greek letter sigma
nn, ppthe number of trials and the probability of success in one trial
λ\lambdathe average number of events in a period (the Greek letter lambda)
eethe number 2.71828…2.71828\ldots
ZZthe standard normal variable: mean 0, standard deviation 1
Φ(z)\Phi(z)P(Z≤z)P(Z \le z), the area under the standard normal curve to the left of zz (the Greek letter phi)
xˉ\bar{x}the mean of a sample ("x bar")
p^\hat{p}the proportion in a sample ("p hat")

1Why distributions and sampling?

1.1From one event to a whole quantity

A shop owner does not ask "will exactly 12 customers buy today?". The owner asks: how many will buy on a usual day, how much can that number change, and how likely is a very bad day? One probability cannot answer this. A distribution can: it says how likely every possible value is.

The good news is that a few distributions describe most situations. Quantities that arise in the same way have the same distribution, whatever they are about:

Three ways in which a quantity arises, and the distribution of each
The quantity counts or measuresExamplesDistribution
successes in a fixed number of independent triesbuyers among 20 visitors, right answers among 10 guesses, defective parts in a box of 50binomial
events in a period of time or a piece of spacecalls in an hour, orders in a minute, typing mistakes on a pagePoisson
a measurement that is the sum of many small influencesheights, weights, measurement errors, exam marksnormal

Learn these three and you can calculate with a large part of the real world.

1.2Why sampling?

We almost never see everything. A company asks 1,000 customers, not all 2 million. A model is trained on the rows that were collected, not on all rows that exist. A test set of 500 photos stands for all photos the model will ever see. A part that stands for the whole is a sample, and the question of this lesson is: how far can a number from a sample be from the true number? The answer, the standard error, is one of the most useful formulas in statistics.

1.3Where you will meet these ideas again

Later topics and the idea each takes from this lesson
Later topicThe idea it takes from this lesson
Descriptive statistics (Topic 18)mean, variance and standard deviation, now calculated from data
Hypothesis testing (Topic 19)"how likely is a result like this by chance?": an area under a normal curve
Confidence intervals (Topic 20)the sample mean plus or minus about two standard errors
Linear regressionthe errors of the model are assumed to follow a normal distribution
Logistic regression and classificationevery label is a Bernoulli variable with its own pp
Feature scalingthe z-score: the value minus the mean, divided by the standard deviation
Random forests and baggingevery tree is trained on a random sample of the rows
Neural networksthe weights start as random numbers from a normal distribution; training uses small random samples of the data
Model evaluationan accuracy measured on a test set is a sample proportion and has a standard error

2Random variables and their distributions

2.1A random variable

A random variable is a quantity whose value depends on the outcome of an experiment. It is written with a capital letter: XX. Its possible values are written with small letters.

Toss a coin three times. The sample space has 8 equally likely outcomes (last lesson). Let XX be the number of heads:

The 8 outcomes of three tosses and the number of heads in each
OutcomeHHHHHTHTHTHHHTTTHTTTHTTT
XX32221110

XX turns every outcome into a number. The event "exactly two heads" is now simply X=2X = 2.

2.2Discrete and continuous

Discrete and continuous random variables side by side
DiscreteContinuous
Valuesseparate values that can be listed: 0, 1, 2, ...every value in an interval
It answers"how many?""how much?", "how long?"
Examplesheads in 3 tosses, buyers among 20 visitors, calls in an houra height, a waiting time, a temperature
Probabilitiesevery value has its own probabilityonly intervals have probabilities (Part 7)

2.3The distribution as a table

The probability distribution of a discrete random variable lists every value with its probability. For the number of heads in three tosses, count the outcomes:

The distribution of the number of heads in three tosses
kk0123
P(X=k)P(X = k)18\tfrac{1}{8}38\tfrac{3}{8}38\tfrac{3}{8}18\tfrac{1}{8}
00.250.51/803/813/821/83
The distribution of the number of heads in three tosses. One bar for every value; the heights are the probabilities and add up to 1.

Two rules hold for every such table, and they are the first check of any calculation:

  • every probability lies between 0 and 1
  • all probabilities together are exactly 1: here 18+38+38+18=1\tfrac{1}{8} + \tfrac{3}{8} + \tfrac{3}{8} + \tfrac{1}{8} = 1

2.4"At most" and "at least": cumulative probabilities

Many questions ask for a range of values. Add the probabilities of the values in the range.

At most one head:

P(X≤1)=P(X=0)+P(X=1)=18+38=48=0.5\begin{aligned} P(X \le 1) &= P(X = 0) + P(X = 1) \\ &= \tfrac{1}{8} + \tfrac{3}{8} = \tfrac{4}{8} = 0.5 \end{aligned}

At least two heads:

P(X≥2)=P(X=2)+P(X=3)=38+18=48=0.5\begin{aligned} P(X \ge 2) &= P(X = 2) + P(X = 3) \\ &= \tfrac{3}{8} + \tfrac{1}{8} = \tfrac{4}{8} = 0.5 \end{aligned}

At least one head (complement rule):

P(X≥1)=1−P(X=0)=1−18=78P(X \ge 1) = 1 - P(X = 0) = 1 - \tfrac{1}{8} = \tfrac{7}{8}

The probability P(X≤k)P(X \le k) is called the cumulative probability. Read the words of a problem carefully:

The words of a problem and what they mean
WordsMeaning
at most 2, no more than 2X≤2X \le 2
fewer than 2, less than 2X<2X < 2, which is X≤1X \le 1 for a count
at least 2, 2 or moreX≥2X \ge 2
more than 2X>2X > 2, which is X≥3X \ge 3 for a count
between 2 and 5 (inclusive)2≤X≤52 \le X \le 5

Try it yourself

A family has two children. Assume that the four outcomes BB, BG, GB and GG (B for a boy, G for a girl, in the order of birth) are equally likely. Let XX be the number of girls. Find P(X=1)P(X = 1) and P(X≥1)P(X \ge 1).

Show a hint
Write the number of girls under each of the four outcomes. For "at least one" the complement is shorter.
Show the solution

Answer: P(X=1)=12P(X = 1) = \tfrac{1}{2} and P(X≥1)=34P(X \ge 1) = \tfrac{3}{4}.

The numbers of girls in BB, BG, GB, GG are 0, 1, 1, 2. So the distribution is:

The distribution of the number of girls
kk012
P(X=k)P(X = k)14\tfrac{1}{4}24\tfrac{2}{4}14\tfrac{1}{4}
P(X=1)=24=12P(X≥1)=1−P(X=0)=1−14=34\begin{aligned} P(X = 1) &= \tfrac{2}{4} = \tfrac{1}{2} \\[4pt] P(X \ge 1) &= 1 - P(X = 0) = 1 - \tfrac{1}{4} = \tfrac{3}{4} \end{aligned}

3The mean, the variance and the standard deviation of a random variable

3.1The expected value

The last lesson ended with the expected value: every value times its probability, added. It is also called the mean of the random variable and written μ\mu:

E(X)=μ=x1×p1+x2×p2+…E(X) = \mu = x_1 \times p_1 + x_2 \times p_2 + \dots

For the number of heads in three tosses:

E(X)=0×18+1×38+2×38+3×18=128=1.5\begin{aligned} E(X) &= 0 \times \tfrac{1}{8} + 1 \times \tfrac{3}{8} + 2 \times \tfrac{3}{8} + 3 \times \tfrac{1}{8} \\[2pt] &= \tfrac{12}{8} = 1.5 \end{aligned}

The expected value is the average over a very long run of repetitions. It need not be a possible value: nobody tosses 1.5 heads.

3.2The variance and the standard deviation

Two games can have the same expected value and still feel very different. Game A pays 10 for sure. Game B pays 0 or 20, each with the probability 12\tfrac{1}{2}. Both have the mean 10, but only B is risky. We need a number for the spread.

00.61.2011020

Game A

always 10

00.61.21/20101/220

Game B

0 or 20, each with the probability 1/2

Two games with the same mean, 10. Game A has no spread at all. In game B every result is 10 away from the mean: its standard deviation is 10.

The variance is the expected squared distance from the mean:

Var⁡(X)=σ2=(x1−μ)2×p1+(x2−μ)2×p2+…\begin{aligned} \Var(X) = \sigma^2 = {} & (x_1 - \mu)^2 \times p_1 \\ & + (x_2 - \mu)^2 \times p_2 + \dots \end{aligned}

The standard deviation σ\sigma is its square root. It has the same unit as XX itself (the variance has the unit squared), so it is the number we interpret: a typical distance of a value from the mean.

For the number of heads (μ=1.5\mu = 1.5):

Var⁡(X)=(0−1.5)2×18+(1−1.5)2×38+(2−1.5)2×38+(3−1.5)2×18=2.25×18+0.25×38+0.25×38+2.25×18=68=0.75σ=0.75≈0.866\begin{aligned} \Var(X) &= (0 - 1.5)^2 \times \tfrac{1}{8} + (1 - 1.5)^2 \times \tfrac{3}{8} \\[2pt] &\quad + (2 - 1.5)^2 \times \tfrac{3}{8} + (3 - 1.5)^2 \times \tfrac{1}{8} \\[2pt] &= 2.25 \times \tfrac{1}{8} + 0.25 \times \tfrac{3}{8} \\[2pt] &\quad + 0.25 \times \tfrac{3}{8} + 2.25 \times \tfrac{1}{8} \\[2pt] &= \tfrac{6}{8} = 0.75 \\[6pt] \sigma &= \sqrt{0.75} \approx 0.866 \end{aligned}

For the two games: game A has the variance 0 (no spread at all). Game B has (0−10)2×12+(20−10)2×12=100(0 - 10)^2 \times \tfrac{1}{2} + (20 - 10)^2 \times \tfrac{1}{2} = 100, so σ=10\sigma = 10.

3.3A shortcut for the variance

Squaring the distances is slow. The same variance comes from the expected value of the squares minus the square of the mean:

Var⁡(X)=E(X2)−μ2E(X2)=x12×p1+x22×p2+…\begin{aligned} \Var(X) &= E(X^2) - \mu^2 \\[4pt] E(X^2) &= x_1^2 \times p_1 + x_2^2 \times p_2 + \dots \end{aligned}

For the number of heads:

E(X2)=02×18+12×38+22×38+32×18=0+3+12+98=248=3Var⁡(X)=3−1.52=3−2.25=0.75\begin{aligned} E(X^2) &= 0^2 \times \tfrac{1}{8} + 1^2 \times \tfrac{3}{8} + 2^2 \times \tfrac{3}{8} + 3^2 \times \tfrac{1}{8} \\[2pt] &= \tfrac{0 + 3 + 12 + 9}{8} = \tfrac{24}{8} = 3 \\[6pt] \Var(X) &= 3 - 1.5^2 = 3 - 2.25 = 0.75 \end{aligned}

The same result.

Example: one die. Every number from 1 to 6 has the probability 16\tfrac{1}{6}.

μ=1+2+3+4+5+66=216=3.5E(X2)=1+4+9+16+25+366=916≈15.167Var⁡(X)=916−3.52=916−12.25=3512≈2.917σ=3512≈1.708\begin{aligned} \mu &= \tfrac{1 + 2 + 3 + 4 + 5 + 6}{6} = \tfrac{21}{6} = 3.5 \\[4pt] E(X^2) &= \tfrac{1 + 4 + 9 + 16 + 25 + 36}{6} = \tfrac{91}{6} \approx 15.167 \\[4pt] \Var(X) &= \tfrac{91}{6} - 3.5^2 = \tfrac{91}{6} - 12.25 \\[2pt] &= \tfrac{35}{12} \approx 2.917 \\[4pt] \sigma &= \sqrt{\tfrac{35}{12}} \approx 1.708 \end{aligned}

3.4Rules for calculating

Let aa and bb be fixed numbers.

The rules for the mean and the variance
RuleIn words
E(a×X+b)=a×E(X)+bE(a \times X + b) = a \times E(X) + bthe mean follows every change of scale and every shift
Var⁡(a×X+b)=a2×Var⁡(X)\Var(a \times X + b) = a^2 \times \Var(X)a shift does not change the spread; a factor aa multiplies the variance by a2a^2
σ\sigma of a×X+ba \times X + b is ∣a∣×σ\len{a} \times \sigmathe standard deviation is multiplied by the size of aa
E(X+Y)=E(X)+E(Y)E(X + Y) = E(X) + E(Y)means always add
Var⁡(X+Y)=Var⁡(X)+Var⁡(Y)\Var(X + Y) = \Var(X) + \Var(Y) when XX and YY are independentvariances add for independent quantities; standard deviations do not add
Var⁡(X−Y)=Var⁡(X)+Var⁡(Y)\Var(X - Y) = \Var(X) + \Var(Y) when independenta difference is as uncertain as a sum: the variances still add

Example. A temperature has the mean 20 and the standard deviation 5 in degrees Celsius. In Fahrenheit (F=1.8×C+32F = 1.8 \times C + 32) the mean is 1.8×20+32=681.8 \times 20 + 32 = 68 and the standard deviation is 1.8×5=91.8 \times 5 = 9. The shift 32 changes the mean only.

Example. The sum of two dice. One die has the mean 3.5 and the variance 3512\tfrac{35}{12}. The dice are independent, so:

mean of the sum=3.5+3.5=7variance of the sum=3512+3512=356≈5.833σ of the sum=356≈2.415\begin{aligned} \text{mean of the sum} &= 3.5 + 3.5 = 7 \\[4pt] \text{variance of the sum} &= \tfrac{35}{12} + \tfrac{35}{12} = \tfrac{35}{6} \approx 5.833 \\[4pt] \sigma \text{ of the sum} &= \sqrt{\tfrac{35}{6}} \approx 2.415 \end{aligned}

That is not 1.708+1.7081.708 + 1.708: standard deviations do not add.

Try it yourself

A random variable XX takes the values 0, 2 and 4 with the probabilities 0.25, 0.5 and 0.25. Find E(X)E(X), Var⁡(X)\Var(X) and the standard deviation. Then find the mean and the variance of Y=3×X+1Y = 3 \times X + 1.

Show a hint
Use the shortcut: first E(X2)E(X^2), then subtract μ2\mu^2. For YY the mean follows the whole formula, the variance only the factor, squared.
Show the solution

Answer: E(X)=2E(X) = 2, Var⁡(X)=2\Var(X) = 2, σ≈1.414\sigma \approx 1.414. For YY: mean 7 and variance 18.

E(X)=0×0.25+2×0.5+4×0.25=2E(X2)=0×0.25+4×0.5+16×0.25=6Var⁡(X)=6−22=2σ=2≈1.414\begin{aligned} E(X) &= 0 \times 0.25 + 2 \times 0.5 + 4 \times 0.25 = 2 \\[4pt] E(X^2) &= 0 \times 0.25 + 4 \times 0.5 + 16 \times 0.25 = 6 \\[4pt] \Var(X) &= 6 - 2^2 = 2 \\[4pt] \sigma &= \sqrt{2} \approx 1.414 \end{aligned}
E(Y)=3×2+1=7Var⁡(Y)=32×2=18\begin{aligned} E(Y) &= 3 \times 2 + 1 = 7 \\[4pt] \Var(Y) &= 3^2 \times 2 = 18 \end{aligned}

The shift +1+1 moves every value of YY by the same amount, so it does not appear in the variance.

4The binomial distribution

4.1One trial: the Bernoulli distribution

The simplest random experiment has two outcomes: yes or no, buys or does not buy, spam or not spam. Call one of them "success" and give it the probability pp. Let XX be 1 for a success and 0 for a failure. This is a Bernoulli variable:

P(X=1)=pP(X=0)=1−pE(X)=0×(1−p)+1×p=pVar⁡(X)=E(X2)−p2=p−p2=p×(1−p)\begin{aligned} P(X = 1) &= p \qquad P(X = 0) = 1 - p \\[6pt] E(X) &= 0 \times (1 - p) + 1 \times p = p \\[4pt] \Var(X) &= E(X^2) - p^2 = p - p^2 \\ &= p \times (1 - p) \end{aligned}

Every label of a yes-or-no classification problem is a Bernoulli variable.

4.2Many trials: counting the successes

Three visitors come to an online shop. Each one buys with the probability 0.2, independently of the others. Let XX be the number of buyers. What is P(X=1)P(X = 1)?

Exactly one buyer can happen in three ways (B = buys, N = does not buy):

B N N:0.2×0.8×0.8=0.128N B N:0.8×0.2×0.8=0.128N N B:0.8×0.8×0.2=0.128P(X=1)=3×0.128=0.384\begin{aligned} \text{B N N:} \quad & 0.2 \times 0.8 \times 0.8 = 0.128 \\ \text{N B N:} \quad & 0.8 \times 0.2 \times 0.8 = 0.128 \\ \text{N N B:} \quad & 0.8 \times 0.8 \times 0.2 = 0.128 \\[6pt] P(X = 1) &= 3 \times 0.128 = 0.384 \end{aligned}

Every way has the same probability, one factor 0.2 and two factors 0.8, because the visitors are independent (multiplication rule). The number of ways is the number of choices of the one buyer among three visitors: C(3,1)=3C(3, 1) = 3. This is the whole idea of the binomial formula:

  • P(X=k)P(X = k) = (the number of ways to place kk successes) ×\times (the probability of one such way)

4.3The binomial formula

XX has a binomial distribution with nn trials and success probability pp when it counts the successes in nn independent trials that each succeed with the probability pp. Then, for k=0,1,…,nk = 0, 1, \dots, n:

P(X=k)=C(n,k)×pk×(1−p)n−kP(X = k) = C(n, k) \times p^k \times (1 - p)^{n - k}

C(n,k)=n!k! (n−k)!C(n, k) = \dfrac{n!}{k!\,(n - k)!} is the number of ways to choose which kk of the nn trials are the successes (last lesson, Part 6).

The full table for the three visitors (n=3n = 3, p=0.2p = 0.2):

The number of buyers among three visitors
kkC(3,k)C(3, k)CalculationP(X=k)P(X = k)
010.830.8^30.512
133×0.2×0.823 \times 0.2 \times 0.8^20.384
233×0.22×0.83 \times 0.2^2 \times 0.80.096
310.230.2^30.008

Check: 0.512+0.384+0.096+0.008=10.512 + 0.384 + 0.096 + 0.008 = 1.

4.4The four conditions

Before you use the formula, check all four:

  1. The number of trials nn is fixed in advance.
  2. Every trial has only two outcomes (success or failure).
  3. The probability of success pp is the same in every trial.
  4. The trials are independent.
Is it binomial?
SituationBinomial?
the number of heads in 10 tosses of a coinyes: n=10n = 10, p=0.5p = 0.5
the number of buyers among 20 independent visitorsyes, if every visitor has the same pp
the number of tosses until the first headno: the number of trials is not fixed (this is the geometric distribution, Part 6)
the number of aces among 5 cards dealt from a deckno: the cards are not put back, so pp changes from card to card (hypergeometric, Part 6)
the number of calls in an hourno: there are no separate trials (Poisson, Part 5)

4.5A larger example

Ten visitors come, each buys with the probability 0.2. What is the probability of exactly two buyers?

P(X=2)=C(10,2)×0.22×0.88C(10,2)=10×92=450.22=0.040.88≈0.16777P(X=2)≈45×0.04×0.16777≈0.3020\begin{aligned} P(X = 2) &= C(10, 2) \times 0.2^2 \times 0.8^8 \\[6pt] C(10, 2) &= \frac{10 \times 9}{2} = 45 \\[4pt] 0.2^2 &= 0.04 \\[4pt] 0.8^8 &\approx 0.16777 \\[6pt] P(X = 2) &\approx 45 \times 0.04 \times 0.16777 \\ &\approx 0.3020 \end{aligned}

"At most" and "at least" add single probabilities, or use the complement:

P(X=0)=0.810≈0.1074P(X=1)=10×0.2×0.89≈0.2684\begin{aligned} P(X = 0) &= 0.8^{10} \approx 0.1074 \\[4pt] P(X = 1) &= 10 \times 0.2 \times 0.8^9 \approx 0.2684 \end{aligned}

At most one buyer:

P(X≤1)=0.1074+0.2684=0.3758P(X \le 1) = 0.1074 + 0.2684 = 0.3758

At least one buyer:

P(X≥1)=1−P(X=0)=1−0.1074=0.8926\begin{aligned} P(X \ge 1) &= 1 - P(X = 0) \\ &= 1 - 0.1074 = 0.8926 \end{aligned}

4.6Mean and spread

A binomial variable is a sum of nn independent Bernoulli variables, one for each trial. Means add and variances add (Part 3), so:

E(X)=n×pVar⁡(X)=n×p×(1−p)σ=n×p×(1−p)\begin{aligned} E(X) &= n \times p \\[4pt] \Var(X) &= n \times p \times (1 - p) \\[4pt] \sigma &= \sqrt{n \times p \times (1 - p)} \end{aligned}

For ten visitors with p=0.2p = 0.2: the mean is 10×0.2=210 \times 0.2 = 2 buyers, the variance is 10×0.2×0.8=1.610 \times 0.2 \times 0.8 = 1.6, and σ=1.6≈1.265\sigma = \sqrt{1.6} \approx 1.265. "About 2 buyers, give or take 1."

4.7The shape

00.20.4012345678910

n = 10, p = 0.2

mean 2

00.20.4012345678910

n = 10, p = 0.5

mean 5

00.20.4012345678910

n = 10, p = 0.8

mean 8

The number of successes in 10 trials for three values of p. The highest bar is always near the mean n × p. With p = 0.5 the picture is symmetric; with a small or a large p it leans to one side.

With p=0.5p = 0.5 the distribution is symmetric around n×pn \times p. With a small pp the bars pile up on the left and a tail reaches to the right; with a large pp it is the mirror picture. The highest bar is always near the mean n×pn \times p. When nn grows, the shape comes closer and closer to a bell (Part 10).

Successes in n trials with the probability p. Choose k and the kind of question.

00.20.4012345678910

P(X = 2) = C(10, 2) × 0.22 × 0.88 = 0.3020

Mean: n × p = 2. Standard deviation: √(n × p × (1 − p)) = 1.265

C(10, 2) = 45: the number of ways to place 2 successes among 10 trials.

Try it yourself

A basketball player scores a free throw with the probability 0.6, independently from throw to throw. She throws 5 times. Find the probability of exactly 3 scores, and the mean and the standard deviation of the number of scores.

Show a hint
Binomial with n=5n = 5 and p=0.6p = 0.6. C(5,3)=10C(5, 3) = 10, and the probability of a miss is 0.4.
Show the solution

Answer: P(X=3)=0.3456P(X = 3) = 0.3456, the mean is 3 and σ≈1.095\sigma \approx 1.095.

P(X=3)=C(5,3)×0.63×0.42=10×0.216×0.16=0.3456E(X)=5×0.6=3σ=5×0.6×0.4=1.2≈1.095\begin{aligned} P(X = 3) &= C(5, 3) \times 0.6^3 \times 0.4^2 \\ &= 10 \times 0.216 \times 0.16 = 0.3456 \\[6pt] E(X) &= 5 \times 0.6 = 3 \\[4pt] \sigma &= \sqrt{5 \times 0.6 \times 0.4} = \sqrt{1.2} \approx 1.095 \end{aligned}

The four conditions hold: 5 throws, score or miss, the same 0.6 every time, independent throws.

5The Poisson distribution

5.1Counting events in time or space

A help desk receives 4 calls per hour on average. How likely are exactly 2 calls in the next hour? There are no "trials" here: a call can come at any moment. The binomial formula does not fit.

A count XX has a Poisson distribution with the rate λ\lambda when:

  1. events happen one at a time,
  2. they happen independently of each other,
  3. the average rate is constant: λ\lambda events per period on average.

Then, for k=0,1,2,…k = 0, 1, 2, \dots (there is no upper limit):

P(X=k)=λk×e−λk!P(X = k) = \frac{\lambda^k \times e^{-\lambda}}{k!}

e≈2.71828e \approx 2.71828 is the base of the natural logarithm; every scientific calculator has a key for exe^x. Typical Poisson counts: calls per hour, customers per minute, accidents per month, typing mistakes per page, defects per metre of cable, visits to a web page per second.

Values of e−λe^{-\lambda} that are used in this lesson:

Values of e to the power minus lambda
λ\lambda0.511.522.53456
e−λe^{-\lambda}0.60650.36790.22310.13530.08210.04980.01830.00670.0025

5.2The help desk

With λ=4\lambda = 4:

P(X=0)=40×e−40!=e−4≈0.0183P(X=1)=41×e−41!=4×0.018316≈0.0733P(X=2)=42×e−42!=16×0.0183162≈0.1465\begin{aligned} P(X = 0) &= \frac{4^0 \times e^{-4}}{0!} = e^{-4} \approx 0.0183 \\[6pt] P(X = 1) &= \frac{4^1 \times e^{-4}}{1!} = 4 \times 0.018316 \\[2pt] &\approx 0.0733 \\[6pt] P(X = 2) &= \frac{4^2 \times e^{-4}}{2!} = \frac{16 \times 0.018316}{2} \\[2pt] &\approx 0.1465 \end{aligned}

At most two calls:

P(X≤2)=0.0183+0.0733+0.1465=0.2381\begin{aligned} P(X \le 2) &= 0.0183 + 0.0733 + 0.1465 \\ &= 0.2381 \end{aligned}

At least one call:

P(X≥1)=1−P(X=0)=1−0.0183=0.9817\begin{aligned} P(X \ge 1) &= 1 - P(X = 0) \\ &= 1 - 0.0183 = 0.9817 \end{aligned}

Remember that 0!=10! = 1 and λ0=1\lambda^0 = 1, so P(X=0)P(X = 0) is simply e−λe^{-\lambda}.

5.3Mean and spread

E(X)=λVar⁡(X)=λσ=λE(X) = \lambda \qquad \Var(X) = \lambda \qquad \sigma = \sqrt{\lambda}

The mean and the variance are the same number. For the help desk: 4 calls on average, with σ=4=2\sigma = \sqrt{4} = 2.

5.4Changing the period

The rate belongs to a period. For another period, scale λ\lambda first, then use the formula.

The help desk has 4 calls per hour. In half an hour the average is λ=2\lambda = 2; in three hours it is λ=12\lambda = 12.

P(no call in half an hour)=e−2≈0.1353P(\text{no call in half an hour}) = e^{-2} \approx 0.1353

5.5The shape

00.20.402468

λ = 1

mean 1

00.20.4024681012

λ = 4

mean 4

00.20.4048121620

λ = 10

mean 10

The Poisson distribution for three rates. For a small rate it leans to the left with a tail to the right. For a larger rate it becomes more and more symmetric, around the rate.

For a small λ\lambda the distribution leans to the left with a tail to the right. For a larger λ\lambda it becomes more and more symmetric and bell-shaped, around λ\lambda.

Events in a period at the average rate λ. Choose k and the kind of question.

00.10.2024681012141618202224

P(X = 2) = 42 × e−4 / 2! = 0.1465

Mean: λ = 4. Standard deviation: √λ = 2

The highest bars are near λ. A count has no upper limit here, so "at least" always goes through the complement.

5.6Poisson instead of binomial: rare events

When nn is large and pp is small, the binomial distribution is almost exactly a Poisson distribution with λ=n×p\lambda = n \times p. A usual rule: n≥50n \ge 50 and n×p≤5n \times p \le 5 (some books say p≤0.1p \le 0.1).

Example. A factory makes 1,000 parts, each defective with the probability 0.002. What is the probability of no defective part?

binomial (exact):0.9981000≈0.1351Poisson with λ=2:e−2≈0.1353\begin{aligned} \text{binomial (exact):} \quad & 0.998^{1000} \approx 0.1351 \\[4pt] \text{Poisson with } \lambda = 2\text{:} \quad & e^{-2} \approx 0.1353 \end{aligned}

The two answers agree to three decimals, and the Poisson one needs no thousandth power. This is also why counts of rare events (accidents, defects, clicks on a rarely used button) follow the Poisson distribution: they are binomial counts with a huge nn and a tiny pp.

Try it yourself

A football team scores 1.5 goals per match on average, and the number of goals follows a Poisson distribution. Find the probability that the team scores no goal in a match, and the probability that it scores at least 2 goals. Use e−1.5≈0.2231e^{-1.5} \approx 0.2231.

Show a hint
P(X=0)=e−λP(X = 0) = e^{-\lambda}. For "at least 2" take the complement: 0 or 1 goal.
Show the solution

Answer: P(X=0)≈0.2231P(X = 0) \approx 0.2231 and P(X≥2)≈0.4422P(X \ge 2) \approx 0.4422.

P(X=0)=e−1.5≈0.2231P(X=1)=1.5×e−1.5≈0.3347P(X≥2)=1−(0.2231+0.3347)=1−0.5578=0.4422\begin{aligned} P(X = 0) &= e^{-1.5} \approx 0.2231 \\[4pt] P(X = 1) &= 1.5 \times e^{-1.5} \approx 0.3347 \\[6pt] P(X \ge 2) &= 1 - (0.2231 + 0.3347) \\ &= 1 - 0.5578 = 0.4422 \end{aligned}

6Other discrete distributions worth knowing

The syllabus names three distributions. Three more are so close to them that you should recognise them, because many "is this binomial?" mistakes are really one of these.

6.1The discrete uniform distribution

Every value has the same probability. A fair die is uniform on 1 to 6. Choosing one row of a table of NN rows at random is uniform on the rows: every row has the probability 1N\tfrac{1}{N}. This is the distribution behind "at random".

6.2The geometric distribution: waiting for the first success

Repeat independent trials with success probability pp until the first success. Let XX be the number of the trial on which it comes. For the first success on trial kk, the first k−1k - 1 trials must fail:

P(X=k)=(1−p)k−1×pk=1,2,3,…E(X)=1pP(X>k)=(1−p)k\begin{aligned} P(X = k) &= (1 - p)^{k - 1} \times p \qquad k = 1, 2, 3, \dots \\[6pt] E(X) &= \frac{1}{p} \\[6pt] P(X > k) &= (1 - p)^k \end{aligned}

The last line is "no success in the first kk trials".

Example. A seller closes a sale with the probability 0.2 on every call. The probability that the first sale comes on the third call is 0.82×0.2=0.1280.8^2 \times 0.2 = 0.128. On average the first sale comes on call 10.2=5\tfrac{1}{0.2} = 5. The probability of no sale in the first ten calls is 0.810≈0.10740.8^{10} \approx 0.1074.

6.3The hypergeometric distribution: sampling without putting back

A box holds 10 parts, 3 of them defective. Four parts are taken out without putting them back. The draws are not independent, so the count of defective parts is not binomial. Count combinations instead (last lesson, Part 6):

P(exactly 1 defective)=C(3,1)×C(7,3)C(10,4)=3×35210=105210=0.5\begin{aligned} P(\text{exactly 1 defective}) &= \frac{C(3, 1) \times C(7, 3)}{C(10, 4)} \\[4pt] &= \frac{3 \times 35}{210} = \frac{105}{210} = 0.5 \end{aligned}

In general, with NN things of which KK are "special", and nn taken without putting back:

P(X=k)=C(K,k)×C(N−K,n−k)C(N,n)P(X = k) = \frac{C(K, k) \times C(N - K, n - k)}{C(N, n)}

When the population is much larger than the sample (a usual rule: the sample is at most 5 percent of the population), taking one thing out hardly changes the rest, and the binomial distribution with p=KNp = \tfrac{K}{N} is a very good approximation. That is why surveys of 1,000 people out of millions are treated as binomial.

6.4Which one?

The question decides the distribution
QuestionDistribution
How many successes in nn independent trials?binomial
How many events in a period, at a known average rate?Poisson
On which trial does the first success come?geometric
How many special things in a sample taken without putting back from a small group?hypergeometric
One of NN equally likely values?uniform

Which distribution is it?

1 of 8

The number of customers who buy among 30 independent visitors, each with the same probability.

Try it yourself

Name the distribution of each quantity. (a) The number of customers who arrive at a bank in 10 minutes. (b) The number of defective bulbs in a box of 8, when every bulb is defective with the probability 0.05, independently. (c) The number of the attempt on which a student passes a driving test for the first time, when every attempt succeeds with the probability 0.4.

Show a hint
Ask three questions. Is there a fixed number of trials? Is it a count in a period? Does the counting stop at the first success?
Show the solution

Answer: (a) Poisson, (b) binomial, (c) geometric.

(a) Customers arrive at any moment, at some average rate: a count in a period is a Poisson count. (b) Eight independent bulbs with the same probability 0.05: binomial with n=8n = 8 and p=0.05p = 0.05. (c) The number of attempts is not fixed; the counting stops at the first success: geometric with p=0.4p = 0.4, so on average the test is passed on attempt 10.4=2.5\tfrac{1}{0.4} = 2.5.

7Continuous distributions

7.1Why a table no longer works

A waiting time can be 3 minutes, 3.2 minutes, 3.2071 minutes: there are infinitely many possible values. If each of them had a positive probability, the sum would be infinite. So for a continuous quantity a single exact value has the probability 0, and only intervals have probabilities: "between 3 and 4 minutes", "more than 10 minutes".

7.2The density curve

A continuous distribution is described by a curve, the probability density. Its two rules replace the two rules of a table:

  • the curve never goes below 0
  • the whole area under the curve is exactly 1
P(a<X<b)=the area under the curvebetween a and b\begin{aligned} P(a < X < b) = {} & \text{the area under the curve} \\ & \text{between } a \text{ and } b \end{aligned}
ab

P(a<X<b)P(a < X < b)

the filled area

0.102510

P(2<X<5)=3×0.1=0.3P(2 < X < 5) = 3 \times 0.1 = 0.3

uniform between 0 and 10

For a continuous quantity a probability is an area under the density curve. For the uniform distribution on the right the area is a rectangle: width 3 times height 0.1.

Two consequences:

  • P(X=a)=0P(X = a) = 0, so for a continuous quantity P(X≤a)P(X \le a) and P(X<a)P(X < a) are the same number. (For a count they are not: Part 2.)
  • The height of the curve is not a probability. Only areas are.

7.3The continuous uniform distribution

A bus comes every 10 minutes and you arrive at a random moment. Your waiting time XX is equally likely to be anywhere between 0 and 10 minutes. The density is flat. Because the whole area must be 1, its height is 110\tfrac{1}{10}:

P(2<X<5)=width×height=(5−2)×110=0.3\begin{aligned} P(2 < X < 5) &= \text{width} \times \text{height} \\ &= (5 - 2) \times \tfrac{1}{10} = 0.3 \end{aligned}

For a uniform distribution between aa and bb:

P(c<X<d)=d−cb−aE(X)=a+b2Var⁡(X)=(b−a)212\begin{aligned} P(c < X < d) &= \frac{d - c}{b - a} \\[6pt] E(X) &= \frac{a + b}{2} \qquad \Var(X) = \frac{(b - a)^2}{12} \end{aligned}

For the bus: the mean wait is 5 minutes, the variance is 10012≈8.333\tfrac{100}{12} \approx 8.333 and σ≈2.887\sigma \approx 2.887 minutes.

7.4The exponential distribution: the time between events

If events come at the rate λ\lambda per unit of time (a Poisson count), then the waiting time TT until the next event has the exponential distribution:

P(T>t)=e−λ×tP(T≤t)=1−e−λ×tE(T)=1λ\begin{aligned} P(T > t) &= e^{-\lambda \times t} \\[4pt] P(T \le t) &= 1 - e^{-\lambda \times t} \\[4pt] E(T) &= \frac{1}{\lambda} \end{aligned}

The first formula is nothing new: "waiting longer than tt" means "no event in a period of length tt", and that is the Poisson probability of zero events with the rate λ×t\lambda \times t.

Example. The help desk gets 4 calls per hour. The probability of waiting more than half an hour for the next call is e−4×0.5=e−2≈0.1353e^{-4 \times 0.5} = e^{-2} \approx 0.1353. The mean waiting time is 14\tfrac{1}{4} of an hour, 15 minutes.

Try it yourself

A number XX is chosen at random between 2 and 8, and every value in this interval is equally likely. Find P(3<X<5)P(3 < X < 5), the mean of XX, and P(X=4)P(X = 4).

Show a hint
A probability is a share of the interval. And remember what a single exact value is worth for a continuous quantity.
Show the solution

Answer: P(3<X<5)=13P(3 < X < 5) = \tfrac{1}{3}, the mean is 5, and P(X=4)=0P(X = 4) = 0.

P(3<X<5)=5−38−2=26=13E(X)=2+82=5\begin{aligned} P(3 < X < 5) &= \frac{5 - 3}{8 - 2} = \frac{2}{6} = \frac{1}{3} \\[6pt] E(X) &= \frac{2 + 8}{2} = 5 \end{aligned}

P(X=4)=0P(X = 4) = 0: the interval from 4 to 4 has the width 0, so its area is 0. Only intervals have probabilities.

8The normal distribution

8.1The bell curve

Measure the heights of many adults, the weights of bags filled by a machine, or the errors of a measuring instrument, and the picture is always the same: most values lie near the middle, values far from the middle are rare, and the left and the right side look alike. This is the normal distribution.

A normal distribution is fixed by two numbers:

  • the mean μ\mu: where the centre of the bell is,
  • the standard deviation σ\sigma: how wide the bell is.

It is written N(μ,σ)N(\mu, \sigma) in this lesson. (Some books write the variance σ2\sigma^2 in the second place; always check which one a book means.)

405060708090100
  • μ = 60, σ = 5
  • μ = 70, σ = 5
  • μ = 80, σ = 5

The mean moves the bell

405060708090100
  • μ = 70, σ = 4
  • μ = 70, σ = 8
  • μ = 70, σ = 12

The standard deviation makes it narrow or wide

The mean says where the bell stands, the standard deviation how wide it is. A wider bell is lower, because the area under every curve is 1.

8.2Properties

  • The curve is symmetric around μ\mu. The mean, the middle value (median) and the highest point are the same.
  • Half of the area lies to the left of μ\mu and half to the right.
  • The curve never touches the axis, but far from the mean the area is tiny.
  • A larger σ\sigma makes the bell lower and wider. The area stays 1.
  • It is a continuous distribution: probabilities are areas.

8.3Why it is everywhere

A quantity that is the sum of many small independent influences is approximately normal, whatever the influences look like. A height is the result of many genes and many meals. A measurement error is the sum of many small disturbances. The mean of a large sample is a sum of many observations. This fact is the central limit theorem (Part 12), and it is the reason for the special place of the bell curve.

Not everything is normal. Incomes, prices of flats, waiting times and the numbers of followers have a long tail to the right. Never assume a bell without looking at the data (next lesson).

8.4The 68-95-99.7 rule

For every normal distribution:

  • about 68 percent of the values lie within 1 standard deviation of the mean: between μ−σ\mu - \sigma and μ+σ\mu + \sigma
  • about 95 percent of the values lie within 2 standard deviations of the mean: between μ−2σ\mu - 2\sigma and μ+2σ\mu + 2\sigma
  • about 99.7 percent of the values lie within 3 standard deviations of the mean: between μ−3σ\mu - 3\sigma and μ+3σ\mu + 3\sigma
68%95%99.7%μ − 3σμ − 2σμ − σμμ + σμ + 2σμ + 3σ
The 68-95-99.7 rule: the shares of a normal distribution within 1, 2 and 3 standard deviations of the mean.

Example. The marks of an exam are normal with the mean 70 and the standard deviation 10.

  • about 68 percent of the students have between 60 and 80 marks
  • about 95 percent have between 50 and 90
  • about 99.7 percent have between 40 and 100

Symmetry gives more. Outside "50 to 90" are 5 percent of the students, half on each side: about 2.5 percent have more than 90 marks. Between 70 and 80 is half of 68 percent, 34 percent. So about 50+34=8450 + 34 = 84 percent have at most 80 marks.

A value more than 3 standard deviations from the mean is very rare (about 3 in 1,000). That is the usual rule for flagging a value as unusual.

Try it yourself

The heights of the plants in a field are normal with the mean 50 cm and the standard deviation 4 cm. Use the 68-95-99.7 rule: which share of the plants is between 46 and 54 cm high, which share is higher than 58 cm, and which share is between 42 and 50 cm?

Show a hint
46 and 54 are one standard deviation from the mean, 42 and 58 are two. Use the symmetry for the last two questions.
Show the solution

Answer: About 68 percent, about 2.5 percent and about 47.5 percent.

Between μ−σ=46\mu - \sigma = 46 and μ+σ=54\mu + \sigma = 54 lie about 68 percent. Outside μ±2σ\mu \pm 2\sigma (42 to 58) are 5 percent, half of them above 58: 2.5 percent. Between 42 and 58 are 95 percent, and the half of them to the left of the mean is 952=47.5\tfrac{95}{2} = 47.5 percent.

9z-scores and the standard normal table

9.1The z-score

The 68-95-99.7 rule works only for whole numbers of standard deviations. For every other value we first ask: how many standard deviations is it away from the mean? That number is the z-score:

z=x−μσz = \frac{x - \mu}{\sigma}

For the exam (μ=70\mu = 70, σ=10\sigma = 10): a mark of 85 has z=85−7010=1.5z = \dfrac{85 - 70}{10} = 1.5, one and a half standard deviations above the mean. A mark of 62 has z=−0.8z = -0.8. A positive z-score is above the mean, a negative one below, and 0 is the mean itself.

The z-score has no unit. It makes values from different scales comparable (Problem 16), and in machine learning it is the standard way of scaling features.

9.2The standard normal distribution

If XX is normal with mean μ\mu and standard deviation σ\sigma, then Z=X−μσZ = \dfrac{X - \mu}{\sigma} is normal with the mean 0 and the standard deviation 1. This is the standard normal distribution. So one table is enough for all normal distributions:

P(X≤x)=P(Z≤z)=Φ(z)withz=x−μσ\begin{aligned} P(X \le x) &= P(Z \le z) = \Phi(z) \\[4pt] \text{with} \quad z &= \frac{x - \mu}{\sigma} \end{aligned}

Φ(z)\Phi(z) is the area under the standard normal curve to the left of zz.

Φ(z)−3−2−10z23
Φ(z) is the area under the standard normal curve to the left of z. The table gives this area for every z from 0.00 to 3.09.

9.3The table

The row gives zz to one decimal, the column the second decimal. For z=1.25z = 1.25 go to the row 1.2 and the column .05: Φ(1.25)=0.8944\Phi(1.25) = 0.8944.

Look up z =+

Φ(1.25) = 0.8944: the area to the left of z = 1.25. To the right: 1 − 0.8944 = 0.1056. For z = −1.25 the two areas change places.

The standard normal distribution: the area to the left of z, for z from 0.00 to 3.09
z.00.01.02.03.04.05.06.07.08.09
0.00.50000.50400.50800.51200.51600.51990.52390.52790.53190.5359
0.10.53980.54380.54780.55170.55570.55960.56360.56750.57140.5753
0.20.57930.58320.58710.59100.59480.59870.60260.60640.61030.6141
0.30.61790.62170.62550.62930.63310.63680.64060.64430.64800.6517
0.40.65540.65910.66280.66640.67000.67360.67720.68080.68440.6879
0.50.69150.69500.69850.70190.70540.70880.71230.71570.71900.7224
0.60.72570.72910.73240.73570.73890.74220.74540.74860.75170.7549
0.70.75800.76110.76420.76730.77040.77340.77640.77940.78230.7852
0.80.78810.79100.79390.79670.79950.80230.80510.80780.81060.8133
0.90.81590.81860.82120.82380.82640.82890.83150.83400.83650.8389
1.00.84130.84380.84610.84850.85080.85310.85540.85770.85990.8621
1.10.86430.86650.86860.87080.87290.87490.87700.87900.88100.8830
1.20.88490.88690.88880.89070.89250.89440.89620.89800.89970.9015
1.30.90320.90490.90660.90820.90990.91150.91310.91470.91620.9177
1.40.91920.92070.92220.92360.92510.92650.92790.92920.93060.9319
1.50.93320.93450.93570.93700.93820.93940.94060.94180.94290.9441
1.60.94520.94630.94740.94840.94950.95050.95150.95250.95350.9545
1.70.95540.95640.95730.95820.95910.95990.96080.96160.96250.9633
1.80.96410.96490.96560.96640.96710.96780.96860.96930.96990.9706
1.90.97130.97190.97260.97320.97380.97440.97500.97560.97610.9767
2.00.97720.97780.97830.97880.97930.97980.98030.98080.98120.9817
2.10.98210.98260.98300.98340.98380.98420.98460.98500.98540.9857
2.20.98610.98640.98680.98710.98750.98780.98810.98840.98870.9890
2.30.98930.98960.98980.99010.99040.99060.99090.99110.99130.9916
2.40.99180.99200.99220.99250.99270.99290.99310.99320.99340.9936
2.50.99380.99400.99410.99430.99450.99460.99480.99490.99510.9952
2.60.99530.99550.99560.99570.99590.99600.99610.99620.99630.9964
2.70.99650.99660.99670.99680.99690.99700.99710.99720.99730.9974
2.80.99740.99750.99760.99770.99770.99780.99790.99790.99800.9981
2.90.99810.99820.99820.99830.99840.99840.99850.99850.99860.9986
3.00.99870.99870.99870.99880.99880.99890.99890.99890.99900.9990
The table of the standard normal distribution: Φ(z), the area to the left of z. The row gives z to one decimal, the column its second decimal. For z above 3 the area is practically 1.

For zz above 3 the area is practically 1.

9.4Three kinds of questions

The table gives areas to the left of a positive zz. Everything else follows from two facts: the whole area is 1, and the curve is symmetric.

to the left:P(Z<z)=Φ(z)to the right:P(Z>z)=1−Φ(z)negative z:Φ(−z)=1−Φ(z)between:P(a<Z<b)=Φ(b)−Φ(a)\begin{aligned} \text{to the left:} \quad & P(Z < z) = \Phi(z) \\[2pt] \text{to the right:} \quad & P(Z > z) = 1 - \Phi(z) \\[2pt] \text{negative } z\text{:} \quad & \Phi(-z) = 1 - \Phi(z) \\[2pt] \text{between:} \quad & P(a < Z < b) = \Phi(b) - \Phi(a) \end{aligned}
0z

P(Z<z)=Φ(z)P(Z < z) = \Phi(z)

to the left: read the table

0z

P(Z>z)=1−Φ(z)P(Z > z) = 1 - \Phi(z)

to the right: the rest of the area 1

−z0z

Φ(−z)=1−Φ(z)\Phi(-z) = 1 - \Phi(z)

a negative z: the two tails are equal

a0b

P(a<Z<b)=Φ(b)−Φ(a)P(a < Z < b) = \Phi(b) - \Phi(a)

between: left of b minus left of a

The four kinds of areas. The table gives only the first one; the other three follow from the whole area 1 and from the symmetry of the curve.

The exam again (μ=70\mu = 70, σ=10\sigma = 10).

At most 85 marks:

z=85−7010=1.5P(X≤85)=Φ(1.5)=0.9332\begin{aligned} z &= \frac{85 - 70}{10} = 1.5 \\[4pt] P(X \le 85) &= \Phi(1.5) = 0.9332 \end{aligned}

More than 85 marks:

P(X>85)=1−0.9332=0.0668P(X > 85) = 1 - 0.9332 = 0.0668

Less than 60 marks (a negative z-score):

z=60−7010=−1P(X<60)=Φ(−1)=1−Φ(1)=1−0.8413=0.1587\begin{aligned} z &= \frac{60 - 70}{10} = -1 \\[4pt] P(X < 60) &= \Phi(-1) = 1 - \Phi(1) \\ &= 1 - 0.8413 = 0.1587 \end{aligned}

Between 60 and 85 marks:

P(60<X<85)=Φ(1.5)−Φ(−1)=0.9332−0.1587=0.7745\begin{aligned} P(60 < X < 85) &= \Phi(1.5) - \Phi(-1) \\ &= 0.9332 - 0.1587 = 0.7745 \end{aligned}

Always draw a small bell and shade the area you want. The sketch tells you whether the answer must be more or less than 0.5, and that catches most mistakes.

A normal quantity X with the mean μ and the standard deviation σ. Move z and see the area.

40−350−260−17008019021003

x = μ + z × σ = 70 + 1.5 × 10 = 85

P(X < 85) = Φ(1.5) = 0.9332

Change μ and σ: the numbers on the axis change, the picture and the probability do not. Every normal distribution is the standard one with other labels.

9.5Backwards: from a probability to a value

"Which mark do the best 10 percent of the students exceed?" Now the area is known and the value is asked for.

  1. The area to the left of the mark is 0.90.
  2. Find 0.90 inside the table: the nearest entry is 0.8997, at z=1.28z = 1.28.
  3. Turn the z-score back into a mark: x=μ+z×σ=70+1.28×10=82.8x = \mu + z \times \sigma = 70 + 1.28 \times 10 = 82.8.

The step back is the z-score formula solved for xx:

x=μ+z×σx = \mu + z \times \sigma

z-scores that are used again and again:

The z-scores of often used areas
Area to the left0.800.900.950.9750.990.995
zz0.841.281.6451.962.332.576

So the middle 95 percent of every normal distribution lies within 1.96 standard deviations of the mean (the "2" of the 68-95-99.7 rule is 1.96 rounded), and the middle 90 percent within 1.645.

Try it yourself

The time that a machine needs for a job is normal with the mean 40 minutes and the standard deviation 8 minutes. Find the probability that a job takes less than 50 minutes, the probability that it takes more than 50 minutes, and the probability that it takes between 36 and 50 minutes.

Show a hint
The z-scores are 1.251.25 for 50 minutes and −0.5-0.5 for 36 minutes. Use Φ(−0.5)=1−Φ(0.5)\Phi(-0.5) = 1 - \Phi(0.5).
Show the solution

Answer: 0.89440.8944, 0.10560.1056 and 0.58590.5859.

z=50−408=1.25P(X<50)=Φ(1.25)=0.8944P(X>50)=1−0.8944=0.1056\begin{aligned} z &= \frac{50 - 40}{8} = 1.25 \\[4pt] P(X < 50) &= \Phi(1.25) = 0.8944 \\[4pt] P(X > 50) &= 1 - 0.8944 = 0.1056 \end{aligned}
z=36−408=−0.5Φ(−0.5)=1−0.6915=0.3085P(36<X<50)=0.8944−0.3085=0.5859\begin{aligned} z &= \frac{36 - 40}{8} = -0.5 \\[4pt] \Phi(-0.5) &= 1 - 0.6915 = 0.3085 \\[4pt] P(36 < X < 50) &= 0.8944 - 0.3085 = 0.5859 \end{aligned}

10The normal curve as an approximation, and sums

10.1A binomial distribution with a large n

P(X≥60)P(X \ge 60) for 100 tosses of a coin would need 41 binomial terms. But for a large nn the binomial bars form a bell, with the mean n×pn \times p and the standard deviation n×p×(1−p)\sqrt{n \times p \times (1 - p)}. So areas of the normal curve can replace sums of bars.

The rule: the approximation is good when both n×p≥5n \times p \ge 5 and n×(1−p)≥5n \times (1 - p) \ge 5 (some books ask for 10).

The continuity correction. A count takes whole values, the normal curve is continuous. The bar of the value 60 reaches from 59.5 to 60.5. So "at least 60" begins at 59.5:

The continuity correction
The countThe normal curve
P(X≥60)P(X \ge 60)the area to the right of 59.5
P(X≤60)P(X \le 60)the area to the left of 60.5
P(X=60)P(X = 60)the area between 59.5 and 60.5
59.550556065
The number of heads in 100 tosses (bars) and the normal curve with the mean 50 and the standard deviation 5. The bar of 60 reaches from 59.5 to 60.5, so 'at least 60' is the area of the curve to the right of 59.5, the dashed line.

Example. A coin is tossed 100 times. What is the probability of at least 60 heads?

μ=100×0.5=50σ=100×0.5×0.5=25=5z=59.5−505=1.9P(X≥60)≈1−Φ(1.9)=1−0.9713=0.0287\begin{aligned} \mu &= 100 \times 0.5 = 50 \\[4pt] \sigma &= \sqrt{100 \times 0.5 \times 0.5} = \sqrt{25} = 5 \\[4pt] z &= \frac{59.5 - 50}{5} = 1.9 \\[4pt] P(X \ge 60) &\approx 1 - \Phi(1.9) \\ &= 1 - 0.9713 = 0.0287 \end{aligned}

The exact binomial value is 0.0284. Sixty heads in a hundred tosses would be a surprise: it happens in fewer than 3 of 100 such experiments.

A Poisson distribution with a large λ\lambda (about 10 or more) is also close to a normal curve, with the mean λ\lambda and the standard deviation λ\sqrt{\lambda}.

10.2Sums and differences of normal quantities

If XX and YY are independent and normal, then X+YX + Y and X−YX - Y are normal too. Their means add or subtract, and their variances add in both cases (Part 3).

Example. A parcel holds a book and a box. The weight of the book is normal with the mean 200 g and the standard deviation 3 g; the box has the mean 300 g and the standard deviation 4 g. What is the probability that the parcel weighs more than 510 g?

mean of the sum=200+300=500variance of the sum=32+42=9+16=25σ=5(not 3+4=7)z=510−5005=2P(sum>510)=1−Φ(2)=1−0.9772=0.0228\begin{aligned} \text{mean of the sum} &= 200 + 300 = 500 \\[4pt] \text{variance of the sum} &= 3^2 + 4^2 = 9 + 16 = 25 \\[4pt] \sigma &= 5 \qquad (\text{not } 3 + 4 = 7) \\[4pt] z &= \frac{510 - 500}{5} = 2 \\[4pt] P(\text{sum} > 510) &= 1 - \Phi(2) \\ &= 1 - 0.9772 = 0.0228 \end{aligned}

The sum of nn independent quantities with the same mean μ\mu and the same standard deviation σ\sigma has the mean n×μn \times \mu and the standard deviation n×σ\sqrt{n} \times \sigma. This n\sqrt{n} returns in the standard error (Part 12).

Try it yourself

A fair coin is tossed 36 times. Find the mean and the standard deviation of the number of heads. Then use the normal approximation with the continuity correction to find the probability of at least 23 heads.

Show a hint
n×p=18n \times p = 18 and n×(1−p)=18n \times (1 - p) = 18, so the approximation may be used. "At least 23" begins at 22.5.
Show the solution

Answer: The mean is 18, the standard deviation 3, and the probability is about 0.06680.0668.

μ=36×0.5=18σ=36×0.5×0.5=9=3z=22.5−183=1.5P(X≥23)≈1−Φ(1.5)=1−0.9332=0.0668\begin{aligned} \mu &= 36 \times 0.5 = 18 \\[4pt] \sigma &= \sqrt{36 \times 0.5 \times 0.5} = \sqrt{9} = 3 \\[4pt] z &= \frac{22.5 - 18}{3} = 1.5 \\[4pt] P(X \ge 23) &\approx 1 - \Phi(1.5) \\ &= 1 - 0.9332 = 0.0668 \end{aligned}

The exact binomial value is 0.0662, so the approximation is close.

11Populations and samples

11.1The words

The four words of sampling
WordMeaningExample
Populationall the things we want to know something aboutall 2 million customers of a bank
Samplethe part of the population that we really observethe 1,000 customers who were asked
Parametera number that describes the population; fixed, but usually unknownthe mean income μ\mu of all customers; the share pp who would buy
Statistica number calculated from the sample; it changes from sample to samplethe mean income xˉ\bar{x} of the 1,000; the share p^\hat{p} among them

The whole of statistics is one move: use a statistic to say something about a parameter. In machine learning the training data is a sample, and "all data the model will ever see" is the population.

11.2How to choose a sample

Five ways of choosing a sample
MethodHow it worksRemark
Simple random sampleevery member has the same chance, like drawing names from a hatthe standard; the formulas of this lesson assume it
Systematic sampleevery 10th (or k-th) member of a list, from a random startsimple; bad only if the list has a pattern with the same step
Stratified samplesplit the population into groups (strata) such as cities or age groups, and draw a random sample from every groupevery group is represented in the right share
Cluster samplechoose whole groups at random (some schools, some streets) and take everyone in themcheap, but less exact
Convenience samplewhoever is easy to reachnot random: usually biased

A random sample

every member has the same chance

A convenience sample

only those who are easy to reach

A population of 96 people and two samples of 12 (filled). In a random sample every person has the same chance, so the sample is spread over the whole population. A convenience sample takes the people who are easiest to reach: all from one corner.

11.3Bias

A sample is biased when some members of the population have a smaller chance of being chosen than others, so that the sample differs from the population in a systematic way. A larger sample does not repair bias.

The classic example is real. Before the American election of 1936 the magazine Literary Digest sent out millions of questionnaires and received about 2.4 million answers. It predicted a clear win for the candidate Landon. Roosevelt won by one of the largest margins in history. The addresses had come from telephone books and lists of car owners, and in 1936 those were richer people; and only those who wished to answer did. A sample of 2.4 million was beaten by small polls with better sampling.

Everyday forms of bias:

  • Selection bias: asking the visitors of a gym how much the people of a city exercise.
  • Non-response bias: only the very satisfied and the very angry customers fill in the survey.
  • Survivorship bias: studying only the companies that still exist.
  • In machine learning: a model trained on photos taken in daylight is used at night; a model trained on the customers of one city is used in another.

11.4With and without putting back

Sampling with replacement means that a member can be chosen again; the draws are independent. Sampling without replacement means that nobody is chosen twice; that is how real surveys work. When the population is much larger than the sample, the difference does not matter (Part 6), and the simple formulas of the next part hold.

In machine learning both kinds appear. A train and test split takes rows without replacement: no row is in both. A bootstrap sample, used by random forests, takes nn rows with replacement from nn rows, so some rows appear several times and others not at all. A stratified split keeps the share of every class the same in the training and the test set, which matters when one class is rare.

Try it yourself

Name the method or the word. (a) A teacher wants to know how long the 600 students of a school sleep, and asks the students who sit in the first row of her class. (b) A shop takes every 20th name of its list of customers, starting from a name chosen at random. (c) A company with offices in four cities draws a random sample of employees from every city. (d) The mean age of the 50 customers who were asked is 34 years. Is the number 34 a parameter or a statistic?

Show a hint
Who had a chance of being chosen? In (d): does the number describe everyone, or only those who were asked?
Show the solution

Answer: (a) a convenience sample, (b) a systematic sample, (c) a stratified sample, (d) a statistic.

(a) Only the students who are easy to reach were asked, and they are all from one class: a convenience sample, and probably a biased one. (b) A fixed step through a list from a random start is a systematic sample. (c) The cities are the strata, and every one of them is represented. (d) The number comes from the sample of 50, so it is a statistic. The mean age of all customers is the parameter, and nobody knows it exactly.

12The sampling distribution of the mean

12.1A statistic is a random variable

Take a sample of 25 students and calculate their mean mark. Take another 25 students: the mean is a little different. The sample mean xˉ\bar{x} depends on chance, so it is a random variable and has its own distribution. This is the sampling distribution of the mean. Its centre and its spread tell us how good one sample is.

12.2A population small enough to list

A population has only three values: 2, 4 and 6. Its mean and variance:

μ=2+4+63=4σ2=(2−4)2+(4−4)2+(6−4)23=83≈2.667\begin{aligned} \mu &= \frac{2 + 4 + 6}{3} = 4 \\[4pt] \sigma^2 &= \frac{(2 - 4)^2 + (4 - 4)^2 + (6 - 4)^2}{3} \\[2pt] &= \frac{8}{3} \approx 2.667 \end{aligned}

Draw samples of size 2 with replacement. There are 3×3=93 \times 3 = 9 equally likely samples:

The nine samples of size 2 and their means
Sample(2, 2)(2, 4)(2, 6)(4, 2)(4, 4)(4, 6)(6, 2)(6, 4)(6, 6)
Mean xˉ\bar{x}234345456

The distribution of the sample mean:

The distribution of the sample mean
xˉ\bar{x}23456
Probability19\tfrac{1}{9}29\tfrac{2}{9}39\tfrac{3}{9}29\tfrac{2}{9}19\tfrac{1}{9}
E(xˉ)=2×1+3×2+4×3+5×2+6×19=369=4Var⁡(xˉ)=4×1+1×2+0×3+1×2+4×19=129=43\begin{aligned} E(\bar{x}) &= \frac{2 \times 1 + 3 \times 2 + 4 \times 3 + 5 \times 2 + 6 \times 1}{9} \\[2pt] &= \frac{36}{9} = 4 \\[8pt] \Var(\bar{x}) &= \frac{4 \times 1 + 1 \times 2 + 0 \times 3 + 1 \times 2 + 4 \times 1}{9} \\[2pt] &= \frac{12}{9} = \frac{4}{3} \end{aligned}

In the second line the numbers 4, 1, 0, 1, 4 are the squared distances of the means 2, 3, 4, 5, 6 from 4.

Two facts appear, and they hold for every population:

  • The sample means are centred on the population mean: E(xˉ)=μE(\bar{x}) = \mu.
  • Their variance is the population variance divided by the sample size: 43=83÷2\tfrac{4}{3} = \tfrac{8}{3} \div 2.

Look also at the shape. The population is flat (each value 13\tfrac{1}{3}), but the means already pile up in the middle.

00.250.51/3231/3451/36

The population

mean 4, variance 8/3

00.250.51/922/933/942/951/96

The means of samples of size 2

mean 4, variance 4/3

The population is flat: each of its three values has the probability 1/3. The means of samples of size 2 already pile up in the middle, and they are less spread out.

12.3The standard error

For a random sample of size nn from a population with the mean μ\mu and the standard deviation σ\sigma:

E(xˉ)=μVar⁡(xˉ)=σ2nstandard deviation of xˉ=σn\begin{aligned} E(\bar{x}) &= \mu \\[4pt] \Var(\bar{x}) &= \frac{\sigma^2}{n} \\[4pt] \text{standard deviation of } \bar{x} &= \frac{\sigma}{\sqrt{n}} \end{aligned}

The standard deviation of the sample mean has its own name, the standard error (SE):

SE=σn\SE = \frac{\sigma}{\sqrt{n}}

It is the typical distance between a sample mean and the true mean. Where it comes from: the sum of nn observations has the standard deviation n×σ\sqrt{n} \times \sigma (Part 10), and dividing the sum by nn gives n×σn=σn\dfrac{\sqrt{n} \times \sigma}{n} = \dfrac{\sigma}{\sqrt{n}}.

The square root has a hard consequence:

The standard error for a population with the standard deviation 10
Sample size nn14162510040010,000
SE when σ=10\sigma = 101052.5210.50.1

To halve the error you need four times as much data. To make it ten times smaller you need a hundred times as much. Data gets expensive quickly.

12.4The law of large numbers

As nn grows, σn\dfrac{\sigma}{\sqrt{n}} goes to 0: the sample mean comes as close to μ\mu as we wish. This is the law of large numbers, which the last lesson showed for the share of heads in a long run of tosses.

12.5The central limit theorem

The most important theorem of statistics:

A usual rule: n≥30n \ge 30 is "large". If the population itself is normal, the statement is exact for every nn. If the population is very skewed, more than 30 may be needed.

012345678

single values

012345

means of 5 values

0123

means of 30 values

20,000 samples from a very skewed population (waiting times with the mean 2, the dashed line). Single values show the skewed population itself. The means of 5 values are already more symmetric. The means of 30 values form a narrow bell around 2.

The picture shows 20,000 samples from a very skewed population (waiting times with the mean 2, the dashed line). Single values (n=1n = 1) show the skewed population itself. The means of 5 values are already more symmetric. The means of 30 values form a narrow bell around 2.

Choose a population and a sample size. Draw many samples and watch their means.

Sample size n
123456

No samples yet. Every sample is 5 random values from the population; the picture collects the means of the samples.

Every number from 1 to 6 is equally likely. With n = 1 you see the population itself. With n = 30 the means form a bell around μ, whatever the population looks like.

Example. The marks of all students of a large course have the mean 70 and the standard deviation 10. What is the probability that (a) one student chosen at random has more than 73 marks, (b) the mean of 25 students chosen at random is more than 73? Assume the marks are normal.

(a) One student:

z=73−7010=0.3P(X>73)=1−Φ(0.3)=1−0.6179=0.3821\begin{aligned} z &= \frac{73 - 70}{10} = 0.3 \\[4pt] P(X > 73) &= 1 - \Phi(0.3) \\ &= 1 - 0.6179 = 0.3821 \end{aligned}

(b) The mean of 25:

SE=1025=2z=73−702=1.5P(xˉ>73)=1−Φ(1.5)=1−0.9332=0.0668\begin{aligned} \SE &= \frac{10}{\sqrt{25}} = 2 \\[4pt] z &= \frac{73 - 70}{2} = 1.5 \\[4pt] P(\bar{x} > 73) &= 1 - \Phi(1.5) \\ &= 1 - 0.9332 = 0.0668 \end{aligned}

A single student above 73 is ordinary (38 percent). A whole group of 25 with a mean above 73 is rare (under 7 percent): single values vary a lot, means vary little. For a question about a mean, divide by the standard error, not by σ\sigma.

Marks with the mean 70 and the standard deviation 10. How often is one student above x, and how often the mean of n students?

405060708090100
  • one student
  • the mean of 25 students

Standard error: σ / √n = 10 / √25 = 2

One student above 73: z = (73 − 70) / 10 = 0.3, probability 0.3821

The mean of 25 above 73: z = (73 − 70) / 2 = 1.5, probability 0.0668

Single values vary with σ, means vary with σ / √n. Four times as many students give half the standard error.

12.6The sample proportion

"Which share of the customers would buy?" is a question about a proportion. In a sample of nn people, XX say yes, and the sample proportion is p^=Xn\hat{p} = \dfrac{X}{n}. XX is binomial, so dividing its mean n×pn \times p and its standard deviation n×p×(1−p)\sqrt{n \times p \times (1 - p)} by nn gives:

E(p^)=pSE of p^=p×(1−p)n\begin{aligned} E(\hat{p}) &= p \\[4pt] \SE \text{ of } \hat{p} &= \sqrt{\frac{p \times (1 - p)}{n}} \end{aligned}

For a large sample (n×p≥5n \times p \ge 5 and n×(1−p)≥5n \times (1 - p) \ge 5), p^\hat{p} is approximately normal.

Example. 40 percent of all customers prefer the new design. In a random sample of 600 customers, what is the probability that more than 44 percent prefer it?

SE=0.4×0.6600=0.0004=0.02z=0.44−0.400.02=2P(p^>0.44)=1−Φ(2)=1−0.9772=0.0228\begin{aligned} \SE &= \sqrt{\frac{0.4 \times 0.6}{600}} = \sqrt{0.0004} = 0.02 \\[4pt] z &= \frac{0.44 - 0.40}{0.02} = 2 \\[4pt] P(\hat{p} > 0.44) &= 1 - \Phi(2) \\ &= 1 - 0.9772 = 0.0228 \end{aligned}

With 600 people the sample share is almost always within 4 points of the truth (two standard errors). This is why polls of about 1,000 people can speak for millions, if the sample is random.

Try it yourself

A population has the mean 50 and the standard deviation 12. A random sample of 36 is taken. Find the standard error of the sample mean, and the probability that the sample mean is below 46.5.

Show a hint
SE=σn\SE = \dfrac{\sigma}{\sqrt{n}}. Then the z-score of 46.5 with the standard error below the line, not σ\sigma.
Show the solution

Answer: SE=2\SE = 2 and the probability is 0.04010.0401.

SE=1236=126=2z=46.5−502=−1.75P(xˉ<46.5)=Φ(−1.75)=1−Φ(1.75)=1−0.9599=0.0401\begin{aligned} \SE &= \frac{12}{\sqrt{36}} = \frac{12}{6} = 2 \\[4pt] z &= \frac{46.5 - 50}{2} = -1.75 \\[4pt] P(\bar{x} < 46.5) &= \Phi(-1.75) = 1 - \Phi(1.75) \\ &= 1 - 0.9599 = 0.0401 \end{aligned}

A sample of 36 is large, so the central limit theorem allows the normal table, whatever the population looks like.

13Distributions and sampling in machine learning

Labels are Bernoulli variables. A classifier does not output "spam". It outputs pp, the parameter of a Bernoulli distribution for this email. Training a logistic regression or a neural network means finding the pp values that make the observed labels most probable.

Noise is normal. Linear regression assumes: price = the model's prediction + an error, and the error is normal with the mean 0. Minimising the squared errors, the usual training goal, is exactly what this assumption leads to.

Feature scaling is the z-score. Before training, a column is often replaced by x−meanstandard deviation\dfrac{x - \text{mean}}{\text{standard deviation}}. Every column then has the mean 0 and the standard deviation 1, so that a column in metres and a column of prices in thousands have the same weight.

Outliers. By the 68-95-99.7 rule, a value with a z-score above 3 or below −3-3 is rare in normal data. A simple and common first check for unusual rows is "is ∣z∣>3\len{z} > 3?".

Weights start as random numbers. A neural network begins with weights drawn from a normal (or uniform) distribution with the mean 0 and a small standard deviation.

Counts are Poisson. Predicting the number of orders per hour or of visits per day uses models built on the Poisson distribution.

A test set is a sample. If a model is right on a share pp of all possible inputs, then its accuracy measured on nn test rows is a sample proportion with the standard error p×(1−p)n\sqrt{\dfrac{p \times (1 - p)}{n}}. For a true accuracy of 0.90 and 400 test rows:

SE=0.9×0.1400=0.000225=0.015\SE = \sqrt{\frac{0.9 \times 0.1}{400}} = \sqrt{0.000225} = 0.015

Measured accuracies between about 0.87 and 0.93 (two standard errors) are all consistent with the same model. A difference of one point between two models on a small test set proves nothing.

Mini-batches are samples. A neural network does not use all rows for every step of training. It uses a random batch, for example 32 rows. The direction computed from the batch is a sample mean, so its noise falls like 1batch size\dfrac{1}{\sqrt{\text{batch size}}}: a batch four times as large is only twice as exact.

Bootstrap samples. A random forest trains every tree on nn rows drawn with replacement from the nn training rows. The probability that one given row is never drawn is

(1−1n)n≈e−1≈0.368for a large n\left(1 - \frac{1}{n}\right)^n \approx e^{-1} \approx 0.368 \qquad \text{for a large } n

So every tree sees about 63 percent of the rows, and the other 37 percent can be used to test it. For n=1000n = 1000 the exact value is 0.9991000≈0.36770.999^{1000} \approx 0.3677.

Try it yourself

A model classifies 75 percent of all possible inputs correctly. It is tested on 300 random inputs. Find the standard error of the measured accuracy. Between which two values does the measured accuracy lie in about 95 percent of such tests (the true accuracy plus and minus two standard errors)?

Show a hint
The measured accuracy is a sample proportion with p=0.75p = 0.75 and n=300n = 300.
Show the solution

Answer: SE=0.025\SE = 0.025, and the measured accuracy lies between about 0.70 and 0.80.

SE=0.75×0.25300=0.000625=0.025lower value=0.75−2×0.025=0.70upper value=0.75+2×0.025=0.80\begin{aligned} \SE &= \sqrt{\frac{0.75 \times 0.25}{300}} = \sqrt{0.000625} \\[2pt] &= 0.025 \\[6pt] \text{lower value} &= 0.75 - 2 \times 0.025 = 0.70 \\[4pt] \text{upper value} &= 0.75 + 2 \times 0.025 = 0.80 \end{aligned}

A measured accuracy of 0.72 and one of 0.78 can come from the very same model. With 300 test rows, differences of a few points are noise.

14Common mistakes

Using the binomial formula without checking the conditions. Cards dealt without putting back, or a number of trials that is not fixed, are not binomial (Part 4).

Forgetting C(n,k)C(n, k). pk×(1−p)n−kp^k \times (1 - p)^{n - k} is the probability of one order of successes and failures. There are C(n,k)C(n, k) orders.

Reading "at least" and "more than" as the same. For a count, "at least 3" is X≥3X \ge 3 and "more than 3" is X≥4X \ge 4.

Not scaling λ\lambda. A rate of 4 per hour is λ=2\lambda = 2 for half an hour and λ=8\lambda = 8 for two hours. Scale first, then calculate.

Adding standard deviations. For independent quantities the variances add: 3 and 4 give 9+16=5\sqrt{9 + 16} = 5, not 7.

Subtracting variances for a difference. Var⁡(X−Y)=Var⁡(X)+Var⁡(Y)\Var(X - Y) = \Var(X) + \Var(Y). A difference of two uncertain numbers is more uncertain than each of them.

Reading the table for the wrong side. The table gives the area to the left. "More than" needs 1−Φ(z)1 - \Phi(z). A sketch shows which side is meant.

Forgetting the minus sign of a z-score. A value below the mean has a negative z-score, and its area to the left is less than 0.5.

Putting a z-score where a probability belongs. A z-score can be any number; a probability lies between 0 and 1. If a "probability" is 1.5, it is a z-score.

Dividing by σ\sigma in a question about a mean. One value varies with σ\sigma. The mean of nn values varies with σn\dfrac{\sigma}{\sqrt{n}}.

Thinking a single value of a continuous quantity has a probability. P(X=170)P(X = 170) is 0 for a height. Ask for an interval.

Thinking the central limit theorem makes the data normal. It makes the sample mean approximately normal. The single values keep the shape of the population.

Trusting a large biased sample. Size reduces the random error, never the bias (Part 11).

Common mistakes and what is right
WrongRight
P(X=k)=pk×(1−p)n−kP(X = k) = p^k \times (1 - p)^{n - k}C(n,k)×pk×(1−p)n−kC(n, k) \times p^k \times (1 - p)^{n - k}
"more than 3" is X≥3X \ge 3"more than 3" is X≥4X \ge 4 for a count
4 per hour, so λ=4\lambda = 4 for 30 minutesλ=2\lambda = 2 for 30 minutes
σ\sigma of a sum is σ1+σ2\sigma_1 + \sigma_2σ12+σ22\sqrt{\sigma_1^2 + \sigma_2^2} for independent quantities
P(X>x)=Φ(z)P(X > x) = \Phi(z)P(X>x)=1−Φ(z)P(X > x) = 1 - \Phi(z)
Φ(−1.2)=−Φ(1.2)\Phi(-1.2) = -\Phi(1.2)Φ(−1.2)=1−Φ(1.2)\Phi(-1.2) = 1 - \Phi(1.2)
z for a sample mean: xˉ−μσ\dfrac{\bar{x} - \mu}{\sigma}xˉ−μσ/n\dfrac{\bar{x} - \mu}{\sigma / \sqrt{n}}
four times the data, a quarter of the errorfour times the data, half of the error

15Solved problems (from the easiest to the hardest)

Each problem has the question, the idea behind it with the part of the lesson it uses, and the calculation step by step. Cover the solution and try first.

Level 1: Random variables, binomial and Poisson

Problem 1: Reading a distribution table

The number XX of cars sold by a dealer in a day has the distribution in the table below. Check that it is a distribution. Find P(X≥2)P(X \ge 2) and the expected number of cars.

The number of cars sold in a day
kk0123
P(X=k)P(X = k)0.10.30.40.2

Idea. The probabilities must add up to 1. A range of values adds probabilities; the expected value is every value times its probability (Parts 2 and 3).

0.1+0.3+0.4+0.2=1P(X≥2)=0.4+0.2=0.6E(X)=0×0.1+1×0.3+2×0.4+3×0.2=0.3+0.8+0.6=1.7\begin{aligned} 0.1 + 0.3 + 0.4 + 0.2 &= 1 \\[6pt] P(X \ge 2) &= 0.4 + 0.2 = 0.6 \\[6pt] E(X) &= 0 \times 0.1 + 1 \times 0.3 \\ &\quad + 2 \times 0.4 + 3 \times 0.2 \\ &= 0.3 + 0.8 + 0.6 = 1.7 \end{aligned}

The first line shows that it is a distribution.

Why: 1.7 cars are never sold on one day. Over 100 days the dealer sells about 170.

Problem 2: Variance and standard deviation

A machine makes 0, 1 or 2 defective parts in an hour with the probabilities 0.6, 0.3 and 0.1. Find the mean, the variance and the standard deviation of the number of defective parts.

Idea. Use the shortcut Var⁡(X)=E(X2)−μ2\Var(X) = E(X^2) - \mu^2 (Part 3).

μ=0×0.6+1×0.3+2×0.1=0.5E(X2)=02×0.6+12×0.3+22×0.1=0.3+0.4=0.7Var⁡(X)=0.7−0.52=0.7−0.25=0.45σ=0.45≈0.671\begin{aligned} \mu &= 0 \times 0.6 + 1 \times 0.3 + 2 \times 0.1 = 0.5 \\[4pt] E(X^2) &= 0^2 \times 0.6 + 1^2 \times 0.3 + 2^2 \times 0.1 \\ &= 0.3 + 0.4 = 0.7 \\[4pt] \Var(X) &= 0.7 - 0.5^2 = 0.7 - 0.25 = 0.45 \\[4pt] \sigma &= \sqrt{0.45} \approx 0.671 \end{aligned}

Why: the square of the mean is subtracted, not the mean. A check with the definition: 0.25×0.6+0.25×0.3+2.25×0.1=0.15+0.075+0.225=0.450.25 \times 0.6 + 0.25 \times 0.3 + 2.25 \times 0.1 = 0.15 + 0.075 + 0.225 = 0.45.

Problem 3: Changing the scale

The number XX of orders in a day has the mean 3 and the variance 4. Every order brings 50 in profit, and the fixed cost of a day is 20. Find the mean and the standard deviation of the daily profit Y=50×X−20Y = 50 \times X - 20.

Idea. The rules for a×X+ba \times X + b (Part 3): the mean follows the whole formula, the spread only the factor.

E(Y)=50×3−20=130Var⁡(Y)=502×4=2500×4=10,000σ of Y=10,000=100\begin{aligned} E(Y) &= 50 \times 3 - 20 = 130 \\[4pt] \Var(Y) &= 50^2 \times 4 = 2500 \times 4 = 10{,}000 \\[4pt] \sigma \text{ of } Y &= \sqrt{10{,}000} = 100 \end{aligned}

Or directly: 50×σ50 \times \sigma of XX is 50×2=10050 \times 2 = 100.

Why: the fixed cost moves every possible profit down by the same 20. It changes the mean and leaves the spread alone.

Problem 4: One binomial probability

A fair coin is tossed 6 times. What is the probability of exactly 4 heads?

Idea. Binomial with n=6n = 6 and p=0.5p = 0.5 (Part 4). With p=0.5p = 0.5 every order of heads and tails has the same probability 0.560.5^6.

C(6,4)=6×52×1=15P(X=4)=15×0.54×0.52=15×0.56=1564≈0.2344\begin{aligned} C(6, 4) &= \frac{6 \times 5}{2 \times 1} = 15 \\[6pt] P(X = 4) &= 15 \times 0.5^4 \times 0.5^2 = 15 \times 0.5^6 \\[2pt] &= \frac{15}{64} \approx 0.2344 \end{aligned}

Choosing the 2 tails is the same as choosing the 4 heads.

Why: C(6,4)=C(6,2)C(6, 4) = C(6, 2). Always calculate the smaller of the two.

Problem 5: "At least" with a binomial count

A test has 5 questions with 4 answers each, and a student guesses every answer. What is the probability of at least 4 right answers?

Idea. Binomial with n=5n = 5 and p=0.25p = 0.25. "At least 4" is 4 or 5 (Parts 2 and 4).

P(X=4)=C(5,4)×0.254×0.75=5×0.00390625×0.75=0.014648P(X=5)=0.255=0.000977P(X≥4)=0.014648+0.000977=0.015625≈0.0156\begin{aligned} P(X = 4) &= C(5, 4) \times 0.25^4 \times 0.75 \\ &= 5 \times 0.00390625 \times 0.75 \\ &= 0.014648 \\[6pt] P(X = 5) &= 0.25^5 = 0.000977 \\[6pt] P(X \ge 4) &= 0.014648 + 0.000977 \\ &= 0.015625 \approx 0.0156 \end{aligned}

Why: here the direct sum has two terms and the complement would have four. Choose the shorter side. Guessing passes such a test less than twice in a hundred tries.

Problem 6: Mean and spread of a binomial count

200 seeds are planted, and each one grows with the probability 0.9, independently. How many plants are expected, and what is the standard deviation?

Idea. E(X)=n×pE(X) = n \times p and σ=n×p×(1−p)\sigma = \sqrt{n \times p \times (1 - p)} (Part 4).

E(X)=200×0.9=180Var⁡(X)=200×0.9×0.1=18σ=18≈4.243\begin{aligned} E(X) &= 200 \times 0.9 = 180 \\[4pt] \Var(X) &= 200 \times 0.9 \times 0.1 = 18 \\[4pt] \sigma &= \sqrt{18} \approx 4.243 \end{aligned}

Why: "about 180 plants, give or take 4". By the 68-95-99.7 rule (the count is close to a bell, Part 10), fewer than 172 plants would be unusual.

Problem 7: One Poisson probability

A typist makes 2 mistakes per page on average. What is the probability of exactly 3 mistakes on a page?

Idea. A count on a page at a known average rate: Poisson with λ=2\lambda = 2 (Part 5).

P(X=3)=23×e−23!=8×0.135346≈0.1804\begin{aligned} P(X = 3) &= \frac{2^3 \times e^{-2}}{3!} = \frac{8 \times 0.13534}{6} \\[2pt] &\approx 0.1804 \end{aligned}

Why: there is no number of "trials" on a page, only an average rate. That is the sign of a Poisson count.

Problem 8: "At least" with a Poisson count

An online shop receives 5 orders per hour on average. What is the probability of at least 2 orders in the next hour?

Idea. A Poisson count has no upper limit, so "at least" always goes through the complement (Part 5).

P(X=0)=e−5≈0.0067P(X=1)=5×e−5≈0.0337P(X≥2)=1−(0.0067+0.0337)=1−0.0404=0.9596\begin{aligned} P(X = 0) &= e^{-5} \approx 0.0067 \\[4pt] P(X = 1) &= 5 \times e^{-5} \approx 0.0337 \\[6pt] P(X \ge 2) &= 1 - (0.0067 + 0.0337) \\ &= 1 - 0.0404 = 0.9596 \end{aligned}

Why: the direct way would add infinitely many terms: 2, 3, 4, ... orders.

Problem 9: A uniform waiting time

A task takes between 10 and 30 minutes, and every time in this interval is equally likely. Find the probability that it takes less than 15 minutes, the mean time and the standard deviation.

Idea. A continuous uniform distribution: a probability is a share of the interval (Part 7).

P(X<15)=15−1030−10=520=0.25E(X)=10+302=20Var⁡(X)=(30−10)212=40012≈33.33σ≈5.774\begin{aligned} P(X < 15) &= \frac{15 - 10}{30 - 10} = \frac{5}{20} = 0.25 \\[6pt] E(X) &= \frac{10 + 30}{2} = 20 \\[6pt] \Var(X) &= \frac{(30 - 10)^2}{12} = \frac{400}{12} \approx 33.33 \\[6pt] \sigma &\approx 5.774 \end{aligned}

Why: the density is flat with the height 120\tfrac{1}{20}, so the area over an interval is its width divided by 20.

Level 2: The normal distribution

Problem 10: The 68-95-99.7 rule

The lifetime of a battery is normal with the mean 40 hours and the standard deviation 3 hours. Which share of the batteries lasts between 37 and 46 hours?

Idea. 37 is one standard deviation below the mean, and 46 is two above. Use the rule and symmetry (Part 8).

between 37 and 40:half of 68%=34%between 40 and 46:half of 95%=47.5%between 37 and 46:34%+47.5%=81.5%\begin{aligned} \text{between 37 and 40:} \quad & \text{half of } 68\% = 34\% \\[2pt] \text{between 40 and 46:} \quad & \text{half of } 95\% = 47.5\% \\[6pt] \text{between 37 and 46:} \quad & 34\% + 47.5\% = 81.5\% \end{aligned}

Why: the interval is not symmetric, so it is split at the mean into two halves that the rule knows.

Problem 11: An area to the left

The weights of apples are normal with the mean 150 g and the standard deviation 20 g. What is the probability that an apple weighs less than 176 g?

Idea. Turn the value into a z-score and read the table (Part 9).

z=176−15020=1.3P(X<176)=Φ(1.3)=0.9032\begin{aligned} z &= \frac{176 - 150}{20} = 1.3 \\[4pt] P(X < 176) &= \Phi(1.3) = 0.9032 \end{aligned}

Why: 176 is above the mean, so the answer must be more than 0.5. It is.

Problem 12: An area to the right

A delivery takes 30 minutes on average with the standard deviation 5 minutes, normally distributed. What is the probability that a delivery takes more than 38 minutes?

Idea. The table gives the left side; the right side is the rest (Part 9).

z=38−305=1.6P(X>38)=1−Φ(1.6)=1−0.9452=0.0548\begin{aligned} z &= \frac{38 - 30}{5} = 1.6 \\[4pt] P(X > 38) &= 1 - \Phi(1.6) \\ &= 1 - 0.9452 = 0.0548 \end{aligned}

Why: about 1 delivery in 18 is this late. A promise "at most 38 minutes" would be broken more than 5 times in 100.

Problem 13: An area between two values

A machine fills bottles with a mean of 500 ml and a standard deviation of 4 ml, normally distributed. What is the probability that a bottle holds between 495 and 507 ml?

Idea. Two z-scores, then the difference of the two left areas (Part 9).

z1=495−5004=−1.25Φ(−1.25)=1−0.8944=0.1056z2=507−5004=1.75Φ(1.75)=0.9599\begin{aligned} z_1 &= \frac{495 - 500}{4} = -1.25 \\[4pt] \Phi(-1.25) &= 1 - 0.8944 = 0.1056 \\[6pt] z_2 &= \frac{507 - 500}{4} = 1.75 \\[4pt] \Phi(1.75) &= 0.9599 \end{aligned}
P(495<X<507)=0.9599−0.1056=0.8543\begin{aligned} P(495 < X < 507) &= 0.9599 - 0.1056 \\ &= 0.8543 \end{aligned}

Why: "everything to the left of 507" minus "everything to the left of 495" leaves the strip between them.

Problem 14: A value below the mean

The lifetime of a lamp is normal with the mean 1,200 hours and the standard deviation 100 hours. What is the probability that a lamp fails before 1,080 hours?

Idea. A negative z-score: use the symmetry Φ(−z)=1−Φ(z)\Phi(-z) = 1 - \Phi(z) (Part 9).

z=1080−1200100=−1.2P(X<1080)=Φ(−1.2)=1−Φ(1.2)=1−0.8849=0.1151\begin{aligned} z &= \frac{1080 - 1200}{100} = -1.2 \\[4pt] P(X < 1080) &= \Phi(-1.2) = 1 - \Phi(1.2) \\ &= 1 - 0.8849 = 0.1151 \end{aligned}

Why: the area to the left of −1.2-1.2 is as large as the area to the right of +1.2+1.2. The answer is less than 0.5, as it must be for a value below the mean.

Problem 15: From a probability back to a value

The monthly salaries in a company are normal with the mean 2,000 and the standard deviation 300. Which salary is exceeded by only 5 percent of the employees?

Idea. The backwards direction: area, then zz, then x=μ+z×σx = \mu + z \times \sigma (Part 9).

area to the left=0.95soz=1.645x=2000+1.645×300=2000+493.5=2493.5\begin{aligned} \text{area to the left} &= 0.95 \quad \text{so} \quad z = 1.645 \\[4pt] x &= 2000 + 1.645 \times 300 \\ &= 2000 + 493.5 = 2493.5 \end{aligned}

Why: the question gives the area to the right (5 percent). The table works with the left side, so look for 0.95.

Problem 16: Comparing with z-scores

Aysel has 82 marks in mathematics, where the mean is 70 and the standard deviation 8. She has 75 marks in physics, where the mean is 60 and the standard deviation 6. In which subject did she do better compared with the other students?

Idea. Marks from different exams cannot be compared directly. z-scores can (Part 9).

mathematics:z=82−708=1.5physics:z=75−606=2.5\begin{aligned} \text{mathematics:} \quad & z = \frac{82 - 70}{8} = 1.5 \\[4pt] \text{physics:} \quad & z = \frac{75 - 60}{6} = 2.5 \end{aligned}

Physics: she is 2.5 standard deviations above the mean there.

Why: the lower mark is the better result, because the physics exam was harder and its marks lie closer together. With the table: Φ(2.5)=0.9938\Phi(2.5) = 0.9938, so she is ahead of about 99 percent in physics and of Φ(1.5)\Phi(1.5), about 93 percent, in mathematics.

Problem 17: A Poisson count over a longer period

A machine breaks down 0.5 times per week on average. What is the probability of no breakdown in 4 weeks, and of exactly 2 breakdowns in 4 weeks?

Idea. Scale the rate to the period first: λ=0.5×4=2\lambda = 0.5 \times 4 = 2 (Part 5).

P(X=0)=e−2≈0.1353P(X=2)=22×e−22!=4×0.135342≈0.2707\begin{aligned} P(X = 0) &= e^{-2} \approx 0.1353 \\[6pt] P(X = 2) &= \frac{2^2 \times e^{-2}}{2!} = \frac{4 \times 0.13534}{2} \\[2pt] &\approx 0.2707 \end{aligned}

Why: the formula always needs the average number of events in the period that the question is about.

Problem 18: Waiting for the first success

10 percent of the parts of a machine are defective. An inspector checks the parts one by one. What is the probability that the first defective part is the 5th one, and how many parts are checked on average until the first defective one?

Idea. The number of trials is not fixed: this is the geometric distribution (Part 6).

P(X=5)=0.94×0.1=0.6561×0.1≈0.0656E(X)=10.1=10\begin{aligned} P(X = 5) &= 0.9^4 \times 0.1 = 0.6561 \times 0.1 \\ &\approx 0.0656 \\[6pt] E(X) &= \frac{1}{0.1} = 10 \end{aligned}

Why: four good parts must come first, then the defective one. There is no C(n,k)C(n, k), because the order is fixed.

Level 3: Approximations, sums and sampling

Problem 19: The normal curve instead of a binomial sum

400 visitors come to a shop, and each buys with the probability 0.2. What is the probability that more than 90 of them buy?

Idea. n×p=80n \times p = 80 and n×(1−p)=320n \times (1 - p) = 320 are both large, so the normal approximation with the continuity correction is used (Part 10).

μ=400×0.2=80σ=400×0.2×0.8=64=8\begin{aligned} \mu &= 400 \times 0.2 = 80 \\[4pt] \sigma &= \sqrt{400 \times 0.2 \times 0.8} = \sqrt{64} = 8 \end{aligned}

"More than 90" is X≥91X \ge 91, which begins at 90.5:

z=90.5−808=1.3125≈1.31P(X>90)≈1−Φ(1.31)=1−0.9049=0.0951\begin{aligned} z &= \frac{90.5 - 80}{8} = 1.3125 \approx 1.31 \\[4pt] P(X > 90) &\approx 1 - \Phi(1.31) \\ &= 1 - 0.9049 = 0.0951 \end{aligned}

Why: the exact binomial sum has 310 terms and gives 0.0961. The approximation needs one line of the table.

Problem 20: Poisson instead of binomial

A factory makes 2,000 parts in a day, and each one is defective with the probability 0.0015. What is the probability of at most 2 defective parts in a day?

Idea. A large nn and a tiny pp: Poisson with λ=n×p\lambda = n \times p (Part 5).

λ=2000×0.0015=3P(X≤2)=e−3×(1+3+322)=0.04979×8.5≈0.4232\begin{aligned} \lambda &= 2000 \times 0.0015 = 3 \\[6pt] P(X \le 2) &= e^{-3} \times \left(1 + 3 + \frac{3^2}{2}\right) \\[2pt] &= 0.04979 \times 8.5 \approx 0.4232 \end{aligned}

Why: e−3e^{-3} is a common factor of the three terms P(X=0)P(X = 0), P(X=1)P(X = 1) and P(X=2)P(X = 2), so it is taken out. The exact binomial value is 0.4230.

Problem 21: The sum of several normal quantities

The weight of an adult is normal with the mean 75 kg and the standard deviation 10 kg. A lift carries 8 adults chosen at random. What is the probability that their total weight is more than 650 kg?

Idea. Means add, variances add (Part 10). The sum of independent normal quantities is normal.

mean of the sum=8×75=600variance of the sum=8×102=800σ=800≈28.28z=650−60028.28≈1.77P(sum>650)=1−Φ(1.77)=1−0.9616=0.0384\begin{aligned} \text{mean of the sum} &= 8 \times 75 = 600 \\[4pt] \text{variance of the sum} &= 8 \times 10^2 = 800 \\[4pt] \sigma &= \sqrt{800} \approx 28.28 \\[4pt] z &= \frac{650 - 600}{28.28} \approx 1.77 \\[4pt] P(\text{sum} > 650) &= 1 - \Phi(1.77) \\ &= 1 - 0.9616 = 0.0384 \end{aligned}

Why: the standard deviation of the sum is 8×10≈28.3\sqrt{8} \times 10 \approx 28.3, not 8×10=808 \times 10 = 80. Heavy and light people partly cancel each other.

Problem 22: The mean of a sample

A machine fills packets with a mean of 500 g and a standard deviation of 10 g. A sample of 25 packets is weighed. What is the probability that the mean weight of the sample is below 496 g? Assume the weights are normal.

Idea. A question about a mean: use the standard error σn\dfrac{\sigma}{\sqrt{n}} (Part 12).

SE=1025=2z=496−5002=−2P(xˉ<496)=Φ(−2)=1−0.9772=0.0228\begin{aligned} \SE &= \frac{10}{\sqrt{25}} = 2 \\[4pt] z &= \frac{496 - 500}{2} = -2 \\[4pt] P(\bar{x} < 496) &= \Phi(-2) \\ &= 1 - 0.9772 = 0.0228 \end{aligned}

Why: a single packet below 496 g is common (z=−0.4z = -0.4, probability 0.3446). A mean of 25 packets below 496 g is rare, and it would be a good reason to check the machine.

Problem 23: How large must the sample be?

The standard deviation of a population is 12. How large must a sample be so that the standard error of the mean is at most 1? And at most 0.5?

Idea. Solve σn≤SE\dfrac{\sigma}{\sqrt{n}} \le \SE for nn (Part 12).

12n≤1⇒n≥12⇒n≥14412n≤0.5⇒n≥24⇒n≥576\begin{aligned} \frac{12}{\sqrt{n}} \le 1 \quad &\Rightarrow \quad \sqrt{n} \ge 12 \quad \Rightarrow \quad n \ge 144 \\[6pt] \frac{12}{\sqrt{n}} \le 0.5 \quad &\Rightarrow \quad \sqrt{n} \ge 24 \quad \Rightarrow \quad n \ge 576 \end{aligned}

Why: half the error costs four times the sample: 576=4×144576 = 4 \times 144.

Problem 24: A sample proportion

30 percent of all users click on an advertisement. In a random sample of 2,100 users, what is the probability that the share of clicks lies between 28 and 32 percent?

Idea. The sample proportion is approximately normal with the mean pp and the standard error p×(1−p)n\sqrt{\dfrac{p \times (1 - p)}{n}} (Part 12).

SE=0.3×0.72100=0.0001=0.01z1=0.28−0.300.01=−2z2=0.32−0.300.01=2\begin{aligned} \SE &= \sqrt{\frac{0.3 \times 0.7}{2100}} = \sqrt{0.0001} = 0.01 \\[4pt] z_1 &= \frac{0.28 - 0.30}{0.01} = -2 \\[4pt] z_2 &= \frac{0.32 - 0.30}{0.01} = 2 \end{aligned}
P(0.28<p^<0.32)=Φ(2)−Φ(−2)=0.9772−0.0228=0.9544\begin{aligned} P(0.28 < \hat{p} < 0.32) &= \Phi(2) - \Phi(-2) \\ &= 0.9772 - 0.0228 = 0.9544 \end{aligned}

Why: two standard errors on each side: the 95 percent of the 68-95-99.7 rule, here with the exact table value.

Problem 25: A sampling distribution by listing

A population has the three values 1, 2 and 9. List all samples of size 2 drawn with replacement, find the distribution of the sample mean, and check that E(xˉ)=μE(\bar{x}) = \mu and Var⁡(xˉ)=σ22\Var(\bar{x}) = \dfrac{\sigma^2}{2}.

Idea. The method of Part 12, now for a population that is not symmetric.

μ=1+2+93=4σ2=(1−4)2+(2−4)2+(9−4)23=9+4+253=383\begin{aligned} \mu &= \frac{1 + 2 + 9}{3} = 4 \\[4pt] \sigma^2 &= \frac{(1 - 4)^2 + (2 - 4)^2 + (9 - 4)^2}{3} \\[2pt] &= \frac{9 + 4 + 25}{3} = \frac{38}{3} \end{aligned}
The nine samples of size 2 from the population 1, 2, 9
Sample(1, 1)(1, 2)(1, 9)(2, 1)(2, 2)(2, 9)(9, 1)(9, 2)(9, 9)
Mean xˉ\bar{x}11.551.525.555.59

The nine means add up to 36, so:

E(xˉ)=369=4=μE(\bar{x}) = \frac{36}{9} = 4 = \mu

The squared distances of the nine means from 4 are 9, 6.25, 1, 6.25, 4, 2.25, 1, 2.25 and 25. Their sum is 57, so:

Var⁡(xˉ)=579=193σ22=383÷2=193\begin{aligned} \Var(\bar{x}) &= \frac{57}{9} = \frac{19}{3} \\[4pt] \frac{\sigma^2}{2} &= \frac{38}{3} \div 2 = \frac{19}{3} \end{aligned}

The two are equal.

Why: the two facts do not need a symmetric population. They hold for every population.

Problem 26: Normal and binomial together

A machine fills bottles with a mean of 250 ml and a standard deviation of 2 ml, normally distributed. A bottle with less than 246 ml is "underfilled". (a) Which share of the bottles is underfilled? (b) How many underfilled bottles are expected among 1,000? (c) A box holds 20 bottles. What is the probability that it contains at least one underfilled bottle?

Idea. The normal distribution gives the probability pp for one bottle (Part 9). The number of underfilled bottles in a box is then binomial with this pp (Part 4).

(a) One bottle:

z=246−2502=−2p=Φ(−2)=0.0228\begin{aligned} z &= \frac{246 - 250}{2} = -2 \\[4pt] p &= \Phi(-2) = 0.0228 \end{aligned}

(b) Among 1,000 bottles:

1000×0.0228=22.8 bottles are expected1000 \times 0.0228 = 22.8 \text{ bottles are expected}

(c) A box of 20:

P(no underfilled bottle)=(1−0.0228)20=0.977220≈0.6305P(at least one)=1−0.6305=0.3695\begin{aligned} P(\text{no underfilled bottle}) &= (1 - 0.0228)^{20} \\ &= 0.9772^{20} \approx 0.6305 \\[6pt] P(\text{at least one}) &= 1 - 0.6305 = 0.3695 \end{aligned}

Why: a fault that touches only 2 bottles in 100 still appears in more than a third of all boxes. "At least one" grows quickly with the number of tries (last lesson).

16Practice problems

Forty problems in three levels. Solve each one on paper, with the table of Part 9 and the values of e−λe^{-\lambda} of Part 5 next to you, type your result into the answer boxes and press Check. Under every problem there is a hint and a full solution: look at the hint only when you are stuck, and at the solution only after you have an answer of your own. Give probabilities with four decimals unless the problem says something else.

Level 1: Random variables, binomial and Poisson

  1. 1.A random variable XX takes the values 1, 2, 3 and 4 with the probabilities 0.4, 0.3, 0.2 and 0.1. Find E(X)E(X) and P(X≥3)P(X \ge 3).

    Show a hint
    Every value times its probability, then add.
    Show one possible solution

    Answer: E(X)=2E(X) = 2 and P(X≥3)=0.3P(X \ge 3) = 0.3.

    E(X)=1×0.4+2×0.3+3×0.2+4×0.1=0.4+0.6+0.6+0.4=2P(X≥3)=0.2+0.1=0.3\begin{aligned} E(X) &= 1 \times 0.4 + 2 \times 0.3 \\ &\quad + 3 \times 0.2 + 4 \times 0.1 \\ &= 0.4 + 0.6 + 0.6 + 0.4 = 2 \\[6pt] P(X \ge 3) &= 0.2 + 0.1 = 0.3 \end{aligned}
  2. 2.For the random variable of Problem 1, find the variance and the standard deviation.

    Show a hint
    First E(X2)E(X^2), then subtract the square of the mean.
    Show one possible solution

    Answer: Var⁡(X)=1\Var(X) = 1 and σ=1\sigma = 1.

    E(X2)=1×0.4+4×0.3+9×0.2+16×0.1=0.4+1.2+1.8+1.6=5Var⁡(X)=5−22=1σ=1=1\begin{aligned} E(X^2) &= 1 \times 0.4 + 4 \times 0.3 \\ &\quad + 9 \times 0.2 + 16 \times 0.1 \\ &= 0.4 + 1.2 + 1.8 + 1.6 = 5 \\[6pt] \Var(X) &= 5 - 2^2 = 1 \\[4pt] \sigma &= \sqrt{1} = 1 \end{aligned}
  3. 3.A random variable takes the values 0, 1, 2 and 3 with the probabilities 0.15, 0.35, cc and 0.2. Find cc and P(X≤1)P(X \le 1).

    Show a hint
    All probabilities together are 1.
    Show one possible solution

    Answer: c=0.3c = 0.3 and P(X≤1)=0.5P(X \le 1) = 0.5.

    c=1−0.15−0.35−0.2=0.3P(X≤1)=0.15+0.35=0.5\begin{aligned} c &= 1 - 0.15 - 0.35 - 0.2 = 0.3 \\[4pt] P(X \le 1) &= 0.15 + 0.35 = 0.5 \end{aligned}
  4. 4.XX has the mean 4 and the variance 9. Find the mean, the variance and the standard deviation of Y=3×X+2Y = 3 \times X + 2.

    Show a hint
    The mean follows the whole formula. The variance is multiplied by the square of the factor.
    Show one possible solution

    Answer: Mean 14, variance 81, standard deviation 9.

    E(Y)=3×4+2=14Var⁡(Y)=32×9=81σ=81=9\begin{aligned} E(Y) &= 3 \times 4 + 2 = 14 \\[4pt] \Var(Y) &= 3^2 \times 9 = 81 \\[4pt] \sigma &= \sqrt{81} = 9 \end{aligned}

    The standard deviation also comes directly: 3×3=93 \times 3 = 9.

  5. 5.A game pays 10 with the probability 0.2, pays 2 with the probability 0.5, and costs 5 (a result of −5-5) with the probability 0.3. Find the expected result and its standard deviation.

    Show a hint
    For the variance square the values first: (−5)2=25(-5)^2 = 25.
    Show one possible solution

    Answer: Expected result 1.5, standard deviation about 5.22.

    E(X)=10×0.2+2×0.5−5×0.3=2+1−1.5=1.5E(X2)=100×0.2+4×0.5+25×0.3=20+2+7.5=29.5Var⁡(X)=29.5−1.52=27.25σ=27.25≈5.22\begin{aligned} E(X) &= 10 \times 0.2 + 2 \times 0.5 - 5 \times 0.3 \\ &= 2 + 1 - 1.5 = 1.5 \\[6pt] E(X^2) &= 100 \times 0.2 + 4 \times 0.5 + 25 \times 0.3 \\ &= 20 + 2 + 7.5 = 29.5 \\[6pt] \Var(X) &= 29.5 - 1.5^2 = 27.25 \\[4pt] \sigma &= \sqrt{27.25} \approx 5.22 \end{aligned}
  6. 6.A fair coin is tossed 5 times. What is the probability of exactly 3 heads?

    Show a hint
    C(5,3)=10C(5, 3) = 10, and every order has the probability 0.550.5^5.
    Show one possible solution

    Answer: 1032=0.3125\tfrac{10}{32} = 0.3125.

    P(X=3)=C(5,3)×0.53×0.52=10×0.55=1032=0.3125\begin{aligned} P(X = 3) &= C(5, 3) \times 0.5^3 \times 0.5^2 \\ &= 10 \times 0.5^5 = \tfrac{10}{32} = 0.3125 \end{aligned}
  7. 7.Four independent customers each buy with the probability 0.3. What is the probability that exactly two of them buy?

    Show a hint
    Binomial with n=4n = 4, p=0.3p = 0.3, k=2k = 2.
    Show one possible solution

    Answer: 0.26460.2646.

    C(4,2)=6P(X=2)=6×0.32×0.72=6×0.09×0.49=0.2646\begin{aligned} C(4, 2) &= 6 \\[4pt] P(X = 2) &= 6 \times 0.3^2 \times 0.7^2 \\ &= 6 \times 0.09 \times 0.49 = 0.2646 \end{aligned}
  8. 8.Each part is defective with the probability 0.1, independently. What is the probability of at least one defective part among 6?

    Show a hint
    The complement: no defective part.
    Show one possible solution

    Answer: About 0.46860.4686.

    P(none)=0.96≈0.5314P(at least one)=1−0.5314=0.4686\begin{aligned} P(\text{none}) &= 0.9^6 \approx 0.5314 \\[4pt] P(\text{at least one}) &= 1 - 0.5314 = 0.4686 \end{aligned}
  9. 9.A fair coin is tossed 400 times. Find the mean and the standard deviation of the number of heads.

    Show a hint
    n×pn \times p and n×p×(1−p)\sqrt{n \times p \times (1 - p)}.
    Show one possible solution

    Answer: Mean 200, standard deviation 10.

    E(X)=400×0.5=200Var⁡(X)=400×0.5×0.5=100σ=100=10\begin{aligned} E(X) &= 400 \times 0.5 = 200 \\[4pt] \Var(X) &= 400 \times 0.5 \times 0.5 = 100 \\[4pt] \sigma &= \sqrt{100} = 10 \end{aligned}
  10. 10.Five cards are dealt from a deck of 52 without putting them back, and XX is the number of hearts. Is XX binomial with n=5n = 5 and p=14p = \tfrac{1}{4}?

    Show a hint
    Check the four conditions. Does the probability of a heart stay the same from card to card?
    Show one possible solution

    Answer: No.

    The cards are not put back, so the draws are not independent and the probability of a heart changes after every card (1352\tfrac{13}{52}, then 1251\tfrac{12}{51} or 1351\tfrac{13}{51}, and so on). The count is hypergeometric. Only with putting back would it be binomial.

  11. 11.XX is a Poisson count with λ=3\lambda = 3. Find P(X=0)P(X = 0) and P(X=1)P(X = 1).

    Show a hint
    P(X=0)=e−λP(X = 0) = e^{-\lambda}.
    Show one possible solution

    Answer: P(X=0)≈0.0498P(X = 0) \approx 0.0498 and P(X=1)≈0.1494P(X = 1) \approx 0.1494.

    P(X=0)=e−3≈0.0498P(X=1)=3×e−3≈0.1494\begin{aligned} P(X = 0) &= e^{-3} \approx 0.0498 \\[4pt] P(X = 1) &= 3 \times e^{-3} \approx 0.1494 \end{aligned}
  12. 12.A shop sells 2.5 laptops per day on average. What is the probability that it sells exactly 2 laptops tomorrow?

    Show a hint
    Poisson with λ=2.5\lambda = 2.5, and e−2.5≈0.08208e^{-2.5} \approx 0.08208.
    Show one possible solution

    Answer: About 0.25650.2565.

    P(X=2)=2.52×e−2.52!=6.25×0.082082≈0.2565\begin{aligned} P(X = 2) &= \frac{2.5^2 \times e^{-2.5}}{2!} = \frac{6.25 \times 0.08208}{2} \\[2pt] &\approx 0.2565 \end{aligned}
  13. 13.A train arrives at a moment that is uniformly distributed between 0 and 60 minutes after the hour. What is the probability that it arrives more than 45 minutes after the hour, and what is the mean arrival time in minutes?

    Show a hint
    A probability is a share of the interval.
    Show one possible solution

    Answer: 0.250.25, and the mean is 30 minutes.

    P(X>45)=60−4560=1560=0.25E(X)=0+602=30\begin{aligned} P(X > 45) &= \frac{60 - 45}{60} = \frac{15}{60} = 0.25 \\[6pt] E(X) &= \frac{0 + 60}{2} = 30 \end{aligned}
  14. 14.A player hits the target with the probability 0.25 on every throw. What is the probability that the first hit comes on the third throw? On which throw does the first hit come on average?

    Show a hint
    Two misses first, then the hit. The mean of a geometric count is 1p\tfrac{1}{p}.
    Show one possible solution

    Answer: About 0.14060.1406; on average on the 4th throw.

    P(X=3)=0.752×0.25=0.5625×0.25=0.140625≈0.1406E(X)=10.25=4\begin{aligned} P(X = 3) &= 0.75^2 \times 0.25 = 0.5625 \times 0.25 \\ &= 0.140625 \approx 0.1406 \\[6pt] E(X) &= \frac{1}{0.25} = 4 \end{aligned}

Level 2: The normal distribution

  1. 15.A test score is normal with the mean 100 and the standard deviation 15. Use the 68-95-99.7 rule: which share of the scores lies between 85 and 115, and which share is above 130?

    Show a hint
    85 and 115 are one standard deviation from the mean; 130 is two above.
    Show one possible solution

    Answer: About 68 percent, and about 2.5 percent.

    Between μ−σ\mu - \sigma and μ+σ\mu + \sigma lie about 68 percent. Outside μ±2σ\mu \pm 2\sigma (70 to 130) are 5 percent, half of them above 130: 2.5 percent.

  2. 16.A quantity is normal with the mean 50 and the standard deviation 4. Find the z-score of the value 58 and of the value 45.

    Show a hint
    z=x−μσz = \dfrac{x - \mu}{\sigma}.
    Show one possible solution

    Answer: 22 and −1.25-1.25.

    58−504=245−504=−1.25\begin{aligned} \frac{58 - 50}{4} &= 2 \\[4pt] \frac{45 - 50}{4} &= -1.25 \end{aligned}
  3. 17.Find P(Z<0.85)P(Z < 0.85) for the standard normal variable.

    Show a hint
    Row 0.8, column .05.
    Show one possible solution

    Answer: 0.80230.8023.

    Φ(0.85)=0.8023\Phi(0.85) = 0.8023, read from the table.

  4. 18.Find P(Z>1.1)P(Z > 1.1).

    Show a hint
    The right side is 1 minus the left side.
    Show one possible solution

    Answer: 0.13570.1357.

    1−Φ(1.1)=1−0.8643=0.13571 - \Phi(1.1) = 1 - 0.8643 = 0.1357
  5. 19.Find P(−0.5<Z<1.2)P(-0.5 < Z < 1.2).

    Show a hint
    Φ(1.2)−Φ(−0.5)\Phi(1.2) - \Phi(-0.5), and Φ(−0.5)=1−Φ(0.5)\Phi(-0.5) = 1 - \Phi(0.5).
    Show one possible solution

    Answer: 0.57640.5764.

    Φ(1.2)=0.8849Φ(−0.5)=1−0.6915=0.30850.8849−0.3085=0.5764\begin{aligned} \Phi(1.2) &= 0.8849 \\[4pt] \Phi(-0.5) &= 1 - 0.6915 = 0.3085 \\[4pt] 0.8849 - 0.3085 &= 0.5764 \end{aligned}
  6. 20.The time to finish a task is normal with the mean 60 minutes and the standard deviation 5 minutes. What is the probability that a person finishes in less than 53 minutes?

    Show a hint
    The z-score is negative.
    Show one possible solution

    Answer: 0.08080.0808.

    z=53−605=−1.4Φ(−1.4)=1−Φ(1.4)=1−0.9192=0.0808\begin{aligned} z &= \frac{53 - 60}{5} = -1.4 \\[4pt] \Phi(-1.4) &= 1 - \Phi(1.4) \\ &= 1 - 0.9192 = 0.0808 \end{aligned}
  7. 21.The temperature in a room is normal with the mean 25 degrees and the standard deviation 2 degrees. What is the probability of a temperature above 28.5 degrees?

    Show a hint
    z=1.75z = 1.75, then the right side.
    Show one possible solution

    Answer: 0.04010.0401.

    z=28.5−252=1.751−Φ(1.75)=1−0.9599=0.0401\begin{aligned} z &= \frac{28.5 - 25}{2} = 1.75 \\[4pt] 1 - \Phi(1.75) &= 1 - 0.9599 = 0.0401 \end{aligned}
  8. 22.The lifetime of a device is normal with the mean 1,000 hours and the standard deviation 50 hours. What is the probability of a lifetime between 950 and 1,100 hours?

    Show a hint
    The z-scores are −1-1 and 22.
    Show one possible solution

    Answer: 0.81850.8185.

    z1=950−100050=−1z2=1100−100050=2Φ(2)−Φ(−1)=0.9772−0.1587=0.8185\begin{aligned} z_1 &= \frac{950 - 1000}{50} = -1 \\[4pt] z_2 &= \frac{1100 - 1000}{50} = 2 \\[4pt] \Phi(2) - \Phi(-1) &= 0.9772 - 0.1587 = 0.8185 \end{aligned}
  9. 23.Exam marks are normal with the mean 64 and the standard deviation 10. Which mark do the best 20 percent of the students exceed?

    Show a hint
    The area to the left is 0.80, which belongs to z=0.84z = 0.84.
    Show one possible solution

    Answer: 72.472.4.

    x=μ+z×σ=64+0.84×10=72.4x = \mu + z \times \sigma = 64 + 0.84 \times 10 = 72.4
  10. 24.The weight of a loaf of bread is normal with the mean 300 g and the standard deviation 25 g. Below which weight are the lightest 10 percent of the loaves?

    Show a hint
    By symmetry the z-score is −1.28-1.28.
    Show one possible solution

    Answer: 268268 g.

    The area to the left is 0.10. Φ(1.28)≈0.90\Phi(1.28) \approx 0.90, so Φ(−1.28)≈0.10\Phi(-1.28) \approx 0.10.

    x=300−1.28×25=300−32=268x = 300 - 1.28 \times 25 = 300 - 32 = 268
  11. 25.Kamran runs 100 metres in 12.4 seconds; the times of his group have the mean 13 and the standard deviation 0.5. He swims 50 metres in 31 seconds; there the mean is 34 and the standard deviation 2. In which sport is he better compared with his group? (A shorter time is better.)

    Show a hint
    Compare the z-scores. For times, the more negative one is the better one.
    Show one possible solution

    Answer: Swimming.

    running:z=12.4−130.5=−1.2swimming:z=31−342=−1.5\begin{aligned} \text{running:} \quad & z = \frac{12.4 - 13}{0.5} = -1.2 \\[4pt] \text{swimming:} \quad & z = \frac{31 - 34}{2} = -1.5 \end{aligned}

    In swimming he is 1.5 standard deviations faster than the mean, in running only 1.2.

  12. 26.Customers arrive at a rate of 6 per hour (Poisson). What is the probability of no customer in 10 minutes, and of exactly 3 customers in 30 minutes?

    Show a hint
    Scale the rate: λ=1\lambda = 1 for 10 minutes and λ=3\lambda = 3 for 30 minutes.
    Show one possible solution

    Answer: About 0.36790.3679 and 0.22400.2240.

    10 minutes are a sixth of an hour, so λ=66=1\lambda = \tfrac{6}{6} = 1:

    P(X=0)=e−1≈0.3679P(X = 0) = e^{-1} \approx 0.3679

    30 minutes are half an hour, so λ=3\lambda = 3:

    P(X=3)=33×e−33!=27×0.049796≈0.2240\begin{aligned} P(X = 3) &= \frac{3^3 \times e^{-3}}{3!} = \frac{27 \times 0.04979}{6} \\[2pt] &\approx 0.2240 \end{aligned}
  13. 27.A fair coin is tossed 8 times. What is the probability of at most 2 heads?

    Show a hint
    Add C(8,0)C(8, 0), C(8,1)C(8, 1) and C(8,2)C(8, 2); every order has the probability 1256\tfrac{1}{256}.
    Show one possible solution

    Answer: 37256≈0.1445\tfrac{37}{256} \approx 0.1445.

    C(8,0)+C(8,1)+C(8,2)=1+8+28=370.58=1256P(X≤2)=37256≈0.1445\begin{aligned} & C(8, 0) + C(8, 1) + C(8, 2) \\ & \quad = 1 + 8 + 28 = 37 \\[4pt] & 0.5^8 = \tfrac{1}{256} \\[4pt] & P(X \le 2) = \tfrac{37}{256} \approx 0.1445 \end{aligned}
  14. 28.A test has 12 questions with 4 answers each, and a student guesses all of them. How many right answers are expected, and what is the probability of exactly 3 right answers? Use 0.759≈0.075080.75^9 \approx 0.07508.

    Show a hint
    Binomial with n=12n = 12 and p=0.25p = 0.25; C(12,3)=220C(12, 3) = 220.
    Show one possible solution

    Answer: 3 right answers are expected; the probability is about 0.25810.2581.

    E(X)=12×0.25=3C(12,3)=12×11×106=220P(X=3)=220×0.253×0.759=220×0.015625×0.07508≈0.2581\begin{aligned} E(X) &= 12 \times 0.25 = 3 \\[4pt] C(12, 3) &= \frac{12 \times 11 \times 10}{6} = 220 \\[4pt] P(X = 3) &= 220 \times 0.25^3 \times 0.75^9 \\ &= 220 \times 0.015625 \times 0.07508 \\ &\approx 0.2581 \end{aligned}

Level 3: Approximations, sums and sampling

  1. 29.A die is rolled 180 times. Use the normal approximation with the continuity correction to find the probability of at least 37 sixes.

    Show a hint
    μ=30\mu = 30 and σ=5\sigma = 5. "At least 37" begins at 36.5.
    Show one possible solution

    Answer: About 0.09680.0968.

    μ=180×16=30σ=180×16×56=25=5z=36.5−305=1.31−Φ(1.3)=1−0.9032=0.0968\begin{aligned} \mu &= 180 \times \tfrac{1}{6} = 30 \\[4pt] \sigma &= \sqrt{180 \times \tfrac{1}{6} \times \tfrac{5}{6}} = \sqrt{25} = 5 \\[4pt] z &= \frac{36.5 - 30}{5} = 1.3 \\[4pt] 1 - \Phi(1.3) &= 1 - 0.9032 = 0.0968 \end{aligned}
  2. 30.An insurance company has 500 clients, and each one makes a claim in a month with the probability 0.004. Use the Poisson approximation to find the probability of at least 3 claims in a month.

    Show a hint
    λ=2\lambda = 2. Use the complement: 0, 1 or 2 claims.
    Show one possible solution

    Answer: About 0.32330.3233.

    λ=500×0.004=2P(X≤2)=e−2×(1+2+222)=0.13534×5≈0.6767P(X≥3)=1−0.6767=0.3233\begin{aligned} \lambda &= 500 \times 0.004 = 2 \\[6pt] P(X \le 2) &= e^{-2} \times \left(1 + 2 + \frac{2^2}{2}\right) \\[2pt] &= 0.13534 \times 5 \approx 0.6767 \\[6pt] P(X \ge 3) &= 1 - 0.6767 = 0.3233 \end{aligned}
  3. 31.A job has two independent steps. The first takes a time that is normal with the mean 30 minutes and the standard deviation 4 minutes; the second has the mean 45 and the standard deviation 3. What is the probability that the whole job takes less than 85 minutes?

    Show a hint
    Means add, variances add: 42+32=254^2 + 3^2 = 25.
    Show one possible solution

    Answer: 0.97720.9772.

    The sum is normal with the mean 30+45=7530 + 45 = 75 and the variance 16+9=2516 + 9 = 25, so σ=5\sigma = 5.

    z=85−755=2Φ(2)=0.9772\begin{aligned} z &= \frac{85 - 75}{5} = 2 \\[4pt] \Phi(2) &= 0.9772 \end{aligned}
  4. 32.A population has the mean 120 and the standard deviation 15. A random sample of 36 is taken. What is the probability that the sample mean lies between 117 and 123?

    Show a hint
    The standard error is 1536=2.5\dfrac{15}{\sqrt{36}} = 2.5.
    Show one possible solution

    Answer: 0.76980.7698.

    SE=156=2.5z2=123−1202.5=1.2z1=117−1202.5=−1.2\begin{aligned} \SE &= \frac{15}{6} = 2.5 \\[4pt] z_2 &= \frac{123 - 120}{2.5} = 1.2 \\[4pt] z_1 &= \frac{117 - 120}{2.5} = -1.2 \end{aligned}
    Φ(1.2)−Φ(−1.2)=0.8849−0.1151=0.7698\begin{aligned} \Phi(1.2) - \Phi(-1.2) &= 0.8849 - 0.1151 \\ &= 0.7698 \end{aligned}
  5. 33.The standard deviation of a population is 20. Find the standard error of the sample mean for samples of size 16, 64 and 400.

    Show a hint
    SE=σn\SE = \dfrac{\sigma}{\sqrt{n}}.
    Show one possible solution

    Answer: 55, 2.52.5 and 11.

    2016=204=52064=208=2.520400=2020=1\begin{aligned} \frac{20}{\sqrt{16}} &= \frac{20}{4} = 5 \\[4pt] \frac{20}{\sqrt{64}} &= \frac{20}{8} = 2.5 \\[4pt] \frac{20}{\sqrt{400}} &= \frac{20}{20} = 1 \end{aligned}
  6. 34.The standard deviation of a population is 8. How large must a sample be so that the standard error of the mean is at most 0.5?

    Show a hint
    Solve 8n≤0.5\dfrac{8}{\sqrt{n}} \le 0.5 for nn.
    Show one possible solution

    Answer: At least 256256.

    n≥80.5=16⇒n≥162=256\sqrt{n} \ge \frac{8}{0.5} = 16 \quad \Rightarrow \quad n \ge 16^2 = 256
  7. 35.20 percent of all visitors of a site register. In a random sample of 1,600 visitors, what is the probability that fewer than 18.5 percent register?

    Show a hint
    SE=0.2×0.81600=0.01\SE = \sqrt{\dfrac{0.2 \times 0.8}{1600}} = 0.01.
    Show one possible solution

    Answer: 0.06680.0668.

    SE=0.161600=0.0001=0.01z=0.185−0.200.01=−1.5Φ(−1.5)=1−0.9332=0.0668\begin{aligned} \SE &= \sqrt{\frac{0.16}{1600}} = \sqrt{0.0001} = 0.01 \\[4pt] z &= \frac{0.185 - 0.20}{0.01} = -1.5 \\[4pt] \Phi(-1.5) &= 1 - 0.9332 = 0.0668 \end{aligned}
  8. 36.A population has the three values 0, 3 and 6. Samples of size 2 are drawn with replacement. Find P(xˉ=3)P(\bar{x} = 3) and E(xˉ)E(\bar{x}).

    Show a hint
    List the 9 samples and their means.
    Show one possible solution

    Answer: P(xˉ=3)=13P(\bar{x} = 3) = \tfrac{1}{3} and E(xˉ)=3E(\bar{x}) = 3.

    The means of (0,0)(0, 0), (0,3)(0, 3), (0,6)(0, 6), (3,0)(3, 0), (3,3)(3, 3), (3,6)(3, 6), (6,0)(6, 0), (6,3)(6, 3), (6,6)(6, 6) are 0, 1.5, 3, 1.5, 3, 4.5, 3, 4.5, 6. Three of the nine are 3, and their sum is 27:

    P(xˉ=3)=39=13E(xˉ)=279=3\begin{aligned} P(\bar{x} = 3) &= \tfrac{3}{9} = \tfrac{1}{3} \\[4pt] E(\bar{x}) &= \tfrac{27}{9} = 3 \end{aligned}

    That is the population mean.

  9. 37.The length of a part is normal with the mean 50 mm and the standard deviation 4 mm. A part is accepted when its length is between 44 and 56 mm. (a) What is the probability that a part is accepted? (b) What is the probability that all 5 parts of a set are accepted?

    Show a hint
    The z-scores are −1.5-1.5 and 1.51.5. For (b), independent parts multiply.
    Show one possible solution

    Answer: (a) 0.86640.8664, (b) about 0.48820.4882.

    (a)Φ(1.5)−Φ(−1.5)=0.9332−0.0668=0.8664(b)0.86645≈0.4882\begin{aligned} \text{(a)} \quad & \Phi(1.5) - \Phi(-1.5) \\ & \quad = 0.9332 - 0.0668 = 0.8664 \\[6pt] \text{(b)} \quad & 0.8664^5 \approx 0.4882 \end{aligned}
  10. 38.Requests reach a server at a rate of 2 per minute (Poisson). What is the probability that the next request comes later than 30 seconds from now, and what is the mean waiting time in minutes?

    Show a hint
    The waiting time is exponential: P(T>t)=e−λ×tP(T > t) = e^{-\lambda \times t} with tt in minutes.
    Show one possible solution

    Answer: About 0.36790.3679; the mean wait is half a minute.

    P(T>0.5)=e−2×0.5=e−1≈0.3679E(T)=1λ=12 minute\begin{aligned} P(T > 0.5) &= e^{-2 \times 0.5} = e^{-1} \approx 0.3679 \\[6pt] E(T) &= \frac{1}{\lambda} = \frac{1}{2} \text{ minute} \end{aligned}

    Half a minute is 30 seconds.

  11. 39.A model classifies 80 percent of all inputs correctly. It is tested on 400 random inputs. What is the standard error of the measured accuracy, and what is the probability that the measured accuracy is below 0.75?

    Show a hint
    The measured accuracy is a sample proportion with p=0.8p = 0.8 and n=400n = 400.
    Show one possible solution

    Answer: SE=0.02\SE = 0.02; the probability is 0.00620.0062.

    SE=0.8×0.2400=0.0004=0.02z=0.75−0.800.02=−2.5Φ(−2.5)=1−0.9938=0.0062\begin{aligned} \SE &= \sqrt{\frac{0.8 \times 0.2}{400}} = \sqrt{0.0004} = 0.02 \\[4pt] z &= \frac{0.75 - 0.80}{0.02} = -2.5 \\[4pt] \Phi(-2.5) &= 1 - 0.9938 = 0.0062 \end{aligned}
  12. 40.The weight of a box is normal with the mean 25 kg and the standard deviation 2 kg. A pallet carries 16 boxes. What is the probability that the total weight is more than 410 kg?

    Show a hint
    The sum of 16 boxes has the mean 16×2516 \times 25 and the standard deviation 16×2\sqrt{16} \times 2.
    Show one possible solution

    Answer: 0.10560.1056.

    The sum is normal with the mean 16×25=40016 \times 25 = 400 and the standard deviation 16×2=8\sqrt{16} \times 2 = 8.

    z=410−4008=1.251−Φ(1.25)=1−0.8944=0.1056\begin{aligned} z &= \frac{410 - 400}{8} = 1.25 \\[4pt] 1 - \Phi(1.25) &= 1 - 0.8944 = 0.1056 \end{aligned}

    The same question about the mean: xˉ>25.625\bar{x} > 25.625 with SE=216=0.5\SE = \dfrac{2}{\sqrt{16}} = 0.5 also gives z=1.25z = 1.25.

17Check yourself

Twelve quick questions. Your answers are saved in this browser, so you can leave the page and continue later. Each finished round is kept as an attempt below the questions; you can delete the attempts at any time.

Question 1

1.XX is the number of heads in three tosses of a coin, with the probabilities 18\tfrac{1}{8}, 38\tfrac{3}{8}, 38\tfrac{3}{8}, 18\tfrac{1}{8} for 0, 1, 2 and 3 heads. What is P(X≤1)P(X \le 1)?

Question 2

2.XX takes the values 0, 1 and 2 with the probabilities 0.5, 0.3 and 0.2. What is E(X)E(X)?

Question 3

3.Var⁡(X)=4\Var(X) = 4. What is Var⁡(3X+5)\Var(3X + 5)?

Question 4

4.Which of these counts has a binomial distribution?

Question 5

5.A fair coin is tossed 4 times. What is the probability of exactly 2 heads?

Question 6

6.Calls arrive at a rate of 3 per hour (Poisson). Which λ\lambda belongs to a period of 20 minutes?

Question 7

7.A Poisson count has the mean 9. What is its standard deviation?

Question 8

8.A quantity is normal with μ=50\mu = 50 and σ=5\sigma = 5. About which share of its values lies between 40 and 60?

Question 9

9.A quantity is normal with μ=70\mu = 70 and σ=4\sigma = 4. What is the z-score of the value 64?

Question 10

10.The table gives Φ(1)=0.8413\Phi(1) = 0.8413. What is P(Z>1)P(Z > 1)?

Question 11

11.A population has the standard deviation 20. What is the standard error of the mean of a sample of 100?

Question 12

12.What does the central limit theorem say?

0 of 12 answered.

18Checking your work with Python

This is the only code of the lesson. Python has the binomial coefficient, exe^x and the normal distribution built in, and NumPy can draw samples.

Python
from math import comb, exp, factorial, sqrt
from statistics import NormalDist
import numpy as np

print(round(comb(10, 2) * 0.2**2 * 0.8**8, 4))
print(round(4**2 * exp(-4) / factorial(2), 4))

marks = NormalDist(70, 10)
print(round(NormalDist().cdf(1.5), 4), round(marks.cdf(85), 4))
print(round(marks.inv_cdf(0.90), 1))

rng = np.random.default_rng(1)
means = rng.integers(1, 7, size=(100_000, 30)).mean(axis=1)
print(round(means.mean(), 3), round(means.std(), 3), round(sqrt(35 / 12 / 30), 3))

Output

0.302
0.1465
0.9332 0.9332
82.8
3.5 0.313 0.312

Change it and run: change the numbers in the first two lines to those of a problem you solved by hand. Then put another mean and standard deviation into NormalDist, or another sample size instead of 30, and run again.

The first line is the binomial probability of exactly two buyers among ten visitors (Part 4), the second the Poisson probability of exactly two calls (Part 5). The third line prints Φ(1.5)\Phi(1.5) twice: once for the standard normal variable and once as "at most 85 marks" for the exam, without any table. The fourth line goes backwards: the mark that the best 10 percent exceed. The last lines roll 30 dice 100,000 times and take the mean of every 30. The means are centred on 3.5, and their standard deviation is the standard error σn=35/1230\dfrac{\sigma}{\sqrt{n}} = \dfrac{\sqrt{35 / 12}}{\sqrt{30}}, as Part 12 says. (The number 1 in default_rng(1) fixes the random numbers, so that every run gives the same result.)

By hand and in Python
By handIn Python
C(n,k)C(n, k)math.comb(n, k)
e−λe^{-\lambda}math.exp(-lam)
Φ(z)\Phi(z)statistics.NormalDist().cdf(z)
P(X≤x)P(X \le x) for a normal XXstatistics.NormalDist(mu, sigma).cdf(x)
from an area back to a valuestatistics.NormalDist(mu, sigma).inv_cdf(area)
drawing samplesnp.random.default_rng() and its methods integers, normal, binomial, poisson, choice

19Quick summary

Every idea of the lesson with its definition or rule
IdeaDefinition or rule
Random variablea quantity whose value depends on chance; discrete (counts) or continuous (measurements)
Distributionevery value with its probability; all probabilities together are 1
Expected valueE(X)=μE(X) = \mu: every value times its probability, added
VarianceVar⁡(X)=σ2=E(X2)−μ2\Var(X) = \sigma^2 = E(X^2) - \mu^2; the standard deviation σ\sigma is its square root
Scale and shiftE(a×X+b)=a×E(X)+bE(a \times X + b) = a \times E(X) + b and Var⁡(a×X+b)=a2×Var⁡(X)\Var(a \times X + b) = a^2 \times \Var(X)
Sumsmeans add; variances add for independent quantities (also for a difference)
Bernoullione trial: mean pp, variance p×(1−p)p \times (1 - p)
BinomialP(X=k)=C(n,k)×pk×(1−p)n−kP(X = k) = C(n, k) \times p^k \times (1 - p)^{n - k}; mean n×pn \times p, variance n×p×(1−p)n \times p \times (1 - p)
Binomial conditionsfixed nn, two outcomes, the same pp, independent trials
PoissonP(X=k)=λk×e−λk!P(X = k) = \dfrac{\lambda^k \times e^{-\lambda}}{k!}; mean λ\lambda, variance λ\lambda; scale λ\lambda to the period
Poisson for rare eventsbinomial with a large nn and a small pp: λ=n×p\lambda = n \times p
Geometricfirst success on trial kk: (1−p)k−1×p(1 - p)^{k - 1} \times p; mean 1p\dfrac{1}{p}
Hypergeometricwithout putting back: C(K,k)×C(N−K,n−k)C(N,n)\dfrac{C(K, k) \times C(N - K, n - k)}{C(N, n)}
Continuous distributiona probability is an area under the density curve; a single value has the probability 0
Uniform on aa to bbP(c<X<d)=d−cb−aP(c < X < d) = \dfrac{d - c}{b - a}; mean a+b2\dfrac{a + b}{2}, variance (b−a)212\dfrac{(b - a)^2}{12}
Exponentialwaiting time at the rate λ\lambda: P(T>t)=e−λ×tP(T > t) = e^{-\lambda \times t}, mean 1λ\dfrac{1}{\lambda}
Normal distributionthe symmetric bell with the centre μ\mu and the width σ\sigma
68-95-99.7 rulethe shares within 1, 2 and 3 standard deviations of the mean
z-scorez=x−μσz = \dfrac{x - \mu}{\sigma}; back: x=μ+z×σx = \mu + z \times \sigma
TableΦ(z)\Phi(z) is the area to the left; right side 1−Φ(z)1 - \Phi(z); Φ(−z)=1−Φ(z)\Phi(-z) = 1 - \Phi(z); between: Φ(b)−Φ(a)\Phi(b) - \Phi(a)
Normal for binomialwhen n×p≥5n \times p \ge 5 and n×(1−p)≥5n \times (1 - p) \ge 5, with the continuity correction of 0.5
Population and samplethe whole and the observed part; a parameter describes the first, a statistic the second
Biasa sample that differs from the population in a systematic way; more data does not repair it
Standard error of the meanSE=σn\SE = \dfrac{\sigma}{\sqrt{n}}
Standard error of a proportionp×(1−p)n\sqrt{\dfrac{p \times (1 - p)}{n}}
Law of large numbersthe sample mean comes closer and closer to μ\mu as nn grows
Central limit theoremfor a large nn the sample mean is approximately normal, whatever the population looks like