Suppose that bugs are present in 1% of all computer programs. A computer de-bugging program detects an actual bug with probability 0.99, but falsely detects a nonexistent bug with probability .02. Give numerical answers to each of the following questions:

(i) If the de-bugging program claims to have found a bug in program A, what is the probability that the bug is actually present?

(ii) Suppose that Program A is tested twice, the two tests conducted independently. If the de-bugging program claims that bugs are present on both the first and second tests, what is the probability that a bug is actually present?

(iii) Suppose that Program A is tested three times, the three tests conducted independently. If the de-bugging program claims that bugs are present on all three tests, what is the probability that a bug is actually present?

Respuesta :

Answer:

(i) The probability that there is a bug in the program given that the de-bugging program has detected the bug is 0.3333.

(ii) The probability that the bug is actually present given that the de-bugging program claims that bugs are present on both the first and second tests is 0.1111.

(iii) The probability that the bug is actually present given that the de-bugging program claims that bugs are present on all three tests is 0.037.

Step-by-step explanation:

Denote the events as follows:

B = bugs are present in a computer program.

D = a de-bugging program detects the bug.

The information provided is:

[tex]P(B) =0.01\\P(D|B)=0.99\\P(D|B^{c})=0.02[/tex]

(i)

The probability that there is a bug in the program given that the de-bugging program has detected the bug is, P (B | D).

The Bayes' theorem states that the conditional probability of an event E given that another event X has already occurred is:

[tex]P(E|X)=\frac{P(X|E)P(E)}{P(X|E)P(E)+P(X|E^{c})P(E^{c})}[/tex]

Use the Bayes' theorem to compute the value of P (B | D) as follows:

[tex]P(B|D)=\frac{P(D|B)P(B)}{P(D|B)P(B)+P(D|B^{c})P(B^{c})}=\frac{(0.99\times 0.01)}{(0.99\times 0.01)+(0.02\times (1-0.01))}=0.3333[/tex]

Thus, the probability that there is a bug in the program given that the de-bugging program has detected the bug is 0.3333.

(ii)

The probability that a bug is actually present given that the de-bugging program claims that bug is present is:

P (B|D) = 0.3333

Now it is provided that two tests are performed on the program A.

Both the test are independent of each other.

The probability that the bug is actually present given that the de-bugging program claims that bugs are present on both the first and second tests is:

P (Bugs are actually present | Detects on both test) = P (B|D) × P (B|D)

                                                                                     [tex]=0.3333\times 0.3333\\=0.11108889\\\approx 0.1111[/tex]

Thus, the probability that the bug is actually present given that the de-bugging program claims that bugs are present on both the first and second tests is 0.1111.

(iii)

Now it is provided that three tests are performed on the program A.

All the three tests are independent of each other.

The probability that the bug is actually present given that the de-bugging program claims that bugs are present on all three tests is:

P (Bugs are actually present | Detects on all 3 test)

= P (B|D) × P (B|D) × P (B|D)

[tex]=0.3333\times 0.3333\times 0.3333\\=0.037025927037\\\approx 0.037[/tex]

Thus, the probability that the bug is actually present given that the de-bugging program claims that bugs are present on all three tests is 0.037.