What is a Binomial Random Variable?
A random variable has a binomial distribution when it counts the number of successes in a fixed number of independent trials.
Each trial must have exactly two possible outcomes, such as success/failure or heads/tails. The probability of success must also stay the same from one trial to the next.
For example, suppose we flip the same coin $n$ times. Let the probability of heads be $p$, and let $X$ count the total number of heads obtained.
Then $X$ has a binomial distribution with parameters $n$ and $p$. We write
$$X\sim\operatorname{Bin}(n,p).$$
Here:
-
$n$ is the number of independent trials;
-
$p$ is the fixed probability of success on each trial;
-
$X$ is the total number of successes.
The possible values of $X$ are
$$0,1,2,\dots,n.$$
The binomial random variable records how many successes occur, rather than the order in which they occur.
A Simple Example
Suppose we flip a coin $5$ times, where the probability of heads is
$$p=0.6.$$
Let $X$ be the number of heads.
Then
$$X\sim\operatorname{Bin}(5,0.6).$$
One possible result is
$$H\ T\ H\ H\ T.$$
There are $3$ heads, so in this case
$$X=3.$$
Another possible result is
$$H\ H\ H\ H\ H,$$
giving
$$X=5.$$
Many different sequences of heads and tails can give the same value of $X$.
The Binomial pmf
For a binomial random variable,
$$\mathbb{P}(X=k)=\binom{n}{k}p^k(1-p)^{n-k}, \qquad k=0,1,\dots,n.$$
The term
$$p^k(1-p)^{n-k}$$
gives the probability of one particular sequence containing exactly $k$ successes and $n-k$ failures.
The binomial coefficient
$$\binom{n}{k}$$
counts how many different ways we can place those $k$ successes among the $n$ trials.
For example, suppose
$$X\sim\operatorname{Bin}(5,0.6).$$
To find the probability of exactly two successes,
$$\mathbb{P}(X=2)=\binom{5}{2}(0.6)^2(0.4)^3.$$
There are
$$\binom{5}{2}=10$$
different ways to place two successes among five trials.
Mean and Variance
For any binomial random variable,
$$\mathbb{E}(X)=np$$
and
$$\operatorname{Var}(X)=np(1-p).$$
The mean $np$ gives the expected number of successes out of the $n$ trials.
Explore the Binomial pmf
The shape of a binomial distribution changes when we change either of its two parameters, $n$ and $p$.
In the interactive graph below, the horizontal axis shows the number of successes, $k$, and each bar has height $\mathbb{P}(X=k)$.
Try changing:
-
$n$, the number of trials;
-
$p$, the probability of success on each trial.
Notice how the possible values and the shape of the pmf change as you change the parameters!
You can also choose a particular value of $k$ to see the corresponding probability $\mathbb{P}(X=k)$.
Binomial Distribution Summary
| Notation: | $X\sim\operatorname{Bin}(n,p)$ |
| Type: | Discrete |
| Meaning: | Number of successes in $n$ independent trials |
| Parameters: | $n$ = number of trials, $p$ = probability of success |
| pmf: | $\mathbb{P}(X=k)=\binom{n}{k}p^k(1-p)^{n-k}$ |
| Support: | $k\in{0,1,2,\dots,n}$ |
| Mean: | $\mathbb{E}(X)=np$ |
| Variance: | $\operatorname{Var}(X)=np(1-p)$ |
Background:
Understanding Econometrics is completely free to use, and always will be.
If you found the site useful and would like to help me keep adding new material, please consider buying me a coffee! Buy me a coffee ☕