Mathwords logoMathwords

Bernoulli Distribution — Definition, Formula & Examples

A Bernoulli distribution is a probability distribution for a random variable that has exactly two possible outcomes: success (1) with probability pp and failure (0) with probability 1p1 - p.

A discrete random variable XX follows a Bernoulli distribution with parameter p[0,1]p \in [0, 1], written XBernoulli(p)X \sim \text{Bernoulli}(p), if its probability mass function is P(X=k)=pk(1p)1kP(X = k) = p^k(1-p)^{1-k} for k{0,1}k \in \{0, 1\}. Its mean is E[X]=pE[X] = p, its variance is Var(X)=p(1p)\text{Var}(X) = p(1-p), and its moment-generating function is M(t)=(1p)+petM(t) = (1-p) + pe^t.

Key Formula

P(X=k)=pk(1p)1k,k{0,1}P(X = k) = p^{\,k}(1 - p)^{1 - k}, \quad k \in \{0,\, 1\}
Where:
  • XX = Bernoulli random variable (equals 0 or 1)
  • kk = Outcome value, either 0 (failure) or 1 (success)
  • pp = Probability of success, where 0 ≤ p ≤ 1

How It Works

The Bernoulli distribution models any random experiment with exactly two outcomes — a coin flip, whether a customer buys a product, or whether a manufactured part is defective. You assign one outcome as "success" (X=1X = 1) and the other as "failure" (X=0X = 0), then specify the probability pp of success. Once you know pp, you know everything about the distribution: the mean is simply pp, and the variance is p(1p)p(1 - p). When you repeat independent Bernoulli trials nn times and count the total number of successes, the result follows a binomial distribution with parameters nn and pp.

Worked Example

Problem: A free-throw shooter makes 80% of her shots. Model a single free throw as a Bernoulli random variable and find the probability of a miss, the mean, and the variance.
Define the variable: Let X=1X = 1 if she makes the shot (success) and X=0X = 0 if she misses (failure). Then p=0.80p = 0.80.
XBernoulli(0.80)X \sim \text{Bernoulli}(0.80)
Find P(miss): The probability of a miss is the complement of the probability of success.
P(X=0)=1p=10.80=0.20P(X = 0) = 1 - p = 1 - 0.80 = 0.20
Compute the mean: The expected value of a Bernoulli random variable equals pp.
E[X]=p=0.80E[X] = p = 0.80
Compute the variance: Apply the variance formula for the Bernoulli distribution.
Var(X)=p(1p)=0.80×0.20=0.16\text{Var}(X) = p(1 - p) = 0.80 \times 0.20 = 0.16
Answer: The probability of a miss is 0.20, the mean is 0.80, and the variance is 0.16.

Another Example

Problem: A quality inspector checks light bulbs. Each bulb has a 3% chance of being defective. What is the probability that a single randomly chosen bulb is not defective?
Set up the Bernoulli model: Define "success" as finding a defective bulb: p=0.03p = 0.03.
XBernoulli(0.03)X \sim \text{Bernoulli}(0.03)
Calculate P(not defective): A non-defective bulb corresponds to X=0X = 0.
P(X=0)=10.03=0.97P(X = 0) = 1 - 0.03 = 0.97
Answer: The probability that the bulb is not defective is 0.97.

Why It Matters

The Bernoulli distribution is the building block for the binomial, geometric, and negative binomial distributions, all of which appear throughout an introductory statistics or probability course. In data science and machine learning, logistic regression models each observation as a Bernoulli trial to predict binary outcomes like spam vs. not-spam. Understanding this distribution is essential before tackling hypothesis testing for proportions.

Common Mistakes

Mistake: Confusing the Bernoulli distribution with the binomial distribution and using n>1n > 1 in the formula.
Correction: A Bernoulli distribution always models a single trial (n=1n = 1). If you are counting successes over multiple independent trials, you need the binomial distribution.
Mistake: Assuming "success" must be a positive or desirable outcome.
Correction: "Success" is just the label for the outcome you are tracking. It can represent a defective part, a disease diagnosis, or any event whose probability you want to model.

Related Terms