Suppose that a computer program is known to have one (and only one \"bug\", whic
ID: 3202138 • Letter: S
Question
Suppose that a computer program is known to have one (and only one "bug", which is considered equally likely to be in any one of three subroutines. Suppose that your ability to find bugs when you search for them is good but not perfect: if the bug is really in subroutine i (i = 1, 2, 3), then a check of subroutine i will reveal the bug with probability .9. In other words, even when the bug is in the subroutine that you check, the probability is .1 that you fail to spot it. Assume that you never mistakenly find a bug in a subroutine where it is not. If you search subroutine 2 and do not find the bug, what is the updated probability that the bug is in subroutine i (for i 1, 2, 3)?Explanation / Answer
Event Bi = { Bug is in subroutine i}
P (B1) = 1/3 , P (B2) = 1/3 , P (B3) = 1/3
Event E = {a search of subroutine 2 fails to reveal a bug}
P(E) = 2/3 + .1/3 = 2.1/3
P ( E | B2 ) = 0.1 {Given that subroutine 2 has a bug, it is not found in Subroutine 2}
P ( E | B1) {Given that subroutine 1 has a bug, it is not found in Subroutine 2}
This will always be true
Thus P ( E | B1) = 1
P ( E | B3) {Given that subroutine 3 has a bug, it is not found in Subroutine 2}
This will always be true
Thus P ( E | B3) = 1
Using Bayes' Theorem,
P ( E | Bi) = P ( EBi) / P(Bi)
Therefore
P ( EB1) = P ( E | B1) * P(B1) = 1*1/3 = 1/3
P ( EB2) = P ( E | B2) * P(B2) = 0.1*1/3 = 0.1/3
P ( EB3) = P ( E | B3) * P(B3) = 1*1/3 = 1/3
P ( B1 | E) = P ( EB1) / P (E) = (1/3) / (2.1/3) = 0.48
P ( B2 | E) = P ( EB2) / P (E) = (.1/3) / (2.1/3) = 0.048
P ( B3 | E) = P ( EB3) / P (E) = (1/3) / (2.1/3) = 0.48
If subroutine does not have a bug,
Probability that the bug is in subroutine 1 is 0.48
Probability that the bug is in subroutine 2 is 0.048
Probability that the bug is in subroutine 3 is 0.48
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.