A basketball player makes 70% of her free throws. She's about to shoot 10 of them.
How many will go in?
Not "will she make the next one", that's a coin flip weighted her way. The real question is bigger: out of 10 attempts, what's the full range of outcomes, and how likely is each one? Could she make all 10? Miss all 10? What's most likely?
That question, repeated across sports, manufacturing, medicine, and polling, has one answer: the binomial distribution.
One shot: success or failure
Before we can count anything, we need to understand a single trial. One free throw. It goes in, or it doesn't. There's no in-between.
We call this a Bernoulli trial: an event with exactly two outcomes, success or failure, where success happens with some fixed probability . For our shooter, .
Click “Shoot” a bunch of times, watch the empirical make rate drift toward p, the true probability of a single success.
Click "Shoot" a few dozen times. Each click is independent, the ball doesn't remember the last shot. But watch the empirical rate at the bottom. It bounces around early, then settles in close to .
That's the law of large numbers sneaking into the picture already. One trial is random. Many trials reveal the probability underneath.
Ten shots: how many ways to make exactly k?
Now scale up. Instead of one shot, take 10. We want to know how many went in, call that number .
Here's the tricky part. There isn't just one way to make exactly 3 out of 10. You could make the first 3 and miss the rest. Or miss the first 3 and make the next 3. Or scatter the makes anywhere across the 10 attempts. Every different arrangement that has exactly 3 makes counts as a separate path to the same outcome.
So counting outcomes means counting arrangements. Let's shrink the problem to make it visible: instead of 10 shots, look at just 5.
Every possible sequence of 5 shots, highlighted whenever it has exactly k makes. Hover a square to see the exact sequence.
There are possible sequences of 5 shots. Drag and watch which ones light up. At , only one sequence qualifies: miss every single time. At , again just one: make every single time. But at or , a whole cluster of sequences lights up, because there are many ways to scatter 2 or 3 makes across 5 slots.
That count, the number of sequences with exactly successes out of trials, has a name: " choose ". We write it as
For 5 shots and , that's . Ten different ways to make exactly 2 out of 5. Go count the highlighted squares. They match.
Putting it together: the formula
We now have two pieces. First, how many arrangements give exactly successes: that's . Second, how likely is any one specific arrangement.
That second part is easier than it sounds. If each shot succeeds with probability and fails with probability , and shots don't affect each other, then one particular sequence with makes and misses has probability
Multiply the count of arrangements by the probability of any one arrangement, and you get the probability of exactly successes out of trials:
That's the binomial probability mass function. Not a mysterious formula handed down from a textbook, just "how many ways" times "how likely each way is".
Watching the shape change
The formula has two knobs: , the number of trials, and , the success probability. Turn them and the whole distribution reshapes.
The full probability formula, bar by bar. Drag n and p and watch the whole shape respond. Hover a bar for its exact probability.
Start at , . The bars form a symmetric hump centered around , that's just a fair coin flipped 20 times. Now drag up toward 0.9. The hump slides right and squeezes tight, because when success is likely, most outcomes cluster near the top.
Now push up to 40 while keeping fixed. The hump gets wider in raw count but relatively smoother and more bell-shaped. That's not a coincidence, we'll come back to that.
Two numbers summarize the whole shape without needing the full bar chart. The center:
And the spread:
Watch the stat box as you drag. Mean and variance update instantly, and the dashed line always sits exactly at .
Does reality match the formula?
Here's the test. If the formula is right, then running the actual random experiment over and over should produce a histogram that matches the predicted curve.
Each tick simulates one fresh batch of 20 free throws at p = 0.5. Watch the empirical bars settle onto the theoretical curve.
Hit play. Every tick simulates a fresh batch of 20 shots at and drops the resulting into a bin. Early on, with only a handful of runs, the bars are jagged and uneven, they don't have enough data to look smooth yet.
Keep it running. Watch the "distance from theory" number in the stat box. It doesn't just wobble, it shrinks. By a few hundred simulations, the blue bars are hugging the amber theoretical curve almost exactly.
This is the whole promise of the binomial distribution: it's not a description of one experiment, it's a prediction about what happens when you repeat that experiment forever.
The short version
The binomial distribution answers one question: if you run independent yes/no trials, each succeeding with probability , how many successes should you expect, and how likely is each possible count?
The formula comes from two ingredients multiplied together:
The mean sits at , the spread is governed by , and as grows, the jagged bar chart smooths into something that starts looking suspiciously like a bell curve.
Free throws, coin flips, defective parts on an assembly line, patients responding to a drug, voters saying yes in a poll, they're all the same shape underneath. Count the successes, multiply the ways by the likelihood, and the binomial distribution tells you what to expect.
All simulations run live in the browser. The sequence counter enumerates all 32 length-5 binary sequences directly. The convergence simulator draws fresh Bernoulli trials with Math.random() on every animation tick, driven by requestAnimationFrame, no libraries beyond React.