Structure preview

Fifteen experiments that make probability visible

Dice, coins, an urn, Monty Hall and Poisson: fifteen simulations with observed histograms and theoretical probabilities.

Articles /probability-simulations-histograms
Fifteen experiments that make probability visible

13 min

Theoretical probability describes a model; observed frequency tells us what happened in a particular series of trials. In the laboratory we can place them side by side: choose an experiment, run one trial or many, and watch the histograms change.

Open the interactive probability laboratory

How to read a histogram

For each outcome, the number of occurrences divided by the total number of trials is its relative frequency. For example, if 6 appears 18 times in 100 rolls, its observed frequency is 18/100 = 18%. The theoretical probability of rolling 6 on a fair die remains 1/6, or about 16.67%: the difference does not mean that the die is defective.

In the laboratory, blue bars represent observed frequencies and orange bars represent theoretical probabilities. Counts, percentages and differences in percentage points appear alongside them. You can begin with one trial, add more, stop the run or reset the results.

One die: six equally likely outcomes

Each face from 1 to 6 has probability 1/6. With few trials the histogram may be very uneven. As the number of rolls increases, the six frequencies tend to cluster near 16.67%, but they need not become exactly equal.

Two dice: why a sum of 7 is favoured

There are 36 possible ordered pairs. A sum of 2 comes only from (1,1), so its probability is 1/36. A sum of 7 comes from six pairs: (1,6), (2,5), (3,4), (4,3), (5,2), (6,1). Its probability is 6/36 = 1/6. For a sum s from 2 to 12, the number of favourable pairs is 6 − |7 − s|.

Three coins: counting heads

Three fair coins produce 2 × 2 × 2 = 8 equally likely sequences. If we care only about the number of heads, the probabilities for 0, 1, 2 and 3 heads are respectively 1/8, 3/8, 3/8 and 1/8. The middle outcomes are more common than the extremes.

An urn: two draws without replacement

The urn contains three red and two blue balls. We draw two balls without putting the first one back. The probability of 0 red balls is 1/10; that of 1 red ball is 6/10; that of 2 red balls is 3/10. The draws are not independent: after the first draw, the contents of the urn have changed.

Monty Hall: stay or switch?

There are three doors and only one prize. You choose a door; the host knows where the prize is and always opens another door hiding a goat. Staying wins when your initial choice was correct, with probability 1/3. Switching wins when your initial choice was wrong, with probability 2/3. Each trial in the laboratory compares both strategies in the same situation.

Poisson: how many events in an interval?

Imagine counting calls received in an hour. If events occur independently at a constant average rate, the Poisson model describes the number X of calls in each interval. The parameter λ is the expected average count: you can choose, for example, λ = 2 or λ = 8.

The probability of observing exactly k events is P(X = k) = e^(−λ) λ^k/k!, with k = 0, 1, 2, … . For λ = 2, the probability of no events is e^(−2), about 13.53%; the probability of one event is 2e^(−2), about 27.07%.

In the laboratory, each trial generates an interval and counts its events. The final bar groups all counts above the stated threshold, so no probability is lost. As λ increases, the histogram shifts toward higher counts.

Birthday paradox

In a group of n people, what is the chance that at least two share a birthday? Assume 365 equally likely days, no leap years, and independent birthdays. Compute the complement: the first person may have any birthday, the second must choose one of the 364 remaining days, and so on. Hence P(no match) = 365/365 × 364/365 × … × (365−n+1)/365 and P(at least one match) = 1 − P(no match). With 23 people the chance exceeds 50%. Choose the group size and compare the two outcomes.

Random walk

A marker starts at zero and makes n independent steps, each +1 or −1 with equal probability. If k steps go right, the final position is 2k−n. There are C(n,k) such paths among 2^n possible paths, so P(position = 2k−n) = C(n,k)/2^n. Choose n and see why central positions appear more often.

How long until every face appears?

Roll a die until all six faces have appeared. The waiting time varies considerably. After j distinct faces, the chance that the next roll adds a new face is (6−j)/6; its expected wait is 6/(6−j). Adding all six waits gives E(T) = 6 × (1 + 1/2 + 1/3 + 1/4 + 1/5 + 1/6) = 14.7 rolls. The histogram groups waits of 6–9, 10–12, 13–15, 16–20, 21–30 and 31 or more. Bar probabilities come from an exact count of possible sequences.

Buffon’s needle: estimating π

Draw parallel lines separated by d and drop a needle of length l no greater than d. With uniform orientation and position, the ratio r = l/d gives P(crossing) = 2r/π. If C needles cross a line in N trials, the observed frequency C/N yields π ≈ 2rN/C. With no crossings, the estimate is undefined. The laboratory compares crossing frequencies with theory and updates the estimate; a small sample may be inaccurate.

Means of many rolls

Each trial rolls m fair dice and records their mean. One die has a uniform result from 1 to 6; as m grows, the means cluster around 3.5. The laboratory groups means in bins of width 0.5 and computes theoretical probabilities by counting possible sums exactly, without replacing them with a normal curve. Compare m = 1 with m = 20.

Lotto: does a late number become more likely?

On one Lotto wheel, five distinct numbers are drawn from 1 to 90. Fix one number and ask how many drawings pass before it appears. In one drawing, its probability of appearing is 5/90 = 1/18. Assuming independent drawings, the probability that it is absent for the first n−1 and appears on drawing n is P(T=n) = (17/18)^(n−1) × 1/18.

In the laboratory, a trial ends when the number appears. The histogram groups waiting times, with a final category for 41 or more drawings. The theoretical mean wait is 18 drawings, but this is not a deadline: even after 40 misses, the chance in the next drawing remains 1/18. This exposes the fallacy of the overdue number.

10eLotto: how many matches?

In the basic 10eLotto model, fix m numbers from 1 to 90, where m ranges from 1 to 10. Draw 20 distinct numbers from the same pool. Each trial counts the matches, from zero to m. Oro, Extra, money and prizes are excluded.

To obtain exactly k matches, choose k from the m fixed numbers and the remaining 20−k from the 90−m other numbers. Dividing by all possible sets of 20 gives P(X=k) = C(m,k) × C(90−m,20−k) / C(90,20). The histogram compares this exact distribution with simulated trials. Changing m changes the whole distribution, not just the maximum-match probability.

Eurojackpot: two draws in one result

The two pools are separate: compare five chosen numbers out of 50 with five drawn out of 50, and two chosen Euro numbers out of 12 with two drawn out of 12. An outcome 3+1 means three main-number matches and one Euro-number match. The laboratory shows all 18 possible pairs, including those that are not prize categories.

For main numbers, P(X=i) = C(5,i)C(45,5−i)/C(50,5); for Euro numbers, P(Y=j) = C(2,j)C(10,2−j)/C(12,2). The pools are drawn separately, so P(X=i,Y=j) = P(X=i)P(Y=j). A rare outcome may occur zero times even after many trials: the table therefore retains its numerical theoretical probability rather than treating an empty bar as probability zero.

Forty-card solitaire: almost always losing is not always

Shuffle a 40-card Neapolitan deck, with four cards of each rank from 1 to 10. Turn over cards while saying 1, 2, …, 10 repeatedly, for four rounds. Lose at the first match between the spoken number and card rank; win if the entire deck passes without a match. The simulation shuffles full decks and counts wins and losses.

Cards are drawn without replacement, so the 40 positions are not independent trials. Exact inclusion-exclusion gives P(win) ≈ 1.5621568639% and P(loss) ≈ 98.4378431361%. A win is possible, but rare. See the step-by-step proof in Forty-card frustration solitaire: why you almost always lose.

What do the trials teach us?

With many trials, frequencies tend to approach the theoretical probabilities. This does not promise a perfect match, and it does not predict the result of the next roll. The comparison between random fluctuations and mathematical structure is what makes the experiment useful.

Try the fifteen simulations now