Probability. Will Monroe Summer 2017 with materials by Mehran Sahami and Chris Piech

Similar documents
Today s Topics. Next week: Conditional Probability

Will Monroe June 28, with materials by Mehran Sahami and Chris Piech. Combinatorics

3. Discrete Probability. CSE 312 Spring 2015 W.L. Ruzzo

2.5 Sample Spaces Having Equally Likely Outcomes

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

Theory of Probability - Brett Bernstein

Chapter 1. Probability

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

Chapter 1. Probability

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

Basic Probability Models. Ping-Shou Zhong

Counting and Probability Math 2320

Chapter 2. Permutations and Combinations

Probability Models. Section 6.2

CSE 312: Foundations of Computing II Quiz Section #2: Inclusion-Exclusion, Pigeonhole, Introduction to Probability (solutions)

8.2 Union, Intersection, and Complement of Events; Odds

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?

1 Permutations. Example 1. Lecture #2 Sept 26, Chris Piech CS 109 Combinatorics

The Product Rule The Product Rule: A procedure can be broken down into a sequence of two tasks. There are n ways to do the first task and n

The probability set-up

More Probability: Poker Hands and some issues in Counting

Permutations. Example 1. Lecture Notes #2 June 28, Will Monroe CS 109 Combinatorics

Week 3 Classical Probability, Part I

Discrete Structures Lecture Permutations and Combinations

Define and Diagram Outcomes (Subsets) of the Sample Space (Universal Set)

Probability. Ms. Weinstein Probability & Statistics

The probability set-up

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

Compound Probability. Set Theory. Basic Definitions

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

STAT 3743: Probability and Statistics

Sample Spaces, Events, Probability

Intermediate Math Circles November 1, 2017 Probability I

Statistics Intermediate Probability

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

Introductory Probability

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

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

Math 1313 Section 6.2 Definition of Probability

Math Exam 2 Review. NOTE: For reviews of the other sections on Exam 2, refer to the first page of WIR #4 and #5.

Math Exam 2 Review. NOTE: For reviews of the other sections on Exam 2, refer to the first page of WIR #4 and #5.

CSE 312: Foundations of Computing II Quiz Section #2: Inclusion-Exclusion, Pigeonhole, Introduction to Probability

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

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

Section 7.1 Experiments, Sample Spaces, and Events

Classical vs. Empirical Probability Activity

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6

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

3 The multiplication rule/miscellaneous counting problems

3 The multiplication rule/miscellaneous counting problems

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

Combinatorics: The Fine Art of Counting

7.1 Experiments, Sample Spaces, and Events

Lecture 1. Permutations and combinations, Pascal s triangle, learning to count

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

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

Chapter 4: Probability and Counting Rules

Probability. Dr. Zhang Fordham Univ.

1 Permutations. 1.1 Example 1. Lisa Yan CS 109 Combinatorics. Lecture Notes #2 June 27, 2018

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

1. Counting. 2. Tree 3. Rules of Counting 4. Sample with/without replacement where order does/doesn t matter.

Probability and Counting Techniques

Counting Poker Hands

Today s Topics. Sometimes when counting a set, we count the same item more than once

Probability. Engr. Jeffrey T. Dellosa.

4.1 Sample Spaces and Events

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

Such a description is the basis for a probability model. Here is the basic vocabulary we use.

Lecture 6 Probability

Discrete Structures for Computer Science

Probability is often written as a simplified fraction, but it can also be written as a decimal or percent.

Probability and Statistics. Copyright Cengage Learning. All rights reserved.

Lecture 14. What s to come? Probability. A bag contains:

Chapter 5 - Elementary Probability Theory

{ a, b }, { a, c }, { b, c }

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

A Probability Work Sheet

Probability - Chapter 4

Probability: Terminology and Examples Spring January 1, / 22

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

Chapter 4: Introduction to Probability

CHAPTER 2 PROBABILITY. 2.1 Sample Space. 2.2 Events

EECS 203 Spring 2016 Lecture 15 Page 1 of 6

Week 6: Advance applications of the PIE. 17 and 19 of October, 2018

6.1 Basics of counting

If you roll a die, what is the probability you get a four OR a five? What is the General Education Statistics

CSE 21: Midterm 1 Solution

4.3 Rules of Probability

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.

GAMBLING ( ) Name: Partners: everyone else in the class

MATHEMATICS 152, FALL 2004 METHODS OF DISCRETE MATHEMATICS Outline #10 (Sets and Probability)

Textbook: pp Chapter 2: Probability Concepts and Applications

Problem Set 2. Counting

Probability (Devore Chapter Two)

Basic Concepts of Probability and Counting Section 3.1

Simple Probability. Arthur White. 28th September 2016

Probability I Sample spaces, outcomes, and events.

CSE 312: Foundations of Computing II Quiz Section #1: Counting (solutions)

Section : Combinations and Permutations

6) A) both; happy B) neither; not happy C) one; happy D) one; not happy

Transcription:

Probability Will Monroe Summer 207 with materials by Mehran Sahami and Chris Piech June 30, 207

Today we will make history

Logistics: Office hours

Review: Permutations The number of ways of ordering n distinguishable objects. n n! = 2 3... n= i i=

Review: Combinations The number of unique subsets of size k from a larger set of size n. (objects are distinguishable, unordered) n k () n! = k!(n k )! choose k n

Review: Bucketing The number of ways of assigning n distinguishable objects to a fixed set of k buckets or labels. k n n objects k buckets

Divider method The number of ways of assigning n indistinguishable objects to a fixed set of k buckets or labels. ( n+(k ) n ) n objects k buckets (k - dividers)

A grid of ways of counting All distinct Some indistinct All indistinct Ordering Subsets n! n k () k n Creativity! Split into cases Use inclusion/exclusion Reframe the problem n! k! k 2! k m! Bucketing ( n+(k ) n )

Sample space S = the set of all possible outcomes Coin flip S = {Heads, Tails} Two coin flips S = {(H, H), (H, T), (T, H), (T, T)} Roll of 6-sided die S = {, 2, 3, 4, 5, 6} # emails in day S = ℕ (non-neg. integers) Netflix hours in day S = [0, 24] (interval, inclusive)

Events E = some subset of S (E S) Coin flip is heads E = {Heads} head on 2 flips E = {(H, H), (H, T), (T, H)} Roll of die 3 E = {, 2, 3} # emails in day 20 E = {x x ℕ, x 20} Wasted day E = [5, 24] (Ross uses to mean )

Set operations Union: outcomes that are in E or F S = {, 2, 3, 4, 5, 6} E= {, 2} F= {2, 3} E F = {, 2, 3}

Set operations Intersection: outcomes that are in E and F S = {, 2, 3, 4, 5, 6} E= {, 2} F= {2, 3} EF = E F = {2}

Set operations Complement: outcomes that are not in E S = {, 2, 3, 4, 5, 6} E= {, 2} F= {2, 3} Ec = {3, 4, 5, 6}

A profound truth https://medium.com/@timanglade/how-hbos-silicon-valley-built-not-hotdog-with-mobile-tensorflow-keras-react-native-ef03260747f3

A profound truth Everything in the world is either a hot dog or not a hot dog. (E Ec = S) https://medium.com/@timanglade/how-hbos-silicon-valley-built-not-hotdog-with-mobile-tensorflow-keras-react-native-ef03260747f3

Quiz question https://b.socrative.com/login/student/ Room: CS09SUMMER7

Quiz question Which is the correct picture for EcFc (= Ec Fc)? S A S E F D S B F E F S E F E F S C E E

Quiz question Which is the correct picture for EcFc (= Ec Fc)? S C E F

Quiz question Which is the correct picture for Ec Fc? S A S E F D S B F E F S E F E F S C E E

Quiz question Which is the correct picture for Ec Fc? S D E F

De Morgan's Laws distributive laws for set complement (E F)c = Ec Fc (E F)c = Ec Fc S S F E c F E Ei = ( Ei ) (i ) i c c Ei = ( Ei ) (i ) i c

What is a probability? A number between 0 and to which we ascribe meaning

Sources of probability Experiment Datasets Expert opinion Analytical solution

Meaning of probability A quantification of ignorance image: Frank Derks

What is a probability? # ( E) P( E)=lim n n

Axioms of probability () (2) (3) 0 P( E) P(S)= If E F=, then P( E F)=P( E)+ P( F) (Sum rule, but with probabilities!)

Corollaries c P( E )= P( E) If E F, then P( E) P( F) P( E F)=P( E)+ P( F) P( EF) (Principle of inclusion/exclusion, but with probabilities!)

Principle of Inclusion/Exclusion The total number of elements in two sets is the sum of the number of elements of each set, minus the number of elements in both sets. A B = A + B A B 3 4 3+4- = 6

Inclusion/exclusion with more than two sets E F G = E F G

Inclusion/exclusion with more than two sets E F G = E E F G

Inclusion/exclusion with more than two sets E F G = E + F E 2 2 F G

Inclusion/exclusion with more than two sets E F G = E + F + G E 2 2 3 F 2 G

Inclusion/exclusion with more than two sets E F G = E + F + G EF E 2 2 F 2 G

Inclusion/exclusion with more than two sets E F G = E + F + G EF EG E F 2 G

Inclusion/exclusion with more than two sets E F G = E + F + G EF EG FG E 0 F G

Inclusion/exclusion with more than two sets E F G = E + F + G EF EG FG E + EFG F G

Inclusion/exclusion with more than two sets size of the union n add or subtract (based on size) n size of intersections r Ei = ( ) i= i < <i r sum over subset sizes sum over all subsets of that size (r +) r= Ei j= j

Inclusion/exclusion with more than two sets prob. of OR n P ( ) add or subtract (based on size) prob. of AND n Ei = ( ) i= r (r +) r= sum over subset sizes i < <i r P ( ) sum over all subsets of that size Ei j= j

Inclusion/exclusion with more than two sets P( E F G)=P( E)+ P( F)+ P(G) P( EF) P( EG) P(FG) E + P( EFG) F G

Break time!

Equally likely outcomes Coin flip S = {Heads, Tails} Two coin flips S = {(H, H), (H, T), (T, H), (T, T)} Roll of 6-sided die S = {, 2, 3, 4, 5, 6} P(Each outcome)= S E P( E)= S (counting!)

Rolling two dice D D2 P( D + D 2=7)=?

How do I get started? For word problems involving probability, start by defining events!

Rolling two dice D D2 P( D + D 2=7)=? E: {all outcomes such that the sum of the two dice is 7}

Rolling two dice D D2 6 P( D + D 2=7)= = 36 6 S = {(, ), (, 2), (, 3), (, 4), (, 5), (, 6), S = {(2, ), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), E =6 S =36 S = {(3, ), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), S = {(4, ), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), S = {(5, ), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), S = {(6, ), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6)}

Rolling two (indistinguishable) dice? D D2 3 sumptions] P( D + D 2=7)= as =? r u o y k c e 2 7 [ch S = {(, ), (, 2), (, 3), (, 4), (, 5), (, 6), S = {(2, ), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), E =3 S =2 S = {(3, ), (3, 2), (3, 3), (3, 4), (3, 5), (3, 6), S = {(4, ), (4, 2), (4, 3), (4, 4), (4, 5), (4, 6), S = {(5, ), (5, 2), (5, 3), (5, 4), (5, 5), (5, 6), S = {(6, ), (6, 2), (6, 3), (6, 4), (6, 5), (6, 6)}

Getting rid of ORs Finding the probability of an OR of events can be nasty. Try using De Morgan's laws to turn it into an AND! c c c P( A B Z )= P( A B Z ) S E F

Running into a friend 2,000 people at Stanford You're friends with 250 Go to an event with 70 other (equally-likely) Stanforders What's P(at least one friend among the 70)? E =??? 2,000 S = 70 ( E: {subsets of size 70 with at least one friend} ) S: {all subsets of size 70 of 2,000 students} image: torbakhopper / scott richard

Running into a friend 2,000 people at Stanford You're friends with 250 Go to an event with 70 other (equally-likely) Stanforders What's P(at least one friend among the 70)? 20,750 70 C C E = 2,000 250 P( E)= P( E )= 2,000 0.552 70 70 E: {subsets of size 70 with at least one friend} 2,000 S = Ec: {subsets of size 70 with no friends} 70 S: {all subsets of size 70 of 2,000 students} ( ( ) ( ( ) ) ) image: torbakhopper / scott richard

Running into a friend https://cs09.stanford.edu/demos/serendipity.html serendipity [ˌse.ɹənˈdɪ.pɨ.ɾi] n the faculty or phenomenon of finding valuable or agreeable things not sought for Merriam-Webster

Getting rid of ORs Finding the probability of an OR of events can be nasty. Try using De Morgan's laws to turn it into an AND! c c c P( A B Z )= P( A B Z ) S E F

Defective chips k E = n k ( ) n S = (k ) n E: {all outcomes such that the defective chip is chosen} S: {all subsets of size k from n chips}

Defective chips k E = n k ( ) n S = (k ) n n k ( ) P( E)= n (k ) (n )! (k )!(n k )! (n )! k! (n )! k (k )! k = = = = n! n!(k )! n (n )!(k )! n k!(n k)!

Poker straight (Standard deck:) 52 cards = 3 ranks 4 suits Straight : 5 consecutive ranks (suits can be different) starting rank E: {all hands that are straights} E =0 4 52 S = 5 ( ) S: {all possible hands} 5 suit of each card image: Guts Gaming (www.guts.com/en)

Poker straight (Standard deck:) 52 cards = 3 ranks 4 suits Straight : 5 consecutive ranks (suits can be different) E: {all hands that are straights} S: {all possible hands} E =0 4 52 S = 5 ( ) 5 5 0 4 P ( E)= 0.00394 52 5 ( ) image: Guts Gaming (www.guts.com/en)

Birthdays n people in a room. What is the probability none share the same birthday? E: {all ways of giving all n people different birthdays} S: {all ways of giving all n people each a birthday} 365! 365 E =365 364 (365 n+)= = n! (365 n)! n n S =365 ( ) 365 n! n ( ) P( E)= 365 n n = 23: P(E) < /2 n = 75: P(E) < /3,000 n = 00: P(E) < /3,000,000 n = 50: P(E) < /3,000,000,000,000,000

Flipping cards Shuffle deck. Reveal cards from the top until we get an Ace. Put Ace aside. What is P(next card is the Ace of Spades)? P(next card is the 2 of Clubs)? A) P(Ace of Spades) > P(2 of Clubs) B) P(Ace of Spades) = P(2 of Clubs) C) P(Ace of Spades) < P(2 of Clubs) https://bit.ly/a2ki4g https://b.socrative.com/login/student/ Room: CS09SUMMER7

Flipping cards Shuffle deck. Reveal cards from the top until we get an Ace. Put Ace aside. What is P(next card is the Ace of Spades)? P(next card is the 2 of Clubs)? E: {all orderings for which Ace of Spades comes immediately after first Ace} S: {all orderings of the deck} E =5! S =52! 5! P ( E)= = 52! 52

Flipping cards Shuffle deck. Reveal cards from the top until we get an Ace. Put Ace aside. What is P(next card is the Ace of Spades)? P(next card is the 2 of Clubs)? E: {all orderings for which 2 of Clubs comes immediately after first Ace} S: {all orderings of the deck} E =5! S =52! 5! P ( E)= = 52! 52

Flipping cards Shuffle deck. Reveal cards from the top until we get an Ace. Put Ace aside. What is P(next card is the Ace of Spades)? P(next card is the 2 of Clubs)? B) P(Ace of Spades) = P(2 of Clubs)

(We just made history)