Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 13 Elements of Probability CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine.

Similar presentations


Presentation on theme: "Lecture 13 Elements of Probability CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine."— Presentation transcript:

1 Lecture 13 Elements of Probability CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine

2 CSCI 1900 Lecture Lecture Introduction Reading –Rosen – Section 6.2, 6.3 Sample spaces Events Probability Pigeonhole principle

3 CSCI 1900 Lecture Sample Space Sample Space - the set containing all possible outcomes of an experiment Examples: –Experiment: Flip a coin, record Heads or Tails. Sample Space: O={H, T} –Experiment: Flip a coin twice Sample Space: O={HH, HT, TH, TT}

4 CSCI 1900 Lecture Sample Space (cont) Examples (cont) –Experiment: Roll two dices, each die has 1-6 spots O={(1,1), (1,2), (1,3), (1,4), (1,5), (1,6), (2,1), (2,2), (2,3), (2,4), (2,5), (2,6), (3,1), (3,2), (3,3), (3,4), (3,5), (3,6), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6), (5,1), (5,2), (5,3), (5,4), (5,5), (5,6), (6,1), (6,2), (6,3), (6,4), (6,5), (6,6) } The number of ways of rolling a particular total may be found on a diagonal (e.g. ways to roll a total of 6 is highlighted)

5 CSCI 1900 Lecture Event A statement about a particular outcome of an experiment is an event –A subset of the sample space The total of the spots on two die is 6 –E={ (5,1), (4,2), (3,3), (2,4), (1,5)}

6 CSCI 1900 Lecture Events (cont) Example: Consider the experiment of tossing a die and recording the outcome of the top face –O={1, 2, 3, 4, 5, 6} (The universal set) –Let E be the event that the number of spots is even E={2, 4, 6} –Let F be the event the number of spots is prime F={2, 3, 5} –E  F ={2, 3, 4, 5, 6} ( Event: number of spots is even or prime) –E  F ={2} (Event: the number of spots is even and prime) –E = {1, 3, 5} (Event: the number of spots is not even)

7 CSCI 1900 Lecture Events (cont) Recall : –If E  F= Ø, then E and F are disjoint –Also called mutually exclusive –This means at most one can occur at a time

8 CSCI 1900 Lecture Probability Each event can be assigned a number, p(E) called the probability of event E If all outcomes are equally likely to occur, then p(E) = |E| / |O| Example. O={H,T} for flipping a coin –Let E={ Event: coin turned up heads}={H} –|E| = 1 |O| = 2 –p(E)=|E| / |O|=1/2

9 CSCI 1900 Lecture Probability (cont) Example. Rolling two fair dice –For O see slide 4 –Let E= {Event: number of spots add to 6} –E = { (1,5), (2,4), (3,3), (4,2), (5,1) } –|E| = 5 –p(E)=|E| / |O| –p(E)= 5/36

10 CSCI 1900 Lecture Probability (cont) Sometimes outcomes are not equally likely –Consider the following “unfair” die –Let O = {1, 2, 3, 4, 5, 6} p 1 = 1/12 p 2 = 1/12 p 3 = 1/3 p 4 = 1/6 p 5 = 1/4 p 6 = 1/12 –p (even number) = 1/12 + 1/6 + 1/12 = 4/12 = 1/3 –p(odd number) = 1/12 + 1/3 + 1/4 = 8/12 = 2/3

11 CSCI 1900 Lecture Properties of Probabilities Property 1: 0 <= p(E) <= 1 Property 2: p(O)=1 and p(Ø)=0 Property 3: p(E  F)=p(E)+p(F) - p(E  F) If E and F are disjoint, then p(E  F)=p(E)+p(F) Property 4: The probability that an event E will not happen 1 - p(E) Property 5: If E and F are independent, then p(E  F) = p(E)*p(F)

12 CSCI 1900 Lecture Example A box contains six red balls and four green balls. Four balls are selected at random. What is the probability that two of the selected balls are red and the other two green? Choose two red from 6 Choose two green from 4 |O|= 10 C 4 = 210 |E|= 6 C 2 * 4 C 2 = 15*6 =90 P(E)= 90/210 = 3/7

13 CSCI 1900 Lecture Example A few poker hands –Total possible hands = 52 C 5 = 2,598,960 Royal Flush  4 possible hands Odds are 4 in 2,598,960  1 in 649,740 Straight Flush  40 possible hands Odds are 40 in 2,598,960  1 in 64,974 Four Aces  48 possible hands Odds are 48 in 2,598,960  1 in 54,145

14 CSCI 1900 Lecture Example (cont) What is the probability that a hand of five cards from a standard deck contains four cards of one kind? Pick the type of kind (2,3,…A) 13 C 1 = 13 Pick the four of that kind 4 C 4 = 1 Pick 1 of the 48 remaining 48 C 1 = 48 |E| = 13*1*48, the number of 5 card hands having 4 of a kind P(E) = |E|/|U| = 624/ 2,598,960 .00024

15 CSCI 1900 Lecture Pigeonhole Principle Reading –Rosen – Section 6.2 If you put n Pigeons in k Holes and n > k then at least one hole will have more than one pigeon in it –Everybody has to be somewhere

16 CSCI 1900 Lecture Example If there are 8 people in a room at least two of them must have been born on the same day of the week … –The people are the pigeons –The days of the week are the pigeonholes

17 CSCI 1900 Lecture Using the Pigeonhole Principle If we are putting 27 files on 26 flash drives, at least one drive will have 2 or more files –Identify the pigeons and the pigeonholes The drives are the pigeonholes The files are the pigeons –We have 26 holes and 27 pigeons –Therefore by the pigeonhole principle at least one disk must have more than 1 file on it

18 CSCI 1900 Lecture Extended Pigeonhole Principle If you put 2K + I People on K Starships then at least one Starship will have more than two people on it You can extend this with 3K + I, 4K + I and so on This is just an application of the Remainder Theorem

19 CSCI 1900 Lecture Using the Extended Principle If we have 433 problems are to be done by 20 students show that at least one student must do more than 21 problems –Identify the pigeons and the pigeonholes The students are the pigeonholes The problems are the pigeons –Apply the Remainder Theorem 433 = 21 * –Therefore K = 21 I=13

20 CSCI 1900 Lecture Key Concepts Summary Sample spaces Events Probability Pigeonhole principle


Download ppt "Lecture 13 Elements of Probability CSCI – 1900 Mathematics for Computer Science Fall 2014 Bill Pine."

Similar presentations


Ads by Google