Bernoulli Distribution
You'll learn: How to model a single yes/no experiment where success has a fixed probability.
What Is a Bernoulli Distribution?
A Bernoulli distribution models the simplest random experiment: a single trial with exactly two possible outcomes. Think of flipping a coin once, checking if a bit is set, or testing if a user clicks an ad. One outcome is labeled "success" (usually coded as 1), the other "failure" (coded as 0).
The distribution has one parameter, p, which is the probability of success. The probability of failure is automatically 1 - p.
The Mathematics
For a Bernoulli random variable X:
- Probability Mass Function (PMF):
- P(X = 1) = p
- P(X = 0) = 1 - p
You can write this compactly as: P(X = k) = p^k · (1-p)^(1-k) for k ∈ {0, 1}
Example
Suppose a network packet has a 0.95 probability of arriving successfully (success) and 0.05 probability of being dropped (failure). This is a Bernoulli trial with p = 0.95.
- Probability the packet arrives: 0.95
- Probability the packet drops: 1 - 0.95 = 0.05
Why It Matters in CS
Bernoulli distributions appear constantly: testing if a hash collision occurs, modeling single authentication attempts, representing individual bits in error-prone channels, or simulating single user actions. It's the building block for more complex distributions.
Key Takeaway: A Bernoulli distribution models a single binary trial with success probability p and failure probability 1 - p; it's the foundation for analyzing yes/no events in computing.