Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I have the following events:

  • Event A: Contracted HIV
  • Event B: Tested Positive with HIV

Given $1$ in $1000$ people gets contracted with HIV and the HIV Test gives a wrong test result for $1$ in $100$ people. If a person is tested Positive with HIV, I need to find the probability of him really contracted with HIV.

So I need to find $P(A|B)$ and that $P(A|B)=\frac{P(B|A) \cdot P(A)}{P(B)}$.

To find $P(B)$, I need to find all that are tested positive. So...

$P(B)=\frac{1}{1000} \cdot \frac{99}{100}+\frac{999}{1000} \cdot \frac{1}{100}=\frac{1098}{100000}$

$P(B|A)=\frac{1}{1000} \cdot \frac{99}{100}=\frac{99}{100000}$


Therefore, $P(A|B)=\frac{P(B|A) \cdot P(A)}{P(B)}=\frac{\frac{99}{100000}\cdot \frac{1}{1000}}{\frac{1098}{100000}}=\frac{11}{122000}=0.0000901639=0.009016\%$

While this may seem ok to me at first, I suspected my answer to be wrong because $0.009016\%$ as a figure is a little hard to believe. I did a search on the internet and looks like the answer could be just $ \frac{99}{1098} = 9.016\% $.

Is my initial answer wrong? What has gone wrong with my initial answer of $0.009016\%$? I simply followed the Bayes' Conditional formula.

share|cite|improve this question
$P(B|A)$ should be $99/100$, as this is the probability that the test will not be wrong on someone who has HIV. This is where the $1000\times$ discrepancy between your answer and the correct one lies. – Alex Becker Jan 17 '12 at 6:02
$P(B|A)=0.99$. You got a far smaller number. – André Nicolas Jan 17 '12 at 6:02
Forget about what operation to use. If a person has HIV (A), what is the probability that the test will be positive (B)? By the information we were given, the test is correct $99$ percent of the time, so given the person has HIV, there is a probability $0.99$ that the test will say yes. By the way, the problem is not well-worded. We are forced to assume that the probability of a false positive is the same as the probability of a false negative, namely $0.01$. For medical tests, the probability of a false positive is often significantly different from the probability of a false negative. – André Nicolas Jan 17 '12 at 6:15
@xEnOn No. $\frac{1}{1000} \cdot \frac{99}{100}$ is the probability of being tested positive AND having HIV for a random person. $\frac{99}{100}$ is the probability of being tested positive for someone with HIV. – Alex Becker Jan 17 '12 at 6:17
@AndréNicolas This is simplified in many ways, so I'm not particularly bothered by that issue. For example, people who are at risk for HIV are probably more likely to get tested as well, but the problem ignores this. – Alex Becker Jan 17 '12 at 6:18
up vote 4 down vote accepted

For convenience, let's say that there are 100,000 people (why I chose 100,000 will hopefully be clear shortly). Since you said 1 in 1000 people has HIV, of our 100,000 people, 100 have HIV and 99,900 do not. Since the HIV test returns an incorrect result 1 in 100 times: of the 100 HIV-positive people, 99 will test positive and 1 will test negative; of the 99,900 HIV-negative people, 98,901 will test negative and 999 will test positive. Making a chart:

                  HIV-positive      HIV-negative      total
tests positive           99               999         1,098
tests negative            1            98,901        98,902
         total          100            99,900       100,000

Now, you wanted the probability that a person who tests positive is actually HIV-positive. 1,098 people tested positive and of those, only 99 were HIV-positive. $$\frac{99}{1098}=\frac{11}{122}\approx 9.01639\%$$

As stated in comments, it's your $P(B|A)$ that's off. $P(B|A)$ is the probability that an HIV-positive person tests positive—in the table above, there are 100 HIV-positive people and 99 test positive, so $$P(B|A)=\frac{99}{100}.$$

You might consider an alternate formula for the conditional probability: $$P(A|B)=\frac{P(A\text{ and }B)}{P(B)}.$$ $P(A\text{ and }B)$ is the probability of a person testing positive and being HIV-positive, which is the 99 out of 100,000 that you computed, so $$P(A|B)=\frac{P(A\text{ and }B)}{P(B)}=\frac{\frac{99}{100000}}{\frac{1098}{100000}}=\frac{99}{1098}=\frac{11}{122}\approx 9.01639\%.$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.