Mathematics for Computer Science MIT 6.042J/18.062J

Slides:



Advertisements
Similar presentations
22C:19 Discrete Math Counting Fall 2011 Sukumar Ghosh.
Advertisements

Counting. Counting in Algorithms How many comparisons are needed to sort n numbers? How many steps to compute the GCD of two numbers ? How many steps.
Copyright © 2002 by Radhika Nagpal and Charles E. Leiserson. All rights reserved. October 30, L9-2.1 Mathematics for Computer Science MIT 6.042J/18.062J.
Counting. Counting = Determining the number of elements of a finite set.
Counting Chapter 6 With Question/Answer Animations.
Great Theoretical Ideas in Computer Science.
Chapter 3b Counting Rules. Permutations  How many ways can 5 students in a class of 30 be assigned to the front row in the seating chart?  There are.
Discrete Structures & Algorithms More Counting. + + ( ) + ( ) = ? Counting II: Recurring Problems and Correspondences.
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 10Feb 12, 2004Carnegie.
1 Section 5.1 Discrete Probability. 2 LaPlace’s definition of probability Number of successful outcomes divided by the number of possible outcomes This.
Intro to Probability & Games
Counting Techniques: r-combinations with
Week 10 - Monday.  What did we talk about last time?  More permutations  Addition rule  Inclusion and exclusion.
CompSci 102 Discrete Math for Computer Science March 22, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Combinatorics.
Combinatorics 3/15 and 3/ Counting A restaurant offers the following menu: Main CourseVegetablesBeverage BeefPotatoesMilk HamGreen BeansCoffee.
Chapter 11: Counting Methods
Poker Solutions.
Counting. Techniques for counting Rule 1 Suppose we carry out have a sets A 1, A 2, A 3, … and that any pair are mutually exclusive (i.e. A 1  A 2 =
1 Melikyan/DM/Fall09 Discrete Mathematics Ch. 6 Counting and Probability Instructor: Hayk Melikyan Today we will review sections 6.4,
Basic Counting. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations, combinations.
Chapter The Basics of Counting 5.2 The Pigeonhole Principle
Copyright 2013, 2010, 2007, Pearson, Education, Inc. Section 12.2 Theoretical Probability
Chapter 10: Counting Methods
Chapter 6 With Question/Answer Animations 1. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
Fall 2002CMSC Discrete Structures1 One, two, three, we’re… Counting.
15.3 Counting Methods: Combinations ©2002 by R. Villar All Rights Reserved.
Homework Homework due now. Reading: relations
COMPSCI 102 Discrete Mathematics for Computer Science.
Discrete Mathematics for Computer Science. + + ( ) + ( ) = ? Counting II: Recurring Problems and Correspondences Chapter 9 slides 1-54.
Great Theoretical Ideas in Computer Science.
The Pigeonhole Principle. The pigeonhole principle Suppose a flock of pigeons fly into a set of pigeonholes to roost If there are more pigeons than pigeonholes,
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science John LaffertyCS Fall 2005 Lecture 7Sept 20, 2005Carnegie.
Counting II: Recurring Problems And Correspondences Great Theoretical Ideas In Computer Science V. AdamchikCS Spring 2006 Lecture 6Feb 2, 2005Carnegie.
CS Lecture 8 Developing Your Counting Muscles.
2/24/20161 One, two, three, we’re… Counting. 2/24/20162 Basic Counting Principles Counting problems are of the following kind: “How many different 8-letter.
L14: Permutations, Combinations and Some Review EECS 203: Discrete Mathematics.
Discrete Mathematics and Its Applications Sixth Edition By Kenneth Rosen Chapter 5 Counting 歐亞書局.
Probability and statistics - overview Introduction Basics of probability theory Events, probability, different types of probability Random variable, probability.
Texas Holdem A Poker Variant vs. Flop TurnRiver. How to Play Everyone is dealt 2 cards face down (Hole Cards) 5 Community Cards Best 5-Card Hand Wins.
Section 6.3. Section Summary Permutations Combinations.
L14: Permutations, Combinations and Some Review
Introduction to Discrete Mathematics
Developing Your Counting Muscles
Permutations and Combinations
CSC 321: Data Structures Fall 2015 Counting and problem solving
ICS 253: Discrete Structures I
MATH 2311 Chapter 2 Recap.
COCS DISCRETE STRUCTURES
The Addition Rule.
Permutations and Combinations
CS 2210 Discrete Structures Counting
Chapter 10: Counting Methods
Lecture 08 Counting Profs. Koike and Yukita
Mathematics for Computer Science MIT 6.042J/18.062J
Introduction Remember that probability is a number from 0 to 1 inclusive or a percent from 0% to 100% inclusive that indicates how likely an event is to.
Math/CSE 1019: Discrete Mathematics for Computer Science Fall 2011
Asymptotics & Stirling’s Approximation
Mathematics for Computer Science MIT 6.042J/18.062J
Mathematics for Computer Science MIT 6.042J/18.062J
Basic Counting.
Combinatorics.
Mathematics for Computer Science MIT 6.042J/18.062J
Basic Counting Lecture 9: Nov 5, 6.
Counting II: Recurring Problems And Correspondences
Section 12.2 Theoretical Probability
Section 12.2 Theoretical Probability
Counting II: Recurring Problems And Correspondences
Counting I: Choice Trees and Correspondences
Section 12.2 Theoretical Probability
Presentation transcript:

Mathematics for Computer Science MIT 6.042J/18.062J Combinatorics II Copyright © Radhika Nagpal, 2002. Prof. Albert Meyer & Dr. Radhika Nagpal

Last Week: Counting I Sets Pigeonhole Principle Permutations Bijections, Sum Rule, Inclusion-Exclusion, Product Rule Pigeonhole Principle Permutations Tree Diagrams

This Week: Counting II Division Rule Combinations (binomial coefficients) Binomial Theorem and Identities Permutations with limited repetition (multinomial coefficients) Combinations with repetition (stars and bars)

The Real Agenda: Poker How many different hands could I get, if I played 5-card draw?

The Real Agenda: Poker (52) (51) (50) (49) (48) How many different hands could I get, if I played 5-card draw? (52) (51) (50) (49) (48)

The Real Agenda: Poker (52) (51) (50) (49) (48) How many different hands could I get, if I played 5-card draw? (52) (51) (50) (49) (48) r-permutation, P(52,5)

Problem: Over-counting These two hands are the same:

Problem: Over-counting These two hands are the same:

Problem: Over-counting These two hands are the same: In fact any permutation of these cards is the same hand (order is irrelevant)

Number of 5-card Hands How much have we over-counted?

Number of 5-card Hands How much have we over-counted? Over-counted EVERY HAND by 5!

Number of 5-card Hands …… How much have we over-counted? Over-counted EVERY HAND by 5! ……

Number of 5-card Hands …… How much have we over-counted? Over-counted EVERY HAND by 5! …… Still approximately 2.5 million possible hands

Combinations C(n,r) = number of different subsets of size r from a set with n elements. C(n,r) = P(n,r) / r!

Combinations C(n,r) = P(n,r)/r! =

Combinations C(n,r) = P(n,r)/r! =

Combinations C(n,r) = P(n,r)/r! =

Combinations C(n,r) = P(n,r)/r! =

Poker: Gambling Table Straight Flush > Four-of-a-kind > Full House > Flush > Straight > Three-of-a-kind > Two pair > One pair > No pair

Poker: Four-of-a-kind Card: value (13) + suit (4) Four-of-a-kind 4 cards with the same value 1 with a different value EXAMPLE: 9s 9d 9c 9h 5h

Poker: Four-of-a-kind 2 spades 2 clubs 2 hearts 2 diamonds . K hearts K diamonds 1 2 3 . 11 (jack) 12 (queen) 13 (king)

Poker: Four-of-a-kind 2 spades 2 clubs 2 hearts 2 diamonds . K hearts K diamonds 1 2 3 . 11 (jack) 12 (queen) 13 (king) Four-of-a-kind = . 48 = 624

Poker: Full House Full House 9s 9c 9d 5s 5c = choose value for the triple + choose 3 suits + choose value for pair + choose 2 suits

In-class Problem 1: Each table should write their solution on their whiteboard.

Incorrect Counting Argument Two pair = Every hand is counted twice 4 4 7 7 5 7 7 4 4 5

Correct Counting Arguments 1. Divide the Theory Pig’s estimate by 2 2. Choose the values of the two pairs together 2-pair =

Division Rule If set B over-counts every element of A by k times then, |B| = k |A|

Permutations vs Combinations Combinations: subsets of size r, order does not matter Permutations: strings of length r, order of elements does matter.

Calculating Permutations and Combinations Closely related: C(n,r) = P(n,r) / r! C(n,r) = count all r-permutations, every combination is over-counted by r! P(n,r) = choose r items, then take all permutations of the items

Counting Powerset of A P(A) = set of all subsets of A A = {a,b} P(A) = {{}, {a}, {b}, {a,b}}

Counting P(A) Bijection : P(A) and binary strings of length |A| A = {a1 a2 a3 a4 a5……an} Binary String = 1 0 1 0 1 0…..0 Subset of A = {a1, a3, a5} | P(A) | = 2n

Counting P(A) |P(A)| = = subsets + subsets + subsets…..subsets of size 0 of size 1 of size 2 of size n

Counting P(A) Identity: |P(A)| = = subsets + subsets + subsets…..subsets of size 0 of size 1 of size 2 of size n Identity:

Poker: Gambling Table Straight Flush = 40 Four-of-a-kind = 624 Full house = 3744 Flush = 5148 Straight = 10240 Three-of-a-kind = 54,912 Two pair =123,552 One pair = 1,098,240 No pair = 1,317,388

In-class Problems