# Binomial distribution

By binomial distribution you calculate the probability of achieving “success” k times in a sequence of n independent experiments, the outcomes of which either can be “success” or “failure”.

For instance, if you flip a coin five times, what is the probability of achieving “heads” tree times?

## The probability mass function

Every time you make an experiment, which either yields “success” or “failure”, the probability of achieving success in one experiment is given by:
P(success) = p,
and the probability of achieving failure is:
P(failure) = 1 – p.

When you flip a coin the probability of achieving heads is 50 percent:
P(heads) = p = 0.50
and the probability of achieving tails is also 50 percent:
P(tails) = 1 - p = 1 - 0.50 = 0.50

Now we make a sequence of experiments, and we want to calculate the probability of achieving some specific outcomes in a specific order.

For example, we make four “success or failure”-experiments, and we want to calculate the probability of ending up with this specific outcome:

success, failure, failure, success

In order to calculate the probability of getting this result, you multiply the probability of each experiment’s result together.

If the number of times the experiment is carried out is n, and the number of successes is k, then the number of failures must be n-k.

The general formula for calculating the probability of achieving k successes in a specific order in n experiments is then given by:

where p is the probability of achieving success in one experiment, n is the number of experiments, k is the number of successes and n-k is the number of failures.

The probability mass function
With the formula above you can only calculate the probability of getting a specific order of successes. If you make n experiments, and you want to calculate the probability of achieving k successes without caring about in which order they come out, you will have to use the probability mass function given by:

Where X is the random variable indicating the total number of successes, K(n,k) is the so-called binomial coefficient given by: , n is the number of experiments and k is the number of successes.

The probability mass function is therefor given by:

## The probability mass function

Calculate the probability of getting k successes in n trials.
(The order of the outcomes doesn't matter.)

p = probability of achieving success in one experiment

n = number of experiments

k = number of successes

 p: n: k:

## Cumulative distribution function

Sometimes you want to know the probability of achieving k successes or less in n experiments, . That is called cumulative distribution. It can be calculated by adding all probabilities of getting respectively from 0 to k successes.

## The cumulative distribution function

Calculate the probability of getting k successes or less in n trials.
(The order of the outcomes doesn't matter.)

p = probability of achieving success in one experiment

n = number of experiments

k = number of successes

 p: n: k:

## Mean of the binominal distribution

The mean is the expected number of successes we will get, if the probability of success per trial is p and the number of trials is n.

The mean is given by:

If we, for instance, flip a coin four times, how many times will we expect the outcome to be “heads”?

P(heads) = p = 0.5

n = 4

The mean value is:

## Variance

The variance describes how much we expect the results to vary.

It is given by the formula:

In the example above with the coin, which was flipped four times, the variance will be:

## Standard deviation

The standard deviation is the square root of the variance.
It is given by: