Discrete Structures for Computer Science

Similar documents
The study of probability is concerned with the likelihood of events occurring. Many situations can be analyzed using a simplified model of probability

Section Summary. Finite Probability Probabilities of Complements and Unions of Events Probabilistic Reasoning

Section 6.1 #16. Question: What is the probability that a five-card poker hand contains a flush, that is, five cards of the same suit?

CSC/MTH 231 Discrete Structures II Spring, Homework 5

EECS 203 Spring 2016 Lecture 15 Page 1 of 6

November 6, Chapter 8: Probability: The Mathematics of Chance

The topic for the third and final major portion of the course is Probability. We will aim to make sense of statements such as the following:

Week 1: Probability models and counting

Probability. Dr. Zhang Fordham Univ.

The next several lectures will be concerned with probability theory. We will aim to make sense of statements such as the following:

Chapter 1. Probability

The probability set-up

A Probability Work Sheet

Probability MAT230. Fall Discrete Mathematics. MAT230 (Discrete Math) Probability Fall / 37

1. The chance of getting a flush in a 5-card poker hand is about 2 in 1000.

Discrete Mathematics and Probability Theory Spring 2016 Rao and Walrand Note 13

Grade 7/8 Math Circles February 25/26, Probability

Compound Probability. Set Theory. Basic Definitions

The probability set-up

Intermediate Math Circles November 1, 2017 Probability I

Math 1313 Section 6.2 Definition of Probability

Probability. The MEnTe Program Math Enrichment through Technology. Title V East Los Angeles College

23 Applications of Probability to Combinatorics

If a regular six-sided die is rolled, the possible outcomes can be listed as {1, 2, 3, 4, 5, 6} there are 6 outcomes.

Probability Rules. 2) The probability, P, of any event ranges from which of the following?

November 11, Chapter 8: Probability: The Mathematics of Chance

4.1 Sample Spaces and Events

November 8, Chapter 8: Probability: The Mathematics of Chance

Chapter 5 - Elementary Probability Theory

Combinatorics and Intuitive Probability

Theory of Probability - Brett Bernstein

Week 3 Classical Probability, Part I

Honors Precalculus Chapter 9 Summary Basic Combinatorics

CS 237: Probability in Computing

Rosen, Discrete Mathematics and Its Applications, 6th edition Extra Examples

1. An office building contains 27 floors and has 37 offices on each floor. How many offices are in the building?

Chapter 1. Probability

The game of poker. Gambling and probability. Poker probability: royal flush. Poker probability: four of a kind

Combinatorics: The Fine Art of Counting

The student will explain and evaluate the financial impact and consequences of gambling.

Grade 6 Math Circles Fall Oct 14/15 Probability

Simple Probability. Arthur White. 28th September 2016

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

Block 1 - Sets and Basic Combinatorics. Main Topics in Block 1:

Independent Events. 1. Given that the second baby is a girl, what is the. e.g. 2 The probability of bearing a boy baby is 2

7.1 Experiments, Sample Spaces, and Events

CHAPTER 2 PROBABILITY. 2.1 Sample Space. 2.2 Events

Elementary Statistics. Basic Probability & Odds

ECON 214 Elements of Statistics for Economists

1. A factory makes calculators. Over a long period, 2 % of them are found to be faulty. A random sample of 100 calculators is tested.

, x {1, 2, k}, where k > 0. (a) Write down P(X = 2). (1) (b) Show that k = 3. (4) Find E(X). (2) (Total 7 marks)

Raise your hand if you rode a bus within the past month. Record the number of raised hands.

Independent Events B R Y


Lesson 4: Chapter 4 Sections 1-2

I. WHAT IS PROBABILITY?

CSI 23 LECTURE NOTES (Ojakian) Topics 5 and 6: Probability Theory

Probability (Devore Chapter Two)

Key Concepts. Theoretical Probability. Terminology. Lesson 11-1

Section Introduction to Sets

Chapter 1: Sets and Probability

Mathematical Foundations HW 5 By 11:59pm, 12 Dec, 2015

Sample Spaces, Events, Probability

The Teachers Circle Mar. 20, 2012 HOW TO GAMBLE IF YOU MUST (I ll bet you $5 that if you give me $10, I ll give you $20.)

Conditional Probability Worksheet

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Probability with Set Operations. MATH 107: Finite Mathematics University of Louisville. March 17, Complicated Probability, 17th century style

Discrete Structures for Computer Science

2. Combinatorics: the systematic study of counting. The Basic Principle of Counting (BPC)

Option 1: You could simply list all the possibilities: wool + red wool + green wool + black. cotton + green cotton + black

STAT 430/510 Probability Lecture 3: Space and Event; Sample Spaces with Equally Likely Outcomes

Discrete probability and the laws of chance

Discrete Mathematics and Probability Theory Spring 2014 Anant Sahai Note 11

Exam III Review Problems

Probability. Ms. Weinstein Probability & Statistics

4.3 Rules of Probability

Probability Theory. Mohamed I. Riffi. Islamic University of Gaza

Probability and the Monty Hall Problem Rong Huang January 10, 2016

Counting (Enumerative Combinatorics) X. Zhang, Fordham Univ.

7.1 Chance Surprises, 7.2 Predicting the Future in an Uncertain World, 7.4 Down for the Count

MAT104: Fundamentals of Mathematics II Summary of Counting Techniques and Probability. Preliminary Concepts, Formulas, and Terminology

Contents 2.1 Basic Concepts of Probability Methods of Assigning Probabilities Principle of Counting - Permutation and Combination 39

Section : Combinations and Permutations

10-1. Combinations. Vocabulary. Lesson. Mental Math. able to compute the number of subsets of size r.

Math 102 Practice for Test 3

Algebra 1B notes and problems May 14, 2009 Independent events page 1

Functional Skills Mathematics

TEST A CHAPTER 11, PROBABILITY

Georgia Department of Education Georgia Standards of Excellence Framework GSE Geometry Unit 6

CIS 2033 Lecture 6, Spring 2017

Probability: Terminology and Examples Spring January 1, / 22

Bell Work. Warm-Up Exercises. Two six-sided dice are rolled. Find the probability of each sum or 7

Lesson 4: Calculating Probabilities for Chance Experiments with Equally Likely Outcomes

Counting and Probability

Conditional Probability Worksheet

Date. Probability. Chapter

Lesson 4: Calculating Probabilities for Chance Experiments with Equally Likely Outcomes

From Probability to the Gambler s Fallacy

COUNTING AND PROBABILITY

Def: The intersection of A and B is the set of all elements common to both set A and set B

Transcription:

Discrete Structures for Computer Science William Garrison bill@cs.pitt.edu 6311 Sennott Square Lecture #23: Discrete Probability Based on materials developed by Dr. Adam Lee

The study of probability is concerned with the likelihood of events occurring Like combinatorics, the origins of probability theory can be traced back to the study of gambling games Still a popular branch of mathematics with many applications: Risk Assessment Simulation Genetics Algorithm Design Gambling

Many situations can be analyzed using a simplified model of probability Assumptions: 1. Finite number of possible outcomes 2. Each outcome is equally likely Dice Card games Flipping coins Roulette Lotteries

Terminology Definitions: l An experiment is a procedure that yields one of a given set of possible outcomes l The sample space of an experiment is the set of possible outcomes l An event is a subset of the sample space l Given a finite sample space S of equally-likely outcomes, the probability of an event E is p(e) = E / S. Example: l Experiment: Roll a single 6-sided die one time l Sample space: {1, 2, 3, 4, 5, 6} l One possible event: Roll an even number {2, 4, 6} l The probability of rolling an even number is {2, 4, 6} / {1, 2, 3, 4, 5, 6} = 3/6 = 1/2

Solving these simplified finite probability problems is easy I told you that combinatorics and probability were related! Step 1: Identify and count the sample space / Step 2: Count the size of the desired event space Step 3: Divide!

When two dice are rolled, what is the probability that the sum of the two numbers is seven? Step 1: Identify and count sample space l Sample space, S, is all possible pairs of numbers 1-6 l Product rule tells us that S = 6 2 = 36 Step 2: Count event space l (1, 6) l (2, 5) l (3, 4) l (4, 3) l (5, 2) l (6, 1) E = 6 Step 3: Divide l Probability of rolling two dice that sum to 7 is p(e) l p(e) = E / S = 6/36 = 1/6

Balls and Bins Example: A bin contains 4 green balls and 5 red balls. What is the probability that a ball chosen from the bin is green? Solution: l 9 possible outcomes (balls) l 4 green balls, so E = 4 l So p(e) = 4/9 that a green ball is chosen

Hit the lotto Example: Suppose a lottery gives a large prize to a person who picks 4 digits between 0-9 in the correct order, and a smaller prize if only three digits are matched. What is the probability of winning the large prize? The small prize? Solution: Grand prize l S = possible lottery outcomes l S = 10 4 = 10,000 l E = all 4 digits correct l E = 1 l So p(e) = 1/10,000 = 0.0001 Smaller prize l S = possible lottery outcomes l S = 10 4 = 10,000 l E = one digit incorrect l We can count E using the sum rule: l 9 ways to get 1st digit wrong OR l 9 ways to get 2nd digit wrong OR l 9 ways to get 3rd digit wrong OR l 9 ways to get 4th digit wrong l So E = 9 + 9 + 9 + 9 = 36 l p(e) = 36/10,000 = 0.0036

Mega Lotteries Example: Consider a lottery that awards a prize if a person can correctly choose a set of 6 numbers from the set of the first 40 positive numbers. What is the probability of winning this lottery? Solution: l S = All sets of six numbers between 1 and 40 l Note that order does not matter in this lottery l Thus, S = C(40, 6) = 40!/(6!34!) = 3,838,380 l Only one way to do this correctly, so E = 1 l So p(e) = 1/3,838,380 0.00000026 :( Lesson: You stand a better chance at being struck by lightning than winning this lottery!

Four of a Kind Example: What is the probability of getting four of a kind in a 5-card poker hand? Solution: l S = set of all possible poker hands l Recall S = C(52,5) = 2,598,960 l E = all poker hands with 4 cards of the same type l To draw a four of a kind hand: C(13, 1) ways to choose the type of card (2, 3,, King, Ace) C(4,4) = 1 way to choose all 4 cards of that type C(48, 1) ways to choose the 5 th card in the hand So, E = C(13,1)C(4,4)C(48,1) = 13 48 = 624 l p(e) = 624/2,598,960 0.00024

A Full House Example: How many ways are there to draw a full house during a game of poker? (Reminder: A full house is three cards of one kind, and two cards of another kind.) Solution: l S = C(52,5) = 2,598,960 l E = all hands containing a full house l To draw a full house: Choose two types of cards (order matters) Choose three cards of the first type Choose two cards of the second type l So E = 13 12 4 6 = 3,744 l p(e) = 3,744/2,598,960 0.0014 P(13, 2) = 13 12 ways C(4, 3) = 4 ways C(4, 2) = 6 ways

Sampling with or without replacement makes a difference! Example: Consider a bin containing balls labeled with the numbers 1, 2,, 50. How likely is the sequence 23, 4, 3, 12, 48 to be drawn in order if a selected ball is not returned to the bin? What if selected balls are immediately returned to the bin? Solution: l Note: Since order is important, we need to consider 5-permutations l If balls are not returned to the bin, we have P(50, 5) = 50 49 48 47 46 = 254,251,200 ways to select 5 balls l If balls are returned, we have 50 5 = 312,500,000 ways to select 5 balls l Since there is only one way to select the sequence 23, 4, 3, 12, 48 in order, we have that p(e) = 1/254,251,200 if balls are not replaced p(e) = 1/312,500,000 if balls are replaced

Yes, calculating probabilities can be easy Anyone can divide two numbers! But, Be careful when you: l Define the sets S and E l Count the cardinality of S and E

In-class exercises Problem 1: Consider a box with 3 green balls and 1 pink ball. What is the probability of drawing a pink ball? What is the probability of drawing two green balls in two successive picks (without replacement)? Problem 2: In poker, a straight flush is a hand in which all 5 cards are from the same suit and occur in order. For example, a hand containing the 3, 4, 5, 6, and 7 of hearts would be a straight flush, while the hand containing the 3, 4, 5, 7, and 8 of hearts would not be. Note that a royal flush (10 through A) is not considered a straight flush. What is the probability of drawing a straight flush in poker? Problem 3: A flush is a hand in which all five cards are of the same suit, but do not form an ordered sequence. What is the probability of drawing a flush in poker?

What about events that are derived from other events? Recall: An event E is a subset of the sample space S S Definition: p(e) = 1 p(e) E Proof: l Note that E = S E, since S is universe of all possible outcomes l So, E = S - E l Thus, p(e) = E / S by definition l = ( S - E )/ S by substitution l = 1 - E / S simplification l = 1 p(e) by definition E Why is this useful?

Sometimes, counting E is hard! Example: A 10-bit sequence is randomly generated. What is the probability that at least 1 bit is 0? Solution: l S = all 10-bit strings l S = 2 10 l E = all 10-bit strings with at least 1 zero l E = all 10-bit strings with no zeros = {1111111111} l p(e) = 1 p(e) l = 1 1/2 10 l = 1 1/1024 l = 1023/1024 So the probability of a randomly generated 10-bit string containing at least one 0 is 1023/1024.

We can also calculate the probability of the union of two events Definition: If E 1 and E 2 are two events in the sample space S, then p(e 1 E 2 ) = p(e 1 ) + p(e 2 ) p(e 1 E 2 ). S E 1 E 2 Why does this look familiar? Proof: l Recall: E 1 E 2 = E 1 + E 2 - E 1 E 2 l p(e 1 E 2 ) = E 1 E 2 / S l = ( E 1 + E 2 - E 1 E 2 ) / S l = E 1 / S + E 2 / S - E 1 E 2 / S l = p(e 1 ) + p(e 2 ) - p(e 1 E 2 )

Divisibility Example: What is the probability that a positive integer not exceeding 100 is divisible by either 2 or 5? Solution: l Let E 1 be the event that an integer is divisible by 2 l Let E 2 be the event that an integer is divisible by 5 l E 1 E 2 is the event that an integer is divisible by 2 or 5 l E 1 E 2 is the event that an integer is divisible by 2 and 5 l E 1 = 50 l E 2 = 20 l E 1 E 2 = 10 l p(e 1 E 2 ) = p(e 1 ) + p(e 2 ) - p(e 1 E 2 ) l = 50/100 + 20/100 10/100 l = 1/2 + 1/5-1/10 l = 3/5

Not all events are equally likely to occur Sporting events Investments Games of strategy Nature

We can model these types of real-life situations by relaxing our model of probability As before, let S be our sample space. Unlike before, we will allow S to be either finite or countable. We will require that the following conditions hold: 1. 0 p(s) 1 for each s S 2. p s % ' = 1 No event can have a negative likelihood of occurrence, or more than a 100% chance of occurrence In 100% of experiments, one of the events occurs The function p : S [0,1] is called a probability distribution

Simple example: Fair and unfair coins Example: What probabilities should be assigned to outcomes heads (H) and tails (T) if a fair coin is flipped? What if the coin is biased so that heads is twice as likely to occur as tails? Case 1: Fair coins neach outcome is equally likely nso p(h) = 1/2, p(t) = 1/2 ncheck: l 0 1/2 1 l 1/2 + 1/2 = 1 Case 2: Biased coins nnote: 1. p(h) = 2p(T) 2. p(h) + p(t) = 1 n2p(t) + p(t) = 1 n3p(t) = 1 np(t) = 1/3, p(h) = 2/3

Are the following probability distributions valid? Why or why not? S = {1, 2, 3, 4} where S = {1, 2, 3, 4} where l p(1) = 1/3 l p(1) = 2/3 l p(2) = 1/6 l p(2) = 1/6 l p(3) = 1/6 l p(3) = -1/6 l p(4) = 1/3 l p(4) = 1/3 S = {a, b, c} l p(a) = 3/4 l p(b) = 1/4 l p(c) = 0 S = {a, b, c} l p(a) = 1/2 l p(b) = 1/4 l p(c) = 0

More definitions Definition: Suppose that S is a set with n elements. The uniform distribution assigns the probability 1/n to each element of S. The distribution of fair coin flips is a uniform distribution! Definition: The probability of an event E S is the sum of the probabilities of the outcomes in E. That is: p E = + p s %,

Loaded dice Example: Suppose that a die is biased so that 3 appears twice as often as each other number, but that the other five outcomes are equally likely. What is the probability that an odd number appears when we roll this die? Solution: l p(1) + p(2) + p(3) + p(4) + p(5) + p(6) = 1 l Note that p(1) = p(2) = p(4) = p(5) = p(6) and p(3) = 2p(1) l So, p(1) + p(1) + 2p(1) + p(1) + p(1) + p(1) = 7p(1) = 1 l Thus p(1) = p(2) = p(4) = p(5) = p(6) = 1/7 and p(3) = 2/7 l Now, we want to find p(e), where E = {1, 3, 5} l p(e) = p(1) + p(3) + p(5) l = 1/7 + 2/7 + 1/7 l = 4/7

In-class exercises Consider a die in which (i) 1, 3, and 4 are rolled with the same frequency, (ii) 2 is rolled 3 times more often than 1, (iii) 5 is rolled 2 times more often than 4, (iv) and 6 is rolled 4 times more often than 2. Problem 4: What is the probability distribution for this die? Problem 5: What is the probability of rolling a 1 or a 3? Problem 6: What is the probability of rolling an even number? An odd number?

Final Thoughts n Probability allows us to analyze the likelihood of events occurring n Today, we learned how to analyze events that are equally likely, as well as those that have non-equal probabilities of occurrence n Next time: l More probability theory (Section 6.2)