CIS Spring 2018 (instructor Val Tannen)

Similar documents
Lecture Overview. 2 Permutations and Combinations. n(n 1) (n (k 1)) = n(n 1) (n k + 1) =

Math 155 (Lecture 3)

Section 5.1 The Basics of Counting

Combinatorics and Newton s theorem

Let us consider the following problem to warm up towards a more general statement.

Generating Functions. 1 Operations on generating functions

( ) GENERATING FUNCTIONS

Injections, Surjections, and the Pigeonhole Principle

CSE 191, Class Note 05: Counting Methods Computer Sci & Eng Dept SUNY Buffalo

Intermediate Math Circles November 4, 2009 Counting II

Homework 3. = k 1. Let S be a set of n elements, and let a, b, c be distinct elements of S. The number of k-subsets of S is

Chapter 7 COMBINATIONS AND PERMUTATIONS. where we have the specific formula for the binomial coefficients:

1 Counting and Stirling Numbers

Bertrand s Postulate

Permutations, Combinations, and the Binomial Theorem

6.3 Testing Series With Positive Terms

(ii) Two-permutations of {a, b, c}. Answer. (B) P (3, 3) = 3! (C) 3! = 6, and there are 6 items in (A). ... Answer.

Lecture 10: Mathematical Preliminaries

The Random Walk For Dummies

Chapter 0. Review of set theory. 0.1 Sets

(A sequence also can be thought of as the list of function values attained for a function f :ℵ X, where f (n) = x n for n 1.) x 1 x N +k x N +4 x 3

Randomized Algorithms I, Spring 2018, Department of Computer Science, University of Helsinki Homework 1: Solutions (Discussed January 25, 2018)

Summer High School 2009 Aaron Bertram

Lecture 2: April 3, 2013

Complex Numbers Solutions

Combinatorics II. Combinatorics. Product Rule. Sum Rule II. Theorem (Product Rule) Theorem (Sum Rule)

1. n! = n. tion. For example, (n+1)! working with factorials. = (n+1) n (n 1) 2 1

Math 475, Problem Set #12: Answers

3.1 Counting Principles

MT5821 Advanced Combinatorics

Combinatorially Thinking

Chapter 1 : Combinatorial Analysis

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 22

Random Models. Tusheng Zhang. February 14, 2013

Infinite Sequences and Series

Discrete Mathematics for CS Spring 2005 Clancy/Wagner Notes 21. Some Important Distributions

Problem Set 2 Solutions

Sets. Sets. Operations on Sets Laws of Algebra of Sets Cardinal Number of a Finite and Infinite Set. Representation of Sets Power Set Venn Diagram

Week 5-6: The Binomial Coefficients

P1 Chapter 8 :: Binomial Expansion

Math 172 Spring 2010 Haiman Notes on ordinary generating functions

What is Probability?

It is always the case that unions, intersections, complements, and set differences are preserved by the inverse image of a function.

PUTNAM TRAINING PROBABILITY

Basic Counting. Periklis A. Papakonstantinou. York University

Solutions to Final Exam

End-of-Year Contest. ERHS Math Club. May 5, 2009

MATH 304: MIDTERM EXAM SOLUTIONS

Worksheet on Generating Functions

Permutations & Combinations. Dr Patrick Chan. Multiplication / Addition Principle Inclusion-Exclusion Principle Permutation / Combination

MA131 - Analysis 1. Workbook 3 Sequences II

Sequences, Mathematical Induction, and Recursion. CSE 2353 Discrete Computational Structures Spring 2018

A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence

Putnam Training Exercise Counting, Probability, Pigeonhole Principle (Answers)

Lecture 6 Simple alternatives and the Neyman-Pearson lemma

Lecture Notes for CS 313H, Fall 2011

Books Recommended for Further Reading

SEQUENCES AND SERIES

MT5821 Advanced Combinatorics

Mathematical Induction

Solutions. tan 2 θ(tan 2 θ + 1) = cot6 θ,

CS 336. of n 1 objects with order unimportant but repetition allowed.

1 What is combinatorics?

4 The Sperner property.

4.3 Growth Rates of Solutions to Recurrences

Chapter 4. Fourier Series

Discrete Mathematics and Probability Theory Spring 2012 Alistair Sinclair Note 15

CHAPTER 10 INFINITE SEQUENCES AND SERIES

Combinatorics I Introduction. Combinatorics. Combinatorics I Motivating Example. Combinations. Product Rule. Permutations. Theorem (Product Rule)

Lecture 6 April 10. We now give two identities which are useful for simplifying sums of binomial coefficients.

subcaptionfont+=small,labelformat=parens,labelsep=space,skip=6pt,list=0,hypcap=0 subcaption ALGEBRAIC COMBINATORICS LECTURE 8 TUESDAY, 2/16/2016

Sequences A sequence of numbers is a function whose domain is the positive integers. We can see that the sequence

The Binomial Theorem

arxiv: v1 [math.nt] 10 Dec 2014

Some Basic Counting Techniques

Discrete Mathematics and Probability Theory Summer 2014 James Cook Note 15

ARRANGEMENTS IN A CIRCLE

MA131 - Analysis 1. Workbook 2 Sequences I

6 Integers Modulo n. integer k can be written as k = qn + r, with q,r, 0 r b. So any integer.

2 Geometric interpretation of complex numbers

The picture in figure 1.1 helps us to see that the area represents the distance traveled. Figure 1: Area represents distance travelled

International Contest-Game MATH KANGAROO Canada, Grade 11 and 12

A Combinatorial Proof of a Theorem of Katsuura

Counting Well-Formed Parenthesizations Easily

Commutativity in Permutation Groups

Math 105 TOPICS IN MATHEMATICS REVIEW OF LECTURES VII. 7. Binomial formula. Three lectures ago ( in Review of Lectuires IV ), we have covered

Riemann Sums y = f (x)

1 Introduction. 1.1 Notation and Terminology

arxiv: v1 [math.co] 23 Mar 2016

Topic 5: Basics of Probability

If a subset E of R contains no open interval, is it of zero measure? For instance, is the set of irrationals in [0, 1] is of measure zero?

Math 61CM - Solutions to homework 3

Discrete Mathematics Recurrences

MATH 324 Summer 2006 Elementary Number Theory Solutions to Assignment 2 Due: Thursday July 27, 2006

Lecture 3: Catalan Numbers

Beurling Integers: Part 2

Sequences I. Chapter Introduction

Product measures, Tonelli s and Fubini s theorems For use in MAT3400/4400, autumn 2014 Nadia S. Larsen. Version of 13 October 2014.

CSE 21 Mathematics for

Lecture 2: Monte Carlo Simulation

Transcription:

CIS 160 - Sprig 2018 (istructor Val Tae) Lecture 5 Thursday, Jauary 25 COUNTING We cotiue studyig how to use combiatios ad what are their properties. Example 5.1 How may 8-letter strigs ca be costructed by usig the 26 letters of the alphabet if each strig cotais 3,4, or 5 vowels? There is o restrictio o the umber of occurreces of a letter i the strig. Solutio: Let E be the set of 8-letter strigs that cotai at least 3 vowels. Let E i be the set of 8-letter strigs cotaiig exactly i > 0 vowels (so i {1, 2, 3, 4, 5}) A elemet of E i, i.e., a 8-letter strig with exactly i vowels, ca be costructed usig the followig steps. Step 1. Choose i locatios for vowels out of the available 8 locatios. Step 2. Choose the vowels for each of the i locatios. Step 3. Choose the cosoats for each of the remaiig 8 i locatios. Step 1 ca be performed i ( 8 i) ways. Step 2 ca be performed i 5 i ways. Step 3 ca be performed i 21 8 i ways. By the multiplicatio rule, the umber of 8-letter strigs with exactly i vowels is give by ( ) 8 E i 5 i 21 8 i i Sice the sets E 3, E 4, ad E 5 partitio (divide i pairwise disjoit subsets) the set E, by the sum rule we get 5 5 ( ) 8 E E i 5 i 21 8 i i i3 Addedum. The followig questio was raised i class i oe of the previous offerigs of this course. What if we wat to cout all 8-letter strigs with distict letters that have 3, 4, or 5 vowels? I this case, the above procedure still applies. However, the umber of ways of doig each step chages. Step 1 ca be performed i ( 8 i) ways. Step 2 ca be performed i (5)i ways. Step 3 ca be performed i (21) 8 i ways. By the multiplicatio rule, the umber of 8-letter strigs with distict letters that have exactly i vowels is give by ( ) 8 (5) i (21) 8 i i i3 1

The total umber of 8-letter strigs with distict letters that have 3, 4, or 5 vowels is 5 i3 ( ) 8 (5) i (21) 8 i i It is worthwhile revisitig Example 2.5 from Lecture 2 ad comparig it with what we did just ow. Example 5.2 Suppose you are i Mahatta at the NY Public Library (5th Ave ad 42d St) ad you wish to walk to Columbus Circle (8th Ave ad 59th St) takig a shortest path (but you caot take Broadway for some reaso :). How may blocks do you eed to walk? How may differet ways are there to walk a shortest path? Solutio: A shortest path cosists of makig oly two kids of decisios: go-west oe block (at most 8 5 3 times), or, go-north oe block (at most 59 42 17 times), for a total of 3+17 20 blocks. How may differet paths of legth 20 blocks are there from the Library to the Circle? Ay such path is a sequece of 20 decisios of oe of two kids: go-west 3 times, or go-north 17 times. Ad ay such sequece is a valid shortest path. Such a sequece has 20 positios ad choosig the 3 positios i which to make go-west decisios ca be doe i ( ) 20 3 ways. If we choose istead the positios i which to make go-north decisios we get ( 20 17) differet ways. But these umbers are equal (why?). More geerally, cosider the grid defied by the poits of iteger coordiates i the plae. Assumig that we ca move oly alog lies of iteger abscissa or iteger ordiate how may differet shortest paths are there from the origi to the poit (m, ) where m, N? The aswer is ( ) ( ) m + m + m By the way, you ca check that these two are equal by usig the expressio with factorial, or, better, wait for a combiatorial proof comig up below. Stars ad bars (sticks ad crosses) coutig certai kid of collectios. Next we explai, via a example, a versatile method for Example 5.3 How may differet ways are there to buy a doze douts whe 5 give glazes are available? Assume (1) that there is a ulimited supply of douts of each glaze, (2) that douts of the same glaze are idistiguishable, ad (3) that the placemet of the douts i, say, a box, does ot distiguishes your purchases. 2

Solutio: We apply stars ad bars as follows. Arrage 12 stars i a row. They represet hypothetical douts before glazess are assiged, let s call them proto-douts :) Obviously, all 12 proto-douts are idistiguishable so their orderig is irrelevat. Now place 4 bars betwee some of the stars. Note that this separates the proto-douts ito 5 cotiguous parts. 1 Assig the 1st glaze to the proto-douts i the leftmost part, 2d glaze to the ext part, etc. For example: *** ** * **** ** A B C D E Achocolate, Bmaple, Cdulce-de-leche, Damaretto-cherry, Ehazelut Note that it is possible that you do t buy douts of a specific glaze at all. This meas that we have to allow for bars at the begiig or ed ad for adjacet bars: *** ****** *** ********* *** * * ********** A B C D E AB C D E A BCD E I the first example above there are o maple-glazed douts, ad o hazelut-glazed douts, etc. Note also that because the proto-douts are idistiguishable, the orderig of A,B,C,D,E does ot matter, oly how may proto-douts are i each cotiguous part matters. For example the followig have the same glaze distributio hece they produce the same purchase. *** ** * **** ** * **** ** ** *** A B C D E C D B E A Thus, to avoid overcoutig, we fix a orderig of A,B,C,D,E ad the we cout. So how do we cout the differet ways of costructig a sequece of stars ad bars that correspods to a this fixed orderig of glazes? The 12 stars ad the 4 bars form a sequece with 12 + 4 16 positios. Out of these, we choose 4 positios where we put the bars, or, equivaletly, 12 positios where we put the stars. The aswer is ( ) ( 16 4 16 12). Let s review what we have doe so far about coutig differet kids of collectios. We have see that the umber of distict sequeces of legth r made of elemets from a give set of elemets is r This is the same as the umber of differet ways to costruct from elemets of a set with elemets a collectio of size r that is both ordered ad allows repetitios. 1 I am usig part rather tha (sub)sequece because their orderig is irrelevat. 3

We have also cosidered coutig the umber of ways to costruct from elemets of a give set with elemets a collectio of size r that is ordered but does ot allow repetitios. We called these permutatios of r out of ad we deoted their umber by () r! ( r)! Fially, we have cosidered coutig the umber of ways to costruct from elemets of a give set with elemets a collectio of size r that is uordered ad does ot allow repetitios. That is the same as coutig the subsets of size r of the set with elemets. We called these combiatios of r out of ad we deoted their umber by ( r ) () r r!! r!( r)! It is ow atural to cosider coutig the umber of ways to costruct from elemets of a give set with elemets a collectio of size r that is uordered but does allow repetitios. Such a collectio is called a bag or a multiset (because it is set-like, but with repetitios). We shall call these combiatios of r out of with repetitio ad deote their umber by (( r)) (read multichoose r). Notatio for bags There is o stadard otatio. Let A {a, b, c, d} be the give set. Some people use the ormal set otatio (braces) for bags (multisets) ad just repeat elemets. For example, the bag {a, b, a, c, a, b} is the same as the bag {a, a, a, b, b, c}. This ca be dagerous for oe who cofuses them with sets i which the copies of the same elemet are somehow distiguishable. To avoid this, some people use double braces: {{a, b, a, c, a, b}} (same as {{a, a, a, b, b, c}}). A iterestig alterative is to use braces, but, for each distict elemet, use a atural umber that gives the umber of copies (repetitios). For istace the bag above would be {3 a, 2 b, 1 c} or eve {3 a, 2 b, 1 c, 0 d}! (we shall see that this ca be thought of a certai kid of fuctio.) Do t use this otatio whe the elemets of A are umbers, say, A {1, 2, 3, 4}, it s cofusig! Coutig bags Let A {a 1,..., a } be the give set. Its elemets are (clearly) distiguishable. It turs out that we ca use exactly the stars ad bars techique that we used to cout dout purchases to cout the umber of bags of size r costructed from elemets of A ad thus obtai a formula for (( )) r. 2 Thik of costructig bag of size r as separatig r stars ito parts correspodig to copies of the same elemet of A. Sice A we use it with 1 bars. This ca be doe by choosig 1 positios for the bars (equivaletly, choosig r positios for the stars) i a sequece of legth + r 1. Therefore (( )) ( ) ( ) + r 1 + r 1 r r 1 2 A otatio used by some textbooks, icludig Scheierma. 4

Warig Note that is the umber of bags of size r (so repetitios are couted i the r) made from elemets of a set of size (so o repetitios amog the ). Marbles i bis, cois to childre (( r)) is also the umber of ways of puttig r idistiguishable marbles i distiguishable bis; or, the umber of ways of distributig r idistiguishable cois 3 to distiguishable childre; or, the umber of distict atural umber solutios to the Diophatie equatio x 1 + x 2 + + x r Example 5.4 I how may ways ca we distribute 11 idistiguishable cois to 3 distiguishable childre? Solutio: (( )) ( 3 11 3+11 1 ) ( 3 1 13 ) 2. Example 5.5 A (somewhat fairer) distributio of 11 idistiguishable cois to 3 distiguishable childre assumes that each child gets at least 3 cois. I how may differet ways ca this be doe? Solutio: We begi by givig 3 cois each to the 3 childre. This leaves us 11 3 3 2 cois to distribute to the 3 childre accordig to the geeral scheme. So the umber of ways is (( 3 ( 2)) 3+2 1 ) ( 2 4 ) 2 6. Defiitio 5.6 Let m, be two itegers such that m. The iteger iterval [m..] is defied as the set of itegers m ad. That is [m..] {x Z m x } Note that both m ad are elemets i [m..]. Note also that there are m + 1 elemets i [m..]. That is [m..] m + 1 Do ot cofuse iteger itervals with the usual itervals of real umbers. For istace [0..1] {0, 1} has two elemets while [0, 1] is ifiite. 3 May years ago this was taught with peies, the with ickels, evetually with quarters, keepig up with iflatio, you kow. At some poit we gave up ad started usig cois. I expect that at some poit i the future we ll use bitcois ad beam them directly ito the childre s electroic persoal assistat. 5

Example 5.7 What is the umber of o-decreasig sequeces of legth 12 whose elemets are take from [10..30]? What is the umber of icreasig (we ofte say strictly icreasig so there is o cofusio) such sequeces? Solutio: [10..30] has 30 20 + 1 21 elemets. No-decreasig meas that elemets ca be repeated, as log as copies are adjacet i the sequece. Here is a procedure for costructig a o-decreasig sequece of legth 12 usig itegers i [10..30]. Step 1: choose a uordered collectio of 12 out of the 21 umbers, with repetitio. Step 2: order it. Step 1 ca be doe i (( )) ( 21 12 32 12) ways. Step 2 ca be doe i exactly oe way. The aswer is ( 32 12). O the other had, to cout the umber of strictly icreasig sequeces of legth 12 made of umbers from [10..30] we choose a combiatio of 12 out of 21 (without repetitio!) ad the order it. The aswer is ( 21 12). Biomial coefficiets Mathematicias typically use this ame istead of (umber of) combiatios. We are about to see why. A biomial is a sum of two terms, such as a + b. The biomial theorem gives a expressio for (a + b) where a ad b are real umbers ad is a atural umber. Theorem 5.8 (Biomial Theorem) For ay real umbers a ad b ad atural umber ( ) (a + b) a k b k k k0 Proof: The formula is easily checked for 0. For 1, let s thik what happes whe we calculate the expasio (a + b) (a + b) (a + b) (a + b) We obtai a sum of terms (moomials), each of the form a k b k, where k is 0 or 1, etc.,..., or. 4 Most of these terms occur more tha oce (which oes occur exactly oce?). How may times does a k b k occur i the expasio? This is the same umber of times as there are orderigs of k a s ad k b s. This is equal to ( ) k. Thus the coefficiet of like terms of the form a k b k is ( k). This proves the theorem. Pascal s Triagle We kow that (a + b) 0 1, (a + b) 1 a + b, (a + b) 2 a 2 + 2ab + b 2, (a + b) 3 a 3 + 3a 2 b + 3ab 2 + b 3, etc. 4 How may terms? Use the multiplicatio rule to figure out that there are 2 terms! 6

Blaise Pascal observed some iterestig relatioships betwee the biomial coefficiets whe arraged i rows as follows: Specifically, observe that each biomial coefficiet is the sum of the two just above it. Formally: Theorem 5.9 (Pascal s Idetity) If ad k are positive itegers with k the ( ) ( ) ( ) 1 1 + k k 1 k Proof: This ca be easily verified usig the factorial formula for combiatios. followig proof is more isightful. However, the Let S {x 1, x 2,..., x } be the set of elemets. We cout the umber of subsets of size k i two ways. Oe way gives the combiatios of k our of, i.e., the LHS of Pascal s Idetity. I the secod way, we observe that k-elemet subsets of S ca be partitioed ito those that cotai x ad those that do t. For the former type of subset the other k 1 elemets come from S \ {x }. There are ( 1 k 1) ways of choosig these subsets. For the latter type of subset all of the k elemets must be chose from S \ {x }. There are ( ) 1 k ways of doig this. Thus, by the sum rule the umber of k-elemet subsets of S is give by the RHS of Pascal s Idetity. Proofs like the oe we just saw are called combiatorial. Combiatorial proofs We ow prove a couple of idetities usig the followig techique. To prove a idetity we will pose a coutig questio. We will the aswer the questio i two ways, oe aswer will correspod to LHS ad the other would correspod to the RHS of the idetity. We have see a example of this techique i the proof of Pascal s Idetity. This techique is ofte called a combiatorial proof. Example 5.10 Prove that ( ) r ( ) r 7

Solutio: We give a combiatorial proof. Let X be a set of size. We cout the umber of subsets of size r of X i two ways. We already did oe such cout whe we defied combiatios ad we kow the aswer is ( r). Alteratively we cout the umber of ways we ca choose elemets that are ot i a subset of size r. That is, cout the umber of subsets of size r which is, of course, ( r). The subsets of size r are i oe-to-oe correspodece with their complemets (see Example 3.12 i Lecture 3). These complemets are exactly the subsets of size r. Therefore there must be as may subsets of size r as there are subsets of size r. This proves the idetity. (The argumet that uses, iformally, the oe-to-oe correspodece is a example of somethig called the Bijectio Rule. We will lear about it whe we study fuctios.) Example 5.11 Prove that ( ) 0 ( ) + 1 ( ) ( )... + ( 1) 0 2 Solutio: Oe way to solve this problem is by substitutig a 1 ad b 1 i the Biomial Theorem, yieldig ( ) 0 0 ( 1) k. k k0 However, a combiatorial proof will give us more isight ito what the expressio meas. We wat to prove that ( ) ( ) ( ) ( ) ( ) ( ) + + +... + + +... 0 2 4 1 3 5 Cosider a set X {x 1, x 2, x 3,..., x }. We wat to show that the total umber of subsets of X that have eve size equals the total umber of subsets of X that have odd size. We will ow show that both these quatities equal 2 1 from which the claim follows. A eve-sized subset of X ca be costructed as follows. Step 1. Decide whether x 1 belogs to the subset or ot. Step 2. Decide whether x 2 belogs to the subset or ot.. Step. Decide whether x belogs to the subset or ot. I the first 1 steps oe ca make either oe of the 2 choices, i or out. But i step oly oe choice is possible! This is because if we have chose a eve umber of elemets from X \ {x } to put i the subset the we must leave out x otherwise we must iclude x i the subset. Hece usig the multiplicatio rule the total umber of eve-sized subsets of X equals 2 1. 8

Aother way of thikig about this is to cout i two steps: i the first step choose a subset of {x 1,..., x 1 }; i the secod step add or ot x to the subset chose i the first step, makig sure the result has eve size (do t forget that 0 is eve!). To compute the umber of odd-sized subsets we could proceed similarly. Or, we could cout complemetarily: sice we kow that the total umber of subsets of X is 2, the total umber of odd-sized subsets of X is 2 2 1 2 1 (2 1) 2 1. Example 5.12 Prove that k0 ( k) 2. Solutio: We pose the followig coutig questio. Give a set S of distict elemets how may subsets are there of the set S? From earlier lectures, we kow that the aswer is 2. This gives us the RHS. Aother way to compute the aswer to the questio is as follows. The powerset 2 S cotaiig all possible subsets ca be partitioed ito S 0, S 1,..., S, where S i, 0 i, is the set of all subsets of S that have cardiality i. Thus 2 S S 0 + S 1 +... + S ( ) ( ) ( ) + +... + 0 1 ( ) LHS k k0 This proves the claim. (How do you derive the same idetity from the Biomial Theorem?) Example 5.13 Give a combiatorial proof to show that r k0 ( )( ) m k r k Solutio: We pose the followig coutig questio. ( ) + m There are me ad m wome. How may ways are there to form a committee of r people from this group of people? r 9

By defiitio, there are ( ) +m r distict committees of r people. This gives us the RHS. The set S of all possible committees of r people ca be partitioed ito subsets S 0, S 1, S 2,..., S r, where S k is the set of committees i which there are exactly k me ad the rest r k are wome. Note that S k ( )( m k r k). Thus we have S r k0 r k0 ( )( ) m k r k which gives us the left had side of the expressio. 10