Lec3 - Conditional Probability
Lec3 - Conditional Probability
Previous lecture
2
Sample space
This is denoted with an S and is a set Each element
whose elements are all the possibilities of S is called
that can occur an outcome.
P (E F ) = P (E ) + P (F ) – P (E F )
Let's look at a Venn Diagram to see
why this is true:
If we count E
EE FF
P (E F ) = P (E ) + P (F )
Mutually exclusive means the events are disjoint.
This means E F =
PE PE 1
This is more often used in the form
P E 1 P E
If we know the probability of rain is 20% or 0.2 then the
probability of the complement (no rain) is 1 - 0.2 = 0.8 or 80%
6
Summary
P (A ) 1 P (A )
P ( A B ) P (A B ) P (A ) P (A B )
A
B
P( A) P(B) P( A B)
P( A B) P( A) P(B) A, B Mutually exclusive
7
Conditional probability
Today lecture
8
introduction
Box contains 3 Red balls and 5 Green balls ,
2 balls are selected (without replacement-
one after another )
Find the probability that the second ball is
3 2 3
Red? P ( RR ) .
8 7 28
3 5 15
P ( RG ) .
8 7 56
5 3 15
P (GR ) .
8 7 56
5 4 10
P (GG ) .
8 7 28
9
introduction
the probability that the second ball is Red
3 15 21
P (2 nd _ Re d ) .
28 56 56
3 2 3
P ( RR ) .
8 7 28
3 5 15
P ( RG ) .
8 7 56
5 3 15
P (GR ) .
8 7 56
5 4 10
P (GG ) .
8 7 28
10
Conditional Probability
What is the probability of the second ball is
Red given that the first ball is Green?
3 2 3
P ( RR ) .
8 7 28
3 5 15
P ( RG ) .
8 7 56
5 3 15
P (GR ) .
8 7 56
5 4 10
P (GG ) .
8 7 28
11
Conditional Probability
What is the probability of the second ball is
Red given that the first ball is Green?
3
P (2nd Re d given 1stGreen ) .
7
3 2 3
P ( RR ) .
8 7 28
3 5 15
P ( RG ) .
8 7 56
5 3 15
P (GR ) .
8 7 56
5 4 10
P (GG ) .
8 7 28
12
Conditional Probability
The probability that the second ball is Red
given that the first ball is Green is called
conditional probability. A key words to
look for is “given.”
General Conditional
Probability
P ( A | B ).
This is read the probability of A given B.
14
Conditional Probability
How would we draw the event A given B?
A B
A
and
B
15
Conditional Probability
How would we draw the event A given B?
Since we know B has occurred, we ignore
everything else B.(B the new sample space)
A B
A
and
B
16
Conditional Probability
How would we draw the event A given B?
Since we know B has occurred, we ignore
everything else B.(B the new sample space)
A B
A
and
B
17
Conditional Probability
How would we draw the event A given B?
Since we know B has occurred, we ignore
everything else B.(B the new sample space)
A B
A
and
The rule: B
P( A B)
P( A | B)
P( B)
18
P (A B )
P (B | A )
P (A )
19
Example
Box contains 3 Red balls and 5 Green balls , 2
balls are selected (without replacement-one after
another ). Find the probability that the first ball is
Red given that the second ball is Green ?
3 2 3
P ( RR ) .
8 7 28
3 5 15
P ( RG ) .
8 7 56
5 3 15
P (GR ) .
8 7 56
5 4 10
P (GG ) .
8 7 28
Example 20
3 5 15
P ( RG ) .
8 7 56
5 3 15
P (GR ) .
8 7 56
5 4 10
P (GG ) .
8 7 28
21
Note
P( A B)
P( A | B)
P( B)
P (A B ) P (A | B )P (B )
Similarly
P ( A B ) P ( B | A) P ( A)
Therfore
P ( A | B) P( B) P( B | A) P( A)
22
Example
If P ( A) 0.2 , P ( B ) 0.3 , and P ( A | B) 0.4
Find
P( B | A)
P ( A | B) P( B) P( B | A) P( A)
0.4 0.3 P( B | A) 0.2
0.4 0.3
P ( B | A) 0.6
0.2
23
Example
600 people were asked what is your opinion of “ something” . There
responses are indicated in the table
140 280
P( N ) P(M )
600 600
28
Example
Yes(Y) No(N) Don’t know(D) total
Men(M) 162 95 23 280
Women(W) 256 45 19 320
total 418 140 42 600
Find the following
320 45
P (W ) P( N | W )
600 320
280 162
P(M ) P (Y | M )
600 280
45 162
P( N W ) P(M | Y )
600 418
25
Example: Rolling a two balanced dice.
If the sum is 6”. Find the probability
that the two numbers are different
26
Direct method
4
P ( diffrent | sum 6)
5
Example 28
?
7
P( B)
19
Example 29
1 4 1 3
P( B)
2 11 2 8
2 3
P (B ) 0.1988
11 16
Example 30
4
P (Y | BoxII )
8
Example 31
Example
Three machines A, B and C produce 60%, 30% and 10% of
the total number of items respectively. The percentages of
the defective outputs are 2%, 3% and 4%.
If an item is selected at random, find the probability that
a. The item is defective.
b. The item was produced from B, if it is defective.
Note
0.3 B
P (Def) P (Def | A) P (A)
P (Def | B) P (B)
P (Def | C) P (C)
Example
b. The probability that the item was
produced from B, if it is defective.
P (Def) 0.025
P (B Def )
P (B | Def)
P (Def) 0.3 B
P (Def | B) P (B)
P (B | Def)
P (Def)
0.03 0.3 9
P (B | Def)
0.025 25
BAYE’S theorem
If E1 , E2 , E3 are mutually exclusive E1 E2 E3
events and B is any event
n
In general P (B) P (B | Ei )P (Ei )
i 1
P ( B | E1 ) P (E1 ) P (B | E1 )P (E1 )
P (E1 | B) n
P (B )
P (B | E
i 1
i ) P (E i )
35
Conditional Probability
:
Show that
. P ( A | A) 1
P ( A A)
L.H .S P ( A | A)
P ( A)
P (A A) P ( A )
L .H .S 1
P (A ) P (A )
36
Conditional Probability
If : A, B are mutually exclusive Show that
. P( A | B) 0
P (A B)
L .H .S P (A | B )
P (B )
P ( A B) 0
P (A B) 0
L .H .S P (A | B ) zero
P (B ) P (B )
37
Conditional Probability
If A B Show that P ( A | B ) P ( A)
: P( B)
.
If A B
B
P ( A B) P ( A )
A
P (A B) P (A )
P (A | B )
P (B ) P (B )
38
Conditional Probability
If A B Show that P ( B | A) 1
:
.
If A B
B
P ( A B) P ( A ) A
P (A B) P ( A )
P (B | A ) 1
P (A ) P (A )
39
Conditional Probability
If : S is the sample space and A is any
event in sample space Show that
. P ( S | A) 1
A S
( A S) ( A )
P (A S) P (A )
L .H .S P (S | A ) 1
P (A ) P (A )
40
Conditional Probability
:
Show that P ( A) P ( A B )
P( A | B)
. 1 P( B)
P( A B )
P( A | B )
P( B)
P ( A) P ( A B )
P( A | B)
1 P( B)
41
Conditional Probability
:
Show that P( A | B) 1 P( A | B)
.
P( A B) P( B) P( A B )
P( A | B)
P( B) P( B)
P( B) P( A B)
P( A | B)
P( B) P( B)
P( A | B) 1 P( A | B)
42
Examples
43
Example
Suppose that five percent of men and 2.5 percent of women are
color-blind. A color-blind person is chosen at random. What is the
probability of this person being male?
Assume that there are an equal number of males and females.
P (M CB )
P (M | CB)
P (CB)
P (M CB ) 0.5 0.05 0.025
0.025 2
P (M | CB)
0.0375 3
Example
A local union has 8 members, 2 of whom are
women. Two are chosen (one after another)
to represent the union.
45
Example
A local union has 8 members, 2 of whom are
women. Two are chosen (one after another)
to represent the union.
6 5
0.536
8 7
b) What is the probability that the second choice
is male?
6 5 2 6
8 7 8 7
46
Example
A local union has 8 members, 2 of whom are
women. Two are chosen (one after another)
to represent the union.
c) Given that the second choice is male ,What is
the probability that the first choice is female?
P (1F 2 M )
P (1F | 2 M )
P (2 M )
2 6
P (1F | 2 M ) 8 7
6 5 2 6
8 7 8 7
47
Example
A printer manufacturer obtained the following probabilities from a database
of test results. Printer failures are associated with three types of problems:
hardware, software, and other(such as connectors), with probabilities 0.2,
0.55, and 0.25, respectively. If there is a hardware problem, the printer will
fail definitely. On the other hand, the probability of a printer failure given a
software problem is 0.2 while the probability of a printer failure is 0.5 given
any other type of problem.
(a) What is the probability of a printer failure?
(b) What is the probability of a printer failure if the printer does not have a
software problem?
(c) For a failed printer,
what is the probability that
it has a software problem?
0.55 Soft
48
Example
(a) What is the probability of a printer failure?
0.55 Soft
49
Example
(b) What is the probability of a printer failure if
the printer does not have a software problem?
P (F soft)
P (F | soft)
P (soft)
0.55 Soft
51
Conditional Probability
:
Show that P( A B | C ) P( A | C ) P( B | C ) P( A B | C )
P (( A B ) C )
. P( A B | C )
P (C )
P (( A C ) ( B C ))
P( A B | C )
P (C )
P( A C ) P( B C ) P( A B C )
P( A B | C )
P(C )
P( A C ) P( B C ) P( A B C )
P( A B | C )
P(C ) P (C ) P (C )
P( A B | C ) P( A | C ) P( B | C ) P( A B | C )
52
Conditional Probability
If the events B and C are disjoint, prove that
for any other event A
. : P( A | B) P( B) P( A | C ) P(C )
P( A | B C )
P( B) P(C )
P( A ( B C )) A C
P( A | B C ) B
P( B C )
P(( A B) ( A C ))
P( A | B C )
P( B C )
P( A B) P( A C )
P( A | B C )
P( B C )
P( A | B) P( B) P( A | C ) P(C )
P( A | B C )
P( B) P(C )
53
Conditional Probability
If the events A,B and C are disjoint, D any
event and P (A ) 0.15 , P (C) 0.45 , P (C | D) 0.2
P (D | A) 0.1 and P (D B ) 0.3
C B
Find
a) P (D | B)
D
b) P (A | D)
A
54
Conditional Probability
If the events A,B and C are disjoint, D any
event and P (A ) 0.15 , P (C) 0.45 , P (C | D) 0.2
P (D | A) 0.1 and P (D B ) 0.3
C B
Find
a) P (D | B)
D
P (D B )
P (D | B )
P (B )
P (D B )
P (D | B ) A
1 p (A ) p(C)
0.3 0.3
P (D | B ) 0.75
1 0.15 0.45 0.4
55
Conditional Probability
If the events A,B and C are disjoint, D any
event and P (A ) 0.15 , P (C) 0.45 , P (C | D) 0.2
P (D | A) 0.1 and P (D B ) 0.3
C B
Find b) P (A | D)
P (A D ) P (D | A)P (A)
P (A | D) D
P (D) P (D)
P (D) P (A D ) P (B D ) P (C D )
P (D) p (D | A)P (A ) P (B D )
p (C | D) p(D) A
P (D) 0.1 0.15 0.3 0.2 p(D) P (D) 0.39375
0.1 0.15
P (A | D) 0.038
0.39375
56
57
Example
A study of 24 mice has classified the mice by two
categories
Fur Colour
Black White Grey
Eye Red Eyes 3 5 2
Colour
Black Eyes 1 7 6
58
A study of 24 mice has classified the mice by two
categories
Fur Colour
Black White Grey
Eye Red Eyes 3 5 2
Colour
Black Eyes 1 7 6
P ( ve) 0.05
P (ILL ve )
P (ILL | ve)
P ( ve)
0.0001 0.99
P (ILL | ve)
0.05
65
Example
(c) You take the test, and the result is negative.
What is the probability that you do not
have the illness?
0.9999 0.95
P (non | ve) 0.9999
0.95
66
Example
The probability that three men A, B, C hit a target are 1/6,
1/4 and 1/3,respectively. Each shoots once. Find the
probability that:
a. Exactly one hits the target.
b. If only one hits the target, what is the probability that the
one hits the target is the first man?
H H H
A B C
F F F
67
Example
¼ H HHH
HHF
HFH
HFF
¼ H FHH
FHF
FFH
FFF
68
Example
Find the probability that:Exactly one hits the target.
¼ H HHH
HHF
HFH
P(HFF)=1/12
¼ H FHH
Let event E P(FHF)=5/36
exactly one hits P(FFH)=5/24
FFF
P(E)=1/12+5/36+5/24=0.43
69
Example
If only one hits the target, what is the probability that the one hits the
target is the first man?
¼ H HHH
HHF
HFH
P(HFF)=1/12
P ( F E ) 1 / 12 FFF
P( F | E )
P( E ) 0.43