Basic probability rules

Joint, conditional, marginal — the vocabulary of uncertainty

Why

Probability is the language of uncertainty, and ML is fundamentally about making decisions under uncertainty. Every model output that is a "probability" — sigmoid, softmax, language model next-token scores — requires you to understand what a probability actually means and how probabilities relate to each other.

Without this foundation you cannot understand Naive Bayes, Bayesian networks, generative models, or even why cross-entropy loss is the right choice for classification.

Intuition

Think of probability as a budget of belief — you have 1.0 to distribute among all possible outcomes. Joint probability asks: how much of that budget goes to two things happening together? Conditional asks: if I already know B happened, how do I redistribute the remaining budget over A? Marginal asks: ignoring everything else, what's the total budget on A?

The three are connected like different views of the same underlying table of counts.

Explanation
The three core probabilities
P(A) marginal: probability that A happens, ignoring everything else P(A ∩ B) joint: probability that A AND B both happen P(A|B) conditional: probability of A, GIVEN that B already happened Key relation: P(A|B) = P(A ∩ B) / P(B) Intuition: of all the times B happened, how often did A also happen?
Law of total probability

If B can take several values (B₁, B₂, ..., Bₙ) that partition the sample space:

P(A) = P(A|B₁)·P(B₁) + P(A|B₂)·P(B₂) + ... + P(A|Bₙ)·P(Bₙ) = Σᴵ P(A|Bᴵ)·P(Bᴵ)

This lets you compute a marginal by summing over all cases of a conditioning variable. Example: P(spam) = P(spam|"win")·P("win") + P(spam|no "win")·P(no "win").

Independence vs mutual exclusivity — the classic confusion
Independent: P(A ∩ B) = P(A) · P(B) Knowing B tells you NOTHING about A. Example: two separate coin flips. Mutually exclusive: P(A ∩ B) = 0 A and B CANNOT both happen. Example: heads and tails on a single flip. CRITICAL: mutually exclusive events (with P(A), P(B) > 0) are NOT independent. If P(A ∩ B) = 0 then P(A|B) = 0 ≠ P(A) → knowing B happened tells you A definitely did NOT happen.