$P(A \mid B)$ reads "the probability of $A$ given $B$". Instead of comparing $A$ to the whole sample space $\Omega$, we compare it only to the part of $\Omega$ where $B$ happens.
Rearranging the definition on the left gives a way to build a joint probability out of two simpler ones, one of them conditional on the other.
This extends to three or more events by conditioning on everything that came before.
| Symbol | Meaning |
|---|---|
| $P(A \mid B)$ | probability of $A$ given that $B$ has occurred |
| $A \perp B$ | $A$ and $B$ are independent |
| $\{B_1, \dots, B_n\}$ | a partition of $\Omega$: events that share no outcomes with each other, and that together include every outcome in the sample space |
| prior, $P(A)$ | what we believe about $A$ before seeing any evidence |
| likelihood, $P(B \mid A)$ | how likely the evidence $B$ is if $A$ is true |
| posterior, $P(A \mid B)$ | updated belief about $A$ after seeing the evidence $B$ |
$A$ and $B$ are independent when finding out that one happened tells us nothing new about the other. Knowing $B$ occurred does not shift $A$'s probability at all.
Substituting this into the multiplication rule gives the usual test for independence.
| Scenario | Event A | Event B | P(A) | P(A|B) | Independent? |
|---|---|---|---|---|---|
| Two separate die rolls | second die is 6 | first die is 6 | $\frac{1}{6} \approx 0.167$ | $\frac{1}{6} \approx 0.167$ | yes, equal |
| Drawing without replacement | second card is a king | first card is a king | $\frac{4}{52} \approx 0.077$ | $\frac{3}{51} \approx 0.059$ | no, they differ |
A partition is a group of events that satisfies two conditions:
Every day the weather is classified as exactly one of three types.
$\{\text{sunny}, \text{cloudy}, \text{rainy}\}$ is a partition.
To find $P(A)$ when you don't know it directly, break the sample space into the branches of a partition $B_1, \dots, B_n$, then weight the probability of $A$ within each branch by how likely that branch is.
With two branches, $B_1$ and $B_2$:
Two factories supply a warehouse. We want the probability that a randomly picked part is defective.
This calculates $P(A)$, the overall probability that a randomly picked part is defective:
The definition of conditional probability works both ways: it can be written starting from $A$, or starting from $B$.
Equating both expressions we get Bayes' theorem:
The denominator can be expanded with the law of total probability whenever $A$ and its complement form a partition.
A disease affects part of the population, and a test can detect it, but not perfectly. We want the probability that a person actually has the disease, given that they tested positive.
First we need $P(T)$, the overall probability of testing positive, using the law of total probability:
Now we can calculate $P(D \mid T)$, the probability that a person actually has the disease given a positive test:
Even after a positive result, there is only about a $15\%$ chance of actually having the disease, because false alarms from the huge healthy group outnumber true positives from the small sick group.
Your first pick has a $\frac{1}{3}$ chance of being the car and a $\frac{2}{3}$ chance of being a goat. The host's move never changes those odds attached to your original door, it only tells you which of the other two doors to avoid.
| Strategy | Wins the car when | Probability |
|---|---|---|
| Stay | your first pick was already the car | $\frac{1}{3}$ |
| Switch | your first pick was a goat, which is the more likely start | $\frac{2}{3}$ |
Pick a door. The host will open one of the other two, always revealing a goat, then you decide: stay, or switch to the last unopened door.