What Is the Binomial Distribution? Formula and Examples

A free throw shooter, a handful of coin flips, and one question: how many successes do you expect out of n tries? Here's the formula, built from scratch, with the combinatorics made visible.

By Petrus Sheya

July 21, 2026 · 5 min read

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 pp. For our shooter, p=0.7p = 0.7.

Click “Shoot” a bunch of times, watch the empirical make rate drift toward p, the true probability of a single success.

no shots yet — hit shoot
Shots taken0
Makes0
Empirical rate
True p0.70

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 pp.

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 kk.

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.

hover a square to inspect its sequence
Highlighted squares10
C(5, 2)10
Total sequences32

There are 25=322^5 = 32 possible sequences of 5 shots. Drag kk and watch which ones light up. At k=0k = 0, only one sequence qualifies: miss every single time. At k=5k = 5, again just one: make every single time. But at k=2k = 2 or k=3k = 3, 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 kk successes out of nn trials, has a name: "nn choose kk". We write it as

(nk)\binom{n}{k}

For 5 shots and k=2k = 2, that's (52)=10\binom{5}{2} = 10. 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 kk successes: that's (nk)\binom{n}{k}. Second, how likely is any one specific arrangement.

That second part is easier than it sounds. If each shot succeeds with probability pp and fails with probability 1p1-p, and shots don't affect each other, then one particular sequence with kk makes and nkn-k misses has probability

pk(1p)nkp^k (1-p)^{n-k}

Multiply the count of arrangements by the probability of any one arrangement, and you get the probability of exactly kk successes out of nn trials:

P(X=k)=(nk)pk(1p)nkP(X = k) = \binom{n}{k} \, p^k (1-p)^{n-k}

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: nn, the number of trials, and pp, 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.

mean = 10.002468101214161820
hover a bar to read its exact probability
Mean (np)10.00
Variance5.00
Std dev2.24
Most likely k10

Start at n=20n = 20, p=0.5p = 0.5. The bars form a symmetric hump centered around k=10k = 10, that's just a fair coin flipped 20 times. Now drag pp up toward 0.9. The hump slides right and squeezes tight, because when success is likely, most outcomes cluster near the top.

Now push nn up to 40 while keeping pp 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:

mean=np\text{mean} = np

And the spread:

variance=np(1p)\text{variance} = np(1-p)

Watch the stat box as you drag. Mean and variance update instantly, and the dashed line always sits exactly at npnp.


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.

Simulations run0
Distance from theory

Hit play. Every tick simulates a fresh batch of 20 shots at p=0.5p = 0.5 and drops the resulting kk 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 nn independent yes/no trials, each succeeding with probability pp, how many successes should you expect, and how likely is each possible count?

The formula comes from two ingredients multiplied together:

P(X=k)=(nk)how many arrangements  pk(1p)nkhow likely one arrangement isP(X = k) = \underbrace{\binom{n}{k}}_{\text{how many arrangements}} \; \underbrace{p^k (1-p)^{n-k}}_{\text{how likely one arrangement is}}

The mean sits at npnp, the spread is governed by np(1p)np(1-p), and as nn 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.