Skip to content
Worked Examples · Example 18

Q.Suppose that the reliability of a HIV test is specified as follows: Of people having HIV, 90% of the test detect the disease but 10% go undetected. Of people free of HIV, 99% of the test are judged HIV−-ive but 1% are diagnosed as showing HIV++ive. From a large population of which only 0.1% have HIV, one person is selected at random, given the HIV test, and the pathologist reports him/her as HIV++ive. What is the probability that the person actually has HIV?

Jammu Kashmir JkboseTextbookSubjective· 5mImportance★★★★★
41% · 67/165 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

This is a classic Bayes' theorem problem. We are given the test's sensitivity (90% true positive rate) and specificity (99% true negative rate), and a very low disease prevalence (0.1%). Even with a positive test result, the probability that the person actually has HIV is only about 8.3% — because the false positives from the huge healthy population swamp the true positives.


Why Bayes' theorem is the natural tool

We want P(HIV∣positive)P(\text{HIV} \mid \text{positive}). That's a conditional probability where the condition (the test result) is observed, but we need to reverse the direction of the given conditional probabilities. The test tells us P(positive∣HIV)P(\text{positive} \mid \text{HIV}) and P(negative∣no HIV)P(\text{negative} \mid \text{no HIV}), but we need the inverse.

Bayes' theorem is exactly the formula for this reversal. It combines:

  • The prior probability of having HIV (the population prevalence: 0.1%)
  • The likelihood of a positive test given HIV (90%)
  • The total probability of a positive test (which includes both true positives and false positives)

The result is the posterior probability — our updated belief after seeing the positive test.


Step-by-step solution

1. Define the events clearly

Let HH = person has HIV, and T+T^+ = test reports positive.

From the problem:

  • P(H)=0.1%=0.001P(H) = 0.1\% = 0.001 (prevalence)
  • P(T+∣H)=90%=0.9P(T^+ \mid H) = 90\% = 0.9 (sensitivity — true positive rate)
  • P(T−∣H‾)=99%=0.99P(T^- \mid \overline{H}) = 99\% = 0.99 (specificity — true negative rate)

Therefore:

  • P(H‾)=1−0.001=0.999P(\overline{H}) = 1 - 0.001 = 0.999
  • P(T+∣H‾)=1−0.99=0.01P(T^+ \mid \overline{H}) = 1 - 0.99 = 0.01 (false positive rate)

2. Find the total probability of a positive test

A positive test can happen in two ways:

  • The person has HIV and the test correctly detects it: P(H)×P(T+∣H)P(H) \times P(T^+ \mid H)
  • The person does not have HIV and the test falsely says positive: P(H‾)×P(T+∣H‾)P(\overline{H}) \times P(T^+ \mid \overline{H})

By the law of total probability:

P(T+)=P(H)⋅P(T+∣H)+P(H‾)⋅P(T+∣H‾)P(T^+) = P(H) \cdot P(T^+ \mid H) + P(\overline{H}) \cdot P(T^+ \mid \overline{H})

Substitute the numbers:

P(T+)=(0.001)(0.9)+(0.999)(0.01)P(T^+) = (0.001)(0.9) + (0.999)(0.01)

Compute each term:

  • True positives: 0.001×0.9=0.00090.001 \times 0.9 = 0.0009
  • False positives: 0.999×0.01=0.009990.999 \times 0.01 = 0.00999

So:

P(T+)=0.0009+0.00999=0.01089P(T^+) = 0.0009 + 0.00999 = 0.01089

Note

Notice that false positives (0.00999) are more than 11 times the true positives (0.0009). This is the key reason the posterior probability is so low — the healthy population is huge, so even a tiny false positive rate produces many false positives.

3. Apply Bayes' theorem

We want P(H∣T+)P(H \mid T^+):

P(H∣T+)=P(H)⋅P(T+∣H)P(T+)P(H \mid T^+) = \frac{P(H) \cdot P(T^+ \mid H)}{P(T^+)} …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.