# Perplexity - Bayes Rule
## Metadata
**Status**:: #x
**Zettel**:: #zettel/fleeting
**Created**:: [[2025-11-04]]
## Synopsis
Bayes's rule is a fundamental theorem in probability theory that describes how to update our beliefs about an event based on new evidence. Mathematically, it expresses the relationship between conditional probabilities:
$
P(A|B) = \frac{P(B|A) \cdot P(A)}{P(B)}
$
Where:
- $P(A|B)$ is the posterior probability—the probability of event A occurring given that event B has occurred
- $P(B|A)$ is the likelihood—the probability of observing B given that A is true
- $P(A)$ is the prior probability—our initial belief about the probability of A before seeing evidence B
- $P(B)$ is the evidence or marginal probability—the total probability of observing B
## Understanding the Components
The **prior** $P(A)$ represents what you believed before gathering new information. The **likelihood** $P(B|A)$ tells you how probable your evidence is if your hypothesis is true. Together, they help you compute the **posterior** $P(A|B)$, which is your updated belief after considering the evidence.
The denominator $P(B)$ acts as a normalizing constant. It can be expanded as $P(B) = P(B|A) \cdot P(A) + P(B|\neg A) \cdot P(\neg A)$, which sums the probability of observing B across all possible scenarios. So the equation can be written as:
$
P(A|B)\propto P(B|A)\cdot P(A)
$
## Practical Example
Imagine you're testing for a rare disease that affects 1 in 1,000 people. The test is 99% accurate (it correctly identifies both sick and healthy people 99% of the time).
If you test positive, what's the probability you actually have the disease?
Using Bayes's rule:
- $P(\text{Disease})$ = 0.001 (prior—the disease is rare)
- $P(\text{Positive}|\text{Disease})$ = 0.99 (likelihood—test accuracy if sick)
- $P(\text{Positive})$ = 0.99 × 0.001 + 0.01 × 0.999 ≈ 0.01099
$
P(\text{Disease}|\text{Positive}) = \frac{0.99 \times 0.001}{0.01099} \approx 0.09 \text{ or } 9\%
$
Despite the positive test, there's only about a 9% chance you have the disease—because the disease is so rare that false positives are more common than true positives.