In probability theory and statistics, the binomial distribution with parameters n and p is the discrete probability distribution of the number of successes in a sequence of n independent experiments, each asking a yes–no question, and each with its own Boolean-valued outcome: success (with probability p) or failure (with probability q = 1 − p). A single success/failure experiment is also called a Bernoulli trial or Bernoulli experiment, and a sequence of outcomes is called a Bernoulli process. For a single trial, that is, when n = 1, the binomial distribution is a Bernoulli distribution. The binomial distribution is the basis for the binomial test of statistical significance. The binomial distribution is frequently used to model the number of successes in a sample of size n drawn with replacement from a population of size N. If the sampling is carried out without replacement, the draws are not independent and so the resulting distribution is a hypergeometric distribution, not a binomial one. However, for N much larger than n, the binomial distribution remains a good approximation, and is widely used.
Definitions
Probability mass function If the random variable X follows the binomial distribution with parameters n∈ℕ (a natural number) and p ∈ [0, 1], we write X ~ B(n, p). The probability of getting exactly k successes in n independent Bernoulli trials (with the same rate p) is given by the probability mass function: f(k;n,p)=Pr(X=k)=(nk)pk(1−p)n−k for k = 0, 1, 2, ..., n, where (nk)=n!k!(n−k)! is the binomial coefficient. The formula can be understood as follows: pk qn−k is the probability of obtaining the sequence of n independent Bernoulli trials in which k trials are "successes" and the remaining n − k trials are "failures". Since the trials are independent with probabilities remaining constant between them, any sequence of n trials with k successes (and n − k failures) has the same probability of being achieved (regardless of positions of successes within the sequence). There are (nk) such sequences, since the binomial coefficient (nk) counts the number of ways to choose the positions of the k successes among the n trials. The binomial distribution is concerned with the probability of obtaining any of these sequences, meaning the probability of obtaining one of them (pk qn−k) must be added (nk) times, hence Pr(X=k)=(nk)pk(1−p)n−k. In creating reference tables for binomial distribution probability, usually, the table is filled in up to n2 values. This is because for k>n2, the probability can be calculated by its complement as f(k;n,p)=f(n−k;n,1−p).
Example Suppose a biased coin comes up heads with probability 0.3 when tossed. The probability of seeing exactly 4 heads in 6 tosses is f(4;6,0.3)=(64)0.34(1−0.3)6−4=0.059535.
Cumulative distribution function The cumulative distribution function can be expressed as: F(k;n,p)=Pr(X≤k)=∑i=0k(ni)pi(1−p)n−i for any integer k. It can also be represented in terms of the regularized incomplete beta function, as follows: F(k;n,p)=Pr(X≤k)=I1−p(n−k,k+1)=(n−k)(nk)∫01−ptn−k−1(1−t)kdt, which is equivalent to the cumulative distribution functions of the beta distribution and of the F-distribution: F(k;n,p)=Fbeta-distribution(x=1−p;α=n−k,β=k+1) F(k;n,p)=FF-distribution(x=1−ppk+1n−k;d1=2(n−k),d2=2(k+1)). Some closed-form bounds for the cumulative distribution function are given below.
Properties
Expected value and variance If X ~ B(n, p), that is, X is a binomially distributed random variable, n being the total number of experiments and p the probability of each experiment yielding a successful result, then the expected value of X is: E[X]=np. This follows from the linearity of the expected value along with the fact that X is the sum of n identical Bernoulli random variables, each with expected value p. In other words, if X1,…,Xn are identical (and independent) Bernoulli random variables with parameter p, then X = X1 + ... + Xn and E[X]=E[X1+⋯+Xn]=E[X1]+⋯+E[Xn]=p+⋯+p=np. The variance is: Var(X)=npq=np(1−p). This similarly follows from the fact that the variance of a sum of independent random variables is the sum of the variances.
Higher moments The first 6 central moments, defined as μc=E[(X−E[X])c], are given by μ1=0,μ2=np(1−p),μ3=np(1−p)(1−2p),μ4=np(1−p)[1+(3n−6)p(1−p)],μ5=np(1−p)(1−2p)[1+(10n−12)p(1−p)],μ6=np(1−p)[1−30p(1−p)[1−4p(1−p)]+5np(1−p)[5−26p(1−p)]+15n2p2(1−p)2]. The non-central moments satisfy E[X]=np,E[X2]=np(1−p)+n2p2, and in general E[Xc]=∑k=0c{ck}nk_pk, where {ck} are the Stirling numbers of the second kind, and nk_=n(n−1)⋯(n−k+1) is the k-th falling power of n. A simple bound follows by bounding the Binomial moments via the higher Poisson moments: E[Xc]≤[cln(1+cnp)]c≤(np)cexp(c22np). This shows that if c=O(np), then E[Xc] is at most a constant factor away from E[X]c. The moment-generating function is MX(t)=𝔼[etX]=(1−p+pet)n.
Mode Usually the mode of a binomial B(n, p) distribution is equal to ⌊(n+1)p⌋, where ⌊⋅⌋ is the floor function. However, when (n + 1)p is an integer and p is neither 0 nor 1, then the distribution has two modes: (n + 1)p and (n + 1)p − 1. When p is equal to 0 or 1, the mode will be 0 and n correspondingly. These cases can be summarized as follows: mode={⌊(n+1)p⌋if (n+1)p is 0 or a noninteger,(n+1)p and (n+1)p−1if (n+1)p∈{1,…,n},nif (n+1)p=n+1. Proof: Let f(k)=(nk)pkqn−k. For p=0 only f(0) has a nonzero value with f(0)=1. For p=1 we find f(n)=1 and f(k)=0 for k≠n. This proves that the mode is 0 for p=0 and n for p=1. Let 0<p<1. We find f(k+1)f(k)=(n−k)p(k+1)(1−p). From this follows k>(n+1)p−1⇒f(k+1)<f(k)k=(n+1)p−1⇒f(k+1)=f(k)k<(n+1)p−1⇒f(k+1)>f(k) So when (n+1)p−1 is an integer, then (n+1)p−1 and (n+1)p is a mode. In the case that (n+1)p−1∉ℤ, then only ⌊(n+1)p−1⌋+1=⌊(n+1)p⌋ is a mode.
Median In general, there is no single formula to find the median for a binomial distribution, and it may even be non-unique. However, several special results have been established:
… excerpt ends here. Continue reading the full article.





