Definition
\( \mathbb{P}(A|B) \) is the probability of event \(A\) given that event \(B\) occurs:
$$ \mathbb{P}(A|B) = \frac{\mathbb{P}(A \cap B)}{\mathbb{P}(B)} $$
Notice that if \(P(B) = 0\) then it’s meaningless to condition \(A\) on \(B\).
from __future__ import annotations
import pandas as pd
from .probability_defn import probability
def conditional_probability(
proposition: pd.Series[bool], given: pd.Series[bool]
) -> float:
# proposition[given] contains the values of proposition for given.
return probability(proposition[given])
Satisfying the Axioms of Probability
Axiom 1: Normalization
$$ \mathbb{P}(B|B) = \frac{\mathbb{P}(B \cap B)}{\mathbb{P}(B)} = 1 $$
Axiom 2: Non-negativity
Because \(A \cap B \subseteq B \), then \( 0 \le \mathbb{P}(A|B) \le 1 \).
Axiom 3: Additivity
Let \(A\) and \(C\) be mutually exclusive, then:
$$ (A \cup C) \cap B = (A \cap B) \cup (C \cap B) $$
… and \(\mathbb{P}((A \cup C) | B)\) is:
$$ = \frac{ \mathbb{P}((A \cup C) \cap B) }{ \mathbb{P}(B) } $$ $$ = \frac{ \mathbb{P}(A \cap B) }{\mathbb{P}(B)} + \frac{ \mathbb{P}(C \cap B) }{\mathbb{P}(B)} $$ $$ = \mathbb{P}(A | B) + \mathbb{P}(C | B) $$
References
- ORF 309: Probability and Stochastic Systems. Mykhaylo Shkolnikov. 2017.
- 1. Probability — Think Bayes. Allen Downey. allendowney.github.io . Accessed Sep 17, 2026.