Download Probability and Counting - University of Louisville Department of

Document related concepts

Statistics wikipedia , lookup

History of statistics wikipedia , lookup

Inductive probability wikipedia , lookup

Birthday problem wikipedia , lookup

Ars Conjectandi wikipedia , lookup

Probability interpretations wikipedia , lookup

Probability wikipedia , lookup

Transcript
Probability and Counting
■
■
■
■
■
■
■
Basic Counting Principles
Permutations and Combinations
Sample Spaces, Events, Probability
Union, Intersection, Complements; Odds
Conditional Probability, Independence
Bayes’ Formula
Random Variable, Distribution, Expectation
Basic Counting Principles
■ Sets, Operations on Sets
■ Addition Principle
■ Venn Diagrams
■ Multiplication Principle
Some Terminology
A SET is a COLLECTION of objects called
ELEMENTS
A={a,b,m,n,1,2,3} 1∈
∈ A “1 is an element of A”
B={*,&,#,@,!,-,P}
C ⊆ A
C={1,2,3}
“C is a subset of A”
D={ { },{1},{2},{3},{1,2},{1,3},{2,3},{1,2,3} }
E={ }
EMPTY SET
POWER SET
UNION:
A ∪B
all elements which are
in A or B (or both) but
no repeats!
{1,2,3} ∪ {2, a,4} = {1,2,3,4, a}
INTERSECTION:
A ∩B
all elements that are in
both, A and B
{1,2,3} ∩ {2, a,4} = {2}
Complements:
Universal Set = Set of all things to be
considered for this case
U = all students in class
A = students getting an A
B = students getting a B
A’= complement of A, all students not
getting an A
A’= U \ A
“ U minus A ”
Addition Principle
Counting elements in a set:
n(A)= number of elements in A (distinct)
n({1,z,2,3})= 4
F = set of female students in this room
M= set of male students in this room
M ∪ F set of students in this room
n(M ∪ F) = n(M) + n(F)
A=
B=
set of business majors registered
for class
set of students present today
A ∪ B = set of business majors or students
present today
A 1 B = set of business majors present today
n(A ∪ B) = n(A) + n(B) - n(A ∩ B)
Addition Principle for Counting
For any two sets A and B
n(A ∪ B) = n(A)+ n(B)- n(A ∩ B)
If A and B are disjoint, i.e.
n(A ∪ B) = n(A)+ n(B)
A ∩ B = ∅ or { }
Practical Problem
U students in this class 40
A students owning car
B students owning computer
30 students own a car
20 students own a computer
15 own both
How many have neither?
Venn Diagram
U
A
B
Assigning Students Numbers
Suppose each student is assigned a 5 digit
number. How many different numbers can
be created?
Each digit is 0,1,2,3,4,5,6,7,8,9
Ten possibilities for each
10*10*10*10*10=105=100,000
More interestingly
A) Suppose not digit is repeated
First slot: 10 Possibilities
Second
9 Possibilities
Third
8 Possibilities
Fourth
7 Possibilities
Fifth
6 Possibilities
TOTAL = 10*9*8*7*6 = 30240
B) No two adjacent digits are equal
First slot: 10 Possibilities
2,3,4,5:
9 Possibilities
TOTAL = 10*9*9*9*9 = 65610
Multiplication Rule
1. If two operations O1 and O2 are performed
in order, with N1 and N2 possible outcomes,
respectively, then there are
N1*N2
possible combined outcomes.
2. For O1,O2,…,Ok operations with N1,N2,…,Nk
possible outcomes, then there are
N1*N2*…*Nk
possible combined outcomes
Permutations and Combinations
■ FACTORIAL
■ PERMUTATIONS
■ COMBINATIONS
■ APPLICATIONS
Factorial
Counting without replacement involved
25*24*23*…*2*1
and similar products, multiplying several
numbers, each one less than the previous.
Beginning Lotto:
Pick 6 numbered balls out of 49 (numbered
consecutively 1,2,3,…,49) without replacing
them. How many ways can this be done
(the order is important here)
First ball: 49 choices
Second : 48
Third:
47
Fourth:
46
Fifth:
45
Sixth:
44
Total: 49*48*47*46*45*44 = 10,068,347,520
So there are over 10 billion ways to pick
the six balls. But the order is not important
when playing Lotto.
123456
654321
132456
etc. are the same
and should not be counted separate.
We will get back to that soon.
Factorial
For a natural number n,
n!=n*(n-1)*(n-2)*…*2*1
0!=1
n!=n*(n-1)!
Read “n factorial”.
Examples:
6! = 6 • 5 • 4 • 3 • 2 • 1= 720
7! = 7 • (7 - 1)! = 7 • (6!) = 7 • 720 = 5040
49! 49 • 48 • 47 • 46 • 45 • 44 • 43 • 42•...•2 • 1
=
43!
43 • 42•...•2 • 1
49 • 48 • 47 • 46 • 45 • 44 • (43!)
=
= 49 • 48 • 47 • 46 • 45 • 44
43!
49!
49 • 48 • 47 • 46 • 45 • 44 10068347520
=
=
= 13,983,816
43!6!
6!
720
Permutations
Recall the lotto example:
Order was not important!
Question:
How many was can we rearrange or
permute the numbers
123456
We can choose any one of the 6 for
the first slot, any of the remaining 5
for the second etc.
1st 6
2nd 5
3rd 4
4th 3
5th 2
6th 1
Total 6!=720.
There is nothing particular about the
numbers 1 2 3 4 5 6, any six distinct
objects can be arranged in 6! different
ways.
A Permutation of a Set of Objects
A permutation of a set of distinct objects
is an arrangement of the objects in a
specific order without repetition.
Number of Permutations of n Objects
The number of permutations of n distinct
objects without repetition, denoted Pn,n,
is given by
Pn,n = n*(n-1)*(n-2)*…*2*1=n!
A permutation of n Objects
r at a Time
In our Lotto example we have 49 numbers
available but pick only 6 at a time:
49 choices for the first
48 for the second
…
44 for the sixth
49 • 48 • 47 • 46 • 45 • 44 =
49!
49!
=
= P49,6
43! (49 - 6)!
A Permutation of n Objects, r at a time
A permutation of a set of n distinct
objects taken r at a time without
repetition is an arrangement of the r
objects in a specific order
The number of Permutations of n Objects
taken r at a time
The number of permutations of n distinct
objects taken r at a time without repetition is
given by
Pn,r = n • (n - 1) • L • (n − r + 1)
Pn,r =
n!
(n - r)!
0≤r ≤n
r factors
Pn,n = n!
Combinations
In our Lotto example the order of the six
numbers did not matter. So we can NOT use
the permutation formula.
Combination of n Objects taken r at a time
A combination of a set of n distinct objects
taken r at a time without repetition is an r
element subset of a set of n objects. The
arrangement of the elements does NOT
matter.
Simple Example:
How many ways can 2 out of 3 paintings of an
artist be selected for shipment to an exhibition?
Let the paintings correspond to {A,B,C}
First choice:
Second:
Ordered:
A
B
C
B or C
A or C
A or B
(A,B) ; (A,C) (B,A) ; (B,C) (C,A) ; (C,B)
There are 6 permutations, but only 3
combinations: {A,B};{A,C};{B,C}
Number of Combinations of n objects
taken r at a time
The number of combinations of n distinct
objects taken r at a time without repetition is
given by
æ n ö Pn,r
n!
Cn,r = çç ÷÷ =
=
0≤r ≤n
r!
r! (n - r)!
èr ø
How many 5 card hands can be
drawn from a 52 card deck?
æ 52 ö
52!
52!
÷÷ =
=
=
C 52,5 = çç
è 5 ø 5! (52 - 5)! 120 • (47! )
52 • 51 • 50 • 49 • 48
= 2,598,960
120
Permutation: ORDER MATTERS
Combination: ORDER DOES NOT MATTER
Sample Spaces, Events and
Probability
■ EXPERIMENTS
■ SAMPLE SPACES AND EVENTS
■ PROBABILITY OF AN EVENT
■ EQUALLY LIKELY ASSUMPTION
Experiments
We need: Mathematical Model for Probability
Random Experiments:
Do not yield same result if repeated
Result of Experiment = Outcome
Sample Spaces and Events
Experiment = rolling a six sided die
Outcomes: one dot up
two dots up
etc.
Possible outcomes of one
experiment:
Simple Outcomes
Simple Events
ìé
ïê
S = íê
ïê
îë
•
ù é•
ú ê
ú, ê
úû êë
ù é•
ù é•
ú ê
ú ê
,
•
ú ê
ú, ê
• úû êë
• úû êë•
• ù é•
•ù é• • • ù ü
ú ê
ú ê
úï
,
•
ú ê
ú, ê
úý
•úû êë•
•úû êë• • • úû ï
þ
Sample Spaces and Events
S is a sample space for an experiment if
in each trial one and only one of the
elements of S can occur as outcome.
The elements of S are called simple events
or simple outcomes.
An event E is any subset of S, including
the empty set and S itself. E is a simple
event if it contains exactly one element of
S, it is a compound event if it contains
more than one element. We say the event E
occurs if any of the simple events in E occur.
For dice we could think of the die having
the numbers {1,2,3,4,5,6} written on each
side (instead of dots), then S= {1,2,3,4,5,6}.
A simple event would be E={3} (rolling a 3)
or E={6} (rolling a 6)
A compound event E={1,3,5}
(rolling and odd number)
this happens if we roll a 1 or a 3 or a 5
Coin Tossing:
Tossing one coin:
Once:
Head or Tail S={H,T}
Twice:
S={HH,HT,TH,TT}
Tossing two coins(nickel and dime):
Once:
Nickel
H
Start
T
Dime
H
T
H
T
Combined
HH
HT
TH
TT
The sample space also depends
on what question in which we
are interested:
Number of heads when tossing
two coins:
S={0,1,2}
Do both coins show the same
side:
S={yes,no}
Choosing the Sample Space:
There is NO ONE correct sample
space for a given experiment. We
need to include enough detail to
answer all questions of interest
regarding the outcomes of the
experiment. When in doubt choose
a sample space with more rather
than less elements.
Rolling a die and tossing a coin:
1
2
3
4
5
6
H
(H,1) (H ,2) (H,3)
(H,4)
(H,5) (H,6)
T
(T,1) (T,2) (T,3)
(T,4)
(T,5) (T,6)
S={
(H,1),(H,2),(H,3),(H,4),(H,5),(H,6),
(T,1),(T,2), (T,3),(T,4),(T,5), (T,6) }
Probability of an Event
We need a way to compare different
experiments such as two lotteries,
say Lotto Kentucky and Power Ball.
Which one
(A) gives us a better chance of winning
(B) is more likely to produce more money
To answer (A), we need a NUMBER that is
independent on the exact nature of the
experiment and measures the likelihood of
winning.
Number of “good” outcomes
versus
Number of all possible outcomes
Probability of rolling a 3 with one fair six sided
die is 1 in 6 or 1/6.
Probabilities for Simple Events
Given a sample space S={e1,e2,…,en} with n
simple events ei we assign a real number,
denoted P(ei), called the probability of ei to
each simple event. These numbers have to
meet only the following conditions:
1) 0 < P(ei) < 1 for i=1,2,…,n
2) P(e1)+P(e2)+…+P(en)=1
Equally Likely Assumption
If the experiment is such that each simple
event is equally likely (fair coin, fair die,
fair poker dealer, but not horse racing), then
Probability of a simple event with equally
likely assumption:
Sample space S={e1,e2,…,en}, with n
elements, then under equally likely
assumption we have
P(e i ) =
1
n
for i=1,2,…,n
Rolling a die: is it fair or not?
Experiment:
Roll it 600 times
If fair:
About 100 times each of 1,2,3,4,5,6
Empirical Probability Approximation
P(e i ) ≈
Frequency of occurrence of e i f(e i )
=
Total number of trials
n
(The larger n is the better the approximation)
Probability of an arbitrary event E
Given probabilities for simple events, we
define the probability of an event E as
(A)
(B)
(C)
(D)
E is empty set, then P(E)=0
E is simple, then P(E) is known
E is compound, then P(E) is the sum
of all P(ei) for ei in E (over all simple
events in E)
E=S (the sample space) then P(E)=1
(Note: this is a consequence of C)
theorem 1
Probability of E under equally likely
If we assume each simple event in the
sample space S to be equally likely, then
P(E) =
Number of elements in E n(E)
=
Number of elements in S n(S)
Page 403 #20
Suppose 6 people check their coats in a
checkroom. If all claim checks are lost
and the 6 coats are randomly returned,
what is the probability that all people will
get their own coats back?
Solution
The experiment is drawing 6 coats without
replacement from 6 available coats. Person A
gets the first coat, Person B the second etc. So
order does matter and we need permutations of
6 coats 6 at a time, P6,6
For the probability we need to know how many
correct assignments there are. Only one!
P(E) =
1
1
1
=
=
≈ 0.001389
P6,6 6! 720
Union, Intersection, Complement
of Events
Odds
■
■
■
■
UNION and INTERSECTION
COMPLEMENT of an EVENT
ODDS
APPLICATIONS to EMPIRICAL
PROBABILITY
Union and Intersection
A, B events in (i.e. subsets of) sample space
S, then A∪ B (“A union B”) and A ∩ B (“A intersect B”) are
A ∪ B = {e ∈ S|e ∈ A or e ∈B}
S
A
B
A ∩ B = {e ∈ S|e ∈ A and e ∈B}
S
The event A or B is A ∪ B
The event A and B is A ∩ B
Example: Rolling a die, S={1,2,3,4,5,6}
a)
E=Rolling an odd number or a number
greater than 3.
A={1,3,5} B={4,5,6} E=A ∪ B={1,3,4,5,6}
P(E)=n(E)/n(S)=5/6
b)
F=Rolling an odd number and a number
greater than 3.
A={1,3,5} B={4,5,6} F=A ∩ B={5}
P(F)=n(F)/n(S)=1/6
Recall:
n(A ∪ B) = n(A) + n(B) - n(A ∩ B)
And since
P(A ∪ B) =
n(A ∪ B) n(A) + n(B) - n(A ∩ B)
=
n(S)
n(S)
Probability of a Union of two Events:
P(A ∪ B)=P(A)+P(B)-P(A ∩ B)
If A and B are mutually exclusive (A∩ B)= ∅ )
P(A ∪ B)=P(A)+P(B)
Complement of an Event
S={e1,e2,…,en}
E and E’ subsets of S such that
E ∪ E’=S
E ∩ E’=∅ then E’ is the complement of E in S
E’= set of all elements of S NOT in E.
S
E’
E
Recall that
P(S)=1
and P(E ∪ E’)=P(E)+P(E’)
Complements
P(E)=1-P(E’)
P(E’)=1-P(E)
Birthday Problem
Suppose everyone has one of 365 birthdays
(no leap years). We have 39 students registered
what is the probability that at least two have
the same birthday (only day not year)?
S=possible birthdays for 39 people:
n(S)=365*365*…*365 = 36539
E=at least two people have same birthday
E’=everyone has a different birthday
To determine n(E’), we note that the first person
can have any of 365 birthdays, but the second
only 364 (not the same as the previous person)
and the third only 363 (not same as all previous
persons) etc.
n(E’)=365*364*363*…(365-38)
(39 terms)
=365!/(365-39)!
with the equally likely assumption
365!
P(E’)=n(E’)/n(S)=
=0.122
39
365 (365 - 39)!
P(E)=1-P(E’)=0.878
From Probability to Odds
Odds for E and odds against E
If P(E) is the probability of event E, then
Odd for E=
P(E)
P(E)
=
1- P(E) P(E' )
Odds against E=
P(E' )
P(E)
P(E) ≠ 1
P(E) ≠ 0
Probability measures:
• good events divided by all possible events
Odds measure:
• good events divided by bad events
or
Probability of winning divided by
Probability of loosing
From Odds to Probability
If the odds for the event E are a/b, then
the probability of E is
P(E)=
a
a+b
Fair Game
If the odds for the event E are a/b,
then we say the game is fair if your
bet of $a is lost if E does not happen,
but you win $b if E does happen.
Single Roll of Two Fair Dice
What is the probability (what are the odds)
of rolling a sum of 8?
roll of the second die
1st
d
i
e
r
o
l
l
1
2
3
4
5
6
1
2
3
4
5
6
7
2
3
4
5
6
7
8
3
4
5
6
4
5
6
7
5
6
7
8
6
7
8
9
7
8
9
10
8
9
10
11
9
10
11
12
There are 5 ways of getting an 8, but
there are 36 total possibilities, thus
P(E)=
5
=0.1389
36
The odds for E are
5
P(E) = 36 = 36 = 5
1-P(E) 1- 5
31 31
36
36
5
If you bet $5 that a sum of 8 turns up,
how much should the house pay to make
this a fair game?
Since the odds are 5:31 the house should
pay $31 if a sum of 8 comes up.
Applications to empirical probability
Odds for E is number of elements in E
divided by number of elements in S but
NOT in E
1000 people are surveyed, 500 tried brand A
600 tried brand B and 200 tried both. What are
the empirical odds for the event E that one
person has tried at least one of the brands?
n(A ∪ B) = n(A) + n(B) - n(A ∩ B) = 500 + 600 - 200 = 900
number of people who haven’ t tried either
1000 - 900 = 100
Therefore the odds for E are
Number of people who tried either
=
number of people who tried neither
900
= 9 : 1 " nine to one"
100
n(A ∪ B) 900
=
= 0.9
empirical probability is
1000
n(S)
Conditional Probability,
Intersection, Independence
■ CONDITIONAL PROBABILITY
■ INTERSECTION OF EVENTS
(PRODUCT RULE)
■ PROBABILITY TREES
■ INDEPENDENT EVENTS
■ SUMMARY
Probability of someone carrying a
bomb on an airplane = p1
Probability of two people carrying
a bomb on an airplane = p2
p2 << p1
Should you always carry a bomb?
NO!
Conditional Probability
The probability of a second person carrying
a bomb, given that you already brought one,
is the same as the probability any one person
carrying on a bomb.
P(second bomb| first bomb)=P(one bomb)
“probability of a second bomb, given that
we know there is already one”
Probability that you roll a 6 with a single
roll of a fair die, given that the person
before you rolled a 6
If the die is fair, this knowledge does not
help. P(6|6 previously)=P(6)=1/6
Probability that you rolled a prime number
{2,3,5} given that you rolled an odd number
There are 3 odd numbers, {1,3,5}, but
only {3,5} are prime
P(prime|odd)=2/3
Rules for Conditional Probabilities
Conditional Probability
For events A and B in a sample space S,
the conditional probability of A given B is
n(A ∩ B)
n(A ∩B)
n(S) = P(A ∩B)
P(A|B)=
=
n(B)
n(B)
P(B)
n(S)
P(B) ≠ 0
Intersection of Events
Product Rule
Last time we discussed the probability of
a union of two events, what about intersection?
P(A|B)=
P(A ∩ B)
P(B)
and
P(B|A)=
P(A ∩ B)
P(A)
so
P(A ∩B)=P(A|B)P(B)=P(B|A)P(A)
If 60% of the customers of a department
store are female and 80% of the male
customers have charge accounts, what is
the probability that a customer selected
at random is male and has a charge account?
P(male)=1-P(female)=1-0.6=0.4
P(charge|male)=0.8
P(male and charge)=P(charge|male)P(male)
=
0.8 *
0.4 =0.32
Probability Trees
A box has two green (striped)
and three blue (dotted) balls.
We draw two balls without
replacement.
g2
g1
S
start
b1
b2
g2
b2
P(g2|g1)=
2
5
g1
S
start
3
5
1
4
3
4
2
4
g2
b2
g2
b1
P(b2|b1)=
2
4
b2
P(g ∩ g ) =P(g )P(g | g ) = 2 • 1 = 1
1 2
1
2 1 5 4 10
P(g ∩ b ) =P(g )P(b | g ) = 2 • 3 = 3
1
2
1
2 1 5 4 10
P(b ∩ g )=P(b )P(g |b )= 3 • 2 = 3
1 2
1
2 1 5 4 10
3 2 3
P(b ∩ b ) = P(b )P(b | b ) = • =
1
2
1
2 1 5 4 10
Total
=1
Constructing Probability Trees
Step 1. Draw tree diagram, all combined
outcomes of sequences of experiments
Step 2. Assign probabilities to each branch;
probability of combined outcome is product
of all probabilities leading to that end
Step 3. Use the results of the above to
answer all questions
More Draws, Bigger Tree
Draw three times without
replacement, what is the
probability to draw
a) striped, striped, dotted
(g,g,b)=g1g2b3
b) dotted, dotted, dotted
(b,b,b)=b1b2b3
c) striped, striped, striped
(g,g,g)=g1g2g3
g2
g1
b2
b3
g3
b3
S
g2
b1
b2
g3
b3
g3
b3
Independence
Suppose instead of keeping the balls out after
they were drawn, we put them back in, then
it looks as follows:
After 1 draw After 2 draws
After 3 draws
Independence
If A and B are any events then we say
that A and B are independent if and only
if
P(A ∩ B) = P(A)P(B)
Otherwise, And B are dependent
Theorem 1: On Independence
If A and B are independent events with
nonzero probability, then
P(A|B)=P(A) and P(B|A)=P(B)
If either of the above equations holds,
then A and B are independent.
Testing for Independence
We need to check whether the probability
that events A and B occur together is the
same as the product of the probability of
A and the probability of B
Toss a coin twice:
S={HH,HT,TH,TT} A={HH,HT} B={HH,TH}
P(A and B)=P(HH)=1/4
P(A)=1/2; P(B)=1/2; P(A)P(B)=1/2*1/2=1/4
Independent of Set of Events
A set of events is said to be independent
if for any finite subset {E1,E2,…,Ek} we
have
P(E ∩ E ∩ L ∩ E ) = P(E ) P(E ) L P(E )
k
k
1
2
1
2
Problem 50 page 434
Quality control: A car manufacturer produces
37% of its cars at plant A. If 5% of the cars
made at plant A have a defective part, what is
the probability that car of this manufacturer
was made at plant A and has a defective part?
A=made at plant A; D=defective part
P(A)=0.37, P(D|A)=0.05
P(A and D)=0.37*0.05= 0.0185
Summary
Conditiona l Probabilit y
P(A|B)= P(A ∩ B) and P(B|A)= P(A ∩ B)
P(B)
P(A)
Product Rule
P(A ∩ B)=P(A|B)P (B)=P(B|A) P(A)
Independen t Events
P(A ∩ B)=P(A)P(B )
P(A|B)=P(A ) and P(B|A)=P(B ) if P(A) ≠ 0 and P(B) ≠ 0
If E ,E , L ,E are independen t then
1 2
k
P(E ∩ E ∩ L ∩ E )=P(E ) P(E ) L P(E )
1
2
1
2
k
k
Bayes’ Formula
Probability of an earlier event
g2
g1
S
b2
g2
start
b1
b2
g2
g1
S
b2
g2
start
b1
b2
Given the probabilities at the end
P(b2), P(g2) can we determine P(g1), P(b1)?
A more useful setting
Given are two urns U1, containing
3 blue and two white balls, and U2,
containing one blue and 3 white balls.
We first pick an urn, then pick a
ball at random from the chosen urn.
P(U1)=1/3 P(B|U1)=3/5 P(W|U1)=2/5
P(U2)=2/3 P(B|U2)=1/4 P(W|U2)=3/4
The probability tree
B
3
5
1
3
U1
W
2
5
S
start
B
1
4
2
3
U2
3
4
W
Now we would like to know:
If we got a blue ball what was
the probability that it came from urn 1?
P(U1 | B) =
P(U1 ∩ B)
P(B)
Since there are only two ways to get B
P(B) = P(U1 ∩ B) + P(U2 ∩ B)
Combining these two
P(U1 | B) =
P(U1 ∩ B)
P(U1 ∩ B) + P(U2 ∩ B)
P(U1 | B) =
P(U1 )P(B | U1 )
P(U1 )P(B | U1 ) + P(U2 )P(B | U2 )
P(U1 | B) =
P(B | U1 )P(U1 )
P(B | U1 )P(U1 ) + P(B | U2 )P(U2 )
Recall from last time
P(B|U1)P(U1)=Product of branch probabilities
leading to B through U1: (3/5)*(1/3)=1/5
P(B|U2)P(U2)= Product of branch probabilities
leading to B through U2: (1/4)*(2/3)=1/6
P(U1 | B) =
Product of branch probabilities to B through U1
Sum of all branch products to B
æ 3 öæ 1 ö
ç ÷ç ÷
6
è 5 øè 3 ø
=
≈ 0.55
=
æ 3 öæ 1 ö æ 1 öæ 2 ö 11
ç ÷ç ÷ + ç ÷ç ÷
è 5 øè 3 ø è 4 øè 3 ø
More Urns, a Picture
S
E
U1 ∩ E
U1
U2 ∩ E
U2
U3 ∩ E
U3
Associated Formulae
P(U1 | E) =
P(U1 | E) =
P(U1 ∩ E)
P(U1 ∩ E) + P(U2 ∩ E) + P(U3 ∩ E)
P(E | U1 )P(U1 )
P(E | U1 )P(U1 ) + P(E | U2 )P(U2 ) + P(E | U3 )P(U3 )
Bayes’ Formula
Theorem 1
Let U1,U2,…, Un be n mutually exclusive events
whose union is S. Let E be an event in S such
that P(E) is not zero. Then
P(Uk | E) =
P(Uk | E) =
P(Uk ∩ E)
P(E)
P(E | Uk )P(Uk )
P(E | U1 )P(U1 ) + ... + P(E | Un )P(Un )
B
3
5
1
3
U1
S
start
W
B
2
5
1
4
2
3
U1
B
S
start
U2
U2
U1
W
3
4
W
U2
Page 442, number 42:
A company rated 75% of employees satisfactory,
25%unsatisfactory. Of the satisfactory ones 80%
had experience, of the unsatisfactory only 40%.
If a person with experience is hired, what is the
probability that (s)he will be satisfactory?
E=experience, N=no experience, S=satisfactory
U=unsatisfactory
P(E|S)=0. 8, P(E|U)=0.2, P(N|S)=0.4, P(N|U)=0.6
P(S)=0.75, P(U)=0.25
Question, what is P(S|E)?
0.8
0.75
0.25
S
U
0.2
0.4
0.6
E
N
E
N
P(E | S)P(S)
=
P(E | S)P(S) + P(E | U)P(U)
0.8 0.75
≈ 0.857
0.8 0.75 + 0.4 0.25
P(S | E) =
Random Variable
Probability Distribution
Expectation
■ RANDOM VARIABLE, PROBABILITY
DISTRIBUTION
■ EXPECTED VALUE OF A RANDOM VARIABLE
■ DECISION-MAKING AND EXPECTED VALUE
Random Variable
A random variable is a function that assigns
a numerical value to each simple event in a
sample space S.
Example: Tossing a coin.
S1={H,T} for a single toss
S2={HH,HT,TH,TT} two tosses
The random variable will depend on the
question that we want to answer:
Number of heads:
f(H)=1, f(T)=0
g(HH)=2, g(HT)= g(TH)=1, g(TT)=0
Simpler notation:
Tossing a coin three times, let x be the
random variable of the number of tails.
x ∈ {0,1,2,3}
The corresponding events are
x = 0 if the event is {HHH}
x = 1 if the event is {HTT, THT, TTH}
x = 2 if the event is {HHT, THH,HTH}
x = 3 if the event is {HHH}
What about probabilities?
Probability of getting two tails when tossing
a coin three times:
x= number of tails
p(0)=P(x=0)=P({ei in S| x(ei)=0})=P({HHH})=1/8
p(1)=P(x=1)=P({ei in S| x(ei)=1})
=P({THH,HTH,HHT})=3/8
p(2)= … =3/8
p(3)= … =P({TTT})=1/8
Probability distribution of a random variable X
A probability function P(X=x)=p(x) is a
probability distribution of the random
variable X
if
1. 0<p(x)<1, x in {x1,x2, … ,xn}
2. P(x1)+p(x2)+ … +p(xn)=1
where {x1,x2, … ,xn} are the range
(possible values) of X.
Random variable
Probability distribution
X
p
e1, e2 e3 e4
e5 e6 e7 e8
x1, x2 x3
x4 x5 x6
p1 p2 p3
Sample space
Numerical
values of X
Probability of
X=x
Expected Values of
a Random Variable
IDEA: What happens in the “long run”?
What is the “average” number of tails in the
experiment of tossing the coin three times?
1) toss three times
2) record number of tails {0,1,2,3}
3) repeat n times
We expect to get 0 tails 1/8 of the time, 1
tail 3/8 of the time, 2 tails 3/8 of the time
and 3 heads 1/8 of the time
Expected value of a random variable X
Given the probability distribution of a random
variable X,
xi
x1
x2
…
xn
pi
p1
p2
…
pn
Where pi = p(xi), we define the expected value
of X, denoted E(X), by the formula
E(X)=x1p1+x2p2+ … +xnpn
Steps for Computing Expected Values
Step 1: Form the probability distribution
of the random variable X.
Step 2: Multiply each image value of X
by its corresponding probability
of occurrence; add the results.
Expected Winnings for Lottery
Suppose we pay $ D (that is buy D tickets
with the same six numbers) and win one
million dollars if our six numbers come up,
otherwise loose our $ D. What are our expected winnings? This is a 6 out of 49 lotto.
Correct combinations:
Possible combinations:
1
æ 49 ö
49!
çç
÷÷ =
= 13,983,816
è 6 ø 6! 43!
Probability of winning: 0.000000007151123842
= 0.7151123842 10-7
Probability of loosing: 1- 0.7151123842 10-7
=0.9999999285
Expected winnings =
(1,000,000-D)*0.7151123842 10-7+
(-D)*(1- 0.7151123842 10-7)
= 0.0 7151123842 - D
Fair would be if expected value = 0
This would correspond to a ticket price of
D= 0.0 7151123842 or about 7 cents
If you bet $1 you can expect to
win -0.92848876158 or loose about 93 cents
Decision making
Outdoor concert, weather forecast
predicts 0.24 chance of rain. If no
rain $100000 net, if rain only $ 10000
net. Insurance for the $ 100000 costs
$ 20000. Should you insure?
In sured
xi
N o t insu red
xi
0.2 4
rain
$ 90,000
$ 1 0,00 0
0.7 6
no rain
$ 80,000
$1 00,00 0
pi
Ins. E(X)=(90000)(0.24)+(80000)(0.76)=82400
Not E(X)=(10000)(0.24)+(100000)(0.76)=78400
The other side of the story:
For the insurance company:
E(X)=(-80000)(0.24)+(20000)(0.76)=-4000
They are either soon going out of business
or have “inside”information.