Guozhen AIGlobal AI field notes and model intelligence

English translation

Visualize the binomial PMF

Published:

Category: Probability Theory for Beginners

Read time: 4 min

Reads: 0

Lesson #7Views are counted together with the original Chinese articleImages are preserved from the source page

Binomial Distribution Concept Diagram

The binomial distribution applies to a fixed number of repeated trials, where we care specifically about how many times success occurs. Its key requirements are:

  • A fixed number of trials (n),
  • Independence between trials, and
  • A constant probability of success (p) across all trials.

Binomial Distribution Checklist Diagram

Always first verify whether the conditions of fixed n and constant p hold. If they do not, do not force-fit the scenario into a binomial model.

In the previous tutorial, we introduced random variables and their associated cumulative distribution functions (CDFs) and probability density/mass functions (PDFs/PMFs). This article dives into one of the most common discrete probability distributions—the binomial distribution. Understanding the binomial distribution is foundational not only for basic statistics but also critically important for applications in data science and artificial intelligence.

What Is the Binomial Distribution?

The binomial distribution describes the probability distribution of the number of successes in a sequence of n independent Bernoulli trials—each trial having exactly two possible outcomes, typically labeled “success” and “failure.” At its core, it models how likely it is to observe k successes across n identical, independent experiments.

Binomial Distribution Decision Card

To decide whether the binomial distribution is appropriate, check four conditions:

  • Is the number of trials fixed?
  • Does each trial have exactly two possible outcomes?
  • Is the probability of success identical across all trials?
  • Are the trials mutually independent?

Parameters of the Binomial Distribution

The binomial distribution is fully determined by two parameters:

  • nn: the total number of trials,
  • pp: the probability of success on any single trial.

Let the random variable XX denote the number of successes observed in nn trials. Then XX follows a binomial distribution with parameters nn and pp, denoted XB(n,p)X \sim B(n, p).

Probability Mass Function (PMF)

The probability mass function (PMF) of the binomial distribution is given by:

P(X=k)=(nk)pk(1p)nkP(X = k) = \binom{n}{k} p^k (1-p)^{n-k}

Here, (nk)\binom{n}{k} is the binomial coefficient—the number of ways to choose kk successes out of nn trials.

Expected Value and Variance

For a binomially distributed random variable XB(n,p)X \sim B(n, p):

  • Expected value (mean): E(X)=npE(X) = n \cdot p
  • Variance: Var(X)=np(1p)\mathrm{Var}(X) = n \cdot p \cdot (1 - p)

Real-World Example

Let’s illustrate the binomial distribution using a simple coin-flip experiment. Suppose we flip a fair coin 10 times; each flip yields heads (“success”) with probability p=0.5p = 0.5.

Probability Reading Map Card

When studying “A Deep Dive into the Binomial Distribution,” start with a small, reproducible scenario you can simulate yourself. Then map concepts and practice steps onto that scenario. After reading, re-explain the entire topic using your own example.

  • Experimental setup: n=10n = 10, p=0.5p = 0.5
  • Question: What is the probability of observing exactly 3 heads (“successes”) in 10 flips?

Using the binomial PMF:

P(X=3)=(103)(0.5)3(0.5)103=(103)(0.5)10P(X = 3) = \binom{10}{3} (0.5)^3 (0.5)^{10-3} = \binom{10}{3} (0.5)^{10}

Compute the binomial coefficient:

(103)=10!3!7!=1098321=120\binom{10}{3} = \frac{10!}{3! \cdot 7!} = \frac{10 \cdot 9 \cdot 8}{3 \cdot 2 \cdot 1} = 120

Thus,

P(X=3)=120(0.5)10=120110240.1172P(X = 3) = 120 \cdot (0.5)^{10} = 120 \cdot \frac{1}{1024} \approx 0.1172

This result means there is approximately an 11.72% chance of getting exactly 3 heads in 10 fair coin tosses.

Code Example

We can compute probabilities for various numbers of successes using Python:

import scipy.stats as stats
import matplotlib.pyplot as plt
import numpy as np

n = 10  # number of trials
p = 0.5  # probability of success

# Visualize the binomial PMF
x = np.arange(0, n+1)
pmf = stats.binom.pmf(x, n, p)

plt.bar(x, pmf, color='blue', alpha=0.7)
plt.title(f'Binomial Distribution PMF (n={n}, p={p})')
plt.xlabel('Number of Successes')
plt.ylabel('Probability')
plt.xticks(x)
plt.show()

Running this code produces a bar chart showing the probability distribution of the number of successes across n=10n = 10 trials.

Binomial Distribution Application Recap Card

If you haven’t yet fully internalized “A Deep Dive into the Binomial Distribution,” revisit this card and walk through its four actionable steps again.

Binomial Distribution Application Check Card

When reviewing “A Deep Dive into the Binomial Distribution,” avoid jumping straight into large-scale projects. Instead, begin with a single, simple example to confirm whether the core logic is clear.

Summary

In this article, we thoroughly examined the definition, mathematical formulation, and practical computation of probabilities under the binomial distribution. In the next tutorial, we will explore the normal distribution—a more complex yet profoundly important concept in probability and statistics. Before moving forward, ensure you have a solid grasp of the material covered here; it forms an essential foundation for deeper statistical learning.

Continue

Keep reading from here

Browse English site

Reader Messages

Reader messages

Questions, corrections, extra sources, or hands-on results can be left here. No login is required.

Max 800 characters

To reduce spam, each message is checked for length, link count, and posting frequency.

0/800

Messages

0 messages
Loading messages...