Bayes rule helps us calculate conditional probabilities (as well as anchoring an entire field of statistics). $P(A|B) = \frac{P(B|A) * P(A)}{P(B)}$ To get Bayes Rule, note that $P(A|B) = \frac{P(A \cap B)}{P(B)}$ from the law of conditional probability. We can get $P(A|B) * P(B) = P(A \cap B)$ from multiplication. By symmetry, we know that $P(A \cap B) = P(B \cap A) = P(B|A) * P(A)$. Substituting this last term for the right half of the equation we get $P(A|B) * P(B) = P(B|A) * P(A)$. Divide both sides by $P(B)$ and you get Bayes Rule. ## Bayes rule using the law of total probability In practice, it is often easier to solve Bayes Rule if we expand the denominator $P(B)$ using the [[law of total probability]]. $P(A|B) = \frac{P(B|A) * P(A)}{P(B|A) * P(A) + P(B|A') * P(A')}$ For a gentle introduction to how Bayes rule works, including the use of the law of total probability, review [Think Bayes](https://allendowney.github.io/ThinkBayes2/chap02.html) chapter 2.