Discrete random variables

The first half of Lecture 4 (binomial, multinomial, Poisson) and Part 1 of Lecture 5 (random variables, pmf and cdf, Bernoulli, geometric, expected value, variance, skewness), rebuilt as one storyline: turn outcomes into numbers, describe how the numbers are distributed, then recognise the four named distributions by what they count.

How to read this page. It needs the probability rules from Design, probability and Bayes, in particular counting. The continuous story continues on The normal curve and the CLT.

Teal = explanation added by Claude, not on the slides. Amber = watch out. Dropdowns hide worked examples, practice questions, and their answers.

The road through the lectures

Side stop: the multinomial distribution (L4 s11), which the exam toolkit mentions but no assignment has used.

Lecture map: which slides each card covers

Part 1

Random variables and their distributions

What a pmf and a cdf are, and the two numbers (mean, variance) plus one shape number (skewness) that summarise them.

Random variables and probability distributions

A random variable is a rule that attaches a number to each outcome of an experiment, such as "the number of yes answers". Its distribution is the list of the values it can take and how likely each one is.

For a random phenomenon, a random variable is a function that assigns a numerical value to each point in the sample space. Example: for three people answering yes or no, the sample space has 8 points, and "the number of people who say yes" assigns the values 3, 2, 2, 2, 1, 1, 1, 1, 0 to them.

Upper-case letters represent random variables (\(Y\), \(X\)); lower-case versions are particular possible values (\(y = x = 2\)).

A probability distribution lists the possible outcomes for a random variable and their probabilities. Discrete random variables have distinct, countable values; continuous ones take any value in a range.

"Discrete" means distinct and countable, not necessarily integers. A game prize \(X \in \{0, 2.5, 7.5, 20\}\) QAR is discrete (a finite set). Energy consumed per cycle in steps \(0.5, 1.0, 1.5, \dots\) kWh is discrete because it changes in fixed steps.

\(X, Y\)
random variables
\(x, y, k\)
a particular value
support
the set of values the variable can take (e.g. \(0, 1, \dots, n\))

On page 1 the capital letter was a column of data you had not looked at yet. Here it is the same idea one step earlier: a quantity the experiment has not produced yet, with a known recipe for its probabilities.

The probability mass function (pmf)

The pmf gives the probability of each exact value. Every entry sits between 0 and 1, and the entries add up to 1, which is your check that a distribution is complete.

Let \(P(y)\) denote the probability that the discrete random variable \(Y\) takes value \(y\). Then

\[ 0 \le P(y) \le 1 \quad\text{and}\quad \sum_{\text{all } y} P(y) = 1 \]

Three people, each independently says yes with probability 0.5: each of the 8 outcomes has probability 0.125. Grouping by the number of yes answers gives \(P(0) = 0.125\), \(P(1) = 0.375\), \(P(2) = 0.375\), \(P(3) = 0.125\). This is \(Y \sim \text{Binomial}(n = 3, p = 0.5)\) with pmf

\[ f(y) = \binom{3}{y}\left(\tfrac{1}{2}\right)^3 = \frac{3!}{y!\,(3-y)!}\cdot\frac{1}{8},\qquad y = 0, 1, 2, 3 \]

Discrete probability distributions have functions called probability mass functions, pmf. The pmf answers an exact-value question: \(P(X = x)\).

Constructing a distribution from given numbers (L3 s65): a sausage machine produces 0, 1, 2, 3, 4 or 5 misshapen sausages per day with probabilities 0.09, 0.07, 0.1, 0.04, 0.12, 0.02. Write the values on one line and the probabilities under them.

The sausage probabilities on L3 s65 add to 0.44, not 1, so as written they are not a complete distribution (the remaining 0.56 would belong to other counts). Always add up the column: if it is not 1, something is missing or wrong.

The cumulative distribution function (cdf): at most, at least, exactly

The cdf at a value is the probability of landing at or below it, so it is the pmf added up from the left. "At most k" is the cdf; "at least k" is one minus the cdf just below k; "exactly k" is the pmf.

\[ F(y) = P(Y \le y) \]

It gives the probability that the random variable takes a value less than or equal to a given number. For a discrete variable it is the sum of the pmf values up to \(k\):

\[ F(k) = P(X \le k) = \sum_{i=0}^{k} P(X = i) \]

Three fair flips, \(X\) = number of heads: \(F(0) = 0.125\), \(F(1) = 0.5\), \(F(2) = 0.875\), \(F(3) = 1\). The cdf is a step function: it never decreases and ends at 1.

For a discrete variable the pmf comes back from consecutive cdf values:

\[ P(X = x) = F(x) - F(x - 1) \]

Defective solar panels among two tested: pmf 0.64, 0.32, 0.04; cdf 0.64, 0.96, 1.00. "Exactly one defective" is \(P(X = 1) = 0.32\); "at most one" is \(F(1) = 0.96\); and \(P(X = 1) = F(1) - F(0) = 0.96 - 0.64 = 0.32\).

Review p34: at most → cdf; at least → \(1 - \) cdf of the value below: \(P(X \ge 2) = 1 - F(1) = 0.5\).

Bar chart of the binomial pmf for n=3, p=0.5 next to its staircase cdf rising from 0.125 to 1
L5 s11: pmf bars and the cdf staircase for three fair flips.
PhraseSymbolValues that count (out of 0–5)Compute
at least 2, no fewer than 2\(X \ge 2\)2, 3, 4, 5\(1 - F(1)\)
at most 2, no more than 2\(X \le 2\)0, 1, 2\(F(2)\)
more than 2\(X \gt 2\)3, 4, 5\(1 - F(2)\)
fewer than 2, less than 2\(X \lt 2\)0, 1\(F(1)\)
exactly 2\(X = 2\)2\(P(2) = F(2) - F(1)\)
between 1 and 3 inclusive\(1 \le X \le 3\)1, 2, 3\(F(3) - F(0)\)

Does the boundary count? "At least" and "at most" include it; "more than" and "fewer than" exclude it. Before calculating, list the possible values and circle the ones the question allows.

"At least 2" and "at most 2" are not complements; both contain 2. The complement of "at least 2" is "at most 1". And the one-step shift (\(X \gt 2\) is the same as \(X \ge 3\)) works only for integer counts, not for continuous measurements.

X = absences from a group of four: write the inequality and allowed values for six phrases

At least 3 · at most 1 · more than 1 · fewer than 3 · exactly 2 · no more than 2.

\(X \ge 3\): 3, 4. \(X \le 1\): 0, 1. \(X \gt 1\): 2, 3, 4. \(X \lt 3\): 0, 1, 2. \(X = 2\): 2. \(X \le 2\): 0, 1, 2. These identify the events; the probabilities need the experiment.

Requests X with P = 0.10, 0.25, 0.35, 0.20, 0.10 for x = 0…4: at least 2, more than 2, at most 2, between 1 and 3
  1. \[ P(X \ge 2) = 0.35 + 0.20 + 0.10 = 0.65 = 1 - (0.10 + 0.25) \]
  2. \[ P(X \gt 2) = 0.20 + 0.10 = 0.30 \] (the 0.35 difference is the boundary value \(X = 2\))
  3. \[ P(X \le 2) = 0.10 + 0.25 + 0.35 = 0.70 \]
  4. \[ P(1 \le X \le 3) = 0.25 + 0.35 + 0.20 = 0.80 \]
Reward X = 0, 2, 5 QAR with probabilities 0.5, 0.3, 0.2: F(2) and P(2 < X ≤ 5)
  1. \[ F(2) = 0.5 + 0.3 = 0.8 \]
  2. \[ P(2 \lt X \le 5) = F(5) - F(2) = 1 - 0.8 = 0.2 \] Only the value 5 is above 2 and at most 5.

Expected value, variance and standard deviation of a random variable

The expected value is the long-run average you would see over many repeats: each value weighted by its probability. The variance is the probability-weighted average squared distance from that mean, and the standard deviation its square root.

Just as we use the mean and standard deviation to summarise observed data, we use the same measures for the centre and variability of a random variable's distribution.

\[ E[X] = \mu = \sum_i x_i\,P(X = x_i) \] \[ \text{Var}(X) = E[(X - \mu)^2] = \sum_i (x_i - \mu)^2\,P(X = x_i) \] \[ \sigma = \sqrt{\text{Var}(X)} \]

Three yes/no answers: \(E[Y] = 0(\tfrac18) + 1(\tfrac38) + 2(\tfrac38) + 3(\tfrac18) = 1.5\). In 1,000 samples we would expect the mean of the 1,000 observations to equal 1.5.

The expected value is the long-run average of \(X\) over many repetitions. It does not need to be one of the possible values of \(X\).

Defective sensors among three tested (s28): \(P(0) = 0.216\), \(P(1) = 0.432\), \(P(2) = 0.288\), \(P(3) = 0.064\).

\[ E(Y) = 0 + 0.432 + 0.576 + 0.192 = 1.2 \text{ defective sensors} \]

Raffle (s39): a $10 ticket for a $15,000 car, 2,000 tickets sold. Gain \(X\) is $14,990 with probability 1/2000 and −$10 with probability 1999/2000:

\[ E(X) = 7.495 - 9.995 = -\$2.50 \]

You expect to lose $2.50 per ticket, so entering is not wise. With a car, a $110 CD player and a $210 luggage set among 200 tickets (s40): \(74.95 + 0.50 + 1.00 - 9.85 = \$66.60\), so entering makes sense.

\(E[X],\ \mu\)
expected value (mean) of the distribution
\(E[X^2]\)
\(\sum x_i^2 P(x_i)\); gives the shortcut \(\text{Var}(X) = E[X^2] - \mu^2\)

Computing \((x_i - \mu)^2\) for every value is tedious when \(\mu\) is a decimal. The same answer comes from \(\text{Var}(X) = E[X^2] - \mu^2\): square each value, weight by probability, subtract the squared mean. The L5 practice set answers (P3) use this route.

Recipe

  1. Table with a row \(x_i\) and a row \(P(x_i)\). Check the probabilities sum to 1.
  2. Row \(x_i P(x_i)\); its sum is \(\mu\).
  3. Row \(x_i^2 P(x_i)\); its sum is \(E[X^2]\).
  4. \[ \text{Var}(X) = E[X^2] - \mu^2,\qquad \sigma = \sqrt{\text{Var}(X)} \]
Daily service calls: P(0) = 0.3, P(1) = 0.4, P(2) = 0.2, P(3) = 0.1. E(X), Var(X), SD
  1. \[ E(X) = 0(0.3) + 1(0.4) + 2(0.2) + 3(0.1) = 1.1 \]
  2. \[ E(X^2) = 0 + 0.4 + 0.8 + 0.9 = 2.1 \]
  3. \[ \text{Var}(X) = 2.1 - 1.1^2 = 0.89 \]
  4. \[ \sigma = \sqrt{0.89} = 0.943 \text{ calls} \]
X = 0, 1, 2 with P = 0.5, 0.3, 0.2: E(X), Var(X), SD
  1. \[ E(X) = 0.3 + 0.4 = 0.7 \]
  2. \[ \text{Var}(X) = 0.49(0.5) + 0.09(0.3) + 1.69(0.2) = 0.61 \]
  3. \[ \sigma = 0.78 \]
Reward 0, 2, 5 QAR with P = 0.5, 0.3, 0.2; each play costs 2 QAR: E[X], the "impossible answer" objection, expected net gain
  1. \[ E[X] = 0(0.5) + 2(0.3) + 5(0.2) = 1.60 \text{ QAR} \]
  2. An expected value is a probability-weighted average, the long-run average over many plays. It need not be a possible single payout.
  3. \[ E[\text{net}] = 1.60 - 2 = -0.40 \text{ QAR per play} \]

Skewness: a number for the direction of the tail

Skewness measures how lopsided a distribution is. Zero means balanced tails, positive means a long tail to the right, negative a long tail to the left.

Skewness measures the direction and degree of asymmetry around the mean. The sign identifies the direction of the longer tail. Skewness describes shape, while the mean and standard deviation describe centre and spread.

\[ \gamma_1 = \frac{E[(Y - \mu)^3]}{\sigma^3} \]

Left-skewed: \(\gamma_1 \lt 0\), long tail to the left. Symmetric: \(\gamma_1 = 0\). Right-skewed: \(\gamma_1 \gt 0\), long tail to the right.

Bernoulli derivation (s35–36): with \(q = 1 - p\), \(\mu = p\), \(\sigma = \sqrt{pq}\), and

\[ E[(X - p)^3] = (0 - p)^3 q + (1 - p)^3 p = -p^3 q + q^3 p = pq(q^2 - p^2) \] \[ q^2 - p^2 = (q - p)(q + p) = q - p = 1 - 2p \] \[ \gamma_1 = \frac{pq(1 - 2p)}{(pq)^{3/2}} = \frac{1 - 2p}{\sqrt{p(1-p)}} \]

Skewness in common discrete distributions (s37):

DistributionSkewnessShape
Bernoulli(\(p\))\(\dfrac{1 - 2p}{\sqrt{p(1-p)}}\)0 at \(p = 0.5\); right-skewed if \(p \lt 0.5\), left if \(p \gt 0.5\)
Binomial(\(n, p\))\(\dfrac{1 - 2p}{\sqrt{np(1-p)}}\)symmetric at \(p = 0.5\); more skewed when \(p\) is far from 0.5, especially for small \(n\)
Geometric(\(p\))\(\dfrac{2 - p}{\sqrt{1 - p}}\)always positively skewed (long right tail)
Poisson(\(\lambda\))\(\dfrac{1}{\sqrt{\lambda}}\)as \(\lambda\) grows the distribution becomes more symmetric

Microcracks per panel \(X \sim \text{Poisson}(2)\) (s38): mean 2, \(\sigma = 1.414\), \(\gamma_1 = 0.707\); \(P(X \le 2) = e^{-2}(1 + 2 + 2) = 5e^{-2} = 0.677\). Positive skewness means a longer right tail from occasional high counts.

Two Poisson pmfs: lambda 2 with skewness 0.707 is lopsided, lambda 5 with skewness 0.447 is closer to symmetric
L5 s37: a bigger \(\lambda\) means a smaller skewness.

Bernoulli and binomial share the sign of \(1 - 2p\): the rarer outcome is in the tail. The geometric is never symmetric because it starts at 1 and stretches to infinity. The Poisson skewness only depends on \(\lambda\): doubling the interval doubles \(\lambda\) and shrinks the skewness by \(\sqrt 2\).

Y1 ~ Bernoulli(0.4), Y2 ~ Geometric(0.4), Y3 ~ Poisson(2): mean, SD, skewness; which is most symmetric; which model for a quality manager
  1. Bernoulli: \[ \mu = 0.4,\quad \sigma = \sqrt{0.24} = 0.490,\quad \gamma_1 = \frac{0.2}{0.490} = 0.408 \]
  2. Geometric: \[ \mu = \tfrac{1}{0.4} = 2.5,\quad \sigma = \sqrt{\tfrac{0.6}{0.16}} = \sqrt{3.75} = 1.936,\quad \gamma_1 = \frac{1.6}{\sqrt{0.6}} = 2.066 \]
  3. Poisson: \[ \mu = 2,\quad \sigma = \sqrt 2 = 1.414,\quad \gamma_1 = \tfrac{1}{\sqrt 2} = 0.707 \]
  4. Most symmetric: the Bernoulli (0.408), because \(p = 0.4\) is close to 0.5. The geometric is strongly right-skewed.
  5. For monitoring defects, the answer key picks Poisson: monitoring means counting defects per hour or shift, and \(\lambda\) gives control limits directly (e.g. \(\lambda + 3\sqrt\lambda = 6.2\)). Bernoulli describes one item; geometric the wait until the first defect.

Part 2

The named distributions

Bernoulli for one trial, binomial for a fixed number of trials, geometric for the wait until the first success, Poisson for counts per interval.

Bernoulli: one yes/no trial

A Bernoulli variable is a single trial coded 1 for success and 0 for failure. It is the building block: a binomial adds up many of them, a geometric counts how many you need until the first 1.

The Bernoulli distribution is the simplest probability distribution: success (coded 1) with probability \(p\), failure (coded 0) with probability \(1 - p\). A "yes/no" model.

\[ P(X = x) = \begin{cases} p & x = 1 \\ 1 - p & x = 0 \end{cases} \]

The cdf is a step function: \(F(x) = 0\) for \(x \lt 0\), \(1 - p\) for \(0 \le x \lt 1\), and 1 for \(x \ge 1\).

\[ E[X] = 0\cdot(1-p) + 1\cdot p = p \] \[ \text{Var}(X) = p(1-p),\qquad \sigma = \sqrt{p(1-p)} \]

Coin with \(p = 0.3\): \(E[X] = 0.3\), \(\text{Var}(X) = 0.21\), \(\sigma = 0.458\).

Indicator of a defective bulb, p = 0.2: pmf, E[X], Var(X), skewness
  1. \[ P(X = 1) = 0.2,\qquad P(X = 0) = 0.8 \]
  2. \[ E[X] = 0.2,\qquad \text{Var}(X) = 0.2 \times 0.8 = 0.16 \]
  3. \[ \gamma_1 = \frac{1 - 0.4}{\sqrt{0.16}} = \frac{0.6}{0.4} = 1.5 \] Right-skewed: the rare value 1 is the tail.

Binomial: successes in a fixed number of trials

Flip a coin n times and count the heads: that count is binomial. The formula is "number of arrangements, times the chance that the k successes happen, times the chance that the other n − k fail".

Applies when there is a fixed number of independent trials, each with two outcomes (success or failure), and the probability of success \(p\) is constant.

\[ P(X = k) = \binom{n}{k}\,p^k\,(1-p)^{n-k},\qquad \binom{n}{k} = \frac{n!}{k!\,(n-k)!} \]

Read it as ways × win × lose: \(C(n, k)\) ways to arrange the \(k\) successes, \(p^k\) for the \(k\) successes all happening, \((1 - p)^{n-k}\) for the \(n - k\) failures all happening.

Why \(C(3, 2) = 3\): of the 8 equally likely outcomes of three flips, exactly 3 (HHT, HTH, THH) have two heads. \(P(\text{exactly 2 heads in 3 flips}) = 3 \times 0.5^2 \times 0.5 = 0.375\).

Ten fair flips, exactly 6 heads (L4 s3):

\[ \binom{10}{6} = \frac{10!}{6!\,4!} = 210,\qquad 0.5^6 \cdot 0.5^4 = \frac{1}{1024} \] \[ P(X = 6) = \frac{210}{1024} = 0.205 \]

Full table for \(n = 10\), \(p = 0.5\) (s5–6): 0.001, 0.010, 0.044, 0.117, 0.205, 0.246, 0.205, 0.117, 0.044, 0.010, 0.001. Centre: mean \(np = 5\). Spread \(\sigma = \sqrt{np(1-p)} = 1.58\). Symmetric because \(p = 0.5\). Most likely ≠ likely: 5 heads is the tallest bar and still happens only about 1 time in 4.

\[ E[X] = np,\qquad \text{Var}(X) = np(1-p),\qquad \sigma = \sqrt{np(1-p)} \]

Changing \(p\) slides the peak (s7): with \(n = 10\), \(p = 0.2\) peaks at 2, \(p = 0.8\) at 8. The spread is widest at \(p = 0.5\).

Sequential flips (one by one, you could stop early) and simultaneous flips (all at once) are equivalent experiments in probability theory (s8).

Exactly two 1s in ten die rolls (s10): \(C(10, 2) = 45\) pairs of rolls could hold the 1s; \((1/6)^2 = 0.0278\) for both chosen rolls to show 1; \((5/6)^8 = 0.2327\) for the other eight to miss. \(P(X = 2) = 45 \times 0.0278 \times 0.2327 = 0.291\).

Three bar charts of the binomial pmf with n=10 for p=0.2 peaking at 2, p=0.5 peaking at 5, and p=0.8 peaking at 8
L4 s7: same \(n = 10\), only \(p\) changes, and the whole distribution shifts to sit over \(np\).
\(n\)
number of trials (fixed in advance)
\(p\)
success probability, the same every trial
\(k\)
number of successes asked about, \(0 \le k \le n\)

Check the three conditions before using the formula: fixed \(n\), independent trials, constant \(p\). Drawing without replacement breaks independence (page 2, pens), so that is not binomial. And "success" is just the outcome being counted; a defective chip can be the "success".

Recipe

  1. Identify \(n\), \(p\), and what \(k\) the question wants (exactly, at most, at least).
  2. \[ \binom{n}{k} \] by cancelling factorials.
  3. \[ P(X = k) = \binom{n}{k} p^k (1-p)^{n-k} \]
  4. "At most \(k\)": add \(P(0)\) to \(P(k)\). "At least 1": \(1 - (1-p)^n\).
Chips 20% defective, test 5; and rainy days in a week with p = 0.3
  1. \[ P(X = 1) = 5 \times 0.2 \times 0.8^4 = 0.410 \]
  2. \[ P(X \ge 1) = 1 - 0.8^5 = 0.672 \]
  3. \[ E[X] = 5(0.2) = 1,\qquad \sigma = \sqrt{0.8} = 0.89 \]
  4. Rainy days, assuming independent days: \[ P(X = 2) = \binom{7}{2} 0.3^2\, 0.7^5 = 21 \times 0.09 \times 0.168 = 0.318 \]
Defectives independent with p = 0.05 in a batch of 20: P(exactly 2), P(at most 1)
  1. \[ P(X = 2) = \binom{20}{2}(0.05)^2(0.95)^{18} = 190 \times 0.0025 \times 0.3972 = 0.189 \]
  2. \[ P(X \le 1) = 0.95^{20} + 20(0.05)(0.95)^{19} = 0.358 + 0.377 = 0.736 \]
X ~ Binomial(12, 0.1): pmf, P(X ≤ 2), E[X], Var(X)
  1. \[ P(X = k) = \binom{12}{k}(0.1)^k(0.9)^{12-k} \]
  2. \[ P(0) = 0.9^{12} = 0.2824,\quad P(1) = 12(0.1)(0.9)^{11} = 0.3766,\quad P(2) = 66(0.01)(0.9)^{10} = 0.2301 \]
  3. \[ P(X \le 2) = 0.2824 + 0.3766 + 0.2301 = 0.889 \]
  4. \[ E[X] = 1.2,\qquad \text{Var}(X) = 12(0.1)(0.9) = 1.08,\qquad \sigma = 1.039 \]
Fair coin: P(exactly 6 heads in 10 flips); P(at least one head in 3 flips)
  1. \[ \binom{10}{6} \times 0.5^{10} = \frac{210}{1024} = 0.205 \]
  2. \[ P(X \ge 1) = 1 - P(X = 0) = 1 - 0.125 = 0.875 \]
Five transmissions, each succeeds with 0.20: name the model; P(X ≥ 1), E[X], Var(X)
  1. Binomial(5, 0.2): a fixed number of independent trials with the same success probability, counting successes.
  2. \[ P(X \ge 1) = 1 - 0.8^5 = 0.672 \]
  3. \[ E[X] = 1,\qquad \text{Var}(X) = 5(0.2)(0.8) = 0.8 \]

Multinomial: more than two outcomes per trial

When each trial can land in one of several categories instead of just success or failure, the binomial generalises to the multinomial. The counting factor becomes a factorial for every category.

Generalisation of the binomial, used when each trial results in one of \(k\) categories with probabilities \(p_1, \dots, p_k\). For \(n\) trials, the probability of counts \(x_1, \dots, x_k\) (with \(\sum x_i = n\)) is

\[ P(X_1 = x_1, \dots, X_k = x_k) = \frac{n!}{x_1!\,x_2!\cdots x_k!}\,p_1^{x_1}\,p_2^{x_2}\cdots p_k^{x_k} \]

Rolling a fair die 12 times: face 1 twice, face 2 three times, face 3 once, faces 4, 5, 6 together six times.

The die example, computed
  1. \[ \frac{12!}{2!\,3!\,1!\,6!} = 55{,}440 \]
  2. Faces 4, 5, 6 together have probability \(\tfrac12\), so the probability factor is \(\left(\tfrac16\right)^{2+3+1}\left(\tfrac12\right)^6\).
  3. \[ P = 55{,}440 \times \left(\tfrac{1}{6}\right)^6 \left(\tfrac{1}{2}\right)^6 = 0.0186 \]

L4 s11 writes the probability factor as \((1/6)^{12}\), which treats "4, 5 or 6" as one face with probability 1/6. That gives \(2.5 \times 10^{-5}\), too small by a factor of \(3^6 = 729\). Grouped categories get the grouped probability.

Geometric: trials until the first success

Keep trying until the first success and count how many attempts it took. The first y − 1 attempts fail and the y-th succeeds, which gives the formula directly.

A basketball player makes each free throw with \(p = 0.3\). \(Y\) = trial number of the first made basket: \(P(Y = 1) = 0.3\); \(P(Y = 2) = (0.7)(0.3) = 0.21\); \(P(Y = 3) = (0.7)^2(0.3) = 0.147\); \(P(Y = 4) = (0.7)^3(0.3) = 0.1029\).

The geometric distribution models the number of trials until the first success in repeated independent Bernoulli trials. Support \(y = 1, 2, 3, \dots\)

\[ P(Y = y) = (1 - p)^{y-1}\,p \]

The first \(y - 1\) trials are failures; success occurs on the \(y\)-th trial. Applications: items inspected until the first defective; calls until the first complaint is resolved; attempts until the first goal.

cdf (s18–20), two ways: sum the pmf terms, a geometric series with first term \(p\) and ratio \(1 - p\); or take the complement of "all failures in the first \(y\) trials":

\[ F(y) = 1 - (1 - p)^y \]

With \(p = 0.3\), \(y = 3\): \(0.3 + 0.21 + 0.147 = 0.657\), and \(1 - 0.7^3 = 0.657\).

\[ E[Y] = \frac{1}{p},\qquad \text{Var}(Y) = \frac{1-p}{p^2},\qquad \sigma = \sqrt{\frac{1-p}{p^2}} \]

Player with \(p = 0.2\): \(E[Y] = 5\) shots on average until the first basket; \(\text{Var}(Y) = 0.8/0.04 = 20\), \(\sigma = 4.47\).

Bar chart of the geometric pmf with p=0.2: bars fall steadily from 0.2 at y=1, mean marked at 5
L5 s31: the geometric pmf for \(p = 0.2\). It always starts at its tallest bar and decays, so it is always right-skewed.

Past failures do not change the future: given that the first two attempts failed, the wait from now on is a fresh geometric. So "first success on attempt 4 given the first two failed" is just "attempt 3 fails and attempt 4 succeeds", \((1-p)\,p\). Dividing \(P(T = 4)\) by \(P(T \gt 2) = (1-p)^2\) gives the same thing.

Components tested until the first defective, p = 0.2: support, mean, variance, SD, skewness, shape
  1. \(X = 1, 2, 3, \dots\) with no upper limit. \(p = 0.2\) is the probability that any single component is defective.
  2. \[ \mu = \frac{1}{0.2} = 5 \] On average she tests 5 components to find the first defective one.
  3. \[ \sigma^2 = \frac{0.8}{0.04} = 20,\qquad \sigma = \sqrt{20} = 4.47 \]
  4. \[ \gamma = \frac{2 - 0.2}{\sqrt{0.8}} = \frac{1.8}{0.894} = 2.01 \]
  5. Positive, so right-skewed. The smallest value is 1 and there is no largest: most runs end after a few tests, but a long lucky streak of good components makes a long right tail.
Items fail with 0.1, inspected until the first failure: P(X = 4), P(X ≤ 3)
  1. \[ P(X = 4) = 0.9^3 \times 0.1 = 0.0729 \]
  2. \[ P(X \le 3) = 1 - 0.9^3 = 0.271 \]
p = 0.3: P(first basket on the 3rd attempt) and expected attempts; login p = 0.25: P(first success on the 4th try) and E(Y)
  1. \[ 0.7^2 \times 0.3 = 0.147,\qquad E(Y) = \tfrac{1}{0.3} = 3.33 \]
  2. \[ 0.75^3 \times 0.25 = 0.105,\qquad E(Y) = \tfrac{1}{0.25} = 4 \]
Transmissions until the first success, p = 0.2: given the first two failed, P(first success on attempt 4)?
  1. Geometric(0.2) on 1, 2, 3, …: it counts attempts up to and including the first success.
  2. Given two failures, attempt 3 must fail and attempt 4 succeed: \[ P(T = 4 \mid T \gt 2) = 0.8 \times 0.2 = 0.16 \]
  3. Check: \(P(T = 4)/P(T \gt 2) = 0.8^3(0.2)/0.8^2 = 0.16\). Multiplying by the first two failures again would answer the unconditional question.

Poisson: events in a fixed interval of time or space

When events arrive at a steady average rate and independently of each other, the number in a fixed stretch of time or space is Poisson. One number, the average rate, fixes the whole distribution, and the count has no upper limit.

Models the probability of a given number of events in a fixed interval of time or space. Conditions: events occur independently; the average rate \(\lambda\) is constant; two events cannot happen at the exact same instant.

\[ P(X = k) = \frac{e^{-\lambda}\lambda^k}{k!},\qquad k = 0, 1, 2, \dots \] \[ F(k) = P(X \le k) = \sum_{i=0}^{k}\frac{e^{-\lambda}\lambda^i}{i!} \]

Since the cdf is a sum, it is computed term by term or with software.

\[ E[X] = \lambda,\qquad \text{Var}(X) = \lambda,\qquad \sigma = \sqrt\lambda \]

Help desk averaging 3 calls an hour (L4 s13): \(P(X = 5) = e^{-3}\,3^5/5! = 0.0498 \times 243/120 = 0.101\). Mean 3, variance 3, \(\sigma = 1.73\). Watch the tail: 4 or more calls still happens in about 35% of hours, so staffing for 3 is not enough.

Bank with \(\lambda = 6\) per 15 minutes (L5 s21): \(P(X = 8) = e^{-6}6^8/8! = 0.1033\); \(F(4) = 0.2851\). Seashells with \(\lambda = 4\) per m² (L4 s15): \(P(X = 2) = 16e^{-4}/2 = 0.146\); \(P(X \ge 1) = 1 - e^{-4} = 0.982\). Typos, 2 per 100 pages (L4 s16): \(P(X = 0) = e^{-2} = 0.135\). Emails at 9 per hour (L5 s32): mean 9, \(\sigma = 3\).

Binomial vs Poisson (L4 s14): the binomial fixes the number of trials, \(k\) can never exceed \(n\), mean \(np\). The Poisson has no number of trials, events arrive over time, length or area, \(k\) has no upper limit, mean \(\lambda\). The bridge: when \(n\) is large and \(p\) small, the binomial becomes Poisson with \(\lambda = np\). With \(n = 1{,}000\) emails and \(p = 0.003\), \(\lambda = 3\) and the two agree to within 0.2 percentage points at every \(k\).

\(\lambda\)
average number of events per interval; scale it with the interval length
\(e^{-\lambda}\)
the probability of zero events; every other term is built on it

Match \(\lambda\) to the interval in the question. Three per hour is \(\lambda = 1\) for a 20-minute gap and \(\lambda = 6\) for two hours. L4 s45 prints the formula as \(e^{-v}\lambda^k/k!\); the exponent is \(-\lambda\).

Recipe

  1. Rescale \(\lambda\) to the interval asked about.
  2. \[ e^{-\lambda} \] once; keep it.
  3. \[ P(X = k) = e^{-\lambda}\,\frac{\lambda^k}{k!} \] for each \(k\) needed; "at most" adds them, "at least" uses the complement.
1.5 typos per page: P(none), P(at least two)
  1. \[ P(X = 0) = e^{-1.5} = 0.223 \]
  2. \[ P(X \ge 2) = 1 - e^{-1.5}(1 + 1.5) = 1 - 0.558 = 0.442 \]
Emails at 3 per hour: P(exactly 5 in an hour), P(none in a 20-minute gap), P(no calls in an hour)
  1. \[ P(X = 5) = \frac{e^{-3}\,3^5}{5!} = 0.101 \]
  2. Twenty minutes is a third of an hour, so \(\lambda = 1\): \[ P(X = 0) = e^{-1} = 0.368 \]
  3. No calls in an hour at \(\lambda = 3\): \[ e^{-3} = 0.050 \]
Café arrivals λ = 4 per 10 minutes: E[Y], σ, skewness; P(exactly 5)
  1. \[ E[Y] = 4,\qquad \sigma = 2,\qquad \gamma_1 = \tfrac{1}{2} = 0.5 \] (mildly right-skewed)
  2. \[ P(Y = 5) = \frac{e^{-4}\,4^5}{5!} = \frac{0.01832 \times 1024}{120} = 0.156 \]
Requests at 6 per hour; N = count in 20 minutes: P(N ≤ 1); is the 60-minute count more or less skewed?
  1. \[ \lambda = 6 \times \tfrac{20}{60} = 2 \]
  2. \[ P(N \le 1) = e^{-2} + 2e^{-2} = 3e^{-2} = 0.406 \]
  3. For 60 minutes \(\lambda = 6\): skewness \(1/\sqrt 6 = 0.408\) against \(1/\sqrt 2 = 0.707\). Less right-skewed, although its mean and variance are larger.

Choosing a discrete model: read what X counts

Before touching a formula, say in words what the random variable counts. One trial, successes out of a fixed n, attempts until the first success, or events per interval: each phrase names its distribution.

ModelX counts…Conditions\(P(X = k)\)MeanVarianceExample
Bernoullione success or failureone trial with probability \(p\)\(p^k(1-p)^{1-k}\), \(k = 0, 1\)\(p\)\(p(1-p)\)a sensor works or fails
Binomialsuccesses in \(n\) trialsfixed \(n\), independent, same \(p\)\(\binom{n}{k}p^k(1-p)^{n-k}\)\(np\)\(np(1-p)\)defective panels in 20 tested
Geometrictrials until the first successindependent trials, same \(p\)\((1-p)^{k-1}p\), \(k = 1, 2, \dots\)\(1/p\)\((1-p)/p^2\)attempts until the first connection
Poissonevents in an intervalindependent events, constant rate \(\lambda\)\(e^{-\lambda}\lambda^k/k!\), \(k = 0, 1, \dots\)\(\lambda\)\(\lambda\)methane alerts per day
Multinomialcounts in \(k \ge 2\) categoriesfixed \(n\), probabilities summing to 1\(\frac{n!}{x_1!\cdots x_k!}p_1^{x_1}\cdots p_k^{x_k}\)\(np_i\)\(np_i(1-p_i)\)faces in 12 die rolls

Diagnostic question: fixed number of trials, waiting for the first success, or events in time or space? Cues: "out of \(n\)" or "in \(n\) trials" → binomial; "until the first…" → geometric; "per hour / per page / per km" → Poisson; "given that…" → conditional probability.

Relations: Bernoulli is binomial with \(n = 1\); binomial is multinomial with \(k = 2\); Poisson is the limit of the binomial when \(n\) is large and \(p\) small, \(\lambda = np\).

Final check (L5 s121): define \(X\), state its support, choose the model, then interpret the probability in context. Every probability sits between 0 and 1 and a complete distribution adds up to exactly 1.

Name the model: defectives in a batch of 20; typos per page; login attempts until the first success

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

A single flip, a few flips, many flips: which description fits each?

A single flip: a single probability (Bernoulli). A few flips: the binomial distribution, a pmf. Many flips: the normal distribution, a pdf, which is where the next page starts.

Part 3

Exam toolkit

Formulas for mean, variance and skewness are usually given; the mark is for choosing and applying them.

Which formula, when

The question asks for…UseCard
"exactly k"the pmf \(P(X = k)\)pmf
"at most k"\(F(k) = \sum_{i \le k} P(i)\)cdf
"at least k"\(1 - F(k-1)\); for "at least 1", \(1 - P(0)\)cdf
long-run average of a table\(E[X] = \sum x\,P(x)\)E(X)
spread of a table\(\text{Var} = \sum x^2 P(x) - \mu^2\)Var(X)
which way the tail pointssign of \(\gamma_1\)Skewness
one yes/no trial\(p\), \(p(1-p)\), \((1-2p)/\sqrt{p(1-p)}\)Bernoulli
k successes out of n\(\binom{n}{k}p^k(1-p)^{n-k}\); \(np\); \(np(1-p)\)Binomial
first success on trial k\((1-p)^{k-1}p\); \(1/p\); \((1-p)/p^2\); \(F(k) = 1 - (1-p)^k\)Geometric
k events per interval\(e^{-\lambda}\lambda^k/k!\); mean and variance \(\lambda\); rescale \(\lambda\) to the intervalPoisson
counts in several categories\(\frac{n!}{x_1!\cdots x_k!}p_1^{x_1}\cdots p_k^{x_k}\)Multinomial
which modelwhat does X count?Which model