What is Binomial distribution and how to simulate it in Python

A binomial distribution is a discrete random variable that uses the formula and specifies the probability of each possible value. It is the discrete random distribution.

Properties of binomial distribution:

  1. The experiments consist of n repeated trials.
  2. Each trial can result in two possible outcomes.
  3. The probability of success expressed by P is the same on each trial.
  4. The trail is independent, which means the one trail does not affect the other trails.

Let’s understand Binomial Distribution with an example

T=tail, H=head


Suppose two coins are tossed, the outcomes are [HH, HT, TH, TT]

XOutcomesP(X=x)
Chances of HeadHHonly 1 time
Chances of Head-TailTH, HTtwo times
Chances of TailTTone time
  • so here the chances of the head are 25%,
  • the head-tail is 50%
  • and the tail is 25%.
  • this rule follows the binomial distribution.
  • Hence the formula is P(X=x). 
  • we can calculate this with the help of the formula P(X=x).

For example, one dice was throw that contains six sides, and the probability is printed as the output is

For example, one dice was throw that contains six sides, and the probability is printed as the output is

A real-life example of Binomial distribution

  1. The number of patients who test positive for corona by 1000 checkups.
  2. The number of defective items in 1 carton.
  3. How many times India win the match in a season.
  4. The daily sales of mobile on Amazon.

Leave a Comment