Partition of a Sample Space
To understand Bayes' Theorem, we first need the idea of a partition of the sample space.
A set of events E1,E2,…,En is said to form a partition of the sample space S if:
They are pairwise disjoint:
Ei∩Ej=∅for i=j
They are exhaustive:
E1∪E2∪⋯∪En=S
Each event has non-zero probability:
P(Ei)>0for all i
Thus, every outcome of the experiment belongs to exactly one of the events E1,E2,…,En.
Theorem on Total Probability
Let E1,E2,…,En be a partition of the sample space S, and let A be any event. Then the Theorem of Total Probability states that
P(A)=P(E1)P(A∣E1)+P(E2)P(A∣E2)+⋯+P(En)P(A∣En)
Equivalently,
P(A)=j=1∑nP(Ej)P(A∣Ej)
This theorem is useful when an event A can occur through several mutually exclusive and exhaustive causes E1,E2,…,En.
Bayes' Theorem (Inverse Probability)
While the Theorem of Total Probability computes the probability of an observed event A, Bayes' Theorem computes the probability that a particular cause Ei was responsible for the occurrence of A.
If E1,E2,…,En form a partition of the sample space and A is an event with P(A)>0, then
P(Ei∣A)=∑j=1nP(Ej)P(A∣Ej)P(Ei)P(A∣Ei)
Here:
- P(Ei) are the prior probabilities.
- P(A∣Ei) are the likelihoods.
- P(Ei∣A) is the posterior probability.
Example 1: The Three Urns Problem
Bag I contains 3 red and 4 black balls while Bag II contains 5 red and 6 black balls. One ball is drawn at random from one of the bags and it is found to be red. Find the probability that it was drawn from Bag II.
Solution:
Let
E1=choosing Bag I,E2=choosing Bag II
Since the bag is chosen at random,
P(E1)=21,P(E2)=21
Let
A=drawing a red ball
Then
P(A∣E1)=73,P(A∣E2)=115
By Bayes' Theorem,
P(E2∣A)=P(E1)P(A∣E1)+P(E2)P(A∣E2)P(E2)P(A∣E2)
Substituting,
P(E2∣A)=(21)(73)+(21)(115)(21)(115)
Cancelling 21 from numerator and denominator,
P(E2∣A)=73+115115=7733+35115=7768115=115⋅6877=6835
Answer:
6835
Example 2: Medical Diagnostic Test
A laboratory blood test is 99% effective in detecting a certain disease when it is, in fact, present. However, the test also yields a false positive result for 0.5% of healthy persons tested. If 0.1% of the population actually has the disease, what is the probability that a person has the disease given that the test result is positive?
Solution:
Let
E1=person has the disease,E2=person is healthy
Then
P(E1)=0.001,P(E2)=0.999
Let
A=test result is positive
Given,
P(A∣E1)=0.99,P(A∣E2)=0.005
By Bayes' Theorem,
P(E1∣A)=P(E1)P(A∣E1)+P(E2)P(A∣E2)P(E1)P(A∣E1)
So,
P(E1∣A)=(0.001)(0.99)+(0.999)(0.005)(0.001)(0.99)
P(E1∣A)=0.00099+0.0049950.00099=0.0059850.00099
Multiplying numerator and denominator by 100000,
P(E1∣A)=598.599=1197198=13322
Hence,
P(E1∣A)=13322≈0.1654
Answer:
13322≈0.1654
Example 3: Manufacturing Defects
In a factory, machine A produces 60% of the items and machine B produces 40%. 2% of items from A are defective and 1% from B are defective. If an item is chosen at random and found to be defective, find the probability that it was produced by machine B.
Solution:
Let
EA=item produced by machine A,EB=item produced by machine B
Then
P(EA)=0.6,P(EB)=0.4
Let
D=item is defective
Then
P(D∣EA)=0.02,P(D∣EB)=0.01
First, by the Theorem of Total Probability,
P(D)=P(EA)P(D∣EA)+P(EB)P(D∣EB)
P(D)=(0.6)(0.02)+(0.4)(0.01)=0.012+0.004=0.016
Now, by Bayes' Theorem,
P(EB∣D)=P(D)P(EB)P(D∣EB)=0.016(0.4)(0.01)=0.0160.004=41
Answer:
41
In an entrance test, a student either knows the answer, guesses, or copies. The probability that he knows is 21, guesses is 41, and copies is 41. The probability that the answer is correct given he knows is 1, given he guesses is 41, and given he copies is 81. If he answered correctly, find the probability he knew the answer.
Solution:
Let
E1=he knows the answer,E2=he guesses,E3=he copies
Then
P(E1)=21,P(E2)=41,P(E3)=41
Let
C=answer is correct
Then
P(C∣E1)=1,P(C∣E2)=41,P(C∣E3)=81
First,
P(C)=21⋅1+41⋅41+41⋅81
P(C)=21+161+321=3216+2+1=3219
Therefore,
P(E1∣C)=P(C)P(E1)P(C∣E1)=321921⋅1=21⋅1932=1916
Answer:
1916
Example 5: Insurance Risk
An insurance company insured 2000 scooter drivers, 4000 car drivers and 6000 truck drivers. The probability of an accident is 0.01, 0.03 and 0.15 respectively. One of the insured persons meets with an accident. What is the probability that he is a scooter driver?
Solution:
Let
ES=scooter driver,EC=car driver,ET=truck driver
Total number insured is
2000+4000+6000=12000
Hence,
P(ES)=120002000=61,P(EC)=120004000=31,P(ET)=120006000=21
Let
A=person meets with an accident
Then,
P(A∣ES)=0.01=1001,P(A∣EC)=0.03=1003,P(A∣ET)=0.15=10015=203
Now,
P(A)=P(ES)P(A∣ES)+P(EC)P(A∣EC)+P(ET)P(A∣ET)
P(A)=61⋅1001+31⋅1003+21⋅203
P(A)=6001+1001+403
Taking LCM 600,
P(A)=6001+6+45=60052=15013
Therefore,
P(ES∣A)=P(A)P(ES)P(A∣ES)=600526001=521
Answer:
521
Example 6: Card Lost from Deck
A card from a pack of 52 cards is lost. From the remaining cards, two cards are drawn and are found to be diamonds. Find the probability that the lost card was a diamond.
Solution:
Let
E1=lost card is a diamond,E2=lost card is not a diamond
Then
P(E1)=5213=41,P(E2)=5239=43
Let
A=the two drawn cards are diamonds
If the lost card was a diamond, then among the remaining 51 cards there are 12 diamonds. So,
P(A∣E1)=(251)(212)
If the lost card was not a diamond, then among the remaining 51 cards there are still 13 diamonds. So,
P(A∣E2)=(251)(213)
Using Bayes' Theorem,
P(E1∣A)=P(E1)P(A∣E1)+P(E2)P(A∣E2)P(E1)P(A∣E1)
Substituting,
P(E1∣A)=41⋅(251)(212)+43⋅(251)(213)41⋅(251)(212)
Cancel the common factor 4(251)1:
P(E1∣A)=(212)+3(213)(212)
Now,
(212)=66,(213)=78
So,
P(E1∣A)=66+3(78)66=30066=5011
Answer:
5011
Example 7: Truth Tellers
A man is known to speak truth 3 out of 4 times. He throws a die and reports that it is a six. Find the probability that it is actually a six.
Solution:
Let
E1=the die actually shows 6,E2=the die does not show 6
Then
P(E1)=61,P(E2)=65
Let
A=the man reports that it is a six
Since he speaks truth with probability 43,
P(A∣E1)=43
If the die is not a six, then he reports six only when he lies. Thus,
P(A∣E2)=41
Therefore,
P(E1∣A)=P(E1)P(A∣E1)+P(E2)P(A∣E2)P(E1)P(A∣E1)
P(E1∣A)=61⋅43+65⋅4161⋅43
Multiplying numerator and denominator by 24,
P(E1∣A)=3+53=83
Answer:
83
Example 8: Multiple Choice Questions
In a multiple-choice test, an examinee either knows the answer or guesses. Let p be the probability that he knows. The probability that an examinee who guesses will be correct is m1. What is the probability that he knows the answer given that he answered it correctly?
Solution:
Let
K=knows the answer,G=guesses
Then,
P(K)=p,P(G)=1−p
Let
C=answer is correct
Then,
P(C∣K)=1,P(C∣G)=m1
By Bayes' Theorem,
P(K∣C)=P(K)P(C∣K)+P(G)P(C∣G)P(K)P(C∣K)
P(K∣C)=p⋅1+(1−p)⋅m1p⋅1
Multiply numerator and denominator by m:
P(K∣C)=mp+1−pmp
Hence,
P(K∣C)=1+(m−1)pmp
Answer:
1+(m−1)pmp
Example 9: Item Transferred between Bags
Bag A contains 2 white and 3 red balls and Bag B contains 4 white and 5 red balls. One ball is transferred from Bag A to Bag B and then a ball is drawn from Bag B. The ball so drawn is found to be white. Find the probability that the transferred ball was white.
Solution:
Let
EW=the transferred ball is white,ER=the transferred ball is red
Since Bag A has 2 white and 3 red balls,
P(EW)=52,P(ER)=53
Let
A=the ball drawn from Bag B is white
If a white ball is transferred, Bag B becomes 5 white and 5 red. Therefore,
P(A∣EW)=105=21
If a red ball is transferred, Bag B becomes 4 white and 6 red. Therefore,
P(A∣ER)=104=52
Now, by Bayes' Theorem,
P(EW∣A)=P(EW)P(A∣EW)+P(ER)P(A∣ER)P(EW)P(A∣EW)
Substitute the values:
P(EW∣A)=52⋅21+53⋅5252⋅21
P(EW∣A)=51+25651=2511255=115
Answer:
115
Example 10: Letter from a City
A letter is known to have come from either TATANAGAR or CALCUTTA. On the envelope, just two consecutive letters TA are visible. What is the probability that the letter came from TATANAGAR?
Solution:
Let
T=letter came from TATANAGAR,C=letter came from CALCUTTA
Assuming both are equally likely,
P(T)=21,P(C)=21
Let
A=the visible consecutive letters are TA
Now count the consecutive pairs.
For TATANAGAR:
The word has 9 letters, so it has 8 consecutive pairs:
TA, AT, TA, AN, NA, AG, GA, AR
The pair TA appears 2 times. Hence,
P(A∣T)=82=41
For CALCUTTA:
The word has 8 letters, so it has 7 consecutive pairs:
CA, AL, LC, CU, UT, TT, TA
The pair TA appears 1 time. Hence,
P(A∣C)=71
By Bayes' Theorem,
P(T∣A)=P(T)P(A∣T)+P(C)P(A∣C)P(T)P(A∣T)
P(T∣A)=21⋅41+21⋅7121⋅41
Cancelling 21,
P(T∣A)=41+7141=281141=117
Answer:
117