Sample Spaces, Events & Basic Probability Rules

Probability & Statistics Fundamentals

Chapter 2 · Sample Spaces, Events & Basic Probability Rules

Every probability question starts by pinning down two things precisely: every outcome that could possibly happen, and the specific outcomes you actually care about. Get those two definitions right, and most basic probability calculations turn into simple counting — genuinely just set operations wearing a different name.

Sample Space & Events

The sample space (usually written S) is the set of every possible outcome of an experiment. An event is any subset of that sample space — the specific outcomes that count as a "success" for whatever question is being asked.

Worked example: rolling a single six-sided die
S = {1, 2, 3, 4, 5, 6}
Event A ("rolling an even number") = {2, 4, 6}
Event B ("rolling a number greater than 4") = {5, 6}
This is exactly set theory, applied
A sample space is a set; an event is a subset. "A and B" is the intersection A ∩ B; "A or B" is the union A ∪ B; "not A" is the complement. Every probability rule in this chapter is really a Discrete Mathematics Fundamentals Chapter 4 set operation, counted and divided.

Computing Probability for Equally Likely Outcomes

When every outcome in the sample space is equally likely (a fair die, a fair coin), probability is a straightforward ratio:

The equally-likely-outcomes formula
P(event) = |event| / |sample space|

For event A above: P(A) = |{2,4,6}| / |{1,...,6}| = 3/6 = 0.5. For event B: P(B) = |{5,6}| / 6 = 2/6 = 1/3.

This formula only works because the outcomes are equally likely
A biased die, a loaded coin, or almost any real-world event (a server failing, a user clicking) does not have equally likely outcomes — this simple counting formula breaks down immediately. It's a useful starting tool, not a general-purpose one; later chapters build the machinery (random variables, distributions) that handles the general case properly.

The Probability Axioms

Every valid probability assignment must satisfy three basic rules, regardless of how the probabilities were derived:

AxiomMeaning
Non-negativity0 ≤ P(event) ≤ 1 for any event
CertaintyP(S) = 1 — something in the sample space is guaranteed to happen
ImpossibilityP(∅) = 0 — the empty event (no outcomes) never happens

The Complement Rule

The complement of an event, written Aᶜ ("not A"), is every outcome not in A. Since A and Aᶜ together always cover the whole sample space exactly once:

Complement rule
P(Aᶜ) = 1 − P(A)

The probability of not rolling a 6: P(not 6) = 1 − 1/6 = 5/6. Often faster than counting the complement's outcomes directly, especially when "not A" covers far more cases than "A" does.

The Union (Addition) Rule

For "A or B," the naive instinct is to add P(A) + P(B) — but that double-counts any outcome that belongs to both events. The correct rule subtracts the overlap back out:

Union rule
P(A ∪ B) = P(A) + P(B) − P(A ∩ B)

Continuing the dice example: A ∩ B = {6} (even and greater than 4), so P(A ∩ B) = 1/6.

QuantityValue
P(A) + P(B)0.5 + 0.333 = 0.833 (5/6) — wrong, double-counts 6
P(A) + P(B) − P(A ∩ B)0.5 + 0.333 − 0.167 = 0.667 (2/3) — correct
Direct check: |A ∪ B| / |S|{2,4,5,6} → 4/6 = 2/3 ✓ matches
The double-counting mistake, made concrete
Naively adding P(A) + P(B) counts outcome 6 twice — once as part of "even," once as part of "greater than 4" — inflating the true answer. Whenever two events can genuinely overlap, skipping the − P(A ∩ B) term silently overstates the real probability.

Mutually Exclusive Events — When the Simple Sum Is Correct

If two events can never both happen at once (A ∩ B = ∅), they're called mutually exclusive — and the subtraction term simply vanishes, since P(∅) = 0:

Union rule for mutually exclusive events
P(A ∪ B) = P(A) + P(B) — only valid when A ∩ B = ∅

Rolling a 1 (C = {1}) and rolling a 6 (D = {6}) can never both happen on the same roll: P(C ∪ D) = 1/6 + 1/6 = 1/3 — directly correct here, with no overlap to subtract.

Sample Spaces & Events in Code

S = {1, 2, 3, 4, 5, 6} A = {2, 4, 6} # even B = {5, 6} # greater than 4 def prob(event, sample_space): return len(event) / len(sample_space) P_A = prob(A, S) P_B = prob(B, S) P_A_and_B = prob(A & B, S) # set intersection P_A_or_B = prob(A | B, S) # set union # the union rule, verified directly against the real set union above assert abs((P_A + P_B - P_A_and_B) - P_A_or_B) < 1e-9 print(P_A, P_B, P_A_and_B, P_A_or_B) # 0.5 0.333... 0.1666... 0.6666...

Hands-On Exercises

Exercise 1

A standard 52-card deck. Event A = "drawing a heart" (13 cards). Event B = "drawing a face card" (Jack, Queen, or King — 12 cards total across all suits). Compute P(A), P(B), and P(A ∩ B) (hearts that are also face cards), then use the union rule to find P(A ∪ B). Confirm your answer by directly counting how many of the 52 cards satisfy "heart or face card."

📄 View solution
Exercise 2

Out of 500 requests handled by a service last week, 15 returned an error. Using the complement rule, compute the probability that a randomly selected request from that week did not return an error.

📄 View solution
Exercise 3

Rolling a single die: event E = "rolling an odd number" ({1,3,5}), event F = "rolling a number less than 4" ({1,2,3}). Compute P(E), P(F), and P(E ∩ F), then use the union rule to find P(E ∪ F). Separately, compute the naive (incorrect) sum P(E) + P(F) and explain specifically which outcome(s) it double-counts.

📄 View solution

Chapter 2 Quick Reference

  • Sample space = every possible outcome; event = a subset of the sample space
  • Equally-likely-outcomes formula: P(event) = |event| / |sample space| — only valid when every outcome is equally likely
  • Axioms: 0 ≤ P(event) ≤ 1, P(S) = 1, P(∅) = 0
  • Complement rule: P(Aᶜ) = 1 − P(A)
  • Union rule: P(A ∪ B) = P(A) + P(B) − P(A ∩ B) — the subtraction fixes double-counting the overlap
  • Mutually exclusive events (A ∩ B = ∅) simplify to P(A ∪ B) = P(A) + P(B), with nothing to subtract
  • Next chapter: Conditional probability and independence