---
title: The Poisson distribution
heading: Counting rare events: photons, packets and defects
eyebrow: A11 · Lesson 12 · The Poisson distribution
xp: 40
---

::: hook
A photodiode in dim light catches photons one at a time, at random instants: on average 100 per microsecond, but never exactly 100. Packets reach a router at random. Defects land on a silicon wafer at random spots. Each is a count of many independent, individually rare events, and all of them follow the same distribution, named after Siméon Poisson. Its single parameter, the average count, fixes everything else, including the noise: the spread of a Poisson count is the square root of its mean, which is why dim optical signals are noisy no matter how good the detector is.
:::

::: play
- An interval is cut into $n$ slots, each holding an event with probability $\lambda/n$. The histogram counts events per interval; the line is the Poisson formula with mean $\lambda$.
- Start with $n = 5$: the counts can't exceed 5, and the shape is off. Raise $n$ and watch the histogram settle onto the Poisson curve.
- Compare the measured mean and variance. For a Poisson count they're equal.
:::
:::

```sim plot
view: random
x: k = -0.5..15.5
slider: lam = 0.5..5 step 0.1 = 3
slider: n = 5..40 step 1 = 5
sample: coin(lam/n)*step(n - 0.5) + coin(lam/n)*step(n - 1.5) + coin(lam/n)*step(n - 2.5) + coin(lam/n)*step(n - 3.5) + coin(lam/n)*step(n - 4.5) + coin(lam/n)*step(n - 5.5) + coin(lam/n)*step(n - 6.5) + coin(lam/n)*step(n - 7.5) + coin(lam/n)*step(n - 8.5) + coin(lam/n)*step(n - 9.5) + coin(lam/n)*step(n - 10.5) + coin(lam/n)*step(n - 11.5) + coin(lam/n)*step(n - 12.5) + coin(lam/n)*step(n - 13.5) + coin(lam/n)*step(n - 14.5) + coin(lam/n)*step(n - 15.5) + coin(lam/n)*step(n - 16.5) + coin(lam/n)*step(n - 17.5) + coin(lam/n)*step(n - 18.5) + coin(lam/n)*step(n - 19.5) + coin(lam/n)*step(n - 20.5) + coin(lam/n)*step(n - 21.5) + coin(lam/n)*step(n - 22.5) + coin(lam/n)*step(n - 23.5) + coin(lam/n)*step(n - 24.5) + coin(lam/n)*step(n - 25.5) + coin(lam/n)*step(n - 26.5) + coin(lam/n)*step(n - 27.5) + coin(lam/n)*step(n - 28.5) + coin(lam/n)*step(n - 29.5) + coin(lam/n)*step(n - 30.5) + coin(lam/n)*step(n - 31.5) + coin(lam/n)*step(n - 32.5) + coin(lam/n)*step(n - 33.5) + coin(lam/n)*step(n - 34.5) + coin(lam/n)*step(n - 35.5) + coin(lam/n)*step(n - 36.5) + coin(lam/n)*step(n - 37.5) + coin(lam/n)*step(n - 38.5) + coin(lam/n)*step(n - 39.5) | mean: M | sd: S
trials: 20000
bins: 16
density: exp(-lam)*lam^round(k)/round(k)!
readout: mean, measured = M | digits: 3
readout: variance, measured = S^2 | digits: 3
readout: chance of no events, Poisson = exp(-lam) | digits: 3
```

::: predict
## A detector expects 100 photons per measurement, arriving independently. About how much does the count vary from one measurement to the next (its standard deviation)?

- [ ] 0: always 100
- [ ] 1
- [x] 10
- [ ] 50

::: reveal
About 10, the square root of 100. A Poisson count has variance equal to its mean, so its standard deviation is $\sqrt{100} = 10$. The signal-to-noise ratio is $\frac{100}{10} = 10$, and only collecting more light improves it: 10,000 photons give a ratio of 100.
:::
:::

::: nameit
## The Poisson distribution

A count of events that happen independently and at a steady average rate, with mean $\lambda$, has

$$P(X = k) = e^{-\lambda}\frac{\lambda^k}{k!}, \qquad k = 0, 1, 2, \ldots$$

For a rate $r$ per second, the count in a window of $T$ seconds has $\lambda = rT$.

## Where it comes from

Cut the window into $n$ tiny slots, each with an event with probability $\lambda/n$. The count is binomial, and as $n \to \infty$,

$$\binom{n}{k}\left(\frac{\lambda}{n}\right)^k\left(1 - \frac{\lambda}{n}\right)^{n - k} \to e^{-\lambda}\frac{\lambda^k}{k!}$$

because $(1 - \lambda/n)^n \to e^{-\lambda}$. So the Poisson also approximates any binomial with many tries and a small chance each: as a rule of thumb, $n$ over 20 and $p$ under 0.05, with $\lambda = np$.

## Properties

- **Mean and variance are equal:** $E[X] = \text{Var}(X) = \lambda$, so the standard deviation is $\sqrt\lambda$ and the relative spread is $\frac{1}{\sqrt\lambda}$.
- **Sums:** independent Poisson counts add to a Poisson count with $\lambda_1 + \lambda_2$.
- **No events:** $P(X = 0) = e^{-\lambda}$.

## Two applications

**Shot noise.** Current is carried by discrete electrons or photons arriving at random. A count with mean $N$ fluctuates by $\sqrt N$, so its best possible signal-to-noise ratio is $\sqrt N$ (lesson 46 turns this into a noise current).

**Chip yield.** Defects with density $D$ per unit area land at random, so a die of area $A$ catches a Poisson number with mean $DA$. It works only with none:

$$Y = e^{-DA}$$

Yield falls exponentially with die area, which is why large chips cost far more than their area alone suggests.
:::

::: example
## A 1000-bit packet has bit error rate $10^{-3}$. Using the Poisson approximation, what fraction of packets have 0, 1, and 2 or more errors?

::: solution
1. **The rate.**
   $$\begin{aligned} \lambda &= np \\ &= 1 \end{aligned}$$
2. **No errors.**
   $$\begin{aligned} P(0) &= e^{-1} \\ &= 0.368 \end{aligned}$$
3. **One error.**
   $$\begin{aligned} P(1) &= e^{-1} \\ &= 0.368 \end{aligned}$$
4. **Two or more.**
   $$\begin{aligned} P(\ge 2) &= 1 - 2e^{-1} \\ &= 0.264 \end{aligned}$$
5. **Compare with the binomial.** The exact binomial values are 0.3677, 0.3681 and 0.2642, so the approximation is good to about three digits.
6. **What it means.** A code correcting one error per packet still loses 26% of packets.

**Answer:** 36.8% of packets have no errors, 36.8% have one, and 26.4% have two or more.
:::
:::

::: example
## A process has 0.5 defects per square centimeter. What fraction of 1 cm² dies work? Of 2 cm² dies?

::: solution
1. **Small die.**
   $$\begin{aligned} Y &= e^{-0.5 \times 1} \\ &= 0.607 \end{aligned}$$
2. **Large die.**
   $$\begin{aligned} Y &= e^{-0.5 \times 2} \\ &= 0.368 \end{aligned}$$
3. **Cost.** Doubling the area doubles the silicon per die and cuts the yield from 61% to 37%, so each good large die costs about 3.3 times as much as a good small one.

**Answer:** 60.7% of the 1 cm² dies work, and 36.8% of the 2 cm² dies.
:::
:::

::: example
## A photodetector counts 4 photons on average per interval. What is the chance of no photon, and of at most two?

::: solution
1. **No photon.** Photon counts are Poisson, so
   $$\begin{aligned} P(0) &= e^{-4} \\ &= 0.018 \end{aligned}$$
2. **At most two.**
   $$\begin{aligned} P(\le 2) &= e^{-4}\left(1 + 4 + \frac{4^2}{2}\right) \\ &= 13e^{-4} \\ &= 0.238 \end{aligned}$$
3. **Shot noise.** Even with a steady light, the count fluctuates by $\sqrt4 = 2$ about its mean: shot noise, the floor for every optical receiver.

**Answer:** the chance of no photon is 0.018, and of at most two is 0.238.
:::
:::

::: check
given: lam = 2 | 3; k = 0 | 1 | 2
answer: exp(-lam)*lam^k/k!
tolerance: 0.5%

## A count is Poisson with mean {lam}. What is the chance it equals {k}?

::: right
Right. $e^{-\lambda}\frac{\lambda^k}{k!}$ = {answer}.
:::

::: misses
- [lam^k/k!] Multiply by $e^{-\lambda}$, which makes the chances add to 1.
- [any] Not yet. The Poisson PMF.
:::
:::

::: check
given: r = 200 | 500; T = 2 | 5
answer: exp(-r*T/1000)
tolerance: 0.5%

## Packets arrive at random at an average of {r} per second. What is the chance that none arrives in a {T} ms window?

::: right
Right. $\lambda = rT$ and $P(0) = e^{-rT}$ = {answer}.
:::

::: misses
- [1 - r*T/1000] That's only a first approximation; use $e^{-\lambda}$.
- [any] Not yet. Find $\lambda = rT$, then $P(0) = e^{-\lambda}$.
:::
:::

::: check
given: N = 100 | 400 | 10000
answer: sqrt(N)
tolerance: 0.5%

## A photodetector expects {N} photons per measurement. What is the best possible signal-to-noise ratio (mean over standard deviation)?

::: right
Right. $\frac{N}{\sqrt N} = \sqrt N$ = {answer}.
:::

::: misses
- [N] The count fluctuates by $\sqrt N$, so the ratio is $\sqrt N$.
- [any] Not yet. A Poisson count has standard deviation $\sqrt N$.
:::
:::

::: check
given: D = 0.2 | 0.5; A = 1 | 2 | 4
answer: exp(-D*A)
tolerance: 0.5%

## A process has {D} defects per cm². What fraction of dies of area {A} cm² have no defects?

::: right
Right. $e^{-DA}$ = {answer}.
:::

::: misses
- [1 - D*A] That linear estimate fails once $DA$ isn't small; use $e^{-DA}$.
- [any] Not yet. The count on a die is Poisson with mean $DA$.
:::
:::

::: check
given: l1 = 2 | 3; l2 = 1 | 4
answer: exp(-(l1 + l2))
tolerance: 0.5%

## Two independent sources send Poisson counts with means {l1} and {l2}. What is the chance their total is zero?

::: right
Right. The total is Poisson with mean $\lambda_1 + \lambda_2$: {answer}.
:::

::: misses
- [exp(-l1) + exp(-l2)] Both must be zero, so multiply, which is $e^{-(\lambda_1 + \lambda_2)}$.
- [any] Not yet. Both counts must be zero.
:::
:::

::: check
given: lam = 0.5 | 1 | 2
answer: 1 - exp(-lam)*(1 + lam)
tolerance: 0.5%

## A count is Poisson with mean {lam}. What is the chance it's 2 or more?

::: right
Right. One minus the chances of 0 and 1: {answer}.
:::

::: misses
- [1 - exp(-lam)] That's the chance of at least one; subtract $P(1)$ too.
- [any] Not yet. $1 - P(0) - P(1)$.
:::
:::

::: check
kind: parts
given: m = 2 | 4 | 6

## Photon counts are Poisson with mean {m}.

::: part
answer: exp(-m)
tolerance: 0.5%

### What is the chance of zero counts?

::: misses
- [any] $e^{-\lambda}$.
:::
:::

::: part
answer: exp(-m)*(1 + m + m^2/2)
tolerance: 0.5%

### What is the chance of at most two?

::: misses
- [any] $e^{-\lambda}(1 + \lambda + \lambda^2/2)$.
:::
:::
:::

::: check
kind: derivation
vars: D = 0.1..2, A = 0.1..4

## Defects fall at random with density $D$ per cm² on dies of area $A$ cm².

::: step
answer: D*A

### What is the mean number of defects per die?
:::

::: step
answer: exp(-D*A)

### What fraction of dies have none (the yield)?
:::

::: right
Right. The Poisson yield model: yield falls exponentially with die area.
:::
:::

::: check
kind: python

## Set `pmf` to the Poisson probabilities of 0 to 5 events with mean 2, and `sim` to the same fractions from 10⁵ draws of `rng.poisson(2, n)` (`np.random.default_rng(5)`).

```python starter
import math
import numpy as np

pmf = sim = [0] * 6
print(pmf, sim)
```

```python solution
import math
import numpy as np

pmf = [math.exp(-2) * 2**k / math.factorial(k) for k in range(6)]
rng = np.random.default_rng(5)
x = rng.poisson(2, 10**5)
sim = [np.mean(x == k) for k in range(6)]
print(pmf, sim)
```

```python tests
import numpy as np
assert abs(pmf[0] - 0.135335) < 1e-6 and abs(pmf[2] - 0.270671) < 1e-6, "P(0) = e^-2 and P(2) = 2e^-2."
assert np.allclose(pmf, sim, atol=0.005), f"The simulated fractions should match the PMF within 0.005; got {sim}."
```

::: right
Right. 1 and 2 events are equally likely, at 27% each, a feature of the Poisson distribution with mean 2.
:::
:::

::: explain
## Why does a Poisson count's standard deviation grow only as the square root of its mean?

::: model
The count is a sum of many independent events, each rare. Variances of independent pieces add, and each tiny slot contributes a variance almost equal to its small mean, so the total variance equals the total mean $\lambda$. The standard deviation is then $\sqrt\lambda$. Because it grows more slowly than the mean, larger counts are relatively steadier: the fractional fluctuation $1/\sqrt\lambda$ shrinks as you collect more events.
:::
:::

::: practice

::: check
given: lam = 4 | 9 | 25
answer: sqrt(lam)
tolerance: 0.5%

## What is the standard deviation of a Poisson count with mean {lam}?

::: misses
- [lam] That's the variance.
- [any] $\sqrt\lambda$.
:::
:::

::: check
given: n = 500 | 2000; p = 0.001 | 0.002
answer: exp(-n*p)
tolerance: 0.5%

## Using the Poisson approximation, what is the chance of no errors in {n} bits with bit error rate {p}?

::: misses
- [any] $e^{-np}$.
:::
:::

::: check
given: r = 3 | 5; T = 2 | 4
answer: r*T
tolerance: 0.5%

## Calls arrive at {r} per minute on average. What is the mean count in {T} minutes?

::: misses
- [any] $\lambda = rT$.
:::
:::
:::
