Hide a ball somewhere on a table, then guess its position from nothing but the question "did the next ball land to its left?" asked fifty times. That is the experiment Thomas Bayes used to launch a whole branch of statistics. When I ran it, the sheet placed a ball at position 0.79, kept that number hidden from every later step, and recovered it as a posterior centered on 0.75 with a 95% credible interval of [0.625, 0.857]. The truth sat comfortably inside the interval. The sheet guessed well without ever looking.
The rest of this post explains who Bayes was, what his experiment claimed, and how to reproduce it.
Who was Thomas Bayes?
Thomas Bayes (around 1701 to 1761) was an English Presbyterian minister and amateur mathematician. He published almost nothing on probability in his lifetime and was known mainly for a defense of Newton's calculus. The Royal Society elected him a Fellow in 1742, likely on the strength of that work.
His lasting contribution appeared only after he died. His friend Richard Price found an unpublished essay among his papers, edited it, and read it to the Royal Society in 1763 under the title "An Essay towards solving a Problem in the Doctrine of Chances." That essay contains the first version of what we now call Bayes's theorem. The whole field of Bayesian inference traces back to it.
If you want a great read on the history of Bayes's theorem, I highly recommend The Theory That Would Not Die. My only gripe is the title.
Laplace did the heavy lifting
Bayes set down the idea, but Pierre-Simon Laplace turned it into a working tool. Around 1774, apparently unaware of Bayes's essay, Laplace stated the same principle in general form and gave it the clean mathematical footing Bayes lacked. He then spent decades using it on real problems: estimating the mass of Saturn, weighing whether more boys than girls are born, and correcting astronomical measurements. For most of the nineteenth century the method was known as "inverse probability," and it was Laplace's version that people actually used.
One of his results shows up directly in this experiment. Laplace's rule of succession says that after seeing k successes in n trials with a uniform prior, the next trial succeeds with probability (k+1)/(n+2). That is exactly the posterior mean of our Beta distribution, and it is the formula we put in cell K4 below. When you read the ball's estimated position off the sheet, you are reading Laplace's rule.
The thought experiment
Bayes wanted a problem he could reason about physically, so he described a level table.
Roll one ball across the table and let it come to rest. Call its position W. Because the ball can stop anywhere along the table with equal chance, W is uniform on the interval from 0 to 1. This is the quantity we want to learn, and after this first roll we are forbidden from looking at it.
Now roll a second ball across the same table, over and over. For each roll, record one bit: did it stop to the left of W or to the right? A roll lands left with probability exactly W, since W is the fraction of the table lying to its left. After many rolls you have a tally: k lefts out of n throws.
Bayes's question: given that tally, what can we say about the hidden position W?
His answer is the modern recipe. Start with the uniform belief about W. Weight each candidate position by how well it explains the k lefts you saw. Renormalize. The result is a full distribution over W, the posterior. With a uniform prior and a binomial count, that posterior has a closed form, the Beta distribution: after k lefts in n rolls it is Beta(k+1, n-k+1).
Two details make this experiment a better teaching tool than the usual coin flip. The prior is not a modeling choice you have to defend; it is a physical fact about where a rolled ball stops. And there is a real hidden number to recover, so you can grade the answer.
Building it in TukeySheets
Open a new sheet. We will roll the hidden ball, roll fifty more, count the lefts, and read off the posterior.
The hidden ball
SAMPLE.UNIFORM(low, high, count) draws from a uniform distribution. Ask for a single draw and park it in a cell off to the side:
K1: =SAMPLE.UNIFORM(0, 1, 1)
That is W, the resting place of the first ball. The cell shows a resample button, so you can roll a fresh hidden ball whenever you like. From here on we reference K1 but never read it.
The fifty rolls
One anchored spill rolls the second ball fifty times, each landing position a draw from the same uniform table:
A2: =SAMPLE.UNIFORM(0, 1, 50)
That spills fifty values down column A. See Monte Carlo: one column per variable for the rest of the SAMPLE.* family.
Counting the lefts
A roll counts as a "left" when its position is below W. COUNTIF tallies them in one cell, building the comparison string from the hidden value:
K2: =COUNTIF(A2:A51, "<" & K1) k, rolls left of W
K3: =COUNT(A:A) n, total rolls
In my run these returned k = 38 and n = 50. The hidden ball sat at 0.79, so roughly 79 percent of rolls should land left of it. Thirty-eight out of fifty is 76 percent. The data already leans toward the truth, but we have not used the hidden value to get there. We only counted.
The posterior
With a uniform prior the posterior is Beta(k+1, n-k+1). Lay out a grid of candidate positions and evaluate the Beta density across it in two anchors:
D2: =SEQ.LINEAR(0, 1, 200) candidate positions
E2: =BETA.DIST(D:D, K2+1, K3-K2+1, FALSE) posterior density
BETA.DIST vectorizes over the grid in column D, so one formula fills column E. That is the whole posterior, a curve over every position the first ball might occupy.
Reading the answer
Summary questions are ordinary cell formulas:
K4: =(K2+1)/(K3+2) posterior mean
K5: =BETA.INV(0.025, K2+1, K3-K2+1) 2.5th percentile
K6: =BETA.INV(0.975, K2+1, K3-K2+1) 97.5th percentile
The mean came back at 0.75 and the central 95 percent ran from 0.625 to 0.857. The whole model is six anchors:
| Cell | Formula |
|---|---|
K1 |
=SAMPLE.UNIFORM(0, 1, 1) |
A2 |
=SAMPLE.UNIFORM(0, 1, 50) |
K2 |
=COUNTIF(A2:A51, "<" & K1) |
D2 |
=SEQ.LINEAR(0, 1, 200) |
E2 |
=BETA.DIST(D:D, K2+1, K3-K2+1, FALSE) |
K4 |
=(K2+1)/(K3+2) |
Looking at the result
Select columns D and E, open the plot editor, and draw a line plot with position on the x-axis and posterior on the y-axis. You will see a single smooth hump peaking near 0.75 and falling to nothing well before either edge of the table.
Now reveal the hidden value in K1: 0.79. It lands on the right shoulder of the hump, inside the credible interval. The sheet never compared its guess to the truth. It saw only a stream of lefts and rights, yet it cornered the ball into a narrow band of the table and put the real position inside that band.
That gap between the point estimate, 0.75, and the truth, 0.79, is the honest part. A single best guess would hide it. The posterior shows it as width: the data pins the ball down to a region, not a point, and the region is wide enough to hold the answer.
Two ways to the same curve
The Beta density is the shortcut. If you would rather watch the likelihood explicitly, build it as its own grid column and renormalize. Two anchors give the same shape as column E:
G2: =BINOM.DIST($K$2, $K$3, D:D, FALSE) likelihood at each position
H2: =G:G / SUM(G:G) renormalize to sum to one
BINOM.DIST scores each candidate position by how well it explains 38 lefts in 50 rolls, and dividing by the column sum turns those scores into a proper distribution over the grid. This is the engine from Bayesian updating with grid approximation, now driven by a hidden ball instead of a coin. Column H and column E peak in the same place and have the same shape; they differ only in vertical scale, since one is a normalized grid and the other a continuous density. The closed form and the grid agree because Bayes's table is exactly the case where the math works out by hand.
Try it yourself
- Click the resample button on
K1to hide a new ball, then resampleA2to roll again. Every downstream cell, and the plot, recomputes. Watch where the hump moves. - Drop the roll count. Change
A2toSAMPLE.UNIFORM(0, 1, 5)and update theCOUNTIFrange toA2:A6. The hump goes wide, because five rolls barely constrain the ball. - Raise it. Use 500 rolls and the hump tightens around the truth. More throws, less uncertainty, the same six formulas.
Two and a half centuries later, Bayes's table still teaches the lesson faster than any formula sheet: data narrows belief, and the leftover width is the part worth reporting.