Counting with Categories and Binomial Coefficients

Similar documents
Counting Strategies: Inclusion-Exclusion, Categories

Counting Strategies: Inclusion/Exclusion, Categories

Binomial Coefficient Identities/Complements

Counting Strategies: Inclusion/Exclusion, Categories

Trees/Intro to counting

Announcements. CSE 321 Discrete Structures. Counting. Counting Rules. Important cases of the Product Rule. Counting examples.

Counting. Spock's dilemma (Walls and mirrors) call it C(n,k) Rosen, Chapter 5.1, 5.2, 5.3 Walls and Mirrors, Chapter 3 10/11/12

Counting. Math 301. November 24, Dr. Nahid Sultana

ENGG 2440B Discrete Mathematics for Engineers Tutorial 8

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

Introduction to Decision Sciences Lecture 11

Basic counting techniques. Periklis A. Papakonstantinou Rutgers Business School

Lecture 4: Counting, Pigeonhole Principle, Permutations, Combinations Lecturer: Lale Özkahya

Permutations and Combinations

Discrete Mathematics, Spring 2004 Homework 4 Sample Solutions

Combinatorics. But there are some standard techniques. That s what we ll be studying.

Discrete Mathematics & Mathematical Reasoning Chapter 6: Counting

Contents. Counting Methods and Induction

MATH 556: PROBABILITY PRIMER

CS 2336 Discrete Mathematics

Sets. A set is a collection of objects without repeats. The size or cardinality of a set S is denoted S and is the number of elements in the set.

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

Counting. Mukulika Ghosh. Fall Based on slides by Dr. Hyunyoung Lee

Name: Harry Potter (pothar31) Discrete Math HW#6 Solutions March 9, Added: Chapter 6 Summary/Review: 17(a), 8, 15, 29, 42 and Q1 and Q2 below

Discrete Probability

UNCORRECTED SAMPLE PAGES. Extension 1. The binomial expansion and. Digital resources for this chapter

True/False. Math 10B with Professor Stankova Worksheet, Midterm #1; Friday, 2/16/2018 GSI name: Roy Zhao

What you learned in Math 28. Rosa C. Orellana

MATH MW Elementary Probability Course Notes Part I: Models and Counting

Equivalence of Propositions

{ 0! = 1 n! = n(n 1)!, n 1. n! =

CSE 20 DISCRETE MATH. Fall

Binomial Coefficients MATH Benjamin V.C. Collins, James A. Swenson MATH 2730

CSE 20 DISCRETE MATH WINTER

MATH 10B METHODS OF MATHEMATICS: CALCULUS, STATISTICS AND COMBINATORICS

1 The Basic Counting Principles

Notes Week 2 Chapter 3 Probability WEEK 2 page 1

Notes. Combinatorics. Combinatorics II. Notes. Notes. Slides by Christopher M. Bourke Instructor: Berthe Y. Choueiry. Spring 2006

are the q-versions of n, n! and . The falling factorial is (x) k = x(x 1)(x 2)... (x k + 1).

PROBABILITY VITTORIA SILVESTRI

W3203 Discrete Mathema1cs. Coun1ng. Spring 2015 Instructor: Ilia Vovsha.

Bijective Proofs with Spotted Tilings

Math 564 Homework 1. Solutions.

2 Generating Functions

1 Basic Combinatorics

Number Theory and Counting Method. Divisors -Least common divisor -Greatest common multiple

Regular Languages and Finite Automata

Slides for a Course Based on the Text Discrete Mathematics & Its Applications (5 th Edition) by Kenneth H. Rosen

Lecture 2: Probability

PROBABILITY. Contents Preface 1 1. Introduction 2 2. Combinatorial analysis 5 3. Stirling s formula 8. Preface

Combinations. April 12, 2006

CHAPTER 1 POLYNOMIALS

Principles of Counting. Debdeep Mukhopadhyay IIT Madras

CSE 20. Lecture 4: Introduction to Boolean algebra. CSE 20: Lecture4

Advanced Counting Techniques. Chapter 8

Some Review Problems for Exam 3: Solutions

MATH 3330 ABSTRACT ALGEBRA SPRING Definition. A statement is a declarative sentence that is either true or false.

Divide and Conquer. CSE21 Winter 2017, Day 9 (B00), Day 6 (A00) January 30,

Lecture 3: Miscellaneous Techniques

2 - Strings and Binomial Coefficients

Economics 204 Fall 2011 Problem Set 1 Suggested Solutions

CSE373: Data Structures and Algorithms Lecture 2: Math Review; Algorithm Analysis. Hunter Zahn Summer 2016

The Inclusion Exclusion Principle

The solutions to the two examples above are the same.

Topic 4 Probability. Terminology. Sample Space and Event

Statistical Inference

CSE 20 DISCRETE MATH. Fall

Notes on the Matrix-Tree theorem and Cayley s tree enumerator

Definition: A binary relation R from a set A to a set B is a subset R A B. Example:

Indistinguishable objects in indistinguishable boxes

Lower bound for sorting/probability Distributions

21-301, Spring 2019 Homework 5 Solutions

Name (please print) Mathematics Final Examination December 14, 2005 I. (4)

Solutions to Homework Problems

Review problems solutions

n(n 1) = (n + 1)n(n 1)/ ( 1) n(n 1)(n 2) = (n + 1)n(n 1)(n 2)/4

COMBINATORIAL COUNTING

Advanced Counting Techniques

Carleton University. Final Examination Fall DURATION: 2 HOURS No. of students: 275

6 CARDINALITY OF SETS

Enumerative Combinatorics Through Guided Discovery 1

Massachusetts Institute of Technology Handout J/18.062J: Mathematics for Computer Science May 3, 2000 Professors David Karger and Nancy Lynch

UCSD CSE 21, Spring 2014 [Section B00] Mathematics for Algorithm and System Analysis

Named numbres. Ngày 25 tháng 11 năm () Named numbres Ngày 25 tháng 11 năm / 7

Homework 7 Solutions, Math 55

CDM Combinatorial Principles

q xk y n k. , provided k < n. (This does not hold for k n.) Give a combinatorial proof of this recurrence by means of a bijective transformation.

A is a subset of (contained in) B A B iff x A = x B Socrates is a man. All men are mortal. A = B iff A B and B A. A B means A is a proper subset of B

Sets. Subsets. for any set A, A and A A vacuously true: if x then x A transitivity: A B, B C = A C N Z Q R C. C-N Math Massey, 72 / 125

Bound and Free Variables. Theorems and Proofs. More valid formulas involving quantifiers:

Discrete Mathematics -- Chapter 10: Recurrence Relations

F 2k 1 = F 2n. for all positive integers n.

Math 38: Graph Theory Spring 2004 Dartmouth College. On Writing Proofs. 1 Introduction. 2 Finding A Solution

Foundations of Computer Science Lecture 14 Advanced Counting

Probability. Part 1 - Basic Counting Principles. 1. References. (1) R. Durrett, The Essentials of Probability, Duxbury.

Introducing Proof 1. hsn.uk.net. Contents

10.4 The Kruskal Katona theorem

Time Analysis of Sorting and Searching Algorithms

We might divide A up into non-overlapping groups based on what dorm they live in:

Math Fall Final Exam. Friday, 14 December Show all work for full credit. The problems are worth 6 points each.

Transcription:

Counting with Categories and Binomial Coefficients CSE21 Winter 2017, Day 17 (B00), Day 12 (A00) February 22, 2017 http://vlsicad.ucsd.edu/courses/cse21-w17

When sum rule fails Rosen p. 392-394 Let A = { people who know Java } and B = { people who know C } # people who know Java or C = # people who know Java

When sum rule fails Double counted! Rosen p. 392-394 Let A = { people who know Java } and B = { people who know C } # people who know Java or C = # people who know Java + # people who know C

When sum rule fails Rosen p. 392-394 Let A = { people who know Java } and B = { people who know C } # people who know Java or C = # people who know Java + # people who know C -# people who know both

Inclusion-Exclusion principle Rosen p. 392-394 Let A = { people who know Java } and B = { people who know C }

Inclusion-Exclusion for three sets Rosen p. 392-394

Inclusion-Exclusion for three sets Rosen p. 392-394

Inclusion-Exclusion for three sets Rosen p. 392-394

Inclusion-Exclusion for three sets Rosen p. 392-394

Inclusion-Exclusion for three sets Rosen p. 392-394

Inclusion-Exclusion for three sets Rosen p. 392-394

Inclusion-Exclusion for three sets Rosen p. 392-394

Inclusion-Exclusion for three sets Rosen p. 392-394

Inclusion-Exclusion principle Rosen p. 556 If A 1, A 2,, A n are finite sets then

Counting with categories Rosen p. 394 If A = X 1 U X 2 U U X n and all X i, X j disjoint and all X i have same size, then X i = A / n More generally: There are n/dways to do a task if it can be done using a procedure that can be carried out in nways, and for every way w, dof the nways give the same result as wdid.

Counting with categories Rosen p. 394 If A = X 1 U X 2 U U X n and all X i, X j disjoint and all X i have same size, then X i = A / n More generally: There are n/dways to do a task if it can be done using a procedure that can be carried out in nways, and for every way w, dof the nways give the same result as wdid.

Counting with categories Rosen p. 394 If A = X 1 U X 2 U U X n and all X i, X j disjoint and all X i have same size, then X i = A / n Or in other words, If objects are partitioned into categories of equal size, and we want to think of different objects as being the same if they are in the same category, then # categories = (# objects) / (size of each category)

Ice cream! An ice cream parlor has n different flavors available. How many ways are there to order a two-scoop ice cream cone (where you specify which scoop goes on bottom and which on top, and the two flavors must be different)? A. n 2 B. n! C. n(n-1) D. 2n E. None of the above.

Ice cream! An ice cream parlor has n different flavors available. How can we use our earlier answer to decide the number of cones, if we count two cones as the same if they have the same two flavors (even if they're in opposite order)? A. Double the previous answer. B. Divide the previous answer by 2. C. Square the previous answer. D. Keep the previous answer. E. None of the above.

Ice cream! An ice cream parlor has n different flavors available. How can we use our earlier answer to decide the number of cones, if we count two cones as the same if they have the same two flavors (even if they're in opposite order)? Objects: Categories: Size of each category: # categories = (# objects) / (size of each category)

Ice cream! An ice cream parlor has n different flavors available. How can we use our earlier answer to decide the number of cones, if we count two cones as the same if they have the same two flavors (even if they're in opposite order)? Objects: cones Categories: flavor pairs (regardless of order) Size of each category: # categories = (# objects) / (size of each category)

Ice cream! An ice cream parlor has n different flavors available. How can we use our earlier answer to decide the number of cones, if we count two cones as the same if they have the same two flavors (even if they're in opposite order)? Objects: cones n(n-1) Categories: flavor pairs (regardless of order) Size of each category: 2 # categories = (n)(n-1)/ 2 Avoiding double-counting

Object Symmetries How many different colored triangles can we create by tying these three pipe cleaners end-to-end? A. 3! B. 2 3 C. 3 2 D. 1 E. None of the above.

Object Symmetries How many different colored triangles can we create by tying these three pipe cleaners end-to-end? Objects: all different colored triangles Categories: physical colored triangles (two triangles are the same if they can be rotated and/or flipped to look alike) Size of each category: # categories = (# objects) / (size of each category)

Object Symmetries How many different colored triangles can we create by tying these three pipe cleaners end-to-end? Objects: all different colored triangles 3! Categories: physical colored triangles (two triangles are the same if they can be rotated and/or flipped to look alike) Size of each category: (3)(2) three possible rotations, two possible flips # categories = (# objects) / (size of each category) = 6/6 = 1

Object Symmetries

Fixed-density Binary Strings How many length nbinary strings contain k ones? Rosen p. 413 For example, n=6, k=4 Density is number of ones Which of these strings matches this example? A. 101101 B. 1100011101 C. 111011 D. 1101 E. None of the above.

Fixed-density Binary Strings How many length nbinary strings contain k ones? Rosen p. 413 For example, n=6, k=4 Density is number of ones Product rule: How many options for the first bit? the second? the third?

Fixed-density Binary Strings How many length nbinary strings contain k ones? Rosen p. 413 For example, n=6, k=4 Density is number of ones Tree diagram: gets very big & is hard to generalize

Fixed-density Binary Strings How many length nbinary strings contain k ones? Rosen p. 413 For example, n=6 k=4 Density is number of ones Another approach: use a different representation i.e. count with categories Objects: Categories: Size of each category: # categories = (# objects) / (size of each category)

Fixed-density Binary Strings How many length nbinary strings contain k ones? Rosen p. 413 For example, n=6, k=4 Another approach: use a different representation -- i.e. count with categories Objects: all strings made up of 0 1, 0 2, 1 1, 1 2, 1 3, 1 4 Categories: strings that agree except subscripts Size of each category: Subscripts so objects are distinct # categories = (# objects) /(size of each category)

Fixed-density Binary Strings How many length nbinary strings contain k ones? Rosen p. 413 For example, n=6, k=4 Another approach: use a different representation -- i.e. count with categories Objects: all strings made up of 0 1, 0 2, 1 1, 1 2, 1 3, 1 4 6! Categories: strings that agree except subscripts Size of each category:? # categories = (# objects) / (size of each category)

Fixed-density Binary Strings How many subscripted strings i.e. rearrangements of the symbols 0 1, 0 2, 1 1, 1 2, 1 3, 1 4 result in 101101 when the subscripts are removed? A. 6! B. 4! C. 2! D. 4!2! E. None of the above.

Fixed-density Binary Strings How many length nbinary strings contain k ones? Rosen p. 413 For example, n=6, k=4 Another approach: use a different representation -- i.e. count with categories Objects: all strings made up of 0 1, 0 2, 1 1, 1 2, 1 3, 1 4 6! Categories: strings that agree except subscripts Size of each category: 4!2! # categories = (# objects) / (size of each category) = 6! / (4!2!)

Fixed-density Binary Strings How many length nbinary strings contain k ones? Rosen p. 413 Another approach: use a different representation i.e. count with categories Objects: all strings made up of 0 1, 0 2,, 0 n-k, 1 1, 1 2,, 1 k n! Categories: strings that agree except subscripts Size of each category: k!(n-k)! # categories= (# objects) / (size of each category) =n!/ ( k! (n-k)! )

Terminology A permutation of r elements from a set of n distinctobjects is an ordered arrangement of them. There are P(n,r) = n(n-1) (n-2) (n-r+1) many of these. Rosen p. 407-413 A combinationof r elements from a set of n distinctobjects is an unordered selection of them. There are C(n,r) =n!/ ( r! (n-r)! ) many of these. Binomial coefficient "n choose r"

Fixed-density Binary Strings How many length nbinary strings contain k ones? Rosen p. 413 How to express this using the new terminology? A. C(n,k) B. C(n,n-k) C. P(n,k) D. P(n,n-k) E. None of the above

Fixed-density Binary Strings How many length nbinary strings contain k ones? Rosen p. 413 How to express this using the new terminology? A. C(n,k) {1,2,3..n} is set of positions in string, choose k positions for 1s B. C(n,n-k) {1,2,3..n} is set of positions in string, choose n-k positions for 0s C. P(n,k) D. P(n,n-k) E. None of the above

Ice cream! redux An ice cream parlor has n different flavors available. How many ice cream cones are there, if we count two cones as the same if they have the same two flavors (even if they're in opposite order)? Objects: cones n(n-1) Categories: flavor pairs (regardless of order) Size of each category: 2 # categories = (n)(n-1)/ 2 Order doesn't matter so selecting a subset of size 2 of the n possible flavors: C(n,2) = n!/ (2! (n-2)!) = n(n-1)/2

What's in a name? Binomial: sum of two terms, say x and y. What do powers of binomials look like? Rosen p. 415 (x+y) 4 = (x+y)(x+y)(x+y)(x+y) = (x 2 +2xy+y 2 )(x 2 +2xy+y 2 ) = x 4 +4x 3 y+6x 2 y 2 +4xy 3 +y 4 In general, for (x+y) n A. All terms in the expansion are (some coefficient times) x k y n-k for some k, 0<=k<=n. B. All coefficients in the expansion are integers between 1 and n. C. There is symmetry in the coefficients in the expansion. D. The coefficients of x n and y n are both 1. E. All of the above.

Binomial Theorem (x+y) n = (x+y)(x+y) (x+y) Rosen p. 416 = x n + x n-1 y + x n-2 y 2 + + x k y n-k + + x 2 y n-2 + xy n-1 + y n Number of ways we can choose k of the n factors (to contribute to x) and hence also n-k of the factors (to contribute to y)

Binomial Theorem (x+y) n = (x+y)(x+y) (x+y) Rosen p. 416 = x n + x n-1 y + x n-2 y 2 + + x k y n-k + + x 2 y n-2 + xy n-1 + y n Number of ways we can choose k of the n factors (to contribute to x) and hence also n-k of the factors (to contribute to y) C(n,k) = x n + C(n,1)x n-1 y + + C(n,k)x k y n-k + + C(n,k-1) xy n-1 + y n

Binomial Coefficient Identities What's an identity? An equation that is always true. To prove LHS = RHS Use algebraic manipulations of formulas. OR Interpret each side as counting some collection of strings, and then prove a statements about those sets of strings.

Symmetry Identity Theorem: Rosen p. 411

Symmetry Identity Theorem: Rosen p. 411 Proof 1: Use formula

Symmetry Identity Theorem: Rosen p. 411 Proof 1: Use formula Proof 2: Combinatorial interpretation? LHS counts number of binary strings of length n with k ones RHS counts number of binary strings of length n with n-k ones

Symmetry Identity Theorem: Rosen p. 411 Proof 1: Use formula Proof 2: Combinatorial interpretation? LHS counts number of binary strings of length n with k ones and n-k zeros RHS counts number of binary strings of length n with n-k ones and k zeros

Symmetry Identity Theorem: Rosen p. 411 Proof 1: Use formula Proof 2: Combinatorial interpretation? LHS counts number of binary strings of length n with k ones and n-k zeros RHS counts number of binary strings of length n with n-k ones and k zeros Can match up these two sets by pairing each string with another where 0s, 1s are flipped. This bijection means the two sets have the same size. So LHS = RHS.

Pascal's Identity Theorem: Rosen p. 418 Proof 1: Use formula Proof 2: Combinatorial interpretation? LHS counts number of binary strings??? RHS counts number of binary strings???

Pascal's Identity Theorem: Rosen p. 418 Proof 2: Combinatorial interpretation? LHS counts number of binary strings of length n+1 that have k ones. RHS counts number of binary strings??? Length n+1 binary strings with k ones

Pascal's Identity Theorem: Rosen p. 418 Proof 2: Combinatorial interpretation? LHS counts number of binary strings of length n+1 that have k ones. RHS counts number of binary strings??? Start with 1 Start with 0

Pascal's Identity How many length n+1 strings start with 1 and have k ones in total? Rosen p. 418 A. C(n+1, k+1) B. C(n, k) C. C(n, k+1) D. C(n, k-1) E. None of the above. Start with 1 Start with 0

Pascal's Identity How many length n+1 strings start with 0 and have k ones in total? Rosen p. 418 A. C(n+1, k+1) B. C(n, k) C. C(n, k+1) D. C(n, k-1) E. None of the above. Start with 1 Start with 0

Pascal's Identity Theorem: Rosen p. 418 Proof 2: Combinatorial interpretation? LHS counts number of binary strings of length n+1 that have k ones. RHS counts number of binary strings of length n+1 that have k ones, using two cases Start with 1 Start with 0

Sum Identity Theorem: Rosen p. 417 What set does the LHScount? A. Binary strings of length n that have k ones. B. Binary strings of length n that start with 1. C. Binary strings of length n that have any number of ones. D. None of the above.

Sum Identity Theorem: Rosen p. 417 Proof : Combinatorial interpretation? LHS counts number of binary strings of length n that have any number of 1s. By sum rule, we can break up the set of binary strings of length n into disjoint sets based on how many 1s they have, then add their sizes. RHS counts number of binary strings of length n. This is the same set so LHS= RHS.

Announcements HW6 is due tomorrow! MT2 PPs and Review Improve your process from MT1? MT2 Reviews FRIDAY in SOLIS 107, 5-7pm SATURDAY in CENTER 101, 3-5pm