When answering a multiple choice question assume a student has a 50% probability to know the correct answer. Otherwise, he will guess and he still has a 20% probability to choose the correct answer. Given that he chooses the correct answer, what is the probability that he guessed?
Solution: Our main event is answering correctly, say \(A\). Event \(B_1\) is knowing and event \(B_2\) is guessing. So \(P(A) = P(B_1)P(A|B_1) + P(B_2)P(A|B_2) = 0.5*1 + 0.5*0.2 = 0.6\). By Bayes’ theorem:
\[P(B_2|A) = \dfrac{P(B_2)P(A|B_2)}{P(B_1)P(A|B_1) + P(B_2)P(A|B_2)} = \dfrac{0.5*0.2}{0.6} = 0.167\]
Corresponding R code can be written as follows.
pB1 = 0.5 #Probability of knowing the answer
pB2 = 0.5 #Probability of guessing
pAgB1 = 1 #Probability of answering correct if the student knows
pAgB2 = 0.2 #Probability of answering correct if the student guesses
pA = pB1*pAgB1 + pB2*pAgB2 #Probability of answering correct
pB2gA = (pB2*pAgB2)/pA #Probability of guessing if the answer is correct
pB2gA
## [1] 0.1666667
Two sisters Anne and Zoe play chess or backgammon every day. Anne is better than Zoe in chess and wins 75% of the time but Zoe is better at backgammon and therefore Anne wins only 25% of the time. They play chess 4 out of 7 days of the week (days are random) and backgammon in the rest of the days. Suppose Anne win the game yesterday. What is the probability that she played chess?
Solution: Let’s denote \(P(A)\) as the probability of Anne winning the game. So \(P(A|Chess) = 0.75\), \(P(A|Backgammon) = 0.25\), \(P(Chess) = 4/7\) and \(P(Backgammon) = 3/7\). We want to know \(P(Chess|A)\).
\[P(Chess|A) = \dfrac{P(A|Chess)P(Chess)}{P(A|Chess)P(Chess) + P(A|Backgammon)P(Backgammon)} = \dfrac{0.75*4/7}{0.75*4/7 + 0.25*3/7} = 0.8\]
Corresponding R code can be written as follows.
pAgChess = 0.75
pAgBackg = 0.25
pChess = 4/7
pBackg = 3/7
pChessgA = (pChess*pAgChess)/(pChess*pAgChess + pBackg*pAgBackg)
pChessgA
## [1] 0.8
Consider the system above. There are three fuses in section I and two fuses in section II. In order the system to succeed, at least one fuse from each system should work. Values indicate the probabilities of the fuses remain functioning. What is the probability of the system works?
Solution: Let’s denote the probability of system working as \(P(A)\), section I functioning as \(P(B_1)\) and section 2 functioning as \(P(B_2)\). \(P(A) = P(B_1)P(B_2)\). \(P(B_1)\) can be calculated as \(1 - P(B_1^\prime)\) where \(B_1^\prime\) indicates failure of section 1. \(P(B_1^\prime) =(1-0.5)(1-0.5)(1-0.5) = 0.125\) and \(P(B_1) = 0.875\). Similarly for \(B_2\), \(P(B_2) = 1 - P(B_2^\prime) = 1 - (1 - 0.6)(1 - 0.4) = 0.76\). Finally, \(P(A) = P(B_1)P(B_2) = 0.875 * 0.76 = 0.665\)