## Definition
==Bayes' Theorem== is a formula for updating the probability of a hypothesis given new evidence. It relates the posterior probability to the prior probability, the likelihood of the evidence given the hypothesis, and the total probability of the evidence.
$ P(H \mid E) = \frac{P(E \mid H) \cdot P(H)}{P(E)} $
> [!example]- A medical test is 99% accurate. If the disease affects 1% of the population, what is the probability a positive result is truly positive?
> Let $D$ = has disease, $+$ = positive test.
>
> We know $P(D) = 0.01$, $P(+\mid D) = 0.99$, and $P(+\mid \neg D) = 0.01$.
>
> By Bayes' Theorem:
> $ P(D\mid +) = \frac{P(+\mid D) \cdot P(D)}{P(+\mid D) \cdot P(D) + P(+\mid \neg D) \cdot P(\neg D)} = \frac{0.99 \times 0.01}{0.99 \times 0.01 + 0.01 \times 0.99} = 0.50 $
>
> Despite the test's 99% accuracy, a positive result only gives a 50% chance of actually having the disease — because the disease is so rare, false positives from the healthy population are just as numerous as true positives.