Bayes' rule with dots: is an email that says free spam?
Bayes' rule without a formula: lay out 40 emails, keep only the ones that say free, and count. 5 of the 8 that are left are spam, so 5 in 8.
Bayes' rule answers one kind of question: you see a piece of evidence, so how likely is the thing behind it now? Here is the whole idea with a spam filter and 40 dots, no formula needed. An email lands in your inbox and it says "free". What's the chance it's spam?

What are the rules?
Three facts, in round numbers made up for the puzzle:
- 1 email in 4 is spam. This is what you believe before you read a word: the prior.
- Half of all spam says "free".
- 1 normal email in 10 says "free" too.
So "free" is more common in spam, but it isn't proof. Normal emails say it sometimes, and there are a lot more normal emails.

What happens to 40 emails?
Instead of multiplying percentages, lay out 40 emails and play every rule out on them. 40 is chosen so every count comes out whole.
- 1 in 4 is spam: that's 10 emails. In the picture they're the top row, in berry.
- Half of those 10 say free: 5 of them. Each one sits on a mustard tile.
- The other 30 are normal. 1 in 10 says free: 3 of them, also on mustard tiles.

| Of 40 emails | Says "free" | Doesn't | All |
|---|---|---|---|
| Spam | 5 | 5 | 10 |
| Normal | 3 | 27 | 30 |
| All | 8 | 32 | 40 |
So what's the chance a "free" email is spam?
You've seen the word "free", so every email that doesn't say it is no longer possible. Cross those out and keep only the emails that say free: 8 of them. 5 of those 8 are spam and 3 are normal. So the chance an email that says free is spam is 5 in 8, which is 62.5%.

Before the evidence, spam was 1 in 4. After it, spam is 5 in 8. The word "free" moved the chance up a lot, but not to certainty, because 3 normal emails say it too.
Why does this work?
That's all Bayes' rule is: keep the cases that fit the evidence, then count. The formula you may have seen, P(spam | free) = P(free | spam) × P(spam) / P(free), does exactly this with fractions instead of dots. The top is the spam that says free (half of a quarter, the 5 dots). The bottom is everything that says free (the 8 dots). Counting the dots avoids the most common mistake, which is to forget the 30 normal emails and answer "half".

Check it with code
The script counts the 40 emails with exact fractions, then simulates a million emails and checks how many of the "free" ones were spam:
from fractions import Fraction
import random
spam_rate = Fraction(1, 4) # 1 email in 4 is spam
free_if_spam = Fraction(1, 2) # half of spam says "free"
free_if_normal = Fraction(1, 10) # ...and so does 1 normal email in 10
emails = 40
spam = emails * spam_rate # 10
normal = emails - spam # 30
spam_free = spam * free_if_spam # 5
normal_free = normal * free_if_normal # 3
print('emails that say free:', spam_free, 'spam +', normal_free, 'normal =', spam_free + normal_free)
p = spam_free / (spam_free + normal_free)
print('chance a free email is spam:', p, f'= {float(p):.1%}')
rng = random.Random(13)
free = free_spam = 0
for _ in range(1_000_000):
is_spam = rng.random() < 0.25
if rng.random() < (0.5 if is_spam else 0.1):
free += 1
free_spam += is_spam
print(f'simulated: {free:,} free emails, {free_spam:,} of them spam -> {free_spam / free:.4f} (exact {float(p):.4f})')
Output:
emails that say free: 5 spam + 3 normal = 8
chance a free email is spam: 5/8 = 62.5%
simulated: 200,769 free emails, 125,497 of them spam -> 0.6251 (exact 0.6250)
Try it
Same filter, but now half of all email is spam. An email says "free". What's the chance it's spam? Lay out 40 emails again: how many spam say free, and how many normal ones?