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

Similar documents
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

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

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

Topics to be covered

CS100: DISCRETE STRUCTURES. Lecture 8 Counting - CH6

With Question/Answer Animations. Chapter 6

HOMEWORK ASSIGNMENT 5

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 PIGEONHOLE PRINCIPLE. MARK FLANAGAN School of Electrical and Electronic Engineering University College Dublin

Counting. Chapter 6. With Question/Answer Animations

Discrete Mathematics. Spring 2017

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

12. 6 jokes are minimal.

Lecture 18 - Counting

MATH 351 Fall 2009 Homework 1 Due: Wednesday, September 30

Math 475, Problem Set #3: Solutions

CS 237 Fall 2018, Homework SOLUTION

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

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

3 The multiplication rule/miscellaneous counting problems

Compound Probability. Set Theory. Basic Definitions

Jong C. Park Computer Science Division, KAIST

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

What is counting? (how many ways of doing things) how many possible ways to choose 4 people from 10?

Elementary Combinatorics

Permutations and Combinations

Problem Set 2. Counting

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

Chapter 7. Intro to Counting

Section Summary. Permutations Combinations Combinatorial Proofs

Mat 344F challenge set #2 Solutions

MA 524 Midterm Solutions October 16, 2018

CIS 2033 Lecture 6, Spring 2017

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

Counting integral solutions

Finite Math Section 6_4 Solutions and Hints

Counting Things Solutions

Discrete Structures for Computer Science

Math 3338: Probability (Fall 2006)

6.1 Basics of counting

Math Fall 2011 Exam 2 Solutions - November 1, 2011

Generalized Permutations and The Multinomial Theorem

CSE 21: Midterm 1 Solution

Reading 14 : Counting

PERMUTATIONS AND COMBINATIONS

Sec.on Summary. The Product Rule The Sum Rule The Subtraction Rule (Principle of Inclusion- Exclusion)

DISCRETE STRUCTURES COUNTING

9.5 Counting Subsets of a Set: Combinations. Answers for Test Yourself

MAT 243 Final Exam SOLUTIONS, FORM A

MC215: MATHEMATICAL REASONING AND DISCRETE STRUCTURES

Multiple Choice Questions for Review

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

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

Solutions to Problem Set 7

CSE 21 Mathematics for Algorithm and System Analysis

Solutions to Exercises on Page 86

CMath 55 PROFESSOR KENNETH A. RIBET. Final Examination May 11, :30AM 2:30PM, 100 Lewis Hall

Problems from 9th edition of Probability and Statistical Inference by Hogg, Tanis and Zimmerman:

Principle of Inclusion-Exclusion Notes

Counting in Algorithms

Combinatorics: The Fine Art of Counting

An Elementary Solution to the Ménage Problem

CSE 312 Midterm Exam May 7, 2014

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

Sec$on Summary. Permutations Combinations Combinatorial Proofs

Discrete Structures Lecture Permutations and Combinations

Math 454 Summer 2005 Due Wednesday 7/13/05 Homework #2. Counting problems:

Counting and Probability Math 2320

Chapter 10A. a) How many labels for Product A are required? Solution: ABC ACB BCA BAC CAB CBA. There are 6 different possible labels.

COUNTING TECHNIQUES. Prepared by Engr. JP Timola Reference: Discrete Math by Kenneth H. Rosen

With Question/Answer Animations. Chapter 6

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

MAT 115: Finite Math for Computer Science Problem Set 5

Counting integral solutions

Theory of Probability - Brett Bernstein

Permutations and Combinations Section

5. (1-25 M) How many ways can 4 women and 4 men be seated around a circular table so that no two women are seated next to each other.

CS1800: More Counting. Professor Kevin Gold

The Product Rule can be viewed as counting the number of elements in the Cartesian product of the finite sets

Counting: Basics. Four main concepts this week 10/12/2016. Product rule Sum rule Inclusion-exclusion principle Pigeonhole principle

CS70: Lecture Review. 2. Stars/Bars. 3. Balls in Bins. 4. Addition Rules. 5. Combinatorial Proofs. 6. Inclusion/Exclusion

CPCS 222 Discrete Structures I Counting

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

MATH 215 DISCRETE MATHEMATICS INSTRUCTOR: P. WENG

Permutations and Combinations. Quantitative Aptitude & Business Statistics

Well, there are 6 possible pairs: AB, AC, AD, BC, BD, and CD. This is the binomial coefficient s job. The answer we want is abbreviated ( 4

CSCI 2200 Foundations of Computer Science (FoCS) Solutions for Homework 7

Introductory Probability

In this section, we will learn to. 1. Use the Multiplication Principle for Events. Cheesecake Factory. Outback Steakhouse. P.F. Chang s.

Mathematics. Programming

Week 1: Probability models and counting

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

Combinatorial Proofs

Simple Counting Problems

CISC 1400 Discrete Structures

CSE 21 Practice Final Exam Winter 2016

Sec 5.1 The Basics of Counting

Math 42, Discrete Mathematics

Chapter 2. Permutations and Combinations

Transcription:

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, when the order of the k objects does not matter: ( n! nk k!(n k! = = C(n, k Multinomial coefficients: Suppose there are n objects, but only k are distinct, with k n. (For example, godoggy has n = 7 objects (characters but only k = 4 are distinct: (g, o, d, y. Let n i be the number of times object i appears, for i {1, 2,..., k}. (For example, (3, 2, 1, 1, continuing the godoggy example. The number of distinct ways to arrange the n objects is: ( n! n 1!n 2! n k! = n n 1, n 2,..., n k Binomial Theorem: x, y R, n N: (x + y n = ( k=0 k x k y n k Principle of Inclusion-Exclusion (PIE: 2 events: A B = A + B A B 3 events: A B C = A + B + C A B A C B C + A B C In general: +singles - doubles + triples - quads +... Pigeonhole Principle: If there are n pigeons with k holes and n > k, then at least one hole contains at least 2 (or to be precise, n pigeons. k Complementary Counting (Complementing: If asked to find the number of ways to do X, you can: find the total number of ways and then subtract the number of ways to not do X. Exercises 1. There are 12 points on a plane. Five of them are collinear and, other than these, no three are collinear. 1

(a How many lines, each containing at least 2 of the 12 points, can be formed? ( ( 122 52 + 1 = 57 (b How many triangles, each containing at least 3 of the 12 points, can be formed? ( ( 123 53 = 210 2. There are 6 women and 7 men in a ballroom dancing class. If 4 men and 4 women are chosen and paired off, how many pairings are possible? First choose 4 men and 4 women, ( 7 4 and ( 6 4 respectively. Then, fix the order of men M 1, M 2, M 3, M 4. You can see that there are 4! ways to assign the women to each man, so we have a total of 4! ways. ( 7 ( 6 4 4 3. You have 12 red beads, 16 green beads, and 20 blue beads. How many distinguishable ways are there to place the beads on a string, assuming that beads of the same color are indistinguishable? (The string has a loose end and a tied end, so that reversing the order of the beads gives a different arrangement, unless the pattern of colors happens to form a palindrome. Try solving the problem two different ways, once using permutations and once using using combinations. Using permutations: Using combinations: ( ( 48 36 12 16 = 48! 12! 16! 20! 48! 12! 36! 36! 16! 20! 4. How many bridge hands have a suit distribution of 5, 5, 2, 1? (That is, you are playing with a standard 52-card deck and you have 5 cards of one suit, 5 cards of another suit, 2 of another suit, and 1 of the last suit. ( ( ( ( 135 13 132 131 5 4! : the factor of 4! in the numerator takes care of the number of ways 2! to assign suits to the number of cards, and the factor of 2! in the denominator takes care of the fact that two suits have the same number (5 of cards and so are overcounted. 5. Give a combinatorial proof that ( k=0 k = 2 n. Do not use the binomial theorem. (Hint: you can count the number of subsets of [n] = {1, 2,..., n}. Note: A combinatorial proof is one 2

in which you explain how to count something in two different ways then those formulae must be equivalent if they both indeed count the same thing. Fix a subset of [n] of size k. There are ( n k such subsets because we choose any k elements out of the n, with order not mattering since these are sets. Subsets can be of size k = 0, 1,..., n. So the total number of subsets of [n] is ( k=0 k. On the other hand, each element of [n] is either in a subset or not. So there are 2 possibilities for the first element (in or out, 2 for the second, etc. So there are 2 n subsets of [n]. Therefore, ( k=0 k = 2 n. Note that this agrees with the binomial theorem using x = y = 1. 6. Find the number of ways to rearrange the word INGREDIENT, such that no two identical letters are adjacent to each other. For example, INGREEDINT is invalid because the two E s are adjacent. Repeat the question for the letters AAAAABBB. We use inclusion-exclusion. Let Ω be the set of all anagrams (permutations of INGREDI- ENT, and A I be the set of all anagrams with two consecutive I s. Define A E and A N similarly. A I A E A N clearly are the set of anagrams we don t want. So we use complementing to count the size of Ω \ (A I A E A N. By inclusion exclusion, A I A E A N =singlesdoubles+triples, and by complementing, Ω \ (A I A E A N = Ω A I A E A N. First, Ω = 10! because there are 2 of each of I,E,N s (multinomial coefficient. Clearly, 2!2!2! the size of A I is the same as A E and A N. So A I = 9! because we treat the two adjacent I s 2!2! as one entity. We also need A I A E = 8! because we treat the two adjacent I s as one entity 2! and the two adjacent E s as one entity (same for all doubles. Finally, A I A E A N = 7! since we treat each pair of adjacent I s, E s, and N s as one entity. Putting this together gives 10! 2!2!2! (( 3 1 9! 2!2! ( 3 8! 2 2! + ( 3 7! 3 For the second question, note that no A s and no B s can be adjacent. So let us put the B s down first: B B B By the pigeonhole principle, two A s must go in the same slot, but then they would be adjacent, so there are no ways. 7. At a card party, someone brings out a deck of bridge cards (4 suits with 13 cards in each. N people each pick 2 cards from the deck and hold onto them. What is the minimum value of N that guarantees at least 2 people have the same combination of suits? ( 42 N = 11 : There are combinations of 2 different suits, plus 4 possibilities of having 2 3

cards of the same suit. With N = 11 you can apply the pigeonhole principle. 8. At a dinner party, the n people present are to be seated uniformly spaced around a circular table. Suppose there is a nametag at each place at the table and suppose that nobody sits down at the correct place. Show that it is possible to rotate the table so that at least two people are sitting in the correct place. For i = 1,..., n, let r i be the number of rotations clockwise needed for the i th person to be in their spot. Each r i can be between 1 and n 1 (not 0 since no one is at their nametag, and not n since it is equivalent to 0. Since there are n people and only n 1 possible values for the rotations, at least two must have the same value by the pigeonhole principle. Rotate the table clockwise by that much, and at least two people will be in the correct place. 9. (a Two parents only have 3 bedrooms for their 13 children. If each child is assigned to a bedroom, one of the bedrooms must have at least c children. What is the maximum value of c that makes this statement true? Prove it. c = 5. Prove that c > 4 by contradiction. Suppose not. Then, all bedrooms have 4 children, so there are 12 children, a contradiction. Hence at least one bedroom has at least 5 children. (b (Strong Pigeonhole Principle More generally, what can you say about n children in k bedrooms? Find a general formula for the maximum value of c that guarantees one of the bedrooms must have at least c children. c = n/k. Note that the ordinary Pigeonhole Principle is the special case when k = n 1. 10. Suppose 250 new majors entered the CSE program this fall. There are 200 new majors in CSE 311, 40 in CSE 331, and 150 in CSE 351. Furthermore, 20 new majors are in both CSE 311 and CSE 331, 120 new majors are in both CSE 311 and CSE 351, and 10 new majors are in both CSE 331 and CSE 351. Finally, there are 4 new majors in all three (CSE 311, CSE 331, and CSE 351. How many CSE students are not in any of those 3 courses? (Note: These numbers were made up. Let A be the set of students in CSE 311, B be the set of students in CSE 331, and C be the set of students in CSE 351. Start by counting the complement, which is the number of students who are in at least one of those three classes, which is A B C. By the principle of inclusion-exclusion, A B C = A + B + C A B A C B C + A B C = 200 + 40 + 150 20 120 10 + 4 = 244 4

Finally, the number of new majors who are not in one of those three classes is just the total number of new majors minus those who are in at least one of those classes, which is 250 244 = 6. 11. Suppose Anna, Bob, Carol, Daniel, and Evelyn are sitting down to eat, and Anna and Bob must sit next to each other. How many arrangements are possible if (a They sit in a line Since Anna and Bob must sit next to each other, treat them as a single entity. There are 4! arrangements. Then, there are 2 ways to arrange Anna and Bob (either Anna sits to the left of Bob, or to the right. 2 4! = 48 Alternatively, use complementary counting. There are 5! total arrangements. Now subtract the number of ways where Anna and Bob are not adjacent. If Anna is sitting at an end of the line (2 positions, there are 3 positions for Bob which are not adjacent to Anna. Then, there are 3! ways to arrange the remaining people, so there are 2 3 3! arrangements in this case. However, if Anna is not sitting at an end of the line (3 positions, there are 2 positions for Bob which are not adjacent to Anna. Then there are 3! ways to arrange the remaining people, so there are 3 2 3! arrangements in this case. Putting this together, we have 5! (2 3 3! + 3 2 3! = 48 (b They are sitting at a circular table (two arrangements are considered equivalent if one can be rotated to give another Again, we treat Anna and Bob as a single entity. So we re arranging 4 people around a circle. If they were in a line, we would have 4! arrangements, but this overcounts by a factor of 4 since each of the 4 rotations of the circle were counted separately, but are actually considered the same arrangement. Thus, there are 4!/4 ways to arrange 4 objects arond the circle. Finally, there are 2 ways to arrange Anna and Bob again. 2 4! 4 = 12 5