Binomial Distribution
What You'll Learn
You'll learn how to model and calculate the probability of getting exactly k successes in n independent yes/no trials.
The Core Idea
Imagine flipping a biased coin 10 times and counting how many heads you get. Each flip is an independent Bernoulli trial (success probability p, failure probability 1-p). The Binomial Distribution tells you the probability of getting exactly k heads out of those n = 10 flips.
The binomial distribution has two parameters:
- n: the number of independent trials
- p: the probability of success on each trial
The binomial formula calculates P(X = k), the probability of exactly k successes:
P(X = k) = C(n, k) × p^k × (1-p)^(n-k)
Where:
- C(n, k) is the binomial coefficient ("n choose k") — the number of ways to arrange k successes among n trials
- p^k is the probability all k successes occur
- (1-p)^(n-k) is the probability the remaining (n-k) trials are failures
Example
If you run a network packet transmission 5 times (n=5) and each has 0.8 success probability (p=0.8), what's the probability exactly 4 packets succeed?
P(X = 4) = C(5, 4) × (0.8)^4 × (0.2)^1
P(X = 4) = 5 × 0.4096 × 0.2 = 0.4096
So there's about a 41% chance exactly 4 out of 5 packets succeed.
Why It Matters in CS
Binomial distribution models many real scenarios: successful database queries, packet delivery, test results, A/B testing outcomes — any repeated independent trial with two outcomes.
Key Takeaway: The binomial distribution counts successes in n independent Bernoulli trials using the formula P(X=k) = C(n,k) × p^k × (1-p)^(n-k), combining combinatorics with probability.