Lesson 2 of 15

Probability Axioms & Addition Rule

Kolmogorov's Axioms

Every probability measure PP must satisfy three axioms:

  1. Non-negativity: P(A)0P(A) \geq 0 for all events AA
  2. Normalization: P(Ω)=1P(\Omega) = 1
  3. Countable additivity: if AB=A \cap B = \emptyset, then P(AB)=P(A)+P(B)P(A \cup B) = P(A) + P(B)

These three axioms are all you need to derive all of probability theory.

The Addition Rule

For any two events (not necessarily disjoint):

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

The P(AB)P(A \cap B) term corrects for double-counting outcomes in both AA and BB.

# Drawing a card: P(heart or face card)
p_heart = 13/52       # P(A)
p_face  = 12/52       # P(B)
p_both  = 3/52        # P(A ∩ B): face cards that are hearts

p_union = p_heart + p_face - p_both
print(round(p_union, 4))  # 0.4231

Mutually exclusive events (AB=A \cap B = \emptyset) simplify to P(AB)=P(A)+P(B)P(A \cup B) = P(A) + P(B).

Your Task

Implement union_probability(p_a, p_b, p_ab) that returns P(AB)P(A \cup B), rounded to 4 decimal places.

Pyodide loading...
Loading...
Click "Run" to execute your code.