Course contentsShow
← Machine Learning and Deep Learning
Lesson 64 of 3,5381. Mathematical Foundations for Machine LearningFree lesson

Common Discrete Distributions: Bernoulli and Binomial

Model binary trials and repeated experiments with Bernoulli and binomial distributions.

Common Discrete Distributions: Bernoulli and Binomial

What you'll learn: How to model yes/no trials and count successes across multiple tries using two fundamental probability distributions.

The Core Idea

Think of flipping a coin: it lands heads or tails. That's a Bernoulli trial — a single experiment with exactly two outcomes (success/failure, 1/0, yes/no). The Bernoulli distribution describes this random variable with one parameter p (the probability of success).

Now imagine flipping that coin n times and counting total heads. That's the binomial distribution — it counts successes across repeated independent Bernoulli trials.

Bernoulli Distribution

  • Models a single binary outcome
  • Has one parameter: p (probability of success)
  • Random variable X takes value 1 with probability p, and 0 with probability (1-p)
  • PMF: P(X = 1) = p, P(X = 0) = 1 - p
  • Expectation: E[X] = p
  • Variance: Var(X) = p(1 - p)

Example: Will it rain tomorrow? X = 1 (rain) with p = 0.3, X = 0 (no rain) with p = 0.7.

Binomial Distribution

  • Models the number of successes in n independent Bernoulli trials
  • Has two parameters: n (number of trials) and p (success probability)
  • Random variable X can be 0, 1, 2, ..., n
  • Expectation: E[X] = np
  • Variance: Var(X) = np(1 - p)

Example: Flip 10 coins (n=10) with p=0.5. X might equal 6 heads, 4 heads, etc.

Why They Matter in ML

These distributions appear everywhere: classifying spam (yes/no), detecting fraud, modeling click-through rates, and anywhere you need to represent binary outcomes or count successes.

Key Takeaway: The Bernoulli distribution models a single yes/no trial with probability p, while the binomial distribution counts how many successes occur in n independent Bernoulli trials.