🔁 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(BA)P(B \mid A)

But many real problems ask:

P(AB)P(A \mid B)

Bayes' theorem connects both.


Bayes' Theorem Formula

Mathematical Formula

P(AB)=P(BA)×P(A)P(B)P(A \mid B) = \frac{P(B \mid A) \times P(A)}{P(B)}

Where:

  • P(A)P(A) → Prior probability
  • P(BA)P(B \mid A) → Likelihood
  • P(B)P(B) → Evidence
  • P(AB)P(A \mid B) → Posterior probability

Probability Terminology

TermMeaning
PriorInitial belief (before evidence)
LikelihoodProbability of evidence given cause
PosteriorUpdated probability (after evidence)
EvidenceTotal probability of evidence

Example (Medical Test )

A disease affects 1% of population.

  • Probability that a person has disease:
P(D)=0.01P(D) = 0.01

Test accuracy:

  • Test positive if disease present:
P(+D)=0.99P(+ \mid D) = 0.99
  • Test positive if disease NOT present:
P(+D)=0.05P(+ \mid \overline{D}) = 0.05

👉 If a person tests positive, find probability that the person actually has disease.


Step 1: Define Events

  • D → Person has disease
  • D\overline{D} → Person does not have disease
  • + → Test is positive

Step 2: Write Given Data

QuantityValue
P(D)P(D)0.01
P(D)P(\overline{D})0.99
P(+D)P(+ \mid D)0.99
P(+D)P(+ \mid \overline{D})0.05

Step 3: Calculate Evidence P(+)

P(+)=P(+D)×P(D)+P(+D)×P(D)P(+) = P(+ \mid D) \times P(D) + P(+ \mid \overline{D}) \times P(\overline{D})
TermCalculationValue
P(+ | D) x P(D)0.99 x 0.010.0099
P(+ | D̄) x P(D̄)0.05 x 0.990.0495
Total P(+)0.0594

Step 4: Apply Bayes' Theorem

P(D+)=P(+D)×P(D)P(+)P(D \mid +) = \frac{P(+ \mid D) \times P(D)}{P(+)}
P(D+)=0.00990.05940.1667P(D \mid +) = \frac{0.0099}{0.0594} \approx 0.1667
P(D+)0.1667P(D \mid +) \approx 0.1667

Step 5: Final Answer

Probability that a person actually has disease after testing positive16.67%\text{Probability that a person actually has disease after testing positive} \approx 16.67\%

🗣 Hinglish Tip: Test positive hone ka matlab confirm disease nahi hota


Liked This Tutorial

Scan QR Code To Leave A Review Or

Click Here To Leave A Review
Scan QR