Probability
2. Discrete Distributions
Bernoulli Distribution

Bernoulli Distribution

🪙

The Bernoulli distribution is the absolute simplest discrete probability distribution. It models a single trial or experiment that has exactly two possible outcomes.

These two outcomes are mathematically coded as:

  • Success (11)
  • Failure (00)

Core Concepts

If a random variable XX follows a Bernoulli distribution, we write this as:

XBernoulli(p)X \sim \text{Bernoulli}(p)

Where pp is the probability of the "Success" outcome. Therefore, the probability of the "Failure" outcome is naturally 1p1 - p (sometimes denoted as qq).

Probability Mass Function (PMF)

The probability mass function is piecewise defined as:

P(X=x)={pif x=11pif x=0P(X = x) = \begin{cases} p & \text{if } x = 1 \\ 1 - p & \text{if } x = 0 \end{cases}

This can be written compactly into a single elegant algebraic formula for x{0,1}x \in \{0, 1\}:

f(x;p)=px(1p)1xf(x; p) = p^x (1 - p)^{1 - x}

Key Metrics

  • Expected Value (Mean): E[X]=pE[X] = p
  • Variance: Var(X)=p(1p)\text{Var}(X) = p(1 - p)

Real-World Examples

  1. Flipping a Coin: If we define "Heads" as success, a fair coin has p=0.5p = 0.5.
  2. Quality Control: Testing a single lightbulb where success is "defective" (p=0.02p = 0.02) and failure is "working".
  3. Medical Testing: A patient either tests positive for a disease (11) or negative (00).

Interactive Visualization

Below is an interactive graph. Notice how increasing the probability of success pp physically shifts the weight from the "Failure" bar directly over to the "Success" bar. Because there are only two outcomes, the sum of the two bars will always equal exactly 1.01.0.

Bernoulli Distribution

A single trial: success with probability p, failure with probability 1−p.

Probability of Success (p)
0.50

Test Your Knowledge

Example: Bernoulli Variance

A weighted coin has a 70% chance of landing heads (p=0.7p=0.7). Let XX be the Bernoulli random variable representing a single flip (1 for Heads, 0 for Tails). What is the Expected Value and Variance of XX?

View Step-by-Step Solution

For a Bernoulli distribution:

Expected Value: E[X]=p=0.7E[X] = p = 0.7

Variance: Var(X)=p(1p)=0.7(10.7)=0.7(0.3)=0.21Var(X) = p(1-p) = 0.7(1 - 0.7) = 0.7(0.3) = 0.21