Many random experiments include counting the number of successes in a series of a fixed number of independently repeated trials, which may result in either success or failure.
The distribution of the number of successes is a binomial distribution.
It is a discrete probability distribution with two parameters, traditionally indicated by *n*, the number of trials, and *p*, the probability of success.
Such a success/failure experiment is also called a Bernoulli experiment, or Bernoulli trial; when *n* = 1, the Bernoulli distribution is a binomial distribution.

Named after Jacob Bernoulli, who studied them extensively in the 1600s, a well known example of such an experiment is the repeated tossing of a coin and counting the number of times "heads" comes up.

In a sequence of Bernoulli trials, we are often interested in the total number of successes and not in the order of their occurrence.
If we let the random variable *X* equal the number of observed successes in *n* Bernoulli trials, the possible values of *X* are 0,1,2,…,*n*.
If *x* success occur, where *x*=0,1,2,...,n , then *n-x* failures occur.
The number of ways of selecting *x* positions for the *x* successes in the *x* trials is:

*(nx)=n!x!
(n−x)!*

Since the trials are independent and since the probabilities of success and failure on each trial are, respectively, *p* and *q=1−p*, the probability of each of these ways is *px(1−p)n−x*.
Thus, the *p.d.f.* of X, say *f(x)* , is the sum of the probabilities of these *(nx)* mutually exclusive events--that is,

*f(x)=(nx)px(1−p)n−x,x=0,1,2,...,n.*

These probabilities are called binomial probabilities, and the random variable *X* is said to have a binomial distribution .