# Binomial distribution

##### Intros
###### Lessons
1. Binomial
2. Binomial Formula
3. Binomialpdf Calculator
##### Examples
###### Lessons
1. Identify which of the following experiments below are binomial distributions?

i. A fair die is rolled 4 times. What is the probability of the one coming up 2 times?

ii. A fair coin is flipped until head comes up 7 times. What is the probability that the coin will be flipped 10 times?

iii. 1,000,000 nails are produced in a factory a day. If each nail has a probability of 0.5% of being defective (something being wrong with that nail), then what is the probability that less than 50 nails will be defective in a day?

iv. Roughly 7.5% of Canadians have some form of heart disease. If 100 Canadians are sampled what is the probability that 10 of them will have heart disease?

v. If 5 cards are drawn from a deck, what is the probability that 2 of them will be hearts?

vi. If a fair die is rolled 8 times, what is the probability of getting 2 fours and 3 sixes?
1. An urn contains 6 red balls and 4 green balls. A total of 5 balls are drawn; list all the different combinations of red balls that can be drawn in each of the following cases:

i. A total of 3 green balls are drawn

ii. At most 3 red balls are drawn

iii. At least 2 red balls are drawn

iv. Less than 4 red balls are drawn

v. More than 3 green balls are drawn
1. A die is rolled 3 times, what is the probability that a four is rolled exactly 2 times?
1. A coin is flipped 20 times, what is the probability that the coin comes up heads 15 times?
1. Jimmy the Joker is an unfair gambler. He weights a die so it rolls a "6" with 75% chance. He then bets that if he rolls his die 4 times he will roll six exactly 3 times. What is his probability of winning this bet?
1. Thomas is packing for a trip and wants to bring some stuffed animals along for comfort. He owns 8 stuffed animals, and will pack each stuffed animals independently of all the others with a probability of 30%. Determine the probability that he takes;
1. 0 stuffed animals along with him.
2. 1 stuffed animal with him
3. at most two animals along with him.
4. at most 5 animals along with him.
5. at least 6 animals along with him.

## What is a binomial distribution

A binomial probability distribution is that which can have only two possible outcomes: either a success or a failure. This type of probability distribution is discrete and shows the possible results to occur in a series of finite experiments where the answers are yes or no (did the expected outcome happened? Or did it not?), also referred as success or failure, true or false, and the values of one (for the occurrence to happen) or zero (for the occurence not happening).

Although the binomial distribution definition may sound a bit complicated in comparison with the distributions that we have studied before, it is actually quite simple since the possible outcomes are enclosed in two possible options.

## How to do binomial distribution

The general probability formula of a binomial distribution (which can be sometimes simply referred as the binomial distribution formula), is defined as follows:

$P(x) = \; _{n}C_{x}P^{x} (1-p)^{n-x} = \,$ $\large \frac{n!}{x!(n-x)! }$ $p^{x} (1-p)^{n-x }$

Where:
$n$ = number of trials
$x$ = number of successes in $n$ trials
$p$ = probability of success in each trial
$_{n}C_{x} =$ $\large \frac{n!}{x!(n-x)!}$ = number of success outcome
$P(x)$ = probability of getting $x$ successes out of $n$ trials

## When to use binomial distribution

When studying a discrete random variable $x$ and it has a binomial distribution we are looking for the number of successes in a certain amount of trials. In order to be sure that our statistical experiment is based on such a discrete distribution, there are a few conditions it must meet:
1. The experiment has a fixed number of trials.And so, the value of $n$ is defined.
2. Each trial has only two possible outcomes, the result is either a success or a failure.
3. The probability of success for each individual trial is equal.

This last condition is the result of what we call running the trials with replacement, meaning that all of the possible outcomes of the first attempt, are kept for the second, third and nth attempt. No matter how many trials are run, every single one has the same amount and equal possible outcomes, meaning that its probability of success remains the same throughout all of the trials.

In the example problem one on the next section, you will use these three conditions in order to know if each case describes a binomial distribution, or not; therefore, it is important you understand them and remember them since similar conditions will be used in other discrete probability distribution types.

## Binomial distribution examples and solutions

### Example 1

Identify which of the following experiments below are binomial distributions? For this, remember what a binomial distribution must contain:
• The experiment has a fixed number of trials. And so, the value of $n$ is defined.
• Each trial has only two possible outcomes, the result is either a success or a failure.
• The probability of success for each individual trial is equal.
• The number of successes you want to obtain in those trials
• The purpose is always focused on the question of if I do a particular number of experiment trials, what is the probability to obtain this certain amount of successes?

Where the first three points are the conditions established in our last section. Therefore, with this in mind, identify the binomial distributions!

1. $\quad$A fair die is rolled 4 times. What is the probability of the one coming up 2 times?
This experiment describes a binomial distribution because you can have two outcomes, either is a one, or is not a one coming from the die, providing the bases for what is a success and what is a failure in this case. Then, it asks you about the probability of obtaining two successes in two out of the four total trials. Therefore, this experiment has all the characteristics of a binomial distribution.

2. $\quad$A fair coin is flipped until head comes up 7 times. What is the probability that the coin will be flipped 10 times?
The question of this experiment is focussed on finding how many times you will need to flip a coin in order to obtain 7 successes. Therefore, there is a lack of determined trials to obtain the results we want and so, this experiment is not a binomial distribution. Notice though, that most of the elements of the binomial distribution are there, except for a kind of reversed question, this is because this is an example of a negative binomial distribution, we will talk about these in a later lesson.

3. $\quad$1,000,000 nails are produced in a factory a day. If each nail has a probability of 0.5% of being defective (something being wrong with that nail), then what is the probability that less than 50 nails will be defective in a day?
In here we have 1,000,000 trials, with a specific probability of those trials to be either a success or a failure and then the final question asks about the probability to obtain a certain amount of successes. Therefore, this seems to contain all of the characteristics of a binomial distribution example.

4. $\quad$Roughly 7.5% of Canadians have some form of heart disease. If 100 Canadians are sampled what is the probability that 10 of them will have heart disease?
Definitely a binomial distribution experiment since it asks if I do a particular number of experiment trials, what is the probability to obtain this certain amount of successes?

5. $\quad$If 5 cards are drawn from a deck, what is the probability that 2 of them will be hearts?
This is a non-binomial distribution experiment because each time a card is drawn, the probability of a success changes.

6. $\quad$If a fair die is rolled 8 times, what is the probability of getting 2 fours and 3 sixes?
This is a non-binomial experiment since there are more possible outcomes than two well defined as either success or failure. In other words, this experiment is trying to focus in two different types of successes instead of either success or failure.

### Example 2

A die is rolled 3 times, what is the probability that a four is rolled exactly 2 times? On this case we have that: $n=3, x=2$, and $p= \frac{1}{6}$. Therefore, using the binomial probability distribution formula from equation 1 we compute:

$P(x) = \, _{n}C_{x}P^{x} (1-p)^{n-x} =$ $\large \frac{n!}{x!(n-x)! }$ $p^{x} (1-p)^{n-x } \enspace$$\enspace _{3}C_{2}P^{2} (1- \frac{1}{6})^{3-2} =$ $\large \frac{3!}{2!(3-2)!}$ $\frac{1}{6}^{2} (1-\frac{1}{6})^{3-2}$

$P(2)=$ $\large \frac{3 \, \times 2 \, \times \, 1}{(2 \, \times \, 1) (1!)}$ $(\frac{1}{6}) (\frac{1}{6}) (\frac{5}{6}) = 3 (\frac{1}{6}) (\frac{1}{6}) (\frac{5}{6}) =$ $\large \frac{15}{216} =$ 0.06944

And so, the probability of rolling a four exactly twice during 3 attempts is 0.06944.

### Example 3

A coin is flipped 20 times, what is the probability that the coin comes up heads 15 times?
On this case we have that: $n=20, x=15$, and $p= \frac{1}{2}$. Therefore, we compute:

$P(x) = \; _{n}C_{x}P^{x} (1-p)^{n-x} =$ $\large \frac{n!}{x!(n-x)! }$ $p^{x} (1-p)^{n-x} \enspace$$\enspace _{20}C_{15}P^{15} (1- \frac{1}{2})^{20-15} =$ $\large \frac{20!}{15!(20-15)!}$ $\frac{1}{2}^{15} (1-\frac{1}{2})^{20-15}$

$P(15)=$ $\large \frac{2,432,902,008,176,640,000}{(1,307,674,368,000)(120)} (\frac{1}{32,768})(\frac{1}{2})^{5} =$ 15,504 $\large (\frac{1}{32,768}) (\frac{1}{32})$ 0.01478

And so, the probability of obtaining heads 15 times during the experiment where a coin is flipped for 20 times is approximately P(15) = 0.148.

### Example 4

Thomas is packing for a trip and wants to bring some stuffed animals along for comfort. He owns 8 stuffed animals, and will pack each stuffed animal independently of all the others with a probability of 30%. Determine the probability that he takes;

• 0 stuffed animals along with him.

For this scenario we have that: $n=8, x=0$, and $p = \frac{3}{10}$ = 0.3 or 30%.

$P(x) =$ $\large \frac{n!} {x!(n-x)!}$ $p^{x} (1-p)^{n-x} \enspace$$\enspace P(0) =$ $\large \frac{8!} {0!(8-0)!}$ $(\frac{3}{10})^{0} (1- \frac{3}{10})^{8-0}$

$P(0) = (1)(1)(\frac{7}{8})^{8} =$ $\large \frac{5,764,801}{100,000,000} =$ 0.057648

• 1 stuffed animal with him

For this scenario we have that: $n=8, x=1$, and p = \fra{3}{10} = 0.3 or 30%.

$P(x) =$ $\large \frac{n!} {x!(n-x)!}$ $p^{x} (1-p)^{n-x} \,$$\, P(1) =$ $\large \frac{8!} {1!(8-1)!}$ $(\frac{3}{10})^{1} (1- \frac{3}{10})^{8-1}$

$P(1) = (8)(\frac{3}{10})(\frac{7}{10})^{7} =$ $\large \frac{19,765,032}{100,000,000} =$ 0.19765

• at most two animals along with him

For this scenario we have that: $n = 8, x \leq 2$, and $p = \frac{3}{10} =$ 0.3 or 30%.
On this case we have to add the probabilities of Thomas packing 0, 1 and 2 stuffed animals.

$P(x \leq 2 ) = P(0) + P(1) + P(2)$

We already have the first two numbers, therefore we calculate the probability of him taking two stuffed animals with him:

$P(x) =$ $\large \frac{n!} {x!(n-x)!}$ $p^{x} (1-p)^{n-x} \enspace$$\enspace P(2) =$ $\large \frac{8!} {2!(8-2)!}$ $(\frac{3}{10})^{2} (1- \frac{3}{10})^{8-2}$

$P(2) = (28)(\frac{9}{100})(\frac{7}{10})^{6} =$ $\large \frac{29,674,548}{100,000,000} =$ 0.29647

And now we add all of the probabilities mentioned to obtain our final result:

$P(x \leq 2 ) = P(0) + P(1) + P(2)$ = 0.057648 + 0.19765 + 0.29647 = 0.55177

• at most 5 animals along with him

For this scenario we have that: $n = 8, x \leq 5$, and $\, p = \frac{3}{10} =$ 0.3 or 30%.
On this case we have to add the probabilities of Thomas packing 0, 1 and 2, 3, 4 and 5 stuffed animals.

$P(x \leq 5 ) = P(0) + P(1) + P(2) + P(3) + P(4) + P(5)$

We already have the first three numbers, therefore we calculate the probability of him taking 3, 4 and 5 stuffed animals with him:

$P(3) =$ $\large \frac{8!}{3!(8-3)!}$ $(\frac{3}{10})^{3} (1-\frac{3}{10})^{8-3} = (56)(\frac{27}{1000}) (\frac{7}{10})^{5} = \frac{25,412,184}{100,000,000} = 0.25412$

$P(4) =$ $\large \frac{8!}{4!(8-4)!}$ $(\frac{3}{10})^{4} (1-\frac{3}{10})^{8-4} = (70)(\frac{81}{10,000}) (\frac{7}{10})^{4} = \frac{13,613,670}{100,000,000} = 0.13614$

$P(5) =$ $\large \frac{8!}{5!(8-5)!}$ $(\frac{3}{10})^{5} (1-\frac{3}{10})^{8-5} = (56)(\frac{243}{100,000}) (\frac{7}{10})^{3} = \frac{4,667,544}{100,000,000} = 0.04667$

And now we add all of the probabilities mentioned to obtain our final result:

$P(x \leq 5 ) = P(0) + P(1) + P(2) + P(3) + P(4) + P(5)$

$P(x \leq 5 )$ = 0.55177 + 0.25412 + 0.13614 + 0.04667 = 0.98870

• at least 6 animals along with him

For this scenario we have that: $n=8, x \geq 6$, and $\, p = \frac{3}{10}$= 0.3 or 30%.
If we think about it, the probability of Thomas taking at least 6 animals with him must be the addition of the probability of him taking 6, 7 and 8 animals:

$P(x \geq 6 ) = P(6) + P(7) + P(8) = 1 - P(x \leq 5)$

We could do all that extensive calculation, OR, we could notice that this should be the same as the difference between the 100% probability of Thomas taking from zero to all of his stuffed animals, and the probability we just calculated of him taking 5 stuffed animals at the most. And so, we follow through with this second approach, since the probability that Thomas brings with him from 0 to 8 stuffed animals, is the 100% which is equivalent to a value of 1, we have that:

$P(x \geq 6 ) = 1 - P(x \leq 5) =$ = 1 - 0.9887 = 0.0113

***
Now that we have worked on a few binomial distribution examples, let us finalize this lesson by providing a few recommendations: On this lesson for the binomial distribution you will find the well defined concept for this distribution, and different ways to solve problems related to it; for example, it gives a glimpse at how to use a binomial distribution table and a binomial distribution graph when computing our values of interest. Then, this page showing a comparison of distribution functions introduces the concept of the mean of a binomial distribution, which we will learn later; and finally, this lesson on the binomial distribution uses another form of notation for the binomial distribution equation.

The topic of the binomial distribution is extensive, so, on our next lessons you will continue to see subtopics of this same discrete probability distribution. For example, our next lesson will expand the topic to include the definitions for the mean and the standard deviation of binomial distribution along with some examples, where you will see that the calculation of the mean of a binomial distribution is so simple, yet it has a deep meaning tied to expectation; later, we will have a complete lesson dedicated to a negative binomial distribution example.

Thus, all is left to say is: get ready and see you in the next one!
$P(x)={_n}C_x \;P^x(1-p)^{n-x}$

$n$: number of trials
$x$: number of success in n trials
$p$: probability of success in each trial
$P(x)$: probability of getting $x$ successes (out of $n$ trials)

$\cdot$ binomialpdf $(n,p,x)$
$\cdot$ binomialcdf $(n,p,x)$