310 likes | 442 Views
CSRU 1400 Discrete Structure. Chapter 6 Probability. 1. Start with Our Intuition. What’s the probability/odd/chance of getting “heads” when a coin is tossed ? 0.5 if it’s a fair coin. getting a number larger than 4 with a roll of a die ? 2/6=1/3
E N D
CSRU 1400 Discrete Structure Chapter 6 Probability 1
Start with Our Intuition • What’s the probability/odd/chance of • getting “heads” when a coin is tossed ? • 0.5 if it’s a fair coin. • getting a number larger than 4 with a roll of a die ? • 2/6=1/3 • drawing either the ace of clubs or the queen of diamonds from a deck of cards (52) ? • 2/52
S outcomes Event and Sample Space • The probability of WHAT? • An event E. e.g., “get the head”, “draw a queen”. • An event E is a set of outcomes. • The set of all possible outcomes is known as the sample space of E, is denoted by S. e.g., “get the head or tail when flip a coin”, “draw a card”. • An event E is subset of sample space S
Probability - P(E) • The chance the event E happens is represented as P(E) • All outcomes are equally likely to occur. • The range of P(E) is [0,1]. • P(E) = 0 means that the event can never occur. • P(E) = 1 means that the event will always occur.
Win the Jackpot! • “just pick 5 numbers from 1 - 56, plus a mega ball number from 1 - 46, … ”, no duplicate numbers. • # of different ways to fill the lottery card ? • Event Space: |E|=1 • Sample Space: |S|=C(56,5)*C(46,1)=175,711,536 • P(E) = 1/175711536 5
Example: Roll Two Dices • The event E: rolling a 7. E={(1,6),(2,5),(3,4),(4,3), (5,2), (6,1)} • The sample space S: all possible combinations of numbers on two dices. |S|= 6 * 6=36 S={(1,1),(1,2),..,(1,6),(2,1),..,(2,6),(3,1),…,(6,6)}
Example : Roll Two Dices • P(E) = 0 means that the event can never occur. • The probability of having two numbers’ sum as 15 is 0. • P(E) = 1 means that the event will always occur. • The probability of having a sum greater than 0 is 1.
Example: Toss A Coin • Two events: E1 = {T} (get a tail), E2={H} (get a head). • Sample space: S= {H,T}. |S|=C(2,1)=2 • P (E1)=|{T}| / | {H,T}| = ½ • P (E2)= |{H}| / | {H,T}| = ½ • P(E1 or E2) = |{H,T}|/|{H,T}| = 1
Example: Tossing A Coin Three Times • Tossing a coin 3 times, what’s the probability of getting three heads? • Event E1={HHH} and | E1 |=1*1*1=1 • Sample Space S ={HHH, HHT,HTH,HTT,THH,THT,TTH,TTT} and |S|= C(2,1)*C(2,1)*C(2,1)=2*2*2=8 • Probability of E: P(E1)=| E1 |/|S|= 1/8 = 12.5%
Example: Tossing A Coin Three Times • Tossing a coin 3 times, what’s the probability of getting same results on last two tosses ? • Event E2 ={HHH, THH, HTT, TTT} and | E2 |= C(2,1)*C(2,1) = 2*2=4 • Sample Space S={HHH, HHT,HTH,HTT,THH,THT,TTH,TTT} and |S|= C(2,1)*C(2,1)*C(2,1)=2*2*2=8 • Probability of E: P(E2)=| E2 |/|S|= 4/8 = 50%
Example: Tossing A Coin Three Times • Tossing a coin 3 times, what’s the probability of getting exactly two heads ? • Event E3 ={HHT, HTH, THH} and | E3 |= C(3,2)*C(1,1) = 3 • Sample Space S={HHH, HHT,HTH,HTT,THH,THT,TTH,TTT} and |S|= C(2,1)*C(2,1)*C(2,1)=2*2*2=8 Probability of E: P(E2)=| E3 |/|S|= 3/8 = 37.5% 11
Let’s Play Poker! • When we draw a card from a standard deck of cards (52 cards, 13 cards for each suit). • Sample space is: • All 52 cards • Num. of outcomes that getting an ace is: • |E|=4 • Probability of getting an ace is: • |E|/|S|=4/52=7.7% • Probability of getting a red cardORan ace is: • |E|=26 red cards+2 black ace cards=28 • P (E)=28/52=53.8%
Play Poker • Drawing two cards from the top of a deck of 52 cards, the probability that two cards having same value ? • Event that two cards have same value, E: • |E|=C(13,1)*C(4,2) • Sample space S: • |S|=C(52,2) • P(E)=|E|/|S|=3/51
Example: Match The Card • At a party, each card in a standard deck is torn in half and both halves are placed in a box. Two guests each draw a half-card from the box. What’s the probability that they draw two halves of the same card ? • How many ways to draw two halves of same card from the 52*2 half-cards? • |E|=C(52,1) • Size of sample space, i.e., how many ways are there to draw two from the 52*2 half-cards ? • |S|=C(104,2) • Prob. that they draw two halves of the same card: • P(E)= |E|/|S|=1/103.
Events are sets E2 E1 1 S 5 2 4 3 6 Die rolling experiment E1: getting a number greater than 3 E2: getting a number smaller than 5 • Event of an experiment is a subset of sample space S. • Events are sets, therefore all set operations apply to events • union: • E1 or E2 occurs • Intersection: • E1 and E2 both occurs 15
Disjoint Event S E2 E1 • Two events E1, E2 for an experiment are said to be disjoint (or mutually exclusive) if they cannot occur simultaneously, i.e. • Tossing a dice once • “getting a 3” & “getting a 4” are disjoint • “getting a 3” & “not getting a 6” are not disjoint
Addition Rule of Probability S E2 E1 S E1 E2 if E1 are E2 are disjoint, Generally,
Example of Applying Addition Rules • Toss a fair coin five times, what’s the probability that the first two tosses have same result (E1), or the last two tosses have same result (E2)? i.e. P(E1⋃ E2) = ? • Prob. that first two tosses have same result ? • P (E1) = (2*2*2*2)/(2*2*2*2*2)=1/2 • Prob. that last two tosses have same result? • Similar to above, P(E2) = 1/2 • Are these two events disjoint? • P(E1 ⋃ E2) = P(E1)+P(E2) – P(E1⋂ E2) • Prob. That first two tosses have same result and last two tosses have same result • P(E1⋂ E2)= (2*2*2)/(2*2*2*2*2)=1/4 • P(E1 ⋃ E2) = =1/2+1/2-1/4=3/4
Complement of a Specific Event • Complement of an Event, Ec means E does not occur. • The probability of Ec is denoted by P(Ec) • Given the definition of Ec , we have E ⋃ Ec = S and E ⋂ Ec =Ø, we get P(E) + P(Ec) = P(S)=1 and P(Ec) = 1 – P(E). S E Ec
Tossing a coin 3 times 1 • What’s the probability of getting at least one head ? • How large is our sample space ? • |S|=2*2*2=8 • Instead of considering How many outcomes are there in “getting at least one head” ???, we consider How many outcomes are there that getting no head ? • E ={TTT} and |E| = 1 • P(E)= |E|/|S| = 1/8 • Prob. of getting at least one head is P(Ec) = 1 – P(E) = 1 – 1/8 = 7/8 20
Example: Birthday problem • A class of 8 students, what is the probability that at least two students having birthdays in the same month (E), assuming each student is equally likely to have a birthday in the 12 months ? • Sample space: |S|=C(12,1)*C(12,1)*C(12,1)..=128 • Consider Ec :all students were born in different months • Ec : the permutation of 12 months to 8 students, P(12,8) • P(Ec) = P(12,8)/128 • Answer: P(E)=1-P(Ec)=1 - P(12,8)/128 21
Independent Event • Two events, E1 and E2, are said to beindependent if occurrence of E1 event is not influenced by occurrence (or non-occurrence) of E2, and vice versa • Tossing of a coin for 10 times • “getting a head on first toss”, and “getting a head on second toss” • “getting 9 heads on first 9 tosses”, “getting a tail on 10th toss”
Independent Event • Tossing of a coin for 10 times • “getting a head on first toss”, and “getting a head on second toss” • “getting 9 heads on first 9 tosses”, “getting a tail on 10th toss” • Typically, independent events refer to different and independent aspects of experiment outcome • Above example, outcome for different tosses • Your selection of car color and car model
Independent Event: Example • Choosing a committee of three people from a club with 8 men and 12 women, “the committee has a woman” (E1) and “the committee has a man” (E2) • If E1 occurs, … • If E1 does not occur (i.e., the committee has no woman), then E2 occurs for sure • So, E1 and E2 are not independent
Product Rule (Multiplication Rule) • If E1 and E2 are independent events in a given experiment, then the probability that both E1 and E2 occur is the product of P(E1) and P(E2): • Prob. of getting two heads in two coin flips • E1: getting head in first flip, P(E1)=1/2 • E2: getting head in second flip, P(E2)=1/2 • E1 and E2 are independent
Independent event • Pick 2 marbles one by one randomly from a bag of 10 black marbles and 10 blue marbles, with replacement (i.e., first marble drawn in put back to bag) • Prob. of getting a black marble first time and getting a blue marble second time ? • E1: getting a black marble first time • E2: getting a blue marble second time • E1 and E2 are independent (because of replacement)
What if no replacement ? • Pick 2 marbles one by one randomly from a bag of 10 black marbles and 10 blue marbles, without replacement (i.e., first marble drawn is not put back) • Prob. of getting a black marble first, and getting a blue marble second time ? • E1: getting a black marble in first draw • E2: getting a blue marble in second draw • Are E1 and E2 independent ? • If E1 occurs, prob. of E2 occurs is 10/19 • If E1 does not occurs, prob. of E2occurs is: 9/19 • Here, we intuitively use the concept of conditional probability
Conditional Probability S E1 E2 • Probability of E1 given that E2 occurs, P (E1|E2), is defined as: • Prob. that E1 happens given that E2 happens equals to # of outcomes in E1 and E2 divided by # of outcomes in E2.
General Product Rule S E1 E2 • Conditional probability leads to general product rule: • If E1 and E2 are any events in a given experiment, the probability that both E1 and E2 occur is given by
Using Product Rule • Two marbles are chosen from a bag of 3 red, 5 white, and 8 green marbles, without replacement, what’s the probability that both are red ? • P(first one is red and second one is red) =? • P(first one is red)=3/16 • P(second one is red | first one is red) = 2/15 • P(first one is red and second one is red) = P(first one is red) * P(second one is red | first one is red) = 3/16*2/15
Using Product Rule • Two marbles are chosen from a bag of 3 red, 5 white, and 8 green marbles, without replacement, what’s the probability that one is white and one is green ? • Either the first is white, and second is green • (5/16)*(8/15) • Or the first is green, and second is white • (8/16)*(5/15) • So answer is (5/16)*(8/15)+ (8/16)*(5/15)