🔁 Bayes’ Theorem
Last Updated: Jan 2026
Bayes’ Theorem helps us update probability when new information is available.
It answers questions like:
- What is the probability of cause, given the result?
- How to reverse conditional probability
Bayes’ theorem is the backbone of:
- Machine Learning (Naive Bayes)
- Medical diagnosis
- Spam filtering
- Decision making
🗣 Hinglish Tip: Bayes = result dekh kar cause ka chance nikalna
Why Bayes’ Theorem is Needed?
Conditional probability gives:
P(B | A)
But many real problems ask:
P(A | B)
Bayes’ theorem connects both.
Bayes’ Theorem Formula
Mathematical Formula
P(A | B) = P(B | A) × P(A) / P(B)
Where:
P(A)→ Prior probabilityP(B | A)→ LikelihoodP(B)→ EvidenceP(A | B)→ Posterior probability
Probability Terminology
| Term | Meaning |
|---|---|
| Prior | Initial belief (before evidence) |
| Likelihood | Probability of evidence given cause |
| Posterior | Updated probability (after evidence) |
| Evidence | Total probability of evidence |
Example (Medical Test )
A disease affects 1% of population.
- Probability that a person has disease:
P(D) = 0.01
Test accuracy:
- Test positive if disease present:
P(+ | D) = 0.99
- Test positive if disease NOT present:
P(+ | D̄) = 0.05
👉 If a person tests positive, find probability that the person actually has disease.
Step 1: Define Events
D→ Person has diseaseD̄→ Person does not have disease+→ Test is positive
Step 2: Write Given Data
| Quantity | Value |
|---|---|
| P(D) | 0.01 |
| P(D̄) | 0.99 |
| P(+ | D) | 0.99 |
| P(+ | D̄) | 0.05 |
Step 3: Calculate Evidence P(+)
P(+) = P(+ | D) × P(D) + P(+ | D̄) × P(D̄)
| Term | Calculation | Value |
|---|---|---|
| P(+ | D) × P(D) | 0.99 × 0.01 | 0.0099 |
| P(+ | D̄) × P(D̄) | 0.05 × 0.99 | 0.0495 |
| Total P(+) | — | 0.0594 |
Step 4: Apply Bayes’ Theorem
P(D | +) = P(+ | D) × P(D) / P(+)
P(D | +) = 0.0099 / 0.0594
P(D | +) ≈ 0.1667
Step 5: Final Answer
Probability that a person actually has disease after testing positive ≈ 16.67%
🗣 Hinglish Tip: Test positive hone ka matlab confirm disease nahi hota