← Back to roadmapProbability · 07 of 40

Lesson 7 · Probability

Probability language and counting

Before reaching for a formula, define one outcome, name the event, and ask whether order, replacement, and equal likelihood are actually part of the problem.

Learning objective

Given a probability prompt in ordinary language, you should be able to restate the random experiment, sample space, and event; decide whether order and repetition matter; select a complement, product rule, permutation, combination, partition, or inclusion–exclusion; and explain the assumption that lets a count become a probability. The interview behavior is simple: formalize first, count second, interpret third.

Prediction before reveal

Build the code, then define the event

Four slots are filled from a six-symbol alphabet. Two symbols are marked. Before seeing the count, predict whether a uniformly generated code has at least one marked symbol more often than not.

Result—hidden until reveal

Make a prediction: choose the bucket you expect, then reveal the count. The exact result stays hidden until you commit.

Your predicted probability bucket

Think about the complement: how many four-slot codes contain no marked symbol?

The interview-ready habit: say, “What is one fully specified outcome here, and are those outcomes equally likely?” That sentence prevents most denominator, order, and double-counting errors before they reach the calculator.

1. Translate the sentence into a set

A random experiment is a repeatable process whose exact result is not known in advance. An outcome, written ω, is one fully specified result. The sample space, written Ω, is the set of all outcomes under the experiment. An event, such as A, is a subset of that sample space: the outcomes that satisfy the question.

For four coin tosses, one outcome is the ordered string H T H T. The sample space contains all 2⁴ = 16 ordered strings. “Exactly two heads” is not one outcome; it is an event containing six strings. If you make the event too coarse—say, the five possible head counts {0, 1, 2, 3, 4}—you lose the equal-likelihood property. Two heads is represented by six strings, while four heads is represented by one.

Natural-language operators have set consequences:

  • “And” means an intersection, A ∩ B: both conditions hold.
  • “Or” usually means a union, A ∪ B: either condition or both. It is not automatically a disjoint addition.
  • “At least one” includes one, two, and every larger count. Its complement is often the easier event: “none.”
  • “Exactly” describes one count, while “at most” includes that count and every smaller one.

This translation is useful in data work, too. “A user clicked a video or opened a notification” is a union of user-level events. If one user did both, an event-level table can count that person twice. The unit, time window, eligibility frame, and deduplication rule are part of the probability question—not implementation details to fill in later.

2. When a count becomes a probability

For a finite sample space with equally likely atomic outcomes, every outcome has probability 1 / |Ω|. If event A contains |A| outcomes, adding those equal masses gives:

P(A) = |A| / |Ω|

This is a consequence of uniform assignment, not the definition of probability. A fair die has six equally likely faces, so a count ratio works. A loaded die still has six faces, but the face probabilities differ; “three favorable faces out of six” is not enough. In a marketplace, a sample described as “three users from eight” is uniform only if the sampling mechanism gives each three-user subset the same chance.

Keep three questions attached to every ratio:

  1. What is the atomic outcome? A complete ordered code, an unordered committee, or a user in a defined eligible population?
  2. Does the denominator describe the same experiment? It must use the same unit, timing, eligibility, replacement rule, and sample space as the numerator.
  3. Are the atomic outcomes equally likely? If not, count outcomes for structure, but sum their actual probabilities or model the sampling mechanism.

3. The multiplication principle is a tree

If a complete outcome is built in stages, multiplication counts the leaves of the decision tree. When stage one has n₁ choices, every partial path has n₂ legal choices at stage two, and so on, then:

|Ω| = n₁ × n₂ × ··· × nᵣ

A four-slot code from six symbols with repetition allowed has 6 × 6 × 6 × 6 = 6⁴ = 1,296 outcomes. Without repetition, the branch count changes after every pick: 6 × 5 × 4 × 3 = 360. The product rule has not changed; the number of legal next steps has.

When branches are different, do not multiply an average branch count. Split into disjoint cases and add the products. For example, if a product code starts with a letter and then has either three digits for one category of letter or two digits and another letter for a different category, calculate each category separately. A sum of products is still a tree—just one with branches of unequal shape.

4. Order, replacement, and the semantic decision

Use a permutation when changing positions creates a new outcome. Selecting a podium order, assigning named offices, or recording a password is ordered. For r ordered positions from n distinct objects without replacement:

nP r = n(n − 1) ··· (n − r + 1) = n! / (n − r)!

Use a combination when the selected membership is the outcome and rearranging it changes nothing. Start with nP r. Each unordered r-person group appears exactly r! times, once for each order, so remove that artificial repetition:

nC r = n! / [r!(n − r)!] = nP r / r!

The division is not a trick to memorize. It answers the semantic question: how many ordered lists describe the same unordered selection? A three-person committee from ten has 10C3 = 120 possibilities. A president, vice president, and treasurer from the same ten has 10P3 = 10 × 9 × 8 = 720. Every committee has 3! = 6 assignments to named offices, and 120 × 6 = 720.

Replacement is a separate decision. With replacement, a selected object returns and later stages keep the same number of choices. Without replacement, it does not return. “Draw three users one at a time and record order” and “choose an unordered sample of three users” can describe the same physical selection, but they use different atomic sample spaces. Either can be valid; mixing their denominators is not.

5. Worked calculation: four fair coin tosses

Question: Four fair coins are tossed. What is the probability of exactly two heads? What is the probability of at least one head?

Step 1 — define one outcome. Record the result of tosses 1 through 4 in order. Each string, such as H T H T, is one outcome. There are:

|Ω| = 2 × 2 × 2 × 2 = 2⁴ = 16

Because the coins are fair and tosses are independent, each ordered string has probability 1/16.

Step 2 — exactly two heads. Choose which two of the four positions contain heads; the other two positions are tails:

|A| = 4C2 = 4! / (2!2!) = 6

The six strings are HHTT, H T H T, H T T H, T H H T, T H T H, T T H H. Therefore:

P(A) = 6/16 = 3/8 = 0.375

Step 3 — at least one head. The direct event contains one, two, three, or four heads, so a disjoint partition would count 4C1 + 4C2 + 4C3 + 4C4 = 4 + 6 + 4 + 1 = 15. The complement is shorter: no heads means the one string T T T T. Thus:

P(≥1 head) = 1 − P(0 heads) = 1 − 1/16 = 15/16 = 0.9375

Tempting error: there are five possible head counts, and four of them are positive, so perhaps the answer is 4/5. That treats the summary categories as equally likely. They are not: two heads has six underlying strings, while four heads has one. Rebuild the atomic sample space before using a count ratio.

6. Unions: add disjoint cases or subtract the overlap

If events A and B cannot happen together, they are mutually exclusive, or disjoint, and:

P(A ∪ B) = P(A) + P(B)

If an outcome can belong to both, direct addition counts the intersection twice. Inclusion–exclusion corrects the duplication:

|A ∪ B| = |A| + |B| − |A ∩ B|

Use a disjoint case split when the cases are easy to make mutually exclusive. Use inclusion–exclusion when the overlap is easy to count and a partition would be awkward. Use a complement when “none” has a compact description. The best method is the one another person can audit, not the one with the most impressive notation.

For example, if a dashboard reports the number of users who clicked a video or opened a notification, ask whether users can do both and whether every term uses the same eligible-user denominator. If they can, add the video count and notification count, then subtract the users who did both—or count distinct users in the union. If the reported union exceeds the eligible population, the double-counting problem has become visible.

7. Worked product scenario: review coverage

Question: A marketplace receives a batch of eight newly onboarded sellers. Two are flagged high-risk and six are not. A reviewer chooses exactly three distinct sellers uniformly without replacement. What is the chance that the review includes at least one high-risk seller? Does that prove the screening rule is accurate?

Step 1 — define the experiment and denominator. The atomic outcome is an unordered set of three sellers. Uniform sampling makes every three-seller subset equally likely, so:

|Ω| = 8C3 = 8! / (3!5!) = 56

Step 2 — count the complement. “No high-risk seller reviewed” means all three come from the six unflagged sellers:

|Ac| = 6C3 = 20

Step 3 — subtract from one. The review catches at least one flagged seller in 56 − 20 = 36 subsets, so:

P(A) = 1 − 20/56 = 36/56 = 9/14 ≈ 0.643

You can audit the same result with disjoint cases: exactly one flagged seller gives 2C1 × 6C2 = 30; exactly two gives 2C2 × 6C1 = 6; total 36. Notice the distinction between this correct case count and the tempting 2C1 × 6C1 = 12, which fills only two of the three review slots. Every case must fill the experiment completely.

Bounded decision: under this batch and sampling design, a random three-seller review encounters at least one flagged seller about 64.3% of the time. That is a coverage probability. It is not screening sensitivity, precision, or proof that the flags are correct. To assess accuracy, the team needs a ground-truth outcome, label-quality audit, and a design that accounts for how the screening rule selected sellers. If the reviewer samples with replacement instead, the no-flag probability is (6/8)³ = 0.421875, giving 57.8%, not 64.3%. The wording “distinct” and “without replacement” does real mathematical work.

8. Failure modes and the nearest alternative

The code explorer shows the most common edge state. With repetition allowed, the complement factors are (n − m)ʳ. When repetition is forbidden, they become (n − m)P r; reusing a power silently violates the experiment. If the generator is weighted—say each slot has an independent 0.4 chance of being marked—then “at least one marked” is 1 − 0.6ʳ. That is a weighted probability calculation, not |A|/|Ω| over equally likely codes. If only marginal probabilities are known and statuses are dependent, the product may fail altogether.

Other frequent errors are treating “at least one” as “exactly one,” using a combination for a ranking, adding overlapping unions, and assuming that visible categories are equally likely. Sanity-check every result: probabilities lie in [0, 1]; counts are integers; a favorable count cannot exceed its denominator; and a result should change when a stated replacement rule changes.

The nearest plausible alternative to exact counting is enumeration or simulation. Enumerate every code when the state space is small; it is an excellent audit of a formula. Simulate when the mechanism has many interacting constraints or the state space is too large to list, and report Monte Carlo error. Neither method repairs a wrong unit, replacement rule, dependence assumption, or biased sampling model. Use exact counting when the finite rules are explicit, enumeration as a check, and simulation when the mechanism is easier to execute than to derive.

Common interview trap

Weak answer: “There are two flagged sellers out of eight, so a three-seller review has probability 2/8 of finding one. I would multiply by three because there are three slots.”

Why it fails: It treats three draws as independent when the review is without replacement, does not define whether order matters, and confuses seller prevalence with the chance of at least one hit. It also skips the complement and cannot tell whether the ratio is about coverage or detector quality.

Corrected answer: “I would define an unordered uniform sample of three distinct sellers from eight. There are 8C3 = 56 review sets. The complement has no flagged seller and contains 6C3 = 20 sets, so the encounter probability is 1 − 20/56 = 9/14 ≈ 64.3%. This is conditional on the sampling design and tells us review coverage, not the screening rule’s accuracy; I would need ground truth and a label audit for that.”

Three quick checks

  1. Why is “two heads” an event rather than an outcome for four tosses?

    An outcome fully specifies all four tosses, such as H T H T. “Two heads” is a set containing the six ordered strings with two heads. The distinction matters because those strings, not the five head-count labels, are equally likely.

  2. When is it safe to add the probabilities of A and B?

    When A and B are disjoint, so no outcome belongs to both. If they overlap, use P(A) + P(B) − P(A ∩ B) or create a disjoint partition.

  3. What changes when a draw switches from with replacement to without replacement?

    The later branch counts change because used objects are removed. Powers such as nʳ become falling products such as nP r, and the denominator and event count must be rebuilt together.

Interview practice bank

  1. What is the difference between an outcome, an event, and a sample space?

    Strong answer: An outcome is one fully specified atomic result; the sample space is all such results; an event is a subset satisfying a condition. For four ordered tosses, one string is an outcome, Ω has 16 strings, and exactly two heads is an event with six strings. Follow-up: Could the number of heads be the sample space? Signal: chooses an atomic level where the probability assignment is clear.

  2. A code has two uppercase letters followed by three digits. How many codes exist with repetition, and without it?

    Strong answer: With repetition, 26² × 10³ = 676,000. If repetition is prohibited within letters and within digits, 26 × 25 × 10 × 9 × 8 = 468,000. Clarify whether “no symbol” means one shared alphabet across letters and digits. Follow-up: What if the first digit cannot be zero? Signal: tracks constraints by stage.

  3. Why is a committee a combination but named offices a permutation?

    Strong answer: Rearranging committee members does not change membership, so use nC r. Assigning president, vice president, and treasurer creates distinct outcomes, so use nP r. Each committee has r! role assignments, which explains the division. Follow-up: What if the committee must contain one of two managers? Signal: explains the semantic decision rather than memorizing notation.

  4. What is the probability that a four-position code has at least one vowel if each position independently has vowel probability 0.2?

    Strong answer: Use the complement: no vowels has probability 0.8⁴, so at least one is 1 − 0.8⁴ = 0.5904. State that independence is required for the product. Follow-up: What if positions are dependent? Signal: attaches the assumption to the arithmetic.

  5. An analyst adds users who clicked A to users who clicked B. What do you check?

    Strong answer: Ask whether users can do both, whether “or” includes both, and whether the denominator, population, time window, and row grain match. If overlap exists, subtract the intersection or count distinct users in the union. Follow-up: How would an event-level table create the error? Signal: connects set algebra to data grain.

  6. When would you use a complement, a case split, or inclusion–exclusion?

    Strong answer: Use a complement when the failure event is smaller, a case split when cases can be made disjoint and fully fill the outcome, and inclusion–exclusion when a union has manageable overlaps. Choose for auditability. Follow-up: Can inclusion–exclusion be valid but a poor presentation? Signal: chooses a method deliberately.

  7. A reviewer selects three of eight sellers, two flagged, without replacement. What do you report?

    Strong answer: There are 8C3 = 56 unordered review sets; no flagged seller has 6C3 = 20, so the chance of at least one is 1 − 20/56 = 9/14 ≈ 64.3%. This is an encounter probability under the sampling design, not precision or recall. Follow-up: What changes with replacement? Signal: carries arithmetic through to a bounded product decision.

  8. Is 1 − 0.99⁴ always the chance of at least one failure when four components each fail with probability 0.01?

    Strong answer: Only under independence and a common trial definition. Shared shocks or common-cause failures can make the actual union probability differ. With only marginal probabilities, state a bound such as the union bound P(∪Eᵢ) ≤ 0.04 or obtain a joint model. Follow-up: What evidence would make independence implausible? Signal: recognizes a convenient formula as assumption-dependent.

Timed synthesis

You have eight minutes: a data platform samples four distinct records from a daily batch of ten for manual QA. Three records have a warning flag. The PM asks, “What is the chance the QA batch catches at least one warning?” Then they ask whether that proves the detector is reliable. Work aloud.

Incomplete: jumps to 10⁴ or a formula without defining an outcome, misses the no-warning complement, or says 83.3% proves reliability. Competent: defines an unordered uniform sample without replacement, computes 1 − 7C4/10C4 = 1 − 35/210 = 5/6 ≈ 83.3%, and names the sampling assumption. Strong: explains why direct “at least one” cases overlap, sanity-checks the count, distinguishes encounter probability from detector precision/recall, and asks for label quality, selection audit, and ground truth before making a reliability claim.

Interview-ready recap

Start with ΩDefine one complete outcome and the event before choosing a formula.

Count pathsMultiply stage choices; if branches differ, sum products over disjoint cases.

Order is semanticPermutations keep position; combinations remove the artificial r! orderings.

Use complements“At least one” often becomes 1 − “none,” with fewer overlapping cases.

Audit unionsAdd only disjoint events, or subtract the intersection.

Name the assumption|A|/|Ω| needs equally likely atomic outcomes; weighted or dependent mechanisms need a different model.

Technical framing and examples were checked against Penn State STAT 414, Counting Techniques, Penn State STAT 414, Properties of Probability, and the MIT OpenCourseWare 18.05 course materials. These sources support the probability language, counting rules, and probability-by-counting assumptions; interview emphasis is calibration, not a claim about any one employer’s universal loop.