# Updating the prior, conditional probability (Bayes) problem

I've been trying to understand very hard this exercise, but I haven't been able to understand how it's solved. The topic is Bayes's theorem. This is the same exercise stated here but that question doesn't have an answer and I went a bit forward. The exercise says:

A woman lives in a country where only 1 out of 1000 people has the virus. There is a test available that gives a positive result 5% of the time when the patient does not have Zika and a negative result 1% of the time when the patient does have Zika. Otherwise, it gives correct results.

The questions are:

1. What's the woman's chance of having the virus, conditional on a positive test?
2. Let the conditional probability computed in (1) serve as the new prior. Compute the new probability that she has the virus (new posterior) based on her receiving a second positive test.
3. How many consecutive positive test results would she have to receive in total (including the two previous test results) in order to be at least 95% sure that she has the virus?

Solving the problem

We have that:

$$\begin{equation} P(Z)=0.001 \\ P(+|Z^{c})=0.05 \implies P(-|Z^{c})=0.95 \small\text{ positive and negative test given that doesn't have the virus} \\ P(-|Z)=0.01 \implies P(+|Z)=0.99 \small\text{ negative and positive test given that does have the virus} \\ P(A|B)= \frac{P(B|A)*P(A)}{P(B|A)*P(A) + P(B|A^{c})*P(A^{c})} \small\text{by Bayes theorem}\\ \end{equation}$$

For problem 1 (which is right!) $$\begin{equation} P(Z|+)=\frac{P(+|Z)*P(Z)}{P(+|Z)*P(Z)+P(+|Z^{c})*P(Z^{c})}=\frac{0.99*0.001}{0.99*0.001+0.05*0.999}=0.019 \end{equation}$$

Problem 2 and 3 I haven't been able to solve them accordingly. The solution for problem 2 is: The solution for problem 3: My questions

• A. I understand how the first problem is solved, but I haven't found where that equation from Bayes Theorem comes from. I haven't even found a name for that equation to search in google, as when I look for Bayes theorem or conditional Bayes, always shows the typical Bayes equation. So, where does that Bayes equation comes from?
• B. I understand that problems 2 and 3 are solved by updating the prior. But how is that procedure? I tried looking it up but the number $$0.981$$ from solution 2 comes from nowhere (As I see it). So, what's the procedure which I should iterate in order to answer question 2 and 3?
• A hint: Search for "law of total probability" and try if you can use that law to transform the denominator in the "typical Bayes equation", as you call it, in a way that will turn it into the equation that was given to you Oct 15, 2022 at 18:46
• Another hint: 0.981 = 1-0.019 Oct 15, 2022 at 18:48