CompSci 102 Discrete Math for Computer Science March 27, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.

Slides:



Advertisements
Similar presentations
Copyright © Cengage Learning. All rights reserved.
Advertisements

Multiplying Polynomials
Formal Models of Computation Part II The Logic Model
CompSci 102 Discrete Math for Computer Science March 29, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
ALGEBRA TILES.
Discrete Math Recurrence Relations 1.
Lecture 07 – Iterating through a list of numbers.
Basic Permutations and Combinations
Generalized Permutations & Combinations: Selected Exercises.
Counting. Counting = Determining the number of elements of a finite set.
 A pencil and a Highlighter   A calculator  Your thinking caps!
1, 3, 5, 7, 9, … + 2 TermNumbersPattern of Numbers The n-order for the pattern of odd numbers is 2n – 1, for n is natural numbers n ?
§ 11.4 The Binomial Theorem.
X-box Factoring. X- Box 3-9 Product Sum Factor the x-box way Example: Factor 3x 2 -13x (3)(-10)= x 2x 3x 2 x-5 3x +2.
Counting Chapter 6 With Question/Answer Animations.
CompSci 102 Discrete Math for Computer Science April 19, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2003 Lecture.
CSE115/ENGR160 Discrete Mathematics 04/17/12
Binomial Identities.
Lecture 5 Counting 4.3, Permutations r-permutation: An ordered arrangement of r elements of a set of n distinct elements. Example: S={1,2,3}:
CSE 321 Discrete Structures Winter 2008 Lecture 16 Counting.
Counting II: Pascal, Binomials, and Other Tricks Great Theoretical Ideas In Computer Science A. Gupta D. Sleator CS Fall 2010 Lecture 8Sept. 16,
CompSci 102 Discrete Math for Computer Science March 22, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Fibonacci Numbers, Polynomial Coefficients, and Vector Programs.
1 © 2010 Pearson Education, Inc. All rights reserved 10.1 DEFINITION OF A SEQUENCE An infinite sequence is a function whose domain is the set of positive.
Rev.S08 MAC 1140 Module 12 Introduction to Sequences, Counting, The Binomial Theorem, and Mathematical Induction.
Lecture 11 Feb 17, 1998 Doug Beeferman Carnegie Mellon University Count your blessings... … faster !
CompSci 102 Spring 2012 Prof. Rodger January 11, 2012.
Discrete Mathematics, 1st Edition Kevin Ferland
Chapter 8. Section 8. 1 Section Summary Introduction Modeling with Recurrence Relations Fibonacci Numbers The Tower of Hanoi Counting Problems Algorithms.
Basic Counting. This Lecture We will study some basic rules for counting. Sum rule, product rule, generalized product rule Permutations, combinations.
1 Proof of the Day: Let P= {(b, acbb), (aac, a), (b, ca)}. 1.Prove that P has a match. 2. Find Q which is P encoded in binary. 3.What match of Q corresponds.
On the Symmetries of Pascal’s Pyramid
Section 2.4. Section Summary Sequences. Examples: Geometric Progression, Arithmetic Progression Recurrence Relations Example: Fibonacci Sequence Summations.
Binomial Coefficients, Inclusion-exclusion principle
Chapter 6 With Question/Answer Animations 1. Chapter Summary The Basics of Counting The Pigeonhole Principle Permutations and Combinations Binomial Coefficients.
Great Theoretical Ideas in Computer Science.
Great Theoretical Ideas in Computer Science.
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2003 Lecture.
Lecture 5 Counting 4.3, Permutations r-permutation: An ordered arrangement of r elements of a set of n distinct elements. Example: S={1,2,3}:
1 Binomial Coefficients CS 202 Epp, section ??? Aaron Bloomfield.
Copyright © Cengage Learning. All rights reserved. CHAPTER 9 COUNTING AND PROBABILITY.
Fibonacci Numbers, Vector Programs and a new kind of science.
COMPSCI 102 Discrete Mathematics for Computer Science.
CompSci 102 Discrete Math for Computer Science March 20, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily.
Choose Your Representation! Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2005 Lecture 14 Feb 24, 2005 Carnegie Mellon University.
CompSci 102 Discrete Math for Computer Science February 7, 2012 Prof. Rodger Slides modified from Rosen.
Spring 2016 COMP 2300 Discrete Structures for Computation
Binomial Coefficients: Selected Exercises
Section 6.4. Powers of Binomial Expressions Definition: A binomial expression is the sum of two terms, such as x + y. (More generally, these terms can.
Binomial Coefficients and Identities
Polynomials Count! CS Lecture 9 X1 X1 X2 X2 + + X3 X3.
Counting III: Pigeonhole principal, Pascal’s Triangle and more Great Theoretical Ideas In Computer Science S. Rudich V. Adamchik CS Spring 2006.
Binomial Coefficients: Selected Exercises
CSE15 Discrete Mathematics 04/19/17
Induction: One Step At A Time
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs
Generating Functions II
Great Theoretical Ideas in Computer Science
Basic Counting.
CSE 321 Discrete Structures
Great Theoretical Ideas in Computer Science
Basic Counting Lecture 9: Nov 5, 6.
11.6 Binomial Theorem & Binomial Expansion
Counting III: Pascal’s Triangle, Polynomials, and Vector Programs
Great Theoretical Ideas in Computer Science
Discrete Mathematics for Computer Science
Introduction to Discrete Mathematics
Presentation transcript:

CompSci 102 Discrete Math for Computer Science March 27, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily by Prof. Steven Rudich

Announcements More on Counting

X1 X1 X2 X2 + + X3 X3 Counting III

Power Series Representation (1+X) n = n k XkXk  k = 0 n n k XkXk   = “Product form” or “Generating form” “Power Series” or “Taylor Series” Expansion For k>n, n k = 0

By playing these two representations against each other we obtain a new representation of a previous insight: (1+X) n = n k XkXk  k = 0 n Let x = 1, n k  k = 0 n 2 n = The number of subsets of an n-element set

Example = 16 Number of subsets of size 0, size 1, size 2, size 3, and size 4

By varying x, we can discover new identities: (1+X) n = n k XkXk  k = 0 n Let x = -1, n k  k = 0 n 0 = (-1) k Equivalently, n k  k even n n k  k odd n =

The number of subsets with even size is the same as the number of subsets with odd size

Proofs that work by manipulating algebraic forms are called “algebraic” arguments. Proofs that build a bijection are called “combinatorial” arguments (1+X) n = n k XkXk  k = 0 n

Let O n be the set of binary strings of length n with an odd number of ones. Let E n be the set of binary strings of length n with an even number of ones. We gave an algebraic proof that  O n  =  E n  n k  k even n n k  k odd n =

A Combinatorial Proof Let O n be the set of binary strings of length n with an odd number of ones Let E n be the set of binary strings of length n with an even number of ones A combinatorial proof must construct a bijection between O n and E n

An Attempt at a Bijection Let f n be the function that takes an n-bit string and flips all its bits f n is clearly a one-to- one and onto function...but do even n work? In f 6 we have for odd n. E.g. in f 7 we have:     Uh oh. Complementing maps evens to evens!

A Correspondence That Works for all n Let f n be the function that takes an n-bit string and flips only the first bit. For example,    

The binomial coefficients have so many representations that many fundamental mathematical identities emerge… (1+X) n = n k XkXk  k = 0 n

The Binomial Formula (1+X) 0 = (1+X) 1 = (1+X) 2 = (1+X) 3 = (1+X) 4 = X 1 + 2X + 1X X + 3X 2 + 1X X + 6X 2 + 4X 3 + 1X 4 Pascal’s Triangle: k th row are coefficients of (1+X) k Inductive definition of k th entry of n th row: Pascal(n,0) = Pascal (n,n) = 1; Pascal(n,k) = Pascal(n-1,k-1) + Pascal(n-1,k)

“Pascal’s Triangle” 0 0 = = = 1 Al-Karaji, Baghdad Chu Shin-Chieh 1303 Blaise Pascal = = = 1

Pascal’s Triangle “It is extraordinary how fertile in properties the triangle is. Everyone can try his hand”

Summing the Rows n k  k = 0 n 2 n = = 1 = 2 = 4 = 8 = 16 = 32 = 64

= Odds and Evens

Summing on 1 st Avenue  i = 1 n i 1 =  n i n+1 2 =

Summing on k th Avenue  i = k n i k n+1 k+1 =

Fibonacci Numbers = 2 = 3 = 5 = 8 = 13

Sums of Squares

Al-Karaji Squares +2  = 1 = 4 = 9 = 16 = 25 = 36

Pascal Mod 2

All these properties can be proved inductively and algebraically. We will give combinatorial proofs using the Manhattan block walking representation of binomial coefficients

How many shortest routes from A to B? B A 10 5

Manhattan j th streetk th avenue There areshortest routes from (0,0) to (j,k) j+k k

Manhattan Example j th streetk th avenue j+k k 2cd street, 3 rd ave 5 3 = 6 points on that row, this is the 4 th binomial coefficient of 6 items

Manhattan Level nk th avenue There areshortest routes from (0,0) to (n-k,k) n k

Manhattan Level nk th avenue There are shortest routes from (0,0) to n k level n and k th avenue 4 3 Example: Level 4, 3 rd avenue

Level nk th avenue

Level nk th avenue n k n-1 k-1 n-1 k = + +

Level nk th avenue n n n k  k = 0 n 2 = Example: Show for n=3

= =

Level nk th avenue n+1 k+1 i k  i = k n = Show for k=2, n=5

= = 20

Vector Programs Let’s define a (parallel) programming language called VECTOR that operates on possibly infinite vectors of numbers. Each variable V ! can be thought of as:

Vector Programs Let k stand for a scalar constant will stand for the vector = V ! + T ! means to add the vectors position-wise + =

Vector Programs RIGHT(V ! ) means to shift every number in V ! one position to the right and to place a 0 in position 0 RIGHT( ) =

Vector Programs Example: V ! := ; V ! := RIGHT(V ! ) + ; V ! = Store: V ! =

Vector Programs Example: V ! := ; Loop n times V ! := V ! + RIGHT(V ! ); V ! = n th row of Pascal’s triangle Store: V ! =

X1 X1 X2 X2 + + X3 X3 Vector programs can be implemented by polynomials!

Programs  Polynomials The vector V ! = will be represented by the polynomial:  i = 0  aiXiaiXi P V =

Formal Power Series The vector V ! = will be represented by the formal power series:  i = 0  aiXiaiXi P V =

 i = 0  aiXiaiXi P V = V ! = is represented by 0 k V ! + T ! is represented by(P V + P T ) RIGHT(V ! ) is represented by(P V X)

Vector Programs Example: V ! := ; Loop n times V ! := V ! + RIGHT(V ! ); V ! = n th row of Pascal’s triangle P V := 1; P V := P V + P V X;

Vector Programs Example: V ! := ; Loop n times V ! := V ! + RIGHT(V ! ); V ! = n th row of Pascal’s triangle P V := 1; P V := P V (1+X);

Vector Programs Example: V ! := ; Loop n times V ! := V ! + RIGHT(V ! ); V ! = n th row of Pascal’s triangle P V = (1+ X) n

Polynomials count Binomial formula Combinatorial proofs of binomial identities Vector programs Here’s What You Need to Know…