The prosecutor's fallacy: a DNA match that is probably innocent
The prosecutor's fallacy with a city of a million: 1 innocent in 100,000 matches, yet 10 of the 11 people who match are innocent, about 91%.
The prosecutor's fallacy is a mistake about what a piece of evidence tells you. A suspect's DNA matches the crime scene. An expert says an innocent person would match only 1 time in 100,000. The prosecutor turns that into "so there is only a 1 in 100,000 chance he is innocent." It sounds like the same sentence. It isn't, and counting people shows how far apart the two can be.

What are the rules?
The setup, with numbers chosen so the counting comes out clean:
- A city of 1,000,000 innocent people, plus 1 guilty person.
- The guilty person always matches.
- An innocent person matches by chance 1 time in 100,000.
- There is no other evidence. The suspect was found only because of the match, say by searching a database of the whole city.
The question is: given that someone matches, how likely is it that they are innocent?

What happens when you test the whole city?
Draw the million innocent people as 100 blocks of 10,000 each, with the guilty person beside them. Now test everyone.
- The innocent million. Each one matches 1 time in 100,000, so on average 10 of them match. In any one city it could be 8 or 13; 10 is the expected count, which is why the video says "about ten".
- The guilty one matches, always.
In the picture, every match is a person on a mustard tile.

| Of 1,000,001 people | Match | No match | All |
|---|---|---|---|
| Innocent | about 10 | about 999,990 | 1,000,000 |
| Guilty | 1 | 0 | 1 |
| All | about 11 | about 999,990 | 1,000,001 |
So how likely is a match innocent?
We know the suspect matches, so the only people still possible are the ones who match. Keep those and drop everyone else: about 11 people. 10 of them are innocent and 1 is guilty. So the chance that a matching person is innocent is 10 in 11, about 91%.

That is the opposite of what the prosecutor claimed. "1 in 100,000" was the chance that an innocent person matches. The chance that a match is innocent is 10 in 11.
Why are the two numbers so different?
A tiny chance applied to a huge crowd still picks out real people: 1 in 100,000 of 1,000,000 is 10 people. Those 10 innocent matches outnumber the single guilty one, so a match on its own points at an innocent person most of the time.

The two chances run in opposite directions:
- Innocent → match: rare, 1 in 100,000.
- Match → innocent: likely, 10 in 11.
Swapping one for the other is the whole fallacy. In Bayes' rule terms, P(match | innocent) is tiny, but P(innocent | match) also depends on how many innocent people there were to begin with. Other evidence, such as being seen near the scene, shrinks the crowd of people who could have done it, and then a match means much more.
Check it with code
The script counts the expected matches with exact fractions, then simulates 20,000 cities, each with a million innocent people, and checks what share of all matches were innocent:
from fractions import Fraction
import math
import random
innocent = 1_000_000 # a city of a million innocent people
guilty = 1 # plus one guilty person, who always matches
match_rate = Fraction(1, 100_000) # an innocent person matches by chance 1 time in 100,000
innocent_matches = innocent * match_rate # expected: 10
matches = innocent_matches + guilty # 11
p = innocent_matches / matches
print('matches:', innocent_matches, 'innocent +', guilty, 'guilty =', matches)
print('chance a match is innocent:', p, f'= {float(p):.1%}')
rng = random.Random(15)
log_q = math.log1p(-float(match_rate))
total_innocent = total = 0
for _ in range(20_000): # 20,000 simulated cities
k, pos = 0, 0
while True: # walk to the next innocent match, person by person in one jump
pos += int(math.log(1.0 - rng.random()) / log_q) + 1
if pos > innocent:
break
k += 1
total_innocent += k
total += k + guilty
print(f'simulated: {total_innocent:,} of {total:,} matches innocent -> {total_innocent / total:.4f} (exact {float(p):.4f})')
Output:
matches: 10 innocent + 1 guilty = 11
chance a match is innocent: 10/11 = 90.9%
simulated: 200,366 of 220,366 matches innocent -> 0.9092 (exact 0.9091)
Try it
Same test, same 1 in 100,000 chance for an innocent person, but now the whole city has only 100,000 people, one of them guilty. Someone matches. How likely is it that they are innocent? Count the innocent matches and the guilty one again.