Class 12 Maths, Worked in Full Past papersGet updates
Chapter 13 · Probability

Example 18: HIV test: has HIV, given a positive report, P=10121P = \frac{10}{121}

ExamplesBayes' theorem · Section 13.5
The question

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?

Exam answer

Let EE⁠: the person selected has HIV, and AA⁠: the test report is positive (HIV+ive). Then E′E'⁠: the person does not have HIV.

EE and E′E' form a partition of the sample space (a person either has HIV or does not).

P(E)=0.1%=11000P(E) = 0.1\% = \frac{1}{1000}

P(E′)=1−11000=9991000P(E') = 1 - \frac{1}{1000} = \frac{999}{1000}

P(A∣E)=90%=910P(A|E) = 90\% = \frac{9}{10}

P(A∣E′)=1%=1100P(A|E') = 1\% = \frac{1}{100}

By the theorem of total probability,

P(A)=P(E)P(A∣E)+P(E′)P(A∣E′)=11000⋅910+9991000⋅1100=90100000+999100000=1089100000\begin{aligned} P(A) &= P(E)P(A|E) \\ &\quad + P(E')P(A|E') \\ &= \frac{1}{1000}\cdot\frac{9}{10} \\ &\quad + \frac{999}{1000}\cdot\frac{1}{100} \\ &= \frac{90}{100000} + \frac{999}{100000} \\ &= \frac{1089}{100000} \end{aligned}

By Bayes' theorem,

P(E∣A)=P(E)P(A∣E)P(A)=90100000÷1089100000=901089\begin{aligned} P(E|A) &= \frac{P(E)P(A|E)}{P(A)} \\ &= \frac{90}{100000} \div \frac{1089}{100000} \\ &= \frac{90}{1089} \end{aligned}

∴\therefore The probability that the person actually has HIV is 10121≈0.083\dfrac{10}{121} \approx 0.083⁠.

Want the reason behind every step, the basics and the checks?

The one idea this problem is built on

A positive report has two sources. It comes from a person with HIV whose test detects it, or from a person without HIV who gets a false positive. HIV is rare here (1 person in 1000), so even a 1% false-positive rate among the many people without HIV produces far more positive reports than the true positives. Bayes' theorem measures the share of true positives.

Given, to find, and the plan
Given
0.1% of the population has HIV. The test reports positive for 90% of people with HIV and for 1% of people without HIV.
To find
The probability that a person with a positive report actually has HIV: P(E∣A)P(E|A)⁠.
Plan
(1) Name the events; check the partition. (2) Percentages as fractions. (3) Total probability for P(A)P(A)⁠. (4) Bayes' theorem, then simplify.

Basics you need

1Percentages as fractions

x%=x100x\% = \frac{x}{100}⁠; so 0.1%=0.1100=110000.1\% = \frac{0.1}{100} = \frac{1}{1000}⁠. Basics: working with fractions

2Test data are conditional probabilities (Section 13.2)

"Of people having HIV, 90% of the test detect the disease" is P(positive∣HIV)P(\text{positive} \mid \text{HIV})⁠. Lesson: conditional probability

3Complement

P(E′)=1−P(E)P(E') = 1 - P(E)⁠. Basics: rules of probability

4Total probability and Bayes' theorem (Section 13.5)

P(A)P(A) is the sum of the paths to AA⁠; P(E∣A)P(E|A) is the EE path divided by P(A)P(A)⁠. Lesson: Bayes' theorem

Solution

  1. Name the events

    Let

    • EE⁠: the person selected has HIV, so E′E'⁠: the person does not have HIV;
    • AA⁠: the person's test is reported positive (HIV+ive).

    {E,E′}\{E, E'\} is a partition of the sample space of all people in the population.

    Having HIV or not is the cause; the positive report is the effect we observe. An event and its complement always form a partition when neither is impossible, so total probability and Bayes' theorem apply.
    {E,E′}\{E, E'\} is a partition. Lesson: Bayes' theorem
  2. Every number as a fraction

    P(E)=0.1%=0.1100=11000,P(E′)=1−11000=9991000,P(A∣E)=90%=90100=910,P(A∣E′)=1%=1100.\begin{aligned} P(E) &= 0.1\% = \frac{0.1}{100} = \frac{1}{1000}, \\ P(E') &= 1 - \frac{1}{1000} = \frac{999}{1000}, \\ P(A|E) &= 90\% = \frac{90}{100} = \frac{9}{10}, \\ P(A|E') &= 1\% = \frac{1}{100}. \end{aligned}
    The person is chosen at random from the population, so the chance of having HIV is the share 0.1%. "Of people having HIV, 90% ... detect the disease" is about people with HIV, so it is P(A∣E)P(A|E)⁠. "Of people free of HIV ... 1% are diagnosed as showing HIV+ive" is P(A∣E′)P(A|E')⁠. The 10% and 99% are the chances of a negative report and are not needed. The book writes the same values as decimals: 0.001, 0.999, 0.9 and 0.01.
    x%=x100x\% = \frac{x}{100}⁠; P(E′)=1−P(E)P(E') = 1 - P(E)⁠. Basics: rules of probability
  3. The chance of a positive report: total probability

    Since EE and E′E' form a partition, by the theorem of total probability

    P(A)=P(E)P(A∣E)+P(E′)P(A∣E′)=11000⋅910+9991000⋅1100=910000+999100000=90100000+999100000=1089100000.\begin{aligned} P(A) &= P(E)P(A|E) \\ &\quad + P(E')P(A|E') \\ &= \frac{1}{1000}\cdot\frac{9}{10} \\ &\quad + \frac{999}{1000}\cdot\frac{1}{100} \\ &= \frac{9}{10000} + \frac{999}{100000} \\ &= \frac{90}{100000} + \frac{999}{100000} \\ &= \frac{1089}{100000}. \end{aligned}
    start HIV status test report multiply along the path person E: has HIV A: +ive 1/1000 × 9/10 A′: −ive 1/1000 × 1/10 E′: no HIV A: +ive 999/1000 × 1/100 A′: −ive 999/1000 × 99/100 1/1000 9/10 1/10 999/1000 1/100 99/100
    The tree for Example 18. The rose path (HIV, then positive) has product 910000=90100000\frac{9}{10000} = \frac{90}{100000}⁠; the green path (no HIV, then a false positive) has 999100000\frac{999}{100000}⁠, about eleven times as much.
    A positive report happens through a true positive or a false positive, never both, so the two path probabilities add. To add them, write 910000\frac{9}{10000} as 90100000\frac{90}{100000}⁠.
    Multiply along a path, add the paths. Basics: tree diagrams
  4. Has HIV, given a positive report: Bayes' theorem

    By Bayes' theorem,

    P(E∣A)=P(E)P(A∣E)P(A)=90100000÷1089100000=901089.\begin{aligned} P(E|A) &= \frac{P(E)P(A|E)}{P(A)} \\ &= \frac{90}{100000} \div \frac{1089}{100000} \\ &= \frac{90}{1089}. \end{aligned}

    Both 90 and 1089 are divisible by 9: 90=9×1090 = 9 \times 10 and 1089=9×1211089 = 9 \times 121⁠. So

    P(E∣A)=10121≈0.083.P(E|A) = \frac{10}{121} \approx 0.083.
    The top is the true-positive path; the bottom is all positive reports. The common denominator 100000 cancels. 10=2×510 = 2 \times 5 and 121=112121 = 11^2 share no factor, so 10121\frac{10}{121} is in lowest terms. The book stops at 901089\frac{90}{1089} and gives "0.083 approx.", which is 10121=0.0826…\frac{10}{121} = 0.0826\ldots rounded to three places.
    Simplify by the highest common factor, here 9. Basics: working with fractions
  5. What the answer means

    Only about 8 in 100 people with a positive report actually have HIV; the rest are false positives: P(E′∣A)=9991089=111121P(E'|A) = \frac{999}{1089} = \frac{111}{121}⁠, and 10121+111121=1\frac{10}{121} + \frac{111}{121} = 1⁠.

    The report still matters: it raises the chance of HIV from 11000\frac{1}{1000} to 10121\frac{10}{121}⁠, more than 80 times. That is why a positive screening test is followed by a second, confirmatory test.

    People without HIV outnumber people with HIV 999 to 1. One in a hundred of them gets a false positive, so there are about 11 false positives for every true one (999÷90≈11999 \div 90 \approx 11⁠).
    P(E∣A)+P(E′∣A)=1P(E|A) + P(E'|A) = 1 for a partition. Lesson: Bayes' theorem
Result

The probability that a person with a positive report actually has HIV is 901089=10121≈0.083\frac{90}{1089} = \frac{10}{121} \approx 0.083⁠.

(Textbook answer: 901089≈0.083\frac{90}{1089} \approx 0.083⁠.)

Check it with numbers

Picture 1 000 000 people. 0.1%0.1\% of them, 1000, have HIV, and 90% of these, 900, are reported positive. The other 999 000 do not have HIV, and 1% of them, 9990, are reported positive too. So 900+9990=10890900 + 9990 = 10890 people are reported positive, and 900 of them have HIV: 90010890≈0.0826\frac{900}{10890} \approx 0.0826⁠, the same as 10121≈0.0826\frac{10}{121} \approx 0.0826⁠.

Common mistakes
  1. Answering 0.9. 90% is P(A∣E)P(A|E)⁠, the chance that a person with HIV tests positive. The question asks for P(E∣A)P(E|A)⁠, the chance that a person who tests positive has HIV.
  2. Writing 0.1% as 1100\frac{1}{100}⁠. 0.1%=0.1100=110000.1\% = \frac{0.1}{100} = \frac{1}{1000}⁠.
  3. Using 99% instead of 1%. The false-positive rate is 1%; 99% is the chance that a person without HIV is (correctly) reported negative.
What to take away
  1. For a rare condition, false positives from the large healthy group can outnumber the true positives, even for a good test.
  2. A large round population (here a million) turns the question into counting and is a quick check.
  3. The same calculation with other numbers: Exercise 13.3, Question 5.

Every fact used, and where it comes from

FactUsed inSource
An event and its complement form a partitionStep 1Section 13.5.1 (Lesson: Bayes' theorem)
x%=x100x\% = \frac{x}{100} and P(E′)=1−P(E)P(E') = 1 - P(E)Step 2Class XI (Basics: rules of probability)
Conditional probability P(A∣E)P(A|E)Step 2Section 13.2 (Lesson: conditional probability)
Theorem of total probabilityStep 3Section 13.5.2 (Lesson: total probability)
Bayes' theoremSteps 4, 5Section 13.5 (Examples 15 to 21)
Cancelling a common factorStep 4Arithmetic (Basics: working with fractions)
Found an error, or want more?

Tell us if something on this page is wrong or unclear, or if you would like a fuller explanation, another method or a new feature. Send feedback on this problem →