A bag contains slips of paper. Each paper has a number and a letter written on them. They are: A5, A7, B1, B2, C2, C4, D2, D4, E1, E3. A slip is chosen at random, what is the probability it has a 2 on it?
Easy: 3/10
Now say somebody picks a slip and tells you it has the letter B on it. Now what is the probability it also has a 2 on it?
Again easy: 1/2
This is an example of a conditional probability. We write
P(#2 | Letter B)
(” probability of #2 given letter B)
Above we found the conditional probability by changing the sample space. First it was S={A5, A7, B1, B2, C2, C4, D2, D4, E1, E3} but once we knew the slip of paper had the letter B it changed to S={B1, B2}.
In general this changing of the sample space is too difficult, but we can find conditional probabilities using the formula
P(A|B)=P(A∩B)P(B)
Note: this only works if P(B)>0.
Note: this formula can also be derived using the idea of coherence and the concept of the sure looser discussed earlier.
using the numbers from the previous exmple:
P(#2 | Letter B) =P(#2 ∩ Letter B) /P(Letter B) = (1/10) / (2/10) = 1/2.
It is important to notice that conditional probabilities are just like regular ones, for example they obey the axioms of Kolmogorov:
Axiom 1: P(A|B)=P(A∩B)/P(B), but P(A∩B) and P(B) are both regular probabilities, so P(A∩B)≥0, P(B)>0, so P(A|B)=P(A∩B)/P(B)≥0.
Axiom 2: P(S|B)=P(S∩B)/P(B)=P(B)/P(B)=1.
Axiom 3: say A1,..,An are mutually exclusive, then
P(n⋃i=1Ai|B)=P({⋃ni=1Ai}∩B)P(B)=P(⋃ni=1{Ai∩B})P(B)=∑ni=1P(Ai∩B)P(B)=n∑i=1P(Ai∩B)P(B)=n∑i=1P(Ai|B)
A simple manipulation of the equation above yields
P(A∩B)=P(A|B)P(B) Notice that this formula can also be applied to conditional probabilities:
P(A|B∩C)=P(A∩B∩C)P(B∩C)
P(A∩B∩C)=P(A|B∩C)P(B∩C)
You draw two cards from a standard 52-card deck. What is the probability to draw 2 Aces?
Solution: let
A = “First card drawn is an ace”
B = “Second card drawn is an ace”
Then
P(both cards are aces) =
P(first card is an ace and second card is an ace) =
P(A∩B)=P(A)P(B|A)=452351
It’s easy to extend this to more than two events: What is the probability of drawing 3 aces when drawing 3 cards?
Let Ai = “ith card drawn is an ace”
Then
P(all three cards are aces)=P(A1∩A2∩A3)=P(A1)P(A1∩A2)P(A1)P(A1∩A2∩A3)P(A1∩A2)=P(A1)P(A2|A1)P(A3|A1∩A2)
even a little more complicated: In most Poker games you get in the first round 5 cards (Later you can exchange some you don’t like but we leave that out). What is the probability that you get 4 aces?
all five cards are aces=(A1∩A2∩A3∩A4∩Ac5)∪(A1∩A2∩A3∩Ac4∩A5)∪(A1∩A2∩Ac3∩A4∩A5)∪(A1∩Ac2∩A3∩A4∩A5)∪(Ac1∩A2∩A3∩A4∩A5)
These events are mutually exclusive, and so
P(all five cards are aces)=P(A1∩A2∩A3∩A4∩Ac5)+P(A1∩A2∩A3∩Ac4∩A5)+P(A1∩A2∩Ac3∩A4∩A5)+P(A1∩Ac2∩A3∩A4∩A5)+P(Ac1∩A2∩A3∩A4∩A5)=4523512501494848+4523512504848149+4523514848250149+4524848351250149+4848452351250149=5452351250149=1.847×10−5
A set of events {Ai} is called a partition of the sample space S if
Ai∩Aj=∅ for all i≠j∞⋃i=1Ai=S
a student is selected at random from all the undergraduate students at the Colegio
A1 = “Student is female”, A2 = “Student is male”
or maybe
A1 = “Student is freshman”, .., A4 = “Student is senior”
Law of Total Probability
Let the set of events {Ai} be a partition, and let B be any event, then
P(B)=∞∑i=1P(B|Ai)P(Ai)
proof
P(B)=P(B∩S)=P(B∩(∪∞i=1Ai)=P(∪∞i=1(B∩Ai)=∞∑i=1P(B∩Ai)=∞∑i=1P(B|Ai)P(Ai)
A company has 452 employees, 210 men and 242 women. 15% of the men and 10% of the women have a managerial position. What is the probability that a randomly selected person in this company has a managerial position?
Let A1 = “person is female”, A2 = “person is male”.
Let B = “person has a managerial position”
Then
P(A1)=242452P(A2)=210452P(B)=P(B|A1)P(A1)+P(B|A2)P(A2)=0.1242452+0.15210452=0.123
Say you roll a fair die. If you roll an even number you roll the die again, otherwise you keep the result of the first roll. What are the probabilities of rolling a 1, or a 2 or , ..,6?
Let the event Ai=“First roll was i”. This forms a partition, and so
P(1)=6∑i=1P(1|Ai)P(Ai)=116+1616+016+1616+016+1616=16(1+12)=14P(2)=6∑i=1P(2|Ai)P(Ai)=016+1616+016+1616+016+1616=16(12)=112
and the same for 3-6. Note that
314+3112=33+112=1
Bayes’ Formula
Let the set of events {Ai} be a partition, and let B be any event, then
P(Ak|B)=P(B|Ak)P(Ak)∑∞i=1P(B|Ai)P(Ai)
Notice that the denominator is just the law of total probability, so we could have written the formula also in this way
P(Ak|B)=P(B|Ak)P(Ak)P(B)
only usually the first form is the one that is needed because of the available information.
proof
P(Ak|B)=P(Ak∩B)/P(B)=P(B∩Ak)/P(B)=P(B|Ak)P(Ak)/P(B)
In the company above a person is randomly selected, and that person is in a managerial position. What is the probability the person is female?
P(A1|B)=P(B|A1)P(A1)P(B=
0.1×242/4520.123=0.434
Bayes formula sometimes results in strange answers:
Say in some population 1 in 500 people have a certain virus. A test for the virus has a “false-positive” (aka a person who does not have the virus gets a positive test) of 1 in 25, and a “false-negative” (aka a person who does have the virus gets a negative test) of 1 in 50. Say a randomly chose person tests positive. What is the probability that the person actually has the virus?
Let’s define the events A1=“person has virus”, A2=“person does not have virus” and B=“person tests positive”, then
P(person has virus | person tests positive)=P(A1|B)=P(B|A1)P(A1)P(B|A1)P(A1)+P(B|A2)P(A2)=49/50×1/50049/50×1/500+1/25×499/500=49/5049/50+1/25×499=0.0468 So also the test is very good, the probability is still very small!
Bayes’ Rule plays a very important role in Statistics and in Science in general. It provides a natural method for updating your knowledge based on data.
Sometimes knowing that one event occurred does not effect the probability of another event. For example if you through a red and a blue die, knowing that the red die shows a “6” will not change the probability that the blue die shows a “2”.
Formally we have
P(A|B)=P(A)
or using the multiplication rule we get the previous formula for two independent events
P(A∩B)=P(A|B)P(B)=P(A)P(B)
Say you flip a fair coin 5 times. What is the probability of 5 “heads”?
Let Ai = “ith flip is heads”
Now it is reasonable to assume that the Ai’s are independent and so
P(A1∩A2∩A3∩A4∩A5)=P(A1)P(A2)P(A3)P(A4)P(A5)=(12)5=132=0.03125