Bernoulli & the Binomial
🪙 A Bernoulli trial is one yes/no event: a single coin flip, or a rat choosing left vs. right in a T-maze. The Binomial counts how many "yeses" you get across n of them.
The uniform distribution was continuous — x could be any value in a range. But often the world is discrete: the rat goes left or right, the neuron spikes or doesn't. For one such trial, we say P(Left) = p and P(Right) = 1 − p. That's a Bernoulli trial.
Now run n trials and ask: what's the probability of exactly k lefts? Say the rat went left 7 times out of 10 — how likely is that, if it's really a fair 50/50 chooser? The binomial distribution answers it:
P(k | n, p) = C(n, k) · pᵏ · (1−p)ⁿ⁻ᵏ C(n, k) = n! / [ k! · (n−k)! ]
Three parts: pᵏ = the k lefts happening, (1−p)ⁿ⁻ᵏ = the other n−k going right, and C(n,k) = how many different orders those k lefts could occur in.
That middle piece, the binomial coefficient C(n, k), is the rigorous heart of it. pᵏ(1−p)ⁿ⁻ᵏ is the probability of one specific sequence (say LLRLRRLRLL). But you don't care about order — only the total. C(n,k) counts how many sequences give k lefts. Example: 3 lefts out of 3 trials → only C(3,3)=1 way (LLL). But 2 lefts out of 3 → C(3,2)=3 ways (LLR, LRL, RLL), so it's 3× more likely. Counting arrangements is why the middle of the distribution bulges.
This is a probability mass function (PMF): it puts a chunk of probability "mass" on each whole-number outcome. And because k must land on one of its possible values, all the masses sum to exactly 1: Σₖ P(k | n, p) = 1.
Below: 1000 experiments, each n coin-flips, histogrammed by how many lefts came up. With p = 0.5 the pile is symmetric and centered at n·p. This is the shape you'd see even if you didn't know p — and you'd correctly guess "fair."
Each of 1000 experiments runs 10 coin-flips; the bars show how often the rat turned left k times. Predicted mean n·p = 5.0, measured mean 5.01. Push p toward 0.8 and the whole pile slides right and gets lopsided — it can't go past n.
The gold line marks the predicted mean n·p. Slide p toward 0.8 — the whole pile slides right and goes lopsided (it can't spill past n). Slide n to watch the bell sharpen.
🤖 AI tie-in: a coin-flip per connection is a first model of network wiring — each of a neuron's possible synapses exists with probability p. Binomial statistics then predict how many connections a neuron is likely to have.