Back to blog
Probability··9 min read

The Pólya Urn: When the Past Really Does Predict the Future

The Gambler's Fallacy says the past can't touch the next draw. The Pólya Urn is the model where it can — and the strange part is that it still keeps every marginal probability perfectly fixed.

ProbabilityMartingalesPython

A roulette wheel lands on black eight times in a row. Half the table piles onto red, because red is "due." This is the Gambler's Fallacy, and it is wrong for a boring reason: the wheel has no memory. Spin nine is drawn from exactly the same distribution as spin one, and the eight blacks behind it are decoration.

So the lesson people take away is the past never matters. That lesson is also wrong. There is an entire family of processes where the past matters enormously — where every outcome physically reshapes the distribution the next outcome is drawn from. The cleanest one is a hundred years old and fits in a jar.

The Rules

An urn holds 1 red ball and 1 blue ball. Reach in without looking and pull one out.

Now the twist. You put that ball back — and you add one more of the same colour. Draw red, and the urn becomes 2 red / 1 blue. Draw again. Repeat forever.

Every draw makes the colour you just saw more likely next time. Success breeds success. This is Pólya's Urn.

Your instinct here is probably the opposite of the roulette player's. The wheel had no memory; this thing is nothing but memory. So surely the first few draws hijack the process, and the probability of red drifts away from one half almost immediately?

Let's check. Call the draws D1, D2, … and ask the simplest possible question: what is the probability that the second draw is red?

// Condition on the first draw
P(D₂ = R) = P(D₁ = R)·P(D₂ = R | D₁ = R)
+ P(D₁ = B)·P(D₂ = R | D₁ = B)
= (1/2)(2/3) + (1/2)(1/3)
= 1/2

One half. The reinforcement did nothing. And this is not a coincidence of small numbers — it holds for every draw, forever. P(Dn = R) = 1/2 for all n. From the outside, watching only the marginal probabilities, this urn is indistinguishable from a fair coin.

The reason is that the red fraction is a martingale. Write Xn for the share of red balls after n draws, with R red out of T total. With probability Xn you add a red, and with probability 1 − Xn you do not:

E[Xₙ₊₁ | ℱₙ] = Xₙ·(R+1)/(T+1) + (1−Xₙ)·R/(T+1)
= (Xₙ + R) / (T + 1)
// substitute R = Xₙ·T
= Xₙ(1 + T) / (T + 1)
= Xₙ

The composition of the urn is a fair game against itself. Whatever the urn looks like right now, its expected appearance after the next draw is exactly what it looks like right now.

The Second Surprise

Order Doesn't Matter Either

Here is where it gets genuinely strange. Take three draws and write out every possible sequence with its exact probability:

Sequence# RedProbability
RRR31/4
RRB21/12
RBR21/12
BRR21/12
RBB11/12
BRB11/12
BBR11/12
BBB01/4

RRB, RBR and BRR all have probability 1/12. The urn does not care when the red came out, only how many did. A sequence and any shuffle of it are equally likely. Probabilists call this exchangeability, and it is a much stronger statement than the marginals being equal.

Sum the table by red count and something else falls out. P(0 reds) = P(1 red) = P(2 reds) = P(3 reds) = 1/4. After n draws, the number of reds is uniform on {0, 1, …, n}. Getting zero reds in a hundred draws is exactly as likely as getting fifty — both are 1/101.

Compare that to a fair coin, where a hundred heads has probability 2−100 and fifty is the overwhelming favourite. Same marginals. Completely different universe.

Simulation

Watching It Happen in Python

Math is great, but code is better. Let's run 50,000 independent urns for 200 draws each and look at where the red fraction ends up.

import random

# 1. Parameters
RED, BLUE = 1, 1     # starting balls
C = 1                # balls added per draw (the reinforcement)
DRAWS = 200          # draws per run
TRIALS = 50000       # independent runs

# 2. Trackers
final_fractions = []
reds_on_draw_10 = 0

# 3. Simulate
for _ in range(TRIALS):
    red, total = RED, RED + BLUE

    for draw in range(1, DRAWS + 1):
        drew_red = random.random() < red / total
        if draw == 10 and drew_red:
            reds_on_draw_10 += 1
        if drew_red:
            red += C
        total += C

    final_fractions.append(red / total)

# 4. Results
print(f"P(draw #10 is red)  = {reds_on_draw_10 / TRIALS:.4f}")
print(f"Mean final fraction = {sum(final_fractions) / TRIALS:.4f}")

for lo in range(10):
    band = sum(1 for f in final_fractions if lo / 10 <= f < (lo + 1) / 10)
    print(f"  {lo/10:.1f}-{(lo+1)/10:.1f}  {band/TRIALS:6.2%}")

The output:

P(draw #10 is red)  = 0.4963   (theory 0.5)
Mean final fraction = 0.4991   (theory 0.5)

Where the final red fraction actually landed:
  0.0-0.1  10.12%  ###############
  0.1-0.2  10.00%  ###############
  0.2-0.3  10.24%  ###############
  0.3-0.4   9.77%  ###############
  0.4-0.5   9.77%  ###############
  0.5-0.6  10.15%  ###############
  0.6-0.7   9.83%  ###############
  0.7-0.8  10.12%  ###############
  0.8-0.9  10.14%  ###############
  0.9-1.0   9.86%  ###############

Stare at that histogram for a second, because it is the whole point of the article. The mean is 0.4991 — dead on. And the distribution around that mean is flat. An urn that ends up 95% red is exactly as common as one that ends up 50/50, which is exactly as common as one that ends up 5% red.

The average is 1/2 not because the process is drawn to 1/2, but because it runs away in both directions equally. It is the average of a thing that never happens.

Pólya Urnreinforced

200 draws. The final red share is uniform on [0, 1] — every outcome equally likely.

Mean = 0.4991
Landed below 0.1 or above 0.9:
20.5% of runs
Fair Coinindependent

200 flips, same mean. The share collapses onto 1/2 and essentially never strays.

Mean = 0.5000
Observed range: 0.365 → 0.640
0.0% of runs

Identical expectations. In 20,000 coin runs the extreme bands were hit zero times; the worst outlier in the entire experiment was 0.365. In the urn, one run in five ended there. If you only ever reported the mean, these two processes would look like the same process.

The Resolution

It Was a Coin All Along

So why uniform, of all distributions? There is a beautiful answer, and it comes from de Finetti's theorem: any exchangeable sequence of 0s and 1s is a mixture of i.i.d. coin flips. Since we proved the urn is exchangeable, it must secretly be a coin — one whose bias was chosen at random before the first draw.

And for this urn you can say precisely which coin:

// r red, b blue, adding c of the drawn colour each time
Xₙ → X almost surely, where
X ~ Beta(r/c, b/c)
// our case: r = b = c = 1
X ~ Beta(1, 1) = Uniform(0, 1)

That is the trick. The universe flips a Uniform(0, 1) coin bias p at the start, hides it from you, and then hands you i.i.d. Bernoulli(p) draws forever. The reinforcement you thought you were watching was never really changing the odds — it was revealing a bias that was fixed from the beginning.

Both intuitions were right, and both were describing different things. The marginalprobability of red is stuck at 1/2 forever, so there is no drift to bet against. The conditional probability given what you have seen moves constantly, because every draw is evidence about p. The urn is doing Bayesian updating, and the balls are the posterior.

The reinforcement constant c controls how loudly the past speaks. Turn it up to c = 5 and the limit becomes Beta(0.2, 0.2), a U-shaped distribution that piles probability onto the extremes — in simulation, 67.2% of runs finished below 0.1 or above 0.9. Stronger feedback, earlier lock-in, more extreme destinies. Same fair-looking mean of 1/2.

Why It Matters

This is not a toy. The urn is the skeleton of every "rich get richer" process worth knowing:

  • Preferential attachment. New nodes attach to well-connected nodes, producing the scale-free degree distributions you see in citations, follower counts and trade networks.
  • Path dependence. QWERTY, VHS, the dominant exchange in a given contract. An early, arbitrary lead compounds into a permanent standard — and the counterfactual where the other one won was equally likely.
  • Contagion and order flow. A trade makes the next trade more likely to go the same way. Self-exciting processes are Pólya-flavoured, which is why realised volatility clusters instead of arriving on schedule.
  • Bayesian inference. Beta-Binomial conjugacy is the urn. Adding a ball is adding one to a posterior count.

And there is a sharper warning buried in here for anyone who works with track records. Suppose you see a strategy, a fund, or a founder that has won 90% of the time over a long history. Under the coin model, that is overwhelming evidence of genuine edge — 2−100 does not happen by luck. Under the urn model, it carries no information at all: 90% is exactly as likely as 50%, and the winner was manufactured by feedback rather than skill. The data look the same. The inference is opposite.

Key Insight

The Gambler's Fallacy is the error of reading memory into a memoryless process. The Pólya Urn is the opposite trap: a process with perfect memory whose every marginal probability stays exactly as flat as a fair coin's. You cannot tell them apart from averages — only from the spread.

The roulette player's mistake was assuming the wheel remembers. The subtler mistake — the expensive one — is assuming nothing does.

Want to play with the reinforcement constant and run the simulation yourself? You can find the full Python Jupyter Notebook on my GitHub.