Solve using R software A hat contains 100 coins, where at least 99 are fair, but
ID: 3274614 • Letter: S
Question
Solve using R software
A hat contains 100 coins, where at least 99 are fair, but there may be one that is double headed (always landing Heads): if there is no such coin, then all 100 are fair. Let D be the event that there is such a coin, and suppose that P(D) = 1/2. A coin is chosen uniformly at random. The chosen coin is flipped 7 times, and it lands Heads all 7 times. (a) Given this information, what is the probability that one of the coins is doubleheaded? (b) Given this information, what is the probability that the chosen coin is doubleheaded?Explanation / Answer
Given that we have a double headed coin, now a coin is selected at random from the total 100 coins given ( one of them is double headed ). That coin is headed 7 times to get 7 heads.
Probability of this event is computed as:
P(7 heads | double headed coin) = 0.01*1 + 0.99*(0.5)7 = 0.017734375
Similarly when there is no double headed coin and all coins are fair, then the probability of the event is computed as:
P(7 heads | All fair coins) = 0.57 = 0.0078125
Also we are given that P( double headed coin ) = P( all fair coins ) = 0.5
Therefore, P( 7 heads ) = P(7 heads | double headed coin) P( double headed coin ) + P(7 heads | All fair coins) P( all fair coins )
P( 7 heads ) = 0.017734375*0.5 + 0.0078125*0.5 = 0.0127734375
a) Now we have to compute the probability that one of the coin is double headed given that there were 7 heads.
Using bayes theorem we get:
P(double headed coin | 7 heads ) P( 7 heads ) = P(7 heads | double headed coin) P( double headed coin )
Now putting all the values computed above we get:
P(double headed coin | 7 heads ) * 0.0127734375 = 0.017734375*0.5
Therefore, we get: P(double headed coin | 7 heads ) = 0.017734375*0.5 / 0.0127734375 = 0.6942
Therefore 0.6942 is the required probability here.
b) Now here we have to compute the information that the double headed coin was itself selected. Using bayes theorem we get:
P(double headed coin selected | 7 heads ) P( 7 heads ) = P(7 heads | double headed coin selected) P( double headed coin selected)
P(double headed coin selected | 7 heads ) * 0.0127734375 = 1*0.5*0.01
P(double headed coin selected | 7 heads ) = 0.5*0.01/ 0.0127734375 = 0.3914
Therefore 0.3914 is the required probability here.