CS1800: More Counting. Professor Kevin Gold

Size: px
Start display at page:

Download "CS1800: More Counting. Professor Kevin Gold"

Transcription

1 CS1800: More Counting Professor Kevin Gold

2 Today Dealing with illegal values Avoiding overcounting Balls-in-bins, or, allocating resources Review problems

3 Dealing with Illegal Values Password systems often have rules such as must have at least one special character We could think of this as a union of many sets (passwords with exactly one s.c., exactly two, ) but this turns out to be both tricky and cumbersome It s often better to find the size of the set of values that aren t valid, and subtract: A - B = A - B

4 Example of Subtracting Illegal Values Suppose our passwords consist of 8 letters, either uppercase or lowercase (52 possibilities). If the password must contain at least one uppercase letter, how many possible passwords are there? All passwords of 8 uc/lc characters: 52 8 All passwords with no uppercase letters: 26 8 Total possibilities: All passwords no uc

5 Multiple Categories of Illegal Values Often there s more than one rule about what is illegal, and an item could be excluded for multiple reasons. Inclusion-Exclusion ( A U B = A + B - A B etc) is likely to come into play in these cases. Suppose we re counting 8-character passwords of letters (26*2 = 52), digits (10), and special characters (12) with at least 1 digit and 1 special character (repetition allowed) We want all passwords - bad passwords = all passwords - no digits U no special characters all passwords - ( no digits + no special - no digits & no special ) ( ) 8 - ((52+12) 8 + (52+10) )

6 A Tempting But Incorrect Approach to At Least One There s a strategy we often see students try to apply in this course that is incorrect. We ll illustrate on a small problem: How many 3-digit PIN numbers have at least one even digit? Strategy: Choose where the even digit goes: 3 ways. _ 5 possibilities for the even digit. 4 All the other numbers can be anything. 10 each * 5 * 10 * 10 = 1500 possibilities. Uh oh. That s more than But suppose we just subtract all PINs - all odd = = 875. This turns out to be correct but what went wrong the other way?

7 Be Careful Not to Choose Schemes that Double-Count Suppose we actually drew out the possibilities for the method we outlined in the previous slide. In one branch of our tree, we can choose: Pick first number even, pick even number = 4, pick 2nd=3, pick 3rd= And in another branch of our tree, we can choose: Pick last number is even, pick even=4, pick 1st=4, pick 2nd= These aren t different outcomes; they only differ in which digit we think is special. We have overcounted this number.

8 Be Careful Not to Choose Schemes that Double-Count Which place even? 1st even 2nd even 3rd even Even value? 4 Other value #1? Other value #2? [most of choice tree is abridged] The method of multiplying choices assumes that different choice sequences lead to different outcomes. If that s not true, you need to correct for the overcounting or use a different method.

9 A Somewhat Messy Fix A fix for the method we just presented that didn t work is to use Inclusion-Exclusion. Our method essentially tried to count the union of three sets: first digit even, second digit even, third digit even. Those were the three initial options in the tree of choices. But as we just noted, these sets can overlap. In fact, all three can overlap (222, 224, ). EE E _ E EEE _EE E_E E E = even _ = other digit

10 A Somewhat Messy Fix Let A, B, C, be the sets where the first, second, or third digit is known to be even. Each of these has 5*10*10 possibilities (because 5 even digits). But they overlap. Each intersection like A B has two even digits, so 5*5*10 possibilities. A B C has three even digits; 5*5*5. AUBUC = A + B + C - A B - A C - B C + A B C = 5*10* *5* *10*5-5*5*10-5*10*5-10*5*5 + 5*5*5 = = 875. It s not easier than the first method we saw, but it is correct! You ll never need to use 4+ set Inclusion-Exclusion in this course. If it comes to that, try subtracting the illegal set size instead.

11 Dealing With Overcounting Due to Symmetry There s going to be a dinner party of 8 guests sitting around a round table. How many ways are there to seat everyone around the table, assuming that we don t consider rotations of the table different? A G H B F H G C = E A F E D D C B

12 Dealing With Overcounting Due to Symmetry We can think of this as a permutation problem to start. There are 8! possible strings ABCDEFGH. Now we can mentally rotate through the equivalent positions to that. How many are there? One for each position for A; 8. G H F A E B D C ABCDEFGH H A Divide by this number, because every ordering will have this same issue. 8!/8 = 7!. B HABCDEFG

13 Dealing With Overcounting Due to Symmetry Another approach is to anchor the problem so that a choice that shouldn t matter is arbitrarily fixed. Imagine we tell A to just sit down somewhere; we ll think of how everyone will sit in relation to A. Now every possibility is genuinely different. There are 7! ways to rearrange the remaining guests, once we think of wherever A sits as the head of the table. A _ A _

14 Dealing With Overcounting Due to Symmetry If we also don t care about the difference between a seating arrangement and its mirror image, how many possibilities do we have? H A B B A H G C = C G F E D D E F

15 Dealing With Overcounting Due to Symmetry If we also don t care about the difference between a seating arrangement and its mirror image, how many possibilities do we have? Flipping the items to go clockwise instead of counterclockwise is just one counterpart for each ordering, if we also don t care about rotation. We divide the previous answer by two: 7!/2 H A B B A H G C = C G F E D D E F

16 Practicing a Choice of Approach: Counting Diagonals Let a diagonal be a line from a corner of an n-sided polygon to a non-adjacent corner. How many of these are there in general? The two diagonals from this corner

17 Practicing a Choice of Approach: Counting Diagonals One approach to this problem is a good - bad approach. There are C(N,2) = N(N-1)/2 ways to choose two corners. But N of these are bad, because they re actually sides. So we could say N(N-1)/2 - N.

18 Practicing a Choice of Approach: Counting Diagonals Another approach could be to think about our individual choices. N choices for our starting vertex, then I can pick any vertex that isn t adjacent. N(N-3) possibilities. Am I done, or have I overcounted?

19 Practicing a Choice of Approach: Counting Diagonals Another approach could be to think about our individual choices. N choices for our starting vertex, then I can pick any vertex that isn t adjacent. N(N-3) possibilities. I have overcounted, because I could choose vertex A then B, or B then A, and that would be the same diagonal. N(N-3)/2. This is the same result as the other approach; N(N-1)/2 - N = (N 2 - N)/2-2N/2 = (N 2-3N)/2 = N(N-3)/2.

20 Considering Resources to be Interchangeable: Balls-in-Bins Intro There are a variety of problems in which there s some interchangeable resource, like money or points, that is being allocated (handed out) You have 3 $20 bills to hand out to ten people, possibly handing more than one to the same person. How many ways are there to do that? Suppose you said 10 3 for the problem above, because we could encode the allocation of as a string like (Bob, Bob, Alice). 10*10*10 possibilities. But if that s the same result as (Alice, Bob, Bob), we ve overcounted. How do we handle this kind of problem?

21 Deriving Balls-in-Bins Let s solve an easier problem to illustrate. How many ways can I put 3 balls in 5 bins, if I don t consider the balls different? Thus the counts are all that matters, like (0,2,0,0,1) Imagine the setup for one of these allocations.

22 Deriving Balls-in-Bins We re going to try to turn this setup into a string representation that we can easily count. First, the bottom isn t doing anything useful.

23 Deriving Balls-in-Bins Next, we re going to drop the outer sides. I ll still be able to tell there s nothing in the leftmost bin, and a ball in the rightmost bin.

24 Deriving Balls-in-Bins Now I can change this to a string. I ll write for a divider and O for a ball. Notice that the number of dividers is one less than the original number of bins. I don t really need to record empty spaces. I can still tell when nothing is in a bin. Every character will be either a ball or a divider. OO O

25 Deriving Balls-in-Bins If you think about it, these strings are different exactly when the allocation to bins is different. OO O OO O

26 Deriving Balls-in-Bins If there s exactly one of these strings for each allocation, then we just need to count the number of strings with a valid number of balls and bin dividers. We can rephrase the problem as, How many strings have exactly 3 O s and 4 characters? We ve reduced the problem to one we can solve! How many strings do have 3 O s and 4 characters? OO O OO O

27 Deriving Balls-in-Bins The answer was that there are C(7,3) = 35 ways of choosing 3 characters to be O, and the rest. Equivalently, there are 4 ways to choose which characters are the. That s C(7,4) = C(7,3). Recall that these two ways of counting will give the same answer. OO O OO O Choose 3 characters to be O (or 4 to be )

28 The Balls-in-Bins Equation (Sometimes Called Stars and Bars ) If you re trying to find the number of ways you could distribute N indistinguishable items to R receptacles, the answer is C(N+R-1, N). The first number is the number of characters in the encoding - balls (N) plus bin dividers (R-1). The second number is the number of balls (N). You can equivalently choose where the bin dividers go: C(N+R-1, R-1).

29 Back to the First Example You have 3 $20 bills to hand out to 20 people any way you want, as long as each bill is given out. How many ways are there to do that? Here, the people are the bins - we care about differences between people - and the $20 bills are the balls - we don t care about differences between $20 bills. 19 dividers, 3 bills. C(22,3) = OO O A string that could encode $40 and $20 for persons 2 and 4

30 Slightly More Abstract Balls and Bins You re planning on buying 6 bags of Halloween candy, and there are 5 different brands at the store. How many ways are there to buy 6 bags? We could give a particular solution as a tuple of counts, like (3, 2, 1, 0, 0), where each count corresponds to a different candy brand. We should count the number of such tuples that add to 6. That makes this a balls-in-bins problem. You can think of the balls here as your $5 bills (the price) - indistinguishable - and the bins as the candy manufacturers. 6 balls, 4 dividers = C(6+4,4) = 10*9*8*7/(4*3*2) = 210

31 Minimum Allocations I m dividing $5000 among 3 people, in increments of $1000, but I also need to give everyone at least $1000. What should I do about that?

32 Minimum Allocations I m dividing $5000 among 3 people, in increments of $1000, but I also need to give everyone at least $1000. What should I do about that? Essentially, $3000 is spoken for, leaving only $2000 to divide up. I can just count the number of ways to distribute that. 3 people = 2 bins, 2 balls of $1000 each. C(4,2) = 6 ways to do it. OO O O O O OO O O OO (3,1,1) (2,2,1) (2,1,2) (1,3,1) (1,2,2) (1,1,3)

33 Trying to Decide How To Divide Up a Plane I have 30 rows of an airplane I m designing, and I m trying to decide how many of them should be first class, economy plus, or economy. Assuming these sections are always in the same order on the plane, and just differ in their number of rows (which can be 0), how many ways to do this?

34 Noticing Similarities to Our Encoding I have 30 rows of an airplane I m designing, and I m trying to decide how many of them should be first class, economy plus, or economy. How many ways to do this? This is an instance where the problem should just directly remind us of our balls-in-bins encoding, even if thinking of rows as balls (etc) is a little weird. 2 dividers and 30 rows: C(32,2) = 496 OOOO O

35 Practice Balls-in-Bins Suppose there s a video game where, every time a player gets an experience point, there are 3 scores that can be improved with it; so after 10 such points, the player might have Strength 3, Trapmaking 3, and Survival 4. How many possible builds (allocations of points) are there with 10 points?

36 Practice Balls-in-Bins Suppose there s a video game where, every time a player gets an experience point, there are 3 scores that can be improved with it; so after 10 such points, the player might have Strength 3, Trapmaking 3, and Survival 4. How many possible builds are there with 10 points? The scores to improve are the 3 bins; so 2 bin dividers. C(10+2, 2) = C(12,2) = 12*11/2 = 66.

37 A Mix of Practice Problems How many 6-character passwords have exactly 2 digits, 2 letters (lower or upper case), and 2 special characters (12 possible)? How many possible deals are there of 2 cards to each of 4 players, if I don t care about order in the hand, but I do care who got what cards? What if I don t care who got what cards? If I flip a coin ten times, how many possibilities have exactly the same number of heads and tails? How many don t have the same number? How many of those have more heads than tails? How many ways are there to interleave ABCDE and while keeping the letters in order and the numbers in order?

38 A Mix of Practice Problems How many 6-character passwords have exactly 2 digits, 2 letters (lower or upper case), and 2 special characters (12 possible)? Hint: Choose where everything goes, then fill things in. How many possible deals are there of 2 cards to each of 4 players, if I don t care about order in the hand, but I do care who got what cards? What if I don t care who got what cards? Hint (2nd part): How many ways could you rearrange the same 4 hands? If I flip a coin ten times, how many possibilities have exactly the same number of heads and tails? How many don t have the same number? How many of those have more heads than tails? Hint: Choose where the heads are in the sequence; then, think about how to avoid doing anything tedious. How many ways are there to interleave ABCDE and while keeping the letters in order and the numbers in order? Hint: After your first choice, what s left to choose?

39 The Password Problem How many 6-character passwords have exactly 2 digits, 2 letters (lower or upper case), and 2 special characters (12 possible)? Choose where digits go: C(6,2) Choose where letters go: C(4,2) Nothing left to choose for character positions Choose the digits: 10*10 Choose the letters: 52*52 Choose the special characters: 12*12 C(6,2)*C(4,2)*10 2 *52 2 *12 2

40 The Card Problem How many possible deals are there of 2 cards to each of 4 players, if I don t care about order in the hand, but I do care who got what cards? What if I don t care who got what cards? Choose the 4 hands: C(52,2)*C(50,2)*C(48,2)*C(46,2) (other strategies are possible) Don t care about who got them: Divide by 4!

41 The Coin Problem If I flip a coin ten times, how many possibilities have exactly the same number of heads and tails? How many don t have the same number? How many of those have more heads than tails? Think of the flips as encoded as a string, like TTTTTHHHHH There are C(10,5) ways to pick which ones are heads, if we have a tie (so exactly 5 heads) Since there are 2 10 possible flips in general, there are C(10,5) other possibilities By symmetry, half of those possibilities have heads ahead

42 The Interleaving Problem How many ways are there to interleave ABCDE and while keeping the letters in order and the numbers in order? Choose where the letters go among the 10 characters: C(10,5) The order of both sequences is determined, so there s nothing left to choose.

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6 CS100: DISCRETE STRUCTURES Lecture 8 Counting - CH6 Lecture Overview 2 6.1 The Basics of Counting: THE PRODUCT RULE THE SUM RULE THE SUBTRACTION RULE THE DIVISION RULE 6.2 The Pigeonhole Principle. 6.3

More information

Chapter 7. Intro to Counting

Chapter 7. Intro to Counting Chapter 7. Intro to Counting 7.7 Counting by complement 7.8 Permutations with repetitions 7.9 Counting multisets 7.10 Assignment problems: Balls in bins 7.11 Inclusion-exclusion principle 7.12 Counting

More information

Combinatorics: The Fine Art of Counting

Combinatorics: The Fine Art of Counting Combinatorics: The Fine Art of Counting Lecture Notes Counting 101 Note to improve the readability of these lecture notes, we will assume that multiplication takes precedence over division, i.e. A / B*C

More information

Topics to be covered

Topics to be covered Basic Counting 1 Topics to be covered Sum rule, product rule, generalized product rule Permutations, combinations Binomial coefficients, combinatorial proof Inclusion-exclusion principle Pigeon Hole Principle

More information

Grade 7/8 Math Circles. Visual Group Theory

Grade 7/8 Math Circles. Visual Group Theory Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Grade 7/8 Math Circles October 25 th /26 th Visual Group Theory Grouping Concepts Together We will start

More information

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

Counting (Enumerative Combinatorics) X. Zhang, Fordham Univ. Counting (Enumerative Combinatorics) X. Zhang, Fordham Univ. 1 Chance of winning?! What s the chances of winning New York Megamillion Jackpot!! just pick 5 numbers from 1 to 56, plus a mega ball number

More information

BMT 2018 Combinatorics Test Solutions March 18, 2018

BMT 2018 Combinatorics Test Solutions March 18, 2018 . Bob has 3 different fountain pens and different ink colors. How many ways can he fill his fountain pens with ink if he can only put one ink in each pen? Answer: 0 Solution: He has options to fill his

More information

Discrete Mathematics: Logic. Discrete Mathematics: Lecture 15: Counting

Discrete Mathematics: Logic. Discrete Mathematics: Lecture 15: Counting Discrete Mathematics: Logic Discrete Mathematics: Lecture 15: Counting counting combinatorics: the study of the number of ways to put things together into various combinations basic counting principles

More information

Lecture 2: Sum rule, partition method, difference method, bijection method, product rules

Lecture 2: Sum rule, partition method, difference method, bijection method, product rules Lecture 2: Sum rule, partition method, difference method, bijection method, product rules References: Relevant parts of chapter 15 of the Math for CS book. Discrete Structures II (Summer 2018) Rutgers

More information

Compound Probability. Set Theory. Basic Definitions

Compound Probability. Set Theory. Basic Definitions Compound Probability Set Theory A probability measure P is a function that maps subsets of the state space Ω to numbers in the interval [0, 1]. In order to study these functions, we need to know some basic

More information

Counting and Probability Math 2320

Counting and Probability Math 2320 Counting and Probability Math 2320 For a finite set A, the number of elements of A is denoted by A. We have two important rules for counting. 1. Union rule: Let A and B be two finite sets. Then A B = A

More information

EECS 203 Spring 2016 Lecture 15 Page 1 of 6

EECS 203 Spring 2016 Lecture 15 Page 1 of 6 EECS 203 Spring 2016 Lecture 15 Page 1 of 6 Counting We ve been working on counting for the last two lectures. We re going to continue on counting and probability for about 1.5 more lectures (including

More information

CS 237: Probability in Computing

CS 237: Probability in Computing CS 237: Probability in Computing Wayne Snyder Computer Science Department Boston University Lecture 5: o Independence reviewed; Bayes' Rule o Counting principles and combinatorics; o Counting considered

More information

Introduction to Counting and Probability

Introduction to Counting and Probability Randolph High School Math League 2013-2014 Page 1 If chance will have me king, why, chance may crown me. Shakespeare, Macbeth, Act I, Scene 3 1 Introduction Introduction to Counting and Probability Counting

More information

Foundations of Computing Discrete Mathematics Solutions to exercises for week 12

Foundations of Computing Discrete Mathematics Solutions to exercises for week 12 Foundations of Computing Discrete Mathematics Solutions to exercises for week 12 Agata Murawska (agmu@itu.dk) November 13, 2013 Exercise (6.1.2). A multiple-choice test contains 10 questions. There are

More information

CS1800: Permutations & Combinations. Professor Kevin Gold

CS1800: Permutations & Combinations. Professor Kevin Gold CS1800: Permutations & Combinations Professor Kevin Gold Permutations A permutation is a reordering of something. In the context of counting, we re interested in the number of ways to rearrange some items.

More information

Permutations and Combinations

Permutations and Combinations Motivating question Permutations and Combinations A) Rosen, Chapter 5.3 B) C) D) Permutations A permutation of a set of distinct objects is an ordered arrangement of these objects. : (1, 3, 2, 4) is a

More information

Reading 14 : Counting

Reading 14 : Counting CS/Math 240: Introduction to Discrete Mathematics Fall 2015 Instructors: Beck Hasti, Gautam Prakriya Reading 14 : Counting In this reading we discuss counting. Often, we are interested in the cardinality

More information

Sample Spaces, Events, Probability

Sample Spaces, Events, Probability Sample Spaces, Events, Probability CS 3130/ECE 3530: Probability and Statistics for Engineers August 28, 2014 Sets A set is a collection of unique objects. Sets A set is a collection of unique objects.

More information

Discrete Structures for Computer Science

Discrete Structures for Computer Science Discrete Structures for Computer Science William Garrison bill@cs.pitt.edu 6311 Sennott Square Lecture #22: Generalized Permutations and Combinations Based on materials developed by Dr. Adam Lee Counting

More information

Probability (Devore Chapter Two)

Probability (Devore Chapter Two) Probability (Devore Chapter Two) 1016-351-01 Probability Winter 2011-2012 Contents 1 Axiomatic Probability 2 1.1 Outcomes and Events............................... 2 1.2 Rules of Probability................................

More information

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

CSE 312: Foundations of Computing II Quiz Section #2: Inclusion-Exclusion, Pigeonhole, Introduction to Probability (solutions) CSE 31: Foundations of Computing II Quiz Section #: Inclusion-Exclusion, Pigeonhole, Introduction to Probability (solutions) Review: Main Theorems and Concepts Binomial Theorem: x, y R, n N: (x + y) n

More information

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

Lecture 14. What s to come? Probability. A bag contains: Lecture 14 What s to come? Probability. A bag contains: What is the chance that a ball taken from the bag is blue? Count blue. Count total. Divide. Today: Counting! Later: Probability. Professor Walrand.

More information

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

CSE 312: Foundations of Computing II Quiz Section #1: Counting (solutions) CSE 31: Foundations of Computing II Quiz Section #1: Counting (solutions Review: Main Theorems and Concepts 1. Product Rule: Suppose there are m 1 possible outcomes for event A 1, then m possible outcomes

More information

Grade 7/8 Math Circles. Visual Group Theory

Grade 7/8 Math Circles. Visual Group Theory Faculty of Mathematics Waterloo, Ontario N2L 3G1 Centre for Education in Mathematics and Computing Grade 7/8 Math Circles October 25 th /26 th Visual Group Theory Grouping Concepts Together We will start

More information

IMLEM Meet #5 March/April Intermediate Mathematics League of Eastern Massachusetts

IMLEM Meet #5 March/April Intermediate Mathematics League of Eastern Massachusetts IMLEM Meet #5 March/April 2013 Intermediate Mathematics League of Eastern Massachusetts Category 1 Mystery You may use a calculator. 1. Beth sold girl-scout cookies to some of her relatives and neighbors.

More information

Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand HW 8

Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand HW 8 CS 70 Discrete Mathematics and Probability Theory Fall 2016 Seshia and Walrand HW 8 1 Sundry Before you start your homewor, write down your team. Who else did you wor with on this homewor? List names and

More information

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

1. Counting. 2. Tree 3. Rules of Counting 4. Sample with/without replacement where order does/doesn t matter. Lecture 4 Outline: basics What s to come? Probability A bag contains: What is the chance that a ball taken from the bag is blue? Count blue Count total Divide Today: Counting! Later: Probability Professor

More information

Combinatorics. PIE and Binomial Coefficients. Misha Lavrov. ARML Practice 10/20/2013

Combinatorics. PIE and Binomial Coefficients. Misha Lavrov. ARML Practice 10/20/2013 Combinatorics PIE and Binomial Coefficients Misha Lavrov ARML Practice 10/20/2013 Warm-up Po-Shen Loh, 2013. If the letters of the word DOCUMENT are randomly rearranged, what is the probability that all

More information

CS1800: Intro to Probability. Professor Kevin Gold

CS1800: Intro to Probability. Professor Kevin Gold CS1800: Intro to Probability Professor Kevin Gold Probability Deals Rationally With an Uncertain World Using probabilities is the only rational way to deal with uncertainty De Finetti: If you disagree,

More information

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

Block 1 - Sets and Basic Combinatorics. Main Topics in Block 1: Block 1 - Sets and Basic Combinatorics Main Topics in Block 1: A short revision of some set theory Sets and subsets. Venn diagrams to represent sets. Describing sets using rules of inclusion. Set operations.

More information

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 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 Chapter 5 Chapter Summary 5.1 The Basics of Counting 5.2 The Pigeonhole Principle 5.3 Permutations and Combinations 5.5 Generalized Permutations and Combinations Section 5.1 The Product Rule The Product

More information

CSE 312: Foundations of Computing II Quiz Section #2: Combinations, Counting Tricks (solutions)

CSE 312: Foundations of Computing II Quiz Section #2: Combinations, Counting Tricks (solutions) CSE 312: Foundations of Computing II Quiz Section #2: Combinations, Counting Tricks (solutions Review: Main Theorems and Concepts Combinations (number of ways to choose k objects out of n distinct objects,

More information

CISC 1400 Discrete Structures

CISC 1400 Discrete Structures CISC 1400 Discrete Structures Chapter 6 Counting CISC1400 Yanjun Li 1 1 New York Lottery New York Mega-million Jackpot Pick 5 numbers from 1 56, plus a mega ball number from 1 46, you could win biggest

More information

Exercises Exercises. 1. List all the permutations of {a, b, c}. 2. How many different permutations are there of the set {a, b, c, d, e, f, g}?

Exercises Exercises. 1. List all the permutations of {a, b, c}. 2. How many different permutations are there of the set {a, b, c, d, e, f, g}? Exercises Exercises 1. List all the permutations of {a, b, c}. 2. How many different permutations are there of the set {a, b, c, d, e, f, g}? 3. How many permutations of {a, b, c, d, e, f, g} end with

More information

Solutions for the Practice Final

Solutions for the Practice Final Solutions for the Practice Final 1. Ian and Nai play the game of todo, where at each stage one of them flips a coin and then rolls a die. The person who played gets as many points as the number rolled

More information

Counting. Chapter 6. With Question/Answer Animations

Counting. Chapter 6. With Question/Answer Animations . All rights reserved. Authorized only for instructor use in the classroom. No reproduction or further distribution permitted without the prior written consent of McGraw-Hill Education. Counting Chapter

More information

Chapter 4: Patterns and Relationships

Chapter 4: Patterns and Relationships Chapter : Patterns and Relationships Getting Started, p. 13 1. a) The factors of 1 are 1,, 3,, 6, and 1. The factors of are 1,,, 7, 1, and. The greatest common factor is. b) The factors of 16 are 1,,,,

More information

Counting Things Solutions

Counting Things Solutions Counting Things Solutions Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles March 7, 006 Abstract These are solutions to the Miscellaneous Problems in the Counting Things article at:

More information

In how many ways can we paint 6 rooms, choosing from 15 available colors? What if we want all rooms painted with different colors?

In how many ways can we paint 6 rooms, choosing from 15 available colors? What if we want all rooms painted with different colors? What can we count? In how many ways can we paint 6 rooms, choosing from 15 available colors? What if we want all rooms painted with different colors? In how many different ways 10 books can be arranged

More information

Notes on 4-coloring the 17 by 17 grid

Notes on 4-coloring the 17 by 17 grid otes on 4-coloring the 17 by 17 grid lizabeth upin; ekupin@math.rutgers.edu ugust 5, 2009 1 or large color classes, 5 in each row, column color class is large if it contains at least 73 points. We know

More information

Permutations and Combinations

Permutations and Combinations Permutations and Combinations Rosen, Chapter 5.3 Motivating question In a family of 3, how many ways can we arrange the members of the family in a line for a photograph? 1 Permutations A permutation of

More information

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

The next several lectures will be concerned with probability theory. We will aim to make sense of statements such as the following: CS 70 Discrete Mathematics for CS Fall 2004 Rao Lecture 14 Introduction to Probability The next several lectures will be concerned with probability theory. We will aim to make sense of statements such

More information

Dependence. Math Circle. October 15, 2016

Dependence. Math Circle. October 15, 2016 Dependence Math Circle October 15, 2016 1 Warm up games 1. Flip a coin and take it if the side of coin facing the table is a head. Otherwise, you will need to pay one. Will you play the game? Why? 2. If

More information

In how many ways can the letters of SEA be arranged? In how many ways can the letters of SEE be arranged?

In how many ways can the letters of SEA be arranged? In how many ways can the letters of SEE be arranged? -Pick up Quiz Review Handout by door -Turn to Packet p. 5-6 In how many ways can the letters of SEA be arranged? In how many ways can the letters of SEE be arranged? - Take Out Yesterday s Notes we ll

More information

Combinatorics: The Fine Art of Counting

Combinatorics: The Fine Art of Counting Combinatorics: The Fine Art of Counting Week Four Solutions 1. An ice-cream store specializes in super-sized deserts. Their must famous is the quad-cone which has 4 scoops of ice-cream stacked one on top

More information

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

MAT104: Fundamentals of Mathematics II Summary of Counting Techniques and Probability. Preliminary Concepts, Formulas, and Terminology MAT104: Fundamentals of Mathematics II Summary of Counting Techniques and Probability Preliminary Concepts, Formulas, and Terminology Meanings of Basic Arithmetic Operations in Mathematics Addition: Generally

More information

Discrete Mathematics and Probability Theory Spring 2018 Ayazifar and Rao Midterm 2 Solutions

Discrete Mathematics and Probability Theory Spring 2018 Ayazifar and Rao Midterm 2 Solutions CS 70 Discrete Mathematics and Probability Theory Spring 2018 Ayazifar and Rao Midterm 2 Solutions PRINT Your Name: Oski Bear SIGN Your Name: OS K I PRINT Your Student ID: CIRCLE your exam room: Pimentel

More information

CS1802 Week 3: Counting Next Week : QUIZ 1 (30 min)

CS1802 Week 3: Counting Next Week : QUIZ 1 (30 min) CS1802 Discrete Structures Recitation Fall 2018 September 25-26, 2018 CS1802 Week 3: Counting Next Week : QUIZ 1 (30 min) Permutations and Combinations i. Evaluate the following expressions. 1. P(10, 4)

More information

Problem Set 2. Counting

Problem Set 2. Counting Problem Set 2. Counting 1. (Blitzstein: 1, Q3 Fred is planning to go out to dinner each night of a certain week, Monday through Friday, with each dinner being at one of his favorite ten restaurants. i

More information

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

1 Permutations. 1.1 Example 1. Lisa Yan CS 109 Combinatorics. Lecture Notes #2 June 27, 2018 Lisa Yan CS 09 Combinatorics Lecture Notes # June 7, 08 Handout by Chris Piech, with examples by Mehran Sahami As we mentioned last class, the principles of counting are core to probability. Counting is

More information

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

Define and Diagram Outcomes (Subsets) of the Sample Space (Universal Set) 12.3 and 12.4 Notes Geometry 1 Diagramming the Sample Space using Venn Diagrams A sample space represents all things that could occur for a given event. In set theory language this would be known as the

More information

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

10-1. Combinations. Vocabulary. Lesson. Mental Math. able to compute the number of subsets of size r. Chapter 10 Lesson 10-1 Combinations BIG IDEA With a set of n elements, it is often useful to be able to compute the number of subsets of size r Vocabulary combination number of combinations of n things

More information

3 The multiplication rule/miscellaneous counting problems

3 The multiplication rule/miscellaneous counting problems Practice for Exam 1 1 Axioms of probability, disjoint and independent events 1 Suppose P (A 0, P (B 05 (a If A and B are independent, what is P (A B? What is P (A B? (b If A and B are disjoint, what is

More information

I.M.O. Winter Training Camp 2008: Invariants and Monovariants

I.M.O. Winter Training Camp 2008: Invariants and Monovariants I.M.. Winter Training Camp 2008: Invariants and Monovariants n math contests, you will often find yourself trying to analyze a process of some sort. For example, consider the following two problems. Sample

More information

MATHEMATICS S-152, SUMMER 2005 THE MATHEMATICS OF SYMMETRY Outline #1 (Counting, symmetry, Platonic solids, permutations)

MATHEMATICS S-152, SUMMER 2005 THE MATHEMATICS OF SYMMETRY Outline #1 (Counting, symmetry, Platonic solids, permutations) MATHEMATICS S-152, SUMMER 2005 THE MATHEMATICS OF SYMMETRY Outline #1 (Counting, symmetry, Platonic solids, permutations) The class will divide into four groups. Each group will have a different polygon

More information

The Beauty and Joy of Computing Lab Exercise 10: Shall we play a game? Objectives. Background (Pre-Lab Reading)

The Beauty and Joy of Computing Lab Exercise 10: Shall we play a game? Objectives. Background (Pre-Lab Reading) The Beauty and Joy of Computing Lab Exercise 10: Shall we play a game? [Note: This lab isn t as complete as the others we have done in this class. There are no self-assessment questions and no post-lab

More information

Kenken For Teachers. Tom Davis January 8, Abstract

Kenken For Teachers. Tom Davis   January 8, Abstract Kenken For Teachers Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles January 8, 00 Abstract Kenken is a puzzle whose solution requires a combination of logic and simple arithmetic

More information

Section Introduction to Sets

Section Introduction to Sets Section 1.1 - Introduction to Sets Definition: A set is a well-defined collection of objects usually denoted by uppercase letters. Definition: The elements, or members, of a set are denoted by lowercase

More information

Mathematics Competition Practice Session 6. Hagerstown Community College: STEM Club November 20, :00 pm - 1:00 pm STC-170

Mathematics Competition Practice Session 6. Hagerstown Community College: STEM Club November 20, :00 pm - 1:00 pm STC-170 2015-2016 Mathematics Competition Practice Session 6 Hagerstown Community College: STEM Club November 20, 2015 12:00 pm - 1:00 pm STC-170 1 Warm-Up (2006 AMC 10B No. 17): Bob and Alice each have a bag

More information

Mathematics. Programming

Mathematics. Programming Mathematics for the Digital Age and Programming in Python >>> Second Edition: with Python 3 Maria Litvin Phillips Academy, Andover, Massachusetts Gary Litvin Skylight Software, Inc. Skylight Publishing

More information

(1). We have n different elements, and we would like to arrange r of these elements with no repetition, where 1 r n.

(1). We have n different elements, and we would like to arrange r of these elements with no repetition, where 1 r n. BASIC KNOWLEDGE 1. Two Important Terms (1.1). Permutations A permutation is an arrangement or a listing of objects in which the order is important. For example, if we have three numbers 1, 5, 9, there

More information

Counting Methods and Probability

Counting Methods and Probability CHAPTER Counting Methods and Probability Many good basketball players can make 90% of their free throws. However, the likelihood of a player making several free throws in a row will be less than 90%. You

More information

CIS 2033 Lecture 6, Spring 2017

CIS 2033 Lecture 6, Spring 2017 CIS 2033 Lecture 6, Spring 2017 Instructor: David Dobor February 2, 2017 In this lecture, we introduce the basic principle of counting, use it to count subsets, permutations, combinations, and partitions,

More information

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

CSE 312: Foundations of Computing II Quiz Section #2: Inclusion-Exclusion, Pigeonhole, Introduction to Probability CSE 312: Foundations of Computing II Quiz Section #2: Inclusion-Exclusion, Pigeonhole, Introduction to Probability Review: Main Theorems and Concepts Binomial Theorem: Principle of Inclusion-Exclusion

More information

PERMUTATIONS AND COMBINATIONS

PERMUTATIONS AND COMBINATIONS 8 PERMUTATIONS AND COMBINATIONS FUNDAMENTAL PRINCIPLE OF COUNTING Multiplication Principle : If an operation can be performed in 'm' different ways; following which a second operation can be performed

More information

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

Probability. The MEnTe Program Math Enrichment through Technology. Title V East Los Angeles College Probability The MEnTe Program Math Enrichment through Technology Title V East Los Angeles College 2003 East Los Angeles College. All rights reserved. Topics Introduction Empirical Probability Theoretical

More information

Solutions for Exam I, Math 10120, Fall 2016

Solutions for Exam I, Math 10120, Fall 2016 Solutions for Exam I, Math 10120, Fall 2016 1. Let U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10} A = {1, 2, 3} B = {2, 4, 6, 8, 10}. C = {4, 5, 6, 7, 8}. Which of the following sets is equal to (A B) C? {1, 2, 3,

More information

Probability: introduction

Probability: introduction May 6, 2009 Probability: introduction page 1 Probability: introduction Probability is the part of mathematics that deals with the chance or the likelihood that things will happen The probability of an

More information

3. (8 points) If p, 4p 2 + 1, and 6p are prime numbers, find p. Solution: The answer is p = 5. Analyze the remainders upon division by 5.

3. (8 points) If p, 4p 2 + 1, and 6p are prime numbers, find p. Solution: The answer is p = 5. Analyze the remainders upon division by 5. 1. (6 points) Eleven gears are placed on a plane, arranged in a chain, as shown below. Can all the gears rotate simultaneously? Explain your answer. (4 points) What if we have a chain of 572 gears? Solution:

More information

Chapter 2. Permutations and Combinations

Chapter 2. Permutations and Combinations 2. Permutations and Combinations Chapter 2. Permutations and Combinations In this chapter, we define sets and count the objects in them. Example Let S be the set of students in this classroom today. Find

More information

2015 ACM ICPC Southeast USA Regional Programming Contest. Division 1

2015 ACM ICPC Southeast USA Regional Programming Contest. Division 1 2015 ACM ICPC Southeast USA Regional Programming Contest Division 1 Airports... 1 Checkers... 3 Coverage... 5 Gears... 6 Grid... 8 Hilbert Sort... 9 The Magical 3... 12 Racing Gems... 13 Simplicity...

More information

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

The study of probability is concerned with the likelihood of events occurring. Many situations can be analyzed using a simplified model of probability 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

More information

Discrete Structures Lecture Permutations and Combinations

Discrete Structures Lecture Permutations and Combinations Introduction Good morning. Many counting problems can be solved by finding the number of ways to arrange a specified number of distinct elements of a set of a particular size, where the order of these

More information

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

Permutations. Example 1. Lecture Notes #2 June 28, Will Monroe CS 109 Combinatorics Will Monroe CS 09 Combinatorics Lecture Notes # June 8, 07 Handout by Chris Piech, with examples by Mehran Sahami As we mentioned last class, the principles of counting are core to probability. Counting

More information

n! = n(n 1)(n 2) 3 2 1

n! = n(n 1)(n 2) 3 2 1 A Counting A.1 First principles If the sample space Ω is finite and the outomes are equally likely, then the probability measure is given by P(E) = E / Ω where E denotes the number of outcomes in the event

More information

Mat 344F challenge set #2 Solutions

Mat 344F challenge set #2 Solutions Mat 344F challenge set #2 Solutions. Put two balls into box, one ball into box 2 and three balls into box 3. The remaining 4 balls can now be distributed in any way among the three remaining boxes. This

More information

Topspin: Oval-Track Puzzle, Taking Apart The Topspin One Tile At A Time

Topspin: Oval-Track Puzzle, Taking Apart The Topspin One Tile At A Time Salem State University Digital Commons at Salem State University Honors Theses Student Scholarship Fall 2015-01-01 Topspin: Oval-Track Puzzle, Taking Apart The Topspin One Tile At A Time Elizabeth Fitzgerald

More information

Making Middle School Math Come Alive with Games and Activities

Making Middle School Math Come Alive with Games and Activities Making Middle School Math Come Alive with Games and Activities For more information about the materials you find in this packet, contact: Sharon Rendon (605) 431-0216 sharonrendon@cpm.org 1 2-51. SPECIAL

More information

Week 3-4: Permutations and Combinations

Week 3-4: Permutations and Combinations Week 3-4: Permutations and Combinations February 20, 2017 1 Two Counting Principles Addition Principle. Let S 1, S 2,..., S m be disjoint subsets of a finite set S. If S = S 1 S 2 S m, then S = S 1 + S

More information

Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute. Module 6 Lecture - 37 Divide and Conquer: Counting Inversions

Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute. Module 6 Lecture - 37 Divide and Conquer: Counting Inversions Design and Analysis of Algorithms Prof. Madhavan Mukund Chennai Mathematical Institute Module 6 Lecture - 37 Divide and Conquer: Counting Inversions Let us go back and look at Divide and Conquer again.

More information

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

Rosen, Discrete Mathematics and Its Applications, 6th edition Extra Examples Rosen, Discrete Mathematics and Its Applications, 6th edition Extra Examples Section 6.1 An Introduction to Discrete Probability Page references correspond to locations of Extra Examples icons in the textbook.

More information

2359 (i.e. 11:59:00 pm) on 4/16/18 via Blackboard

2359 (i.e. 11:59:00 pm) on 4/16/18 via Blackboard CS 109: Introduction to Computer Science Goodney Spring 2018 Homework Assignment 4 Assigned: 4/2/18 via Blackboard Due: 2359 (i.e. 11:59:00 pm) on 4/16/18 via Blackboard Notes: a. This is the fourth homework

More information

Difference Engine. 1. Make a sensible definition of boring and determine how many steps it takes for this process to become boring.

Difference Engine. 1. Make a sensible definition of boring and determine how many steps it takes for this process to become boring. Difference Engine The numbers 1, 2, 3, and 4 are written at the corners of a large square. At each step, at the midpoint of each side, write the positive (or absolute value of the) difference between the

More information

1. For which of the following sets does the mean equal the median?

1. For which of the following sets does the mean equal the median? 1. For which of the following sets does the mean equal the median? I. {1, 2, 3, 4, 5} II. {3, 9, 6, 15, 12} III. {13, 7, 1, 11, 9, 19} A. I only B. I and II C. I and III D. I, II, and III E. None of the

More information

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

2. Combinatorics: the systematic study of counting. The Basic Principle of Counting (BPC) 2. Combinatorics: the systematic study of counting The Basic Principle of Counting (BPC) Suppose r experiments will be performed. The 1st has n 1 possible outcomes, for each of these outcomes there are

More information

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG MATH DISCRETE MATHEMATICS INSTRUCTOR: P. WENG Counting and Probability Suggested Problems Basic Counting Skills, Inclusion-Exclusion, and Complement. (a An office building contains 7 floors and has 7 offices

More information

Midterm practice super-problems

Midterm practice super-problems Midterm practice super-problems These problems are definitely harder than the midterm (even the ones without ), so if you solve them you should have no problem at all with the exam. However be aware that

More information

Here are two situations involving chance:

Here are two situations involving chance: Obstacle Courses 1. Introduction. Here are two situations involving chance: (i) Someone rolls a die three times. (People usually roll dice in pairs, so dice is more common than die, the singular form.)

More information

Board Question 1. There are 5 Competitors in 100m final. How many ways can gold silver and bronze be awarded? May 27, / 28

Board Question 1. There are 5 Competitors in 100m final. How many ways can gold silver and bronze be awarded? May 27, / 28 Board Question 1 There are 5 Competitors in 100m final. How many ways can gold silver and bronze be awarded? Photograph of Usain Bolt running a race removed due to copyright restrictions. May 27, 2014

More information

ACTIVITY 6.7 Selecting and Rearranging Things

ACTIVITY 6.7 Selecting and Rearranging Things ACTIVITY 6.7 SELECTING AND REARRANGING THINGS 757 OBJECTIVES ACTIVITY 6.7 Selecting and Rearranging Things 1. Determine the number of permutations. 2. Determine the number of combinations. 3. Recognize

More information

Combinational Mathematics - I

Combinational Mathematics - I Combinational Mathematics - I Jon T. Butler Naval Postgraduate School, Monterey, CA, USA We are here I live here Meiji University 10:50-12:30 September 28, 2018 J. T. Butler Combinatorial Mathematics I

More information

Olympiad Combinatorics. Pranav A. Sriram

Olympiad Combinatorics. Pranav A. Sriram Olympiad Combinatorics Pranav A. Sriram August 2014 Chapter 2: Algorithms - Part II 1 Copyright notices All USAMO and USA Team Selection Test problems in this chapter are copyrighted by the Mathematical

More information

Objective: the student will gain speed and accuracy in letter recognition.

Objective: the student will gain speed and accuracy in letter recognition. ALPHABET ARC Objective: the student will gain speed and accuracy in letter recognition. Materials: Alphabet arc (enlarge 200 percent and attach to 12 x 18 construction paper). 12 x18 construction paper

More information

Junior Circle Meeting 5 Probability. May 2, ii. In an actual experiment, can one get a different number of heads when flipping a coin 100 times?

Junior Circle Meeting 5 Probability. May 2, ii. In an actual experiment, can one get a different number of heads when flipping a coin 100 times? Junior Circle Meeting 5 Probability May 2, 2010 1. We have a standard coin with one side that we call heads (H) and one side that we call tails (T). a. Let s say that we flip this coin 100 times. i. How

More information

CS 361: Probability & Statistics

CS 361: Probability & Statistics February 7, 2018 CS 361: Probability & Statistics Independence & conditional probability Recall the definition for independence So we can suppose events are independent and compute probabilities Or we

More information

! Denver, CO! Demystifying Computing with Magic, continued

! Denver, CO! Demystifying Computing with Magic, continued 2012-03-07! Denver, CO! Demystifying Computing with Magic, continued Special Session Overview Motivation The 7 magic tricks ú Real-Time 4x4 Magic Square ú Left/Right Game ú The Tricky Dice ú The Numbers

More information

Answer each of the following problems. Make sure to show your work.

Answer each of the following problems. Make sure to show your work. Answer each of the following problems. Make sure to show your work. 1. A board game requires each player to roll a die. The player with the highest number wins. If a player wants to calculate his or her

More information

Problem A To and Fro (Problem appeared in the 2004/2005 Regional Competition in North America East Central.)

Problem A To and Fro (Problem appeared in the 2004/2005 Regional Competition in North America East Central.) Problem A To and Fro (Problem appeared in the 2004/2005 Regional Competition in North America East Central.) Mo and Larry have devised a way of encrypting messages. They first decide secretly on the number

More information

Math 475, Problem Set #3: Solutions

Math 475, Problem Set #3: Solutions Math 475, Problem Set #3: Solutions A. Section 3.6, problem 1. Also: How many of the four-digit numbers being considered satisfy (a) but not (b)? How many satisfy (b) but not (a)? How many satisfy neither

More information