Bernoulli trials and the binomial distribution ·… | StemPy Lab
Course 16.3·Lesson 2 of 3
Bernoulli trials and the binomial distribution
Many experiments repeat the same yes or no trial again and again: a free throw, a tossed coin, a tested part. When the trials are independent and each has the same chance of success, the number of successes follows the binomial distribution. This lesson gives the formula, the four conditions, and the mean np and the variance npq.
Lesson 2 of 3Show all lessonsHide
Try the code and the simulations beside the lesson.
What you will be able to do
recognise Bernoulli trials and decide whether a situation is binomial;
use P(X=k)=(kn)pkqn−k;
use the mean np and the variance npq.
Ten free throws
A basketball player takes free throws. Each throw either goes in or it does not, and we count only that. One throw is a Bernoulli trial: a trial with exactly two outcomes, called success and failure. The chance of success is p, and the chance of failure is q=1−p.
Bernoulli trials are n such trials that are independent, with the same p every time. If a player takes 5 throws and goes in with probability 0.6 each time, how many throws will go in? The count X is random. It can be 0 to 5. The question is how likely each count is.
The formula
Take 3 trials and ask for exactly 2 successes. The outcomes are SSF, SFS and FSS. Each has two successes and one failure, so each has probability p×p×q. There are 3 of them, so P(X=2)=3p2q.
For n trials, the number of outcomes with exactly k successes is the number of ways to choose the k places, which is (kn). Each has probability pkqn−k. So
P(X=k)=(kn)pkqn−k,k=0,1,…,n.
We say that X has the binomial distribution with parameters n and p, and write X∼B(n,p). IB and AP write X∼Bin(n,p) and use the calculator command binompdf. The probabilities are the terms of (q+p)n, so they add up to 1. The binomial theorem of the earlier chapter is the reason.
Four conditions
A situation is binomial when all four of these hold.
There is a fixed numbern of trials.
Each trial has two outcomes, success and failure.
The probability of success is the samep on every trial.
The trials are independent.
Tossing a coin 10 times passes all four. Drawing cards from a pack without replacement fails the fourth, because each draw changes the pack. Counting the throws needed to get the first six fails the first, because n is not fixed.
A bar chart of the binomial distribution with 5 trials and success probability 0.6. The bars for k = 0 to 5 have heights 0.01024, 0.0768, 0.2304, 0.3456, 0.2592 and 0.07776. The tallest bar, at k = 3, is orange, and a red dashed line at 3 marks the mean.
Mean and variance
Write X as a sum of n separate indicators, one for each trial. An indicator is 1 for a success and 0 for a failure. Each has mean p and variance p(1−p)=pq. The means add, and because the trials are independent, so do the variances:
E(X)=np,Var(X)=npq.
The standard deviation is npq. The mean np is not always a whole number, and it need not be a value that X can take.
A worked example
A player scores with probability 0.6 on each of 5 free throws, independently.
The whole table.P(X=0,1,2,3,4,5) is 0.01024, 0.0768, 0.2304, 0.3456, 0.2592 and 0.07776. They add up to 1.
Mean and variance.E(X)=5×0.6=3 and Var(X)=5×0.6×0.4=1.2. The standard deviation is about 1.095.
A check: the tallest bar is at 3, which is also the mean.
Practise with new numbers
Try it in Python
The program builds the whole distribution of 5 trials with success probability 53 from the formula. It then finds the mean and the variance from the table and compares them with np and npq.
Common mistakes
Leaving out (kn). The product pkqn−k is the chance of one particular order only.
Using the binomial for draws without replacement. The trials are then not independent.
Mixing up p and q. In P(X=k), p goes with the k successes and q with the n−k failures.
Calling np the most likely value. The mean and the most likely value are close, but they are not the same thing.
Remember these
X∼B(n,p) means P(X=k)=(kn)pkqn−k for k=0,1,…,n.
The four conditions: fixed n, two outcomes, the same p, independent trials.
E(X)=np and Var(X)=npq.
The probabilities add up to (q+p)n=1.
Check yourself
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
Five cards are drawn from a pack without replacement, and X is the number of hearts. Is X exactly binomial?
X∼B(6,0.5). Find P(X=3).
X∼B(10,0.3). Find the mean, the variance and the standard deviation.
A fair coin is tossed 6 times. Find the probability of at least 5 heads.
A binomial variable has mean 12 and variance 8. Find n and p.
References
OpenStax, Introductory Statistics, Chapter 4, section on the binomial distribution.
NCERT, Mathematics Part II for Class XII, Chapter 13, section on Bernoulli trials and the binomial distribution.
Enroll free in Random Variables and the Binomial Distribution
Every lesson is open to read. Enrolling also lets you:
Mark lessons done and carry on where you stopped.
Take the tests of this lesson and its course.
Count the course towards the certificate for its chapter.