Definition 4.5.1 Conditional Probability
For sets A and B,
provided P(A)
When finding the probability of an event, sometimes you may need to consider past history and how it might affect things. Indeed, you might think that when the local station forecasts rain then the probability of it actually raining should be greater than if they forecast fair skies. At least that is the hope. :) In this section, you will develop a way to deal with the probability of some event that might change dependent upon the occurence or not of some other event.
Indeed, consider what happens when you keep on dealing a hand of five cards from a shuffled deck but without replacement. Notice how the probability of the same thing (such as P(getting a Heart on the next card)) oscillates based upon what cards came out of the deck on previous hands.
xxxxxxxxxx
print "Conditional Events - successively deal 5 cards w/o replacement"
var('Ace Clubs Diamonds Hearts Jack King Queen Spades')
suits = [Spades, Diamonds, Clubs, Hearts]
values = [2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace]
deck = [(value, suit) for suit in suits for value in values]
full_deck = copy(deck) # to save a copy of the original deck for later use.
deck1 = copy(full_deck)
history1=[]
def _(choice=['Hearts','Spades','Diamonds','Clubs','New Deck'],again=['Repeat Same Suit']):
global deck1, history1
shuffle(deck1)
if choice=='Hearts':
suit = Hearts
elif choice=='Spades':
suit = Spades
elif choice=='Diamonds':
suit = Diamonds
elif choice=='Clubs':
suit = Clubs
else:
deck1 = copy(full_deck)
shuffle(deck1)
history1=[]
if (Set(deck1).cardinality()<5):
print "Deck is too small...get a new deck"
elif choice<>'New Deck':
hand = [deck1.pop() for card in range(5)]
print "Click on a desired suit above to deal out another 5 card hand. The cards dealt:"
print hand
print "The remaining cards in the deck:"
print deck1
num = Set(deck1).cardinality()
print "\nThe number of remaining cards in the deck = %s"%str(num)
looking = []
for card in deck1:
if card[1]==suit:
looking.append(card)
prob = float(Set(looking).cardinality())/num
history1.append(prob)
print 'So, the remaining probability of getting a card from '+choice+' from the remaining cards is %s'%str(prob)
list_plot(history1).show(xmin=0,xmax=9,ymin=0,ymax=1,figsize=(5,2))
Now, consider the case when you put the cards back in, reshuffle, and then get 5 new cards...
xxxxxxxxxx
print "Independent Events - Successively deal 5 cards but WITH replacement"
var('Ace Clubs Diamonds Hearts Jack King Queen Spades')
suits = [Spades, Diamonds, Clubs, Hearts]
values = [2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King, Ace]
deck = [(value, suit) for suit in suits for value in values]
full_deck = copy(deck) # to save a copy of the original deck for later use.
deck1 = copy(full_deck)
h2=[]
def _(choice=['Heart','Spade','Diamond','Club'],again=['Repeat Same Suit']):
if choice=='Hearts':
suit = Hearts
elif choice=='Spades':
suit = Spades
elif choice=='Diamonds':
suit = Diamonds
else:
suit = Clubs
deck1 = copy(full_deck)
shuffle(deck1)
hand = [deck1.pop() for card in range(5)]
print "The cards dealt:"
print hand
print "Replacing this hand and reshuffling gives the remaining cards in the deck:"
deck1 = copy(full_deck)
shuffle(deck1)
print(deck1)
num = Set(deck1).cardinality()
print "\nThe number of remaining cards in the deck = %s"%str(num)
looking = []
for card in deck1:
if card[1]==suit:
looking.append(card)
prob = float(Set(looking).cardinality())/num
h2.append(prob)
print 'So, the remaining probability of getting a '+choice+' from the remaining cards is %s'%str(prob)
list_plot(h2).show(xmin=0,xmax=15,ymin=0,ymax=1,figsize=(5,2))
print 'Independent Events - Successively deal 5 cards but WITH replacement'
Changing Sample Space - Balls: Consider a box with three balls: one Red, one White, and one Blue. Using an equally likely assumption, the probability of randomly pulling out a Red ball should be 1/3. That is P(Red) = 1/3. However, suppose that for a first trial you pull out the White ball and set it aside. Attempting to pull out another ball leaves you with only two options and so the probability of randomly pulling out a Red ball is 1/2. Notice that the probability changed for the second trial dependent on the outcome of the first trial.
Changing Sample Space - Cards: Consider a deck of 52 standard playing cards and a success occurs when a Heart is selected from the deck. When extracting one card randomly, the probability of that card being a Heart is P(Heart) = 13/52. Now, assume that one card has already been extracted and setaside. Now, prepare to extract another. If the first card drawn was a Heart, then there are only 12 Hearts left for the second draw. However, if the first card drawn was not a Heart, then there are 13 Hearts available for the second draw. To compute this probability correctly, one need to formulate the question so that subadditivity can be utilized.
Let be the outcome Heart on 1st draw and be the outcome Heart on 2nd draw. Then,
For sets A and B,
provided P(A)
You can read P(B|A) as "the probability of B given A".
Conditional Probability satisfies all of the requirements of regular probability.
By definition, for any event probability must be nonnegative. Therefore
So,
Further,
For the third part, we will only consider the case when there are two disjoint sets B and C. Then,
For any sets A and B,
If P(A)=0 or P(B)=0, then the result is trivial. Otherwise, unravel the definition of conditional probably by taking the denominator to the other side. Also note that you can write \(A \cap B = B \cap A\text{.}\)
Conditional Probability sometimes makes you have to think carefully about the ways to get the desired outcome.
See how you had to break the given question up into two disjoint pieces.