Skip to content

06-02: Exercises — Binomial and Poisson Distributions

Notes reference: 06-02: Binomial and Poisson Distributions


Q1: Do the binomial conditions hold?

For each, say whether the binomial model applies. If not, say which condition fails and what to use instead.

  1. Flip a fair coin 20 times, count heads.
  2. Draw 5 cards from a deck without replacement, count hearts.
  3. Ask 100 randomly selected voters whether they support a measure.
  4. Roll a die until you get a 6, count the rolls.
  5. Draw 3 items from a shipment of 10,000 with a 2% defect rate, count defectives.

Solution

1. YES.  Fixed n = 20, two outcomes, p = 0.5 constant, independent flips.

2. NO.   Trials are NOT independent — p changes from 13/52 to 12/51 …
         →  Use the HYPERGEOMETRIC distribution.

3. YES.  Fixed n = 100, support/oppose, p constant, and the sample is a tiny
         fraction of the population, so trials are effectively independent.

4. NO.   n is NOT fixed — you stop when the first success occurs.
         →  Use the GEOMETRIC distribution.

5. YES (approximately).  Technically hypergeometric, but n = 3 is far below
         5% of N = 10,000, so the binomial with p = 0.02 is an excellent
         approximation.

Q2: Binomial by hand and by software

A basketball player makes 75% of free throws. She takes 8.

  1. P(exactly 6)
  2. P(at least 6)
  3. P(at most 5)
  4. μ and σ

Solution

n = 8,  p = 0.75,  q = 0.25

1.  P(X = 6) = 8C6 (0.75)⁶ (0.25)²
             = 28 × 0.177979 × 0.0625
             = 0.311462                       →  0.3115

2.  P(X ≥ 6) = P(6) + P(7) + P(8)
    P(7) = 8C7 (0.75)⁷(0.25)¹ = 8 × 0.133484 × 0.25 = 0.266968
    P(8) = (0.75)⁸                            = 0.100113
    P(X ≥ 6) = 0.311462 + 0.266968 + 0.100113 = 0.678543   →  0.6785

3.  P(X ≤ 5) = 1 − 0.678543 = 0.321457        →  0.3215

4.  μ = np      = 8(0.75)          = 6.0 free throws
    σ = √(npq)  = √(8 × 0.75 × 0.25) = √1.5 = 1.2247
=BINOM.DIST(6, 8, 0.75, FALSE)         ' 0.311462
=1-BINOM.DIST(5, 8, 0.75, TRUE)        ' 0.678543   ← at LEAST 6 is 1 − P(≤5)
=BINOM.DIST(5, 8, 0.75, TRUE)          ' 0.321457
=BINOM.DIST.RANGE(8, 0.75, 6, 8)       ' 0.678543
=8*0.75                                ' 6
=SQRT(8*0.75*0.25)                     ' 1.2247
dbinom(6, 8, 0.75)                     # 0.3114624
pbinom(5, 8, 0.75, lower.tail = FALSE) # 0.6785431
sum(dbinom(6:8, 8, 0.75))              # same
stats.binom.pmf(6, 8, 0.75)            # 0.3114624
stats.binom.sf(5, 8, 0.75)             # 0.6785431

The classic trap: "at least 6" is 1 − P(X ≤ 5), not 1 − P(X ≤ 6).


Q3: Build a full binomial table

n = 5, p = 0.3. Build P(x) for x = 0…5, verify it sums to 1, and confirm μ = np.

Solution

x 5Cx P(x) x·P(x)
0 1 0.16807 0.00000
1 5 0.36015 0.36015
2 10 0.30870 0.61740
3 10 0.13230 0.39690
4 5 0.02835 0.11340
5 1 0.00243 0.01215
Σ 1.00000 1.50000
Σ P(x) = 1.00000                  ✓
μ = Σ x·P(x) = 1.50 = np = 5(0.3) ✓
σ = √(5 × 0.3 × 0.7) = √1.05 = 1.0247
x <- 0:5
data.frame(x, p = round(dbinom(x, 5, 0.3), 5), cum = round(pbinom(x, 5, 0.3), 5))
barplot(dbinom(x, 5, 0.3), names.arg = x, col = "#5B2A86", border = NA)

Q4: Poisson

A website receives an average of 2.5 orders per hour.

  1. P(exactly 4 orders in an hour)
  2. P(no orders in an hour)
  3. P(more than 3 orders in an hour)
  4. P(exactly 5 orders in a 2-hour window)
  5. μ and σ per hour

Solution

λ = 2.5 per hour

1.  P(X = 4) = 2.5⁴ e^(−2.5) / 4!
             = 39.0625 × 0.082085 / 24
             = 3.20645 / 24
             = 0.133602                  →  0.1336

2.  P(X = 0) = e^(−2.5) = 0.082085       →  0.0821

3.  P(X > 3) = 1 − P(X ≤ 3)
    P(0)=0.082085  P(1)=0.205212  P(2)=0.256516  P(3)=0.213763
    P(X ≤ 3) = 0.757576
    P(X > 3) = 0.242424                  →  0.2424

4.  A 2-hour window doubles the rate:  λ' = 2.5 × 2 = 5.0
    P(X = 5) = 5⁵ e^(−5) / 5! = 3125 × 0.0067379 / 120 = 0.175467  →  0.1755

5.  μ = λ = 2.5      σ = √2.5 = 1.5811
=POISSON.DIST(4, 2.5, FALSE)       ' 0.133602
=POISSON.DIST(0, 2.5, FALSE)       ' 0.082085
=1-POISSON.DIST(3, 2.5, TRUE)      ' 0.242424
=POISSON.DIST(5, 5, FALSE)         ' 0.175467
dpois(4, 2.5); dpois(0, 2.5)
ppois(3, 2.5, lower.tail = FALSE)
dpois(5, lambda = 2.5 * 2)

Always rescale λ when the interval changes. Forgetting this is the single most common Poisson error.


Q5: Poisson approximates the binomial

A factory produces 2,000 items with a 0.15% defect rate. Find P(exactly 2 defective) (a) exactly with the binomial, (b) with a Poisson approximation.

Solution

n = 2000,  p = 0.0015    →   λ = np = 3.0

(a) BINOMIAL
    P(X = 2) = 2000C2 (0.0015)² (0.9985)^1998 = 0.223954

(b) POISSON with λ = 3
    P(X = 2) = 3² e^(−3) / 2! = 9 × 0.049787 / 2 = 0.224042

Difference: 0.000088 — negligible.

The rule of thumb (n ≥ 100 and np ≤ 10) is easily satisfied here,
and the Poisson formula is far less work by hand.
=BINOM.DIST(2, 2000, 0.0015, FALSE)    ' 0.223954
=POISSON.DIST(2, 3, FALSE)             ' 0.224042

Q6: Geometric

A telemarketer makes a sale on 12% of calls.

  1. P(first sale on the 5th call)
  2. P(first sale within the first 5 calls)
  3. Expected number of calls per sale

Solution

p = 0.12,  q = 0.88

1.  P(X = 5) = q⁴ p = (0.88)⁴ (0.12) = 0.599695 × 0.12 = 0.071963   → 0.0720

2.  P(X ≤ 5) = 1 − q⁵ = 1 − (0.88)⁵ = 1 − 0.527732 = 0.472268       → 0.4723

3.  μ = 1/p = 1/0.12 = 8.33 calls per sale
=0.88^4*0.12          ' 0.071963
=1-0.88^5             ' 0.472268
=1/0.12               ' 8.3333
dgeom(4, 0.12)        # R counts FAILURES: 4 failures then success = trial 5
pgeom(4, 0.12)        # P(within 5 trials) -> 0.472268
stats.geom.pmf(5, 0.12)      # scipy counts TRIALS -> 0.071963
stats.geom.cdf(5, 0.12)      # 0.472268

Three tools, three conventions. R's dgeom(k, p) uses failures; SciPy's geom.pmf(k, p) uses the trial number. Check before you trust a number.


Q7: Hypergeometric

A committee of 5 is chosen at random from 8 women and 7 men.

  1. P(exactly 3 women)
  2. P(all women)
  3. P(at least 3 women)
  4. Expected number of women

Solution

Total ways:  15C5 = 3003

1.  8C3 × 7C2 / 15C5 = 56 × 21 / 3003 = 1176 / 3003 = 0.391608   → 0.3916

2.  8C5 × 7C0 / 15C5 = 56 × 1 / 3003 = 0.018648                  → 0.0186

3.  P(3) + P(4) + P(5)
    P(4) = 8C4 × 7C1 / 3003 = 70 × 7 / 3003 = 490/3003 = 0.163170
    P(3) + P(4) + P(5) = 0.391608 + 0.163170 + 0.018648 = 0.573426  → 0.5734

4.  μ = n · (a / N) = 5 × (8/15) = 2.667 women
=HYPGEOM.DIST(3, 5, 8, 15, FALSE)      ' 0.391608
=HYPGEOM.DIST(5, 5, 8, 15, FALSE)      ' 0.018648
=1-HYPGEOM.DIST(2, 5, 8, 15, TRUE)     ' 0.573426
dhyper(3, m = 8, n = 7, k = 5)                  # 0.3916084
phyper(2, 8, 7, 5, lower.tail = FALSE)          # 0.5734266
stats.hypergeom.pmf(3, M=15, n=8, N=5)          # 0.3916084
stats.hypergeom.sf(2, 15, 8, 5)                 # 0.5734266

Q8: Which distribution?

Name the distribution for each situation.

  1. Number of heads in 50 coin flips
  2. Number of typos on a randomly chosen page
  3. Number of interviews until the first job offer
  4. Number of aces in a 5-card hand
  5. Number of customers arriving between 2 pm and 3 pm
  6. Number of left-handed people among 30 randomly chosen adults

Solution

1. BINOMIAL        n = 50 fixed, p = 0.5, independent
2. POISSON         count of events in a fixed unit (one page)
3. GEOMETRIC       trials until the first success
4. HYPERGEOMETRIC  sampling without replacement from a finite deck
5. POISSON         count of events in a fixed time interval
6. BINOMIAL        n = 30 fixed, p ≈ 0.10, population effectively infinite

Q9: A decision problem

An airline knows 4% of ticketed passengers do not show up. It sells 105 tickets for a 100-seat flight.

  1. P(everyone who shows up gets a seat)
  2. P(at least one passenger is bumped)

Solution

Let X = number who SHOW UP.  X ~ Binomial(n = 105, p = 0.96)

1.  Everyone is seated when X ≤ 100.
    P(X ≤ 100) = BINOM.DIST(100, 105, 0.96, TRUE) = 0.4108    → 41.1%

2.  P(at least one bumped) = P(X ≥ 101) = 1 − 0.4108 = 0.5892 → 58.9%

Nearly SIX FLIGHTS IN TEN would bump someone. Equivalently, with
Y = no-shows ~ Binomial(105, 0.04), everyone is seated only when
Y ≥ 5, and P(Y ≥ 5) = 0.4108.

μ = np = 105(0.96) = 100.8 expected passengers for 100 seats — the plane
is expected to be over capacity, which is why the risk is so high.
Selling 103 tickets instead gives P(all seated) = 0.7849.
=BINOM.DIST(100, 105, 0.96, TRUE)       ' 0.41083
=1-BINOM.DIST(100, 105, 0.96, TRUE)     ' 0.58917
=BINOM.DIST(100, 103, 0.96, TRUE)       ' 0.78490  — selling only 103 tickets
pbinom(100, 105, 0.96)                  # 0.4108268
pbinom(100, 103, 0.96)                  # 0.7849034

⬅️ Previous: 06-01: Exercises — Random Variables and Expected Value ➡️ Next: 07-01: Exercises — Continuous, Uniform and Exponential Distributions