Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "CompSci 102 Discrete Math for Computer Science March 27, 2012 Prof. Rodger Lecture adapted from Bruce Maggs/Lecture developed at Carnegie Mellon, primarily."— Presentation transcript:

1 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

2 Announcements More on Counting

3 X1 X1 X2 X2 + + X3 X3 Counting III

4 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

5 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

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

7 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 =

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

9 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

10 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 =

11 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

12 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!

13 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,    

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

15 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)

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

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

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

19 = Odds and Evens

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

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

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

23 Sums of Squares

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

25 Pascal Mod 2

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

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

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

29 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

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

31 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

32 Level nk th avenue

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

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

35 = =

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

37 = = 20

38 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:

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

40 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( ) =

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

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

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

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

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

46  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)

47 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;

48 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);

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

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


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

Similar presentations


Ads by Google