A random variable follows a Bernoulli distribution if it only has two possible outcomes: 0 or 1.
For example, suppose we flip a coin one time. Let the probability that it lands on heads be p. This means the probability that it lands on tails is 1-p.
Thus, we could write:
In this case, random variable X follows a Bernoulli distribution. It can only take on two possible values.
Now, if we flip a coin multiple times then the sum of the Bernoulli random variables will follow a Binomial distribution.
For example, suppose we flip a coin 5 times and we want to know the probability of obtaining heads k times. We would say that the random variable X follows a Binomial distribution.
If a random variable X follows a Binomial distribution, then the probability that X = k successes can be found by the following formula:
P(X=k) = nCk * pk * (1-p)n-k
- n: number of trials
- k: number of successes
- p: probability of success on a given trial
- nCk: the number of ways to obtain k successes in n trials
For example, suppose we flip a coin 3 times. We can use the formula above to determine the probability of obtaining 0 heads during these 3 flips:
P(X=0) = 3C0 * .50 * (1-.5)3-0 = 1 * 1 * (.5)3 = 0.125
When n = 1 trial, the Binomial distribution is equivalent to the Bernoulli distribution.
Here are a couple important notes in regards to the Bernoulli and Binomial distribution:
1. A random variables that follows a Bernoulli distribution can only take on two possible values, but a random variable that follows a Binomial distribution can take on several values.
For example, in a single coin flip we will either have 0 or 1 heads. However, in a series of 5 coin flips we could have 0, 1, 2, 3, 4, or 5 heads.
2. In order for a random variable to follow a Binomial distribution, the probability of “success” in each Bernoulli trial must be equal and independent.
For example, if we define “success” as landing on heads, then the probability of success on each coin flip is equal to 0.5 and each flip is independent – the outcome of one coin flip does not affect the outcome of another.