October 19, 2025

Definition of the Binomial Distribution

The Binomial Distribution models the number of \(x\) successes in
\(n\) independent Bernoulli trials, each with a probability \(p\) of success.


\[ \Pr(X = x) = \binom{n}{x} p^{x}(1 - p)^{\,n-x}, \quad x = 0, 1, \ldots, n \]

Connection to Bernoulli Trials

Each Bernoulli trial produces an output of 0 or 1, depending on success. An example of a Bernoulli trial is a coin flip, with a 50% chance of landing heads (success).

The Binomial variable sums these outcomes. For example, \(X\) could represent the number of heads or success across three independent coin flips.

Example Calculation with Formula and R

Below, we calculate the probability of getting exactly 3 heads if we flip a fair coin 5 times:

\[ P(X = 3) = \binom{5}{3}(0.5)^3(0.5)^2 = 0.3125 \]

We can even do this in R!

probability = dbinom(3, size = 5, prob = 0.5)
probability
[1] 0.3125

Expected Value and Variance

\[ \mathbb{E}[X] = n p, \qquad \mathrm{Var}(X) = n p (1 - p) \]

The mean equals the number of trials times the success probability.
Variance depends on the number of trials, as well as success and failure rates.

Flipping a coin 4 times: \[ \mathbb{E}[X] = (4)(0.5) = 2, \qquad \mathrm{Var}(X) = (4)(.5) (1 - .5) = 1 \]

ggplot Example with a Die

Roll a fair die 10 times, where a 6 is a success.

The plot below shows the probability masses across different numbers of 6’s rolled.
The highest probabilities occur at 1 and 2 successes, matching the expected value of \(np = 10 \times \frac{1}{6} \approx 1.67\).

Cumulative Distribution Function (CDF)

The CDF gives the probability of getting at most \(x\) successes.

\[ F(x) = P(X \le x) = \sum_{k=0}^{x} \binom{n}{k} p^{k}(1-p)^{n-k} \]

CDF Plot

The CDF rises to 1 because it adds the probabilities of all outcomes up to each \(x\). As \(x\) approaches the total number of trials (10), the probability approaches 1.

Binomial Probability Across Different p values

The 3D plot shows how lower \(p\) values result in higher probability concentration around 0. As \(p\) increases, the probability mass shifts toward higher success counts around \(np\).

References

Gelman, A., Carlin, J. B., Stern, H. S., Dunson, D. B., Vehtari, A., & Rubin, D. B. (2013). Bayesian data analysis (3rd ed.). CRC Press. https://doi.org/10.1201/b16018