Binomial Coefficient Identities/Complements

Similar documents
Counting with Categories and Binomial Coefficients

Recursion: Introduction and Correctness

Counting Strategies: Inclusion-Exclusion, Categories

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

Recursion and Induction

Advanced Counting Techniques. Chapter 8

1 Sequences and Summation

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

Divide and Conquer. Recurrence Relations

Mathematical Structures Combinations and Permutations

Math 324 Summer 2012 Elementary Number Theory Notes on Mathematical Induction

1 Recursive Algorithms

Algorithm Analysis Recurrence Relation. Chung-Ang University, Jaesung Lee

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

Recursion and Induction

Recursion and Induction

Advanced Counting Techniques

Algorithms: Background

CSCE 222 Discrete Structures for Computing. Review for Exam 2. Dr. Hyunyoung Lee !!!

Section Summary. Sequences. Recurrence Relations. Summations. Examples: Geometric Progression, Arithmetic Progression. Example: Fibonacci Sequence

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

Homework #2 Solutions Due: September 5, for all n N n 3 = n2 (n + 1) 2 4

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

What you learned in Math 28. Rosa C. Orellana

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University

PUTNAM TRAINING NUMBER THEORY. Exercises 1. Show that the sum of two consecutive primes is never twice a prime.

Discrete Mathematics -- Chapter 10: Recurrence Relations

Mathematical Fundamentals

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.

Discrete Mathematics & Mathematical Reasoning Chapter 6: Counting

1 The Basic Counting Principles

1. Determine (with proof) the number of ordered triples (A 1, A 2, A 3 ) of sets which satisfy

Data Structure Lecture#4: Mathematical Preliminaries U Kang Seoul National University

5. Sequences & Recursion

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

cse547, math547 DISCRETE MATHEMATICS Professor Anita Wasilewska

CS 2110: INDUCTION DISCUSSION TOPICS

CSE 21 Practice Exam for Midterm 2 Fall 2017

Discrete Mathematics

MATH 324 Summer 2011 Elementary Number Theory. Notes on Mathematical Induction. Recall the following axiom for the set of integers.

12 Sequences and Recurrences

Some Review Problems for Exam 3: Solutions

Quiz 3 Reminder and Midterm Results

Examples of Finite Sequences (finite terms) Examples of Infinite Sequences (infinite terms)

What we have learned What is algorithm Why study algorithm The time and space efficiency of algorithm The analysis framework of time efficiency Asympt

Every subset of {1, 2,...,n 1} can be extended to a subset of {1, 2, 3,...,n} by either adding or not adding the element n.

CHAPTER 8 Advanced Counting Techniques

INDUCTION AND RECURSION. Lecture 7 - Ch. 4

Practical Session #3 - Recursions

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

Discrete Structures for Computer Science: Counting, Recursion, and Probability

CDM Combinatorial Principles

CSCE 222 Discrete Structures for Computing. Dr. Hyunyoung Lee

CMSC Discrete Mathematics SOLUTIONS TO FIRST MIDTERM EXAM October 18, 2005 posted Nov 2, 2005

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

CSE 20 DISCRETE MATH WINTER

Homework 7 Solutions, Math 55

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

2 - Strings and Binomial Coefficients

Chapter12. Relations, Functions, and Induction

Sums and Products. a i = a 1. i=1. a i = a i a n. n 1

Iowa State University. Instructor: Alex Roitershtein Summer Exam #1. Solutions. x u = 2 x v

Counting Strategies: Inclusion/Exclusion, Categories

Equivalence of Propositions

Mathematical Background

CS Analysis of Recursive Algorithms and Brute Force

Mathathon Round 1 (2 points each)

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

1 Examples of Weak Induction

1 Basic Combinatorics

CSC2100B Data Structures Analysis

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

2.1 Sets. Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R.

3.1 Induction: An informal introduction

Recurrence Relations and Recursion: MATH 180

Trees/Intro to counting

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

Induction and Recursion

Sec$on Summary. Sequences. Recurrence Relations. Summations. Ex: Geometric Progression, Arithmetic Progression. Ex: Fibonacci Sequence

CSC236H Lecture 2. Ilir Dema. September 19, 2018

CSC B36 Additional Notes sample induction and well-ordering proofs. c Nick Cheng

Discrete Mathematics. Kishore Kothapalli

MAT115A-21 COMPLETE LECTURE NOTES

CS 5321: Advanced Algorithms - Recurrence. Acknowledgement. Outline. Ali Ebnenasir Department of Computer Science Michigan Technological University

MODEL ANSWERS TO THE THIRD HOMEWORK. 1. We prove this result by mathematical induction. Let P (n) be the statement that

SERIES

Contents. Counting Methods and Induction

Recurrence Relations

Basic counting techniques. Periklis A. Papakonstantinou Rutgers Business School

Module 9: Mathematical Induction

CHAPTER 4 SOME METHODS OF PROOF

Analysis of Algorithm Efficiency. Dr. Yingwu Zhu

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

Principles of Counting. Debdeep Mukhopadhyay IIT Madras

CS 5321: Advanced Algorithms Analysis Using Recurrence. Acknowledgement. Outline

CSCE 222 Discrete Structures for Computing. Review for the Final. Hyunyoung Lee

Mathematical Induction. How does discrete math help us. How does discrete math help (CS160)? How does discrete math help (CS161)?

Combinatorics. Problem: How to count without counting.

Fibonacci numbers. Chapter The Fibonacci sequence. The Fibonacci numbers F n are defined recursively by

6 CARDINALITY OF SETS

Transcription:

Binomial Coefficient Identities/Complements CSE21 Fall 2017, Day 4 Oct 6, 2017 https://sites.google.com/a/eng.ucsd.edu/cse21-fall-2017-miles-jones/

permutation P(n,r) = n(n-1) (n-2) (n-r+1) = Terminology n! (n r)! Counts the number of sequences of r elements from a set of n (without repeats) Counts the number of strings (words) of length r from an alphabet of n letters (without repeats.) combination C(n,r) = n!/ ( r! (n-r)! ) = n n choose r r Counts the number of r-element subsets of a set of size n Counts the number of length n binary strings with exactly r ones. Rosen p. 407-413

Subsets Binary strings We claim that n counts the number of k k-element subsets of a set of cardinality n e.g. 1,2,, n. Length n binary strings with exactly k ones. Can you think of a bijection (one-to-one correspondence) between these two sets of objects? Exercise: 4 2 = 6 Write down all 6 4-element subsets of {1,2,3,4}. Write down all 6 length 4 binary strings with exactly 2 ones.

We claim that n counts the number of k k-element subsets of a set of cardinality n e.g. 1,2,, n. Length n binary strings with exactly k ones. Example: 4 2 = 6 { {1,2},{1,3},{1,4},{2,3},{2,4},{3,4} } { 1100,1010,1001,0110,0101,0011 } Is there a natural way to pair these up? Subsets Binary strings

Fixed-density Binary Strings How many length n binary strings contain k ones? Rosen p. 413 Another way to think about it Out of all the positions {1,2,,n}, how many ways can you choose k of those positions to be ones and n-k of those positions to be zeros?

Examples: Suppose I am picking 7 people from this class to go on a field trip. How many ways can I do this? Suppose I am picking 7 people from this class and each one will go on a field trip on a different day of the week. How many days can I do this? Suppose you are doing a group project with a team of 20 people. You must pick a team leader, a scribe, a treasurer, and a presenter. How many ways can you do this? Suppose you are doing a group project with a team of 20 people and you want to pick 4 of the 20 to go to a conference. How many ways can you do this?

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

Pascal's Triangle Pascal s triangle is closely related to binomial coefficients C n, k = n k

Pascal's Triangle

What's in a name? Why are they called Binomial Coefficients? Binomial: sum of two terms, say x and y. What do powers of binomials look like? (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 Theorem Rosen p. 416 x + y 0 = 1 x + y 1 = 1x + 1y x + y 2 = 1x 2 + 2xy + 1y 2 x + y 3 = 1x 3 + 3x 2 y + 3xy 2 + 1y 3 x + y 4 = 1x 4 + 4x 3 y + 6x 2 y 2 + 4xy 3 + 1y 4 x + y 5 = 1x 5 + 5x 4 y + 10x 3 y 2 + 10x 2 y 3 + 5xy 4 + 1y 5 x + y 6 = 1x 6 + 6x 5 y + 15x 4 y 2 + 20x 3 y 3 + 15x 2 y 4 + 6xy 5 + 1y 6

Sum Identity Theorem: Rosen p. 417

Sum Identity Theorem: Rosen p. 417 What set does the LHS count? 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.

Another Counting Problem How many 4 digit strings of digits 0-9 have at least one 0? A. 4 9 3 B. 10 4 9 4 C. 4 9 3 + 6 9 2 + 4 9 + 1 D. 9 3 E. 4 10 3

Another Counting Problem How many 4 digit strings of digits 0-9 have at least one 0? All 4 digit strings of 0-9 All 4 digit strings of 1-9

Counting using the complement Whenever you see at least in the problem description, that is a clue. Count the entire set first. Then count the complement of the set you are interested in. Subtract the two counts.

Counting using the complement Exercise: How many length 4 strings of the digits 0-9 have at least two consecutive digits that are the same?

What is recursion? Solving a problem by successively reducing it to the same problem with smaller inputs. Rosen p. 360

Recurrences A recurrence relation (also called a recurrence or recursive formula) expresses f(n) in terms of previous values, such as f(n-1), f(n-2), f(n-3). Example: f(n) = 3*f(n-1) + 7 f(1) = 2 start tells us how to find f(n) from f(n-1) also need a base case to tell us where to

Some well known recurrences Fibonacci numbers: F 0 = 0, F 1 = 1, for n 2: F n = F n 1 + F n 2 Factorials: 0! = 1, for n 1: n! = n n 1! Summation of integers. S(1) = 1, for n 2: S n = S n 1 + n Rosen P. 158

Closed form Summation of integers. Rosen P. 158 S(1) = 1, for n 2: S n = S n 1 + n What is the closed form of this recursion? A. n B. 2 n C. n(n + 1) D. E. n n+1 n 2 2 2

Two ways to solve recurrences 1. Guess and Check find a closed form Start with small values of n and look for a pattern. Confirm your guess with a proof by induction. 2. Unravel Start with the general recurrence and keep replacing n with smaller input values. Keep unraveling until you reach the base case.

Closed form Summation of integers. Rosen P. 158 S(1) = 1, for n 2: S n = S n 1 + n Guess and check: (induction) Claim: S(n) = n n+1 2 for all n 1.

Closed form Summation of integers. Rosen P. 158 S(1) = 1, for n 2: S n = S n 1 + n Guess and check: (induction) Claim: S(n) = n n+1 2 for all n 1. Base Case: S 1 = 1 = 1 1+1 2 Inductive Hypothesis: Suppose that for some k 1, S k = Inductive Step: We want to show that S k + 1 = (k+1)(k+2) 2 k k+1 2

Closed form Summation of integers. Rosen P. 158 S(1) = 1, for n 2: S n = S n 1 + n S k + 1 = S k + k + 1 k k + 1 = + k + 1 2 k k+1 +2(k+1) = 2 k + 2 k + 1 = 2

Unraveling Solve this recurrence by unraveling: a 1 = 2 a n = 2a n 1 + 2 n for n 2

Unraveling Solve this recurrence by unraveling: a 1 = 2 a n = 2a n 1 + 2 n for n 2 a n = 2a n 1 + 2 n = 2 2a n 2 + 2 n 1 + 2 n = 2 2 a n 2 + 2 n + 2 n = 2 2 2a n 3 + 2 n 2 + 2 n + 2 n = 2 3 a n 3 + 2 n + 2 n + 2 n. = 2 k a n k + k 2 n. (k = n 1) = 2 n 1 a 1 + (n 1)2 n = n2 n

The Tower of Hanoi How many moves?

The Tower of Hanoi Recursive solution: 1) Move the stack of the smallest n-1 disks to an empty pole. 2) Move the largest disk to the remaining empty pole. 3) Move the stack of the smallest n-1 disks to the pole with the largest disk. How many moves? T(n) = # of moves to solve puzzle with n disks

Tower of Hanoi: WHEN Recursive solution: 1) Move the stack of the smallest n-1 disks to an empty pole. 2) Move the largest disk to the remaining empty pole. 3) Move the stack of the smallest n-1 disks to the pole with the largest disk. T(n) = # of moves to solve puzzle with n disks Recurrence? A. T(n) = 2T(n-1) B. T(n) = T(n-1) + 1 C. T(n) = n-1 + T(n) D. T(n) = 2T(n-1) + 1 Base case? A. T(1) = 1 B. T(1) = 2 C. T(0) = 0 D. T(2) = 2

Tower of Hanoi: WHEN But what's the value of T(n)? n T(n) 1 1 2 3 4 5 n Recurrence for T(n): T(n) = 2T(n-1) + 1 T(1) = 1

Tower of Hanoi: WHEN But what's the value of T(n)? n T(n) 1 1 2 3 3 7 4 15 5 31 n?? Is there a pattern we can guess? Recurrence for T(n): T(n) = 2T(n-1) + 1 T(1) = 1

After guessing, we check (i.e., validate) Tower of Hanoi: WHEN Claim: For each positive int n, T(n) = 2 n -1. Proof by induction on n Recurrence for T(n): T(n) = 2T(n-1) + 1 T(1) = 1 (Base case) If n = 1, then T(n) = 1 (according to the recurrence). Plugging n = 1 into the formula gives T(1) = 2 1-1 = 2-1 = 1.

Tower of Hanoi: WHEN Claim: For each positive int n, T(n) = 2 n -1. Proof by induction on n Recurrence for T(n): T(n) = 2T(n-1) + 1 T(1) = 1 (Induction step) Suppose n is a positive integer greater than 1 and, as the induction hypothesis, assume that T(n-1) = 2 n-1-1. We need to show that T(n) = 2 n -1. From the recurrence, T(n) = 2 T(n-1) + 1 = 2 ( 2 n-1 1 ) + 1 = 2 n 2 + 1 = 2 n 1. by the I.H.

Tower of Hanoi: WHEN Another method: UNRAVEL the recurrence: Recurrence for T(n): T(n) = 2T(n-1) + 1 T(1) = 1