Lecture 7 - Statistics and Data Analysis I 2
Lecture 7 - Statistics and Data Analysis I 2
Avner Halevy
Sometimes, knowing that one event happened can change our assessment of the probability that
another event happened. For example, suppose we roll a standard die. Let B = “even number” =
{2, 4, 6} and let A = {2}. Without any information about the outcome of the roll, we know P (A) = 16 .
However, if we know that B happened, then the outcome must have been one of 2, 4, 6, and since
these are equally likely, it seems that the probability of A given that B happened should be 13 . This
probability is called a conditional probability, since it leads to the probability of one event based
on the condition that another event happened.
6 0,
The conditional probability of A given B, denoted by P (A|B), for any event B such that P (B) =
is defined as:
P (A ∩ B)
P (A|B) = (1)
P (B)
1
In the example above we have P (B) = 2 and P (A ∩ B) = P ({2}) = 16 , so
1
6 1
P (A|B) = 1 = ,
2
3
as we expected. In this example we could also reverse the roles of A and B and ask: Given that
A happened, what is the probability that B happened? Intuitively, if the outcome was 2, then the
outcome was certainly an even number. We can confirm this:
P (B ∩ A) P (A)
P (B|A) = = = 1.
P (A) P (A)
In a uniform probability space, conditional probabilities are once again especially simple to compute:
|A∩B|
P (A ∩ B) |Ω| |A ∩ B|
P (A|B) = = |B|
=
P (B) |B|
Ω
If, in the definition (1) of conditional probability, we multiply both sides by P (B), we obtain the
multiplication rule:
P (A ∩ B) = P (B)P (A|B) (2)
In words, this rule says that the probability that both A and B happen is equal to the probability that
B happens multiplied by the probability that A happens given that B happens.
1
For example, suppose that 20% of the population are smokers and that among the smokers, 10% are
men. If a person is picked out of the population at random, what’s the probability that this person is
a smoking man? To answer this question, let A = “picking a man ” and let B = “picking a smoker”.
Then we are given P (B) = 0.2 and P (A|B) = 0.1. What we seek is P (A ∩ B). Using (2) we have
Another use for conditional probability is called the law of total probability:
For example, suppose there are two urns with balls. In the first one, 1/3 of the balls are white and 2/3
are black. In the second, 1/4 are white and 3/4 are black. Suppose we pick an urn at random, and
then pick a ball at random. What’s the probability of picking a white ball? To answer this question,
let B = “picking a white ball” and let A = “picking the first urn”. Then P (B|A) is given to be 1/3
and P (B|Ā) is given to be 1/4. Also, since the urn is picked at random, P (A) = P (Ā) = 21 . Thus,
using (3),
1 1 1 1 7
P (B) = + =
3 2 4 2 24
Finally, suppose we know a white ball was picked. Given this, what is the probability that the first
urn was picked? That is, what is P (A|B)? We can answer this using Bayes’ formula, which lets us
reverse the roles of the two events:
P (A ∩ B) P (B|A)P (A)
P (A|B) = =
P (B) P (B)
In our example,
( 13 )( 12 ) 4
P (A|B) = 7 =
24
7