Course outline

Probability Rules

By the end of this lesson, you should be able to: use the addition rule without double counting, test whether two events are independent instead of assuming it, turn any "at least one" question into a complement, and count the ways something can happen.

An engineer says the edge case is one in ten thousand

So it's fine. Ship it.

Pantry ran 25,079 checkouts last week. The chance that a 1-in-10,000 bug hit at least one of them is:

P(at least one)=1(10.0001)25,079=0.919P(\text{at least one}) = 1 - (1 - 0.0001)^{25{,}079} = 0.919

91.9%. It almost certainly fired, roughly two or three times, and somebody's groceries didn't arrive.

Two panels. Left, three rising curves showing P(at least one occurrence) against number of checkouts on a log axis, for bug rates of 1 in 1,000, 1 in 10,000 and 1 in 100,000; a dotted vertical line marks one week at 25,079 checkouts, where the three curves sit at essentially 1.00, 0.92 and 0.22. Right, two pairs of bars comparing observed joint probability against what independence would predict: for ordering and iOS the pair matches at 1.00 times, for ordering and having 3 or more sessions the observed bar is 1.56 times the independent prediction.
Left: rarity is a rate, and a rate meets volume. Right: the multiplication rule is allowed in one of these cases and not the other.

Read the left panel across. At 1 in 1,000 the bug is a certainty long before a week is out. At 1 in 100,000 the weekly chance is 22.2%, which is roughly once a month. Nothing here is a judgement call about severity. It's arithmetic that takes ten seconds, and it's usually the missing input in an argument about whether an edge case matters.

The rules, on one week of Pantry

Probability starts with a sample space, the set of everything that could happen, and an event, a subset of it you care about. Take the 120,000 users from last week and define three events:

  • AA: ordered at least once. P(A)=0.1811P(A) = 0.1811
  • BB: contacted support. P(B)=0.1631P(B) = 0.1631
  • CC: on iOS. P(C)=0.4707P(C) = 0.4707

Three rules cover almost everything you'll be asked.

Probabilities live between 0 and 1, and everything sums to 1. Trivial-sounding, and it's the check that catches a surprising number of errors: if your categories are exhaustive and mutually exclusive, their probabilities must add to exactly 1. When they don't, a case is missing or double counted.

The complement. P(not A)=1P(A)P(\text{not } A) = 1 - P(A). So 81.89% of users ordered nothing.

The addition rule. For "A or B", you can't just add, because anyone in both gets counted twice:

P(AB)=P(A)+P(B)P(AB)P(A \cup B) = P(A) + P(B) - P(A \cap B)

On the data: 0.1811+0.16310.0297=0.31450.1811 + 0.1631 - 0.0297 = 0.3145, and the directly measured P(AB)P(A \cup B) is 0.3145. Skip the subtraction and you get 0.3442, overstating by three points. That's the whole reason "how many users did either of these things" is asked in interviews.

Independence is a claim, not a convenience

The multiplication rule. If AA and BB are independent, P(AB)=P(A)P(B)P(A \cap B) = P(A)\,P(B).

That "if" is where people get hurt. Independent means knowing one tells you nothing about the other, and it is a property of the world that you have to check.

Check it on Pantry:

PairObservedIf independentRatio
Ordered and on iOS0.08520.08521.00
Ordered and 3+ sessions0.15030.09661.56

The first pair is genuinely independent, so multiplying is fine. The second isn't, and multiplying understates the truth by a third.

The conditional version says it more directly:

P(A)=0.1811P(AiOS)=0.1810P(A3+ sessions)=0.2818P(A) = 0.1811 \qquad P(A \mid \text{iOS}) = 0.1810 \qquad P(A \mid \text{3+ sessions}) = 0.2818

Knowing somebody's platform tells you nothing about whether they'll order. Knowing they opened the app three times tells you a great deal. That's what independence is and isn't, and conditional probability picks it up from here.

The common failure isn't forgetting the multiplication rule. It's using it on events that share a cause. "System availability is 99.9% per service, we have four services, so 99.6% overall" assumes four independent failures. If all four sit in one availability zone, they fail together and the real number is far worse. Whenever you multiply probabilities, say out loud what would make them dependent.

Turn "at least one" into "none"

Back to the bug. "At least one" is awkward to compute directly, because you'd have to add up the chance of exactly one, exactly two, exactly three, all the way to 25,079.

The complement makes it one line. The opposite of "at least one" is "none", and "none" is a plain multiplication when the checkouts are independent:

P(none)=(1p)nP(at least one)=1(1p)nP(\text{none}) = (1 - p)^n \qquad P(\text{at least one}) = 1 - (1 - p)^n

Bug rateP(at least one) in a week
1 in 1,0001.0000
1 in 10,0000.9186
1 in 100,0000.2218
1 in 1,000,0000.0248

Whenever a question contains "at least one", compute "none" and subtract. It's the highest-value reflex in this lesson, and it shows up again almost immediately: the multiple testing problem is this exact formula with pp = 0.05 and nn = the number of metrics on your scorecard.

There's a companion number worth quoting alongside it. The expected count is just npn p, here 25,079×0.0001=2.5125{,}079 \times 0.0001 = 2.51 hits. Expected count and probability-of-at-least-one answer different questions, and mixing them up is how "we expect 2.5 incidents" becomes "there's a 250% chance of an incident".

Counting, because multiplication is most of it

Some probability questions are really counting questions, and the machinery is small.

If a choice has aa options and an independent second choice has bb, there are a×ba \times b combined outcomes. Everything else follows.

Permutations, when order matters:

P(n,k)=n!(nk)!P(n, k) = \frac{n!}{(n-k)!}

Combinations, when it doesn't:

C(n,k)=(nk)=n!k!(nk)!C(n, k) = \binom{n}{k} = \frac{n!}{k!\,(n-k)!}

The only question is whether swapping two picks makes a different outcome.

QuestionWhichAnswer
Fill 3 ordered hero slots from 12 productsPermutations1,320
Pick an unordered 3-item bundle from 12 productsCombinations220
4 layout factors at 3 levels eachMultiplication81 cells
Pick 2 of 40 metrics to compareCombinations780 pairs

That last row is worth sitting with. A scorecard of 40 metrics contains 780 pairs, and if you go looking for interesting relationships between them at the 5% level, roughly 39 will look significant with nothing going on. The counting is the easy part. Knowing to do it is the skill.

Takeaways

  • Rare times volume stops being rare. A 1-in-10,000 bug has a 91.9% chance of firing in a 25,079-checkout week, and an expected 2.51 hits.
  • Subtract the overlap. P(AB)=P(A)+P(B)P(AB)P(A \cup B) = P(A) + P(B) - P(A \cap B). Skipping the last term overstated Pantry's "ordered or contacted support" by three percentage points.
  • Independence is checkable. Ordering and platform matched their independent prediction at 1.00 times; ordering and session count came in at 1.56 times, so multiplying there is wrong.
  • The dangerous multiplication is the one over a shared cause. Four services at 99.9% are not 99.6% together if they share an availability zone.
  • "At least one" means compute "none". 1(1p)n1 - (1-p)^n, and the same formula reappears as the multiple testing problem.
  • Expected count and probability are different questions. 2.51 expected hits, 91.9% chance of at least one.

Quick check

A payments team reports each of their three providers is up 99.5% of the time, and concludes that the chance all three are down at once is 0.5% cubed, about 1 in 8 million. What should you push back on?

A growth team wants to test 3 headline options, 2 button colours and 2 hero images as a full factorial, then check 6 metrics in each cell. Roughly how many cell-and-metric results will they look at, and why does it matter?

Practice

What is the chance at least one of 5 trial users churns?

Complement

Each trial user churns independently with probability 0.2. What is P(at least one churns)?

How many ways can you pick and rank 3 recommended items from 10?

Counting

Answer it with order mattering and with order not mattering, and say which one a ranking surface needs.

When can you multiply two probabilities together?

Independence

State the rule precisely, and give a case at Pantry where multiplying is wrong.

Take it further

That closes the free module. Next, conditional probability takes the P(A3+ sessions)=0.2818P(A \mid \text{3+ sessions}) = 0.2818 line seriously and builds the rest of the subject on it.

Probability & Statistics0 / 25