1 CS 140 Discrete Mathematics Combinatorics And Review Notes.

Similar presentations


Presentation on theme: "1 CS 140 Discrete Mathematics Combinatorics And Review Notes."— Presentation transcript:

1 1 CS 140 Discrete Mathematics Combinatorics And Review Notes

2 2 Combinatorics  Permutations and r -permutations  Properties of “n choose r”  Pascal’s theorem  The binomial theorem  Review  Inclusion/exclusion principle

3 3 Permutations Permutation of a set of objects: an ordering of the objects in a row. Example: How many permutations are there of the letters i n the word “now”? Positions: ____ ____ ____ 1 2 3 Step 1: Choose a letter to put in position 1. Step 2: Choose a letter to put in position 2. Step 3: Choose a letter to put in position 3. So the total number of ways to construct a permutation (which equals the total number of permutations) is 3∙2∙1 = 6. Theorem: The number of permutations of a set of n elements is n !.  3 ways  2 ways  1 way n, o, w

4 4 Definition: An r -permutation of a set of n elements is an “ordered selection” of r elements taken from the set of n elements. Example: How many 3-permutations are there of the letters in the word “DEPAUL”? Solution: ____ ____ ____ 1 2 3 Step 1: Choose a letter to put in position 1. Step 2: Choose a letter to put in position 2. Step 3: Choose a letter to put in position 3. So the total number of 3-permutations that can be formed from the 6 letters is 6∙5∙4 = 120. r-Permutations D, E, P, A, U, L  6 ways  5 ways  4 ways

5 5 r -Permutations Example: How many r-permutations are there of the symbols x 1,x 2,x 3,...,x n ? Solution: ___ ___ ___ ___ ___ 1 2 3 r – 1 r Step 1: Choose a letter to put in position 1. Step 2: Choose a letter to put in position 2.    Step r: Choose a letter to put in position r. So the total number of r-permutations that can be formed from x 1,x 2,x 3,...,x n is n∙(n – 1)∙ ∙ ∙ (n – r + 1). x 1, x 2, x 3,..., x n  n ways  n - 1 ways  n – (r - 1) ways NOTE: n – (r – 1) = n – r + 1

6 6 P (n,r) P (n,r) Notation: P(n,r) = the number of r -permutations of a set of n elements Theorem: If n and r are integers and n ≥ r ≥ 0, then P (n,r ) = n (n – 1)(n – 2) ∙ ∙ ∙ (n – r + 1) or, equivalently,

7 7 More Review What is ? Definition:, “n choose r,” is the number of subsets of size r that can be formed from a set with n elements. Theorem:

8 8 a. How many distinguishable ways can the letters of the word MISSISSIPPI be arranged? __ __ __ __ __ __ __ __ __ __ __ 1 2 3 4 5 6 7 8 9 10 11 Step 1: Choose 1 position for the M (Ex: {9}) Step 2: Choose 4 positions for the I’s (Ex: {3, 4, 7, 11}) Step 3: Choose 4 positions for the S’s (Ex: {1, 2, 6, 10}) Step 4: Choose 2 positions for the P’s (Ex: {5, 8}) So the answer is M, I, I, I, I, S, S, S, S, P, P  ways

9 9 b. How many distinguishable ways can the letters of the word MISSISSIPPI be arranged if PPI stays together and the string begins with M? M __ __ __ __ __ __ __ __ 1 2 3 4 5 6 7 8 Step 1: Choose 1 (“long”) position for PPI (Ex: {3}) Step 2: Choose 3 positions for the I’s (Ex: {1, 5, 7}) Step 3: Choose 4 positions for the S’s (Ex: {2, 4, 6, 8}) So the answer is M, PPI, I, I, I, S, S, S, S  ways

10 10 Properties of Examples: Use the definition of n choose r to find a. = the number of subsets of size 1 that can be formed from a set with n elements = n b. = the number of subsets of size n that can be formed from a set with n elements = 1 c. = the number of subsets of size 0 that can be formed from a set with n elements = 1

11 11 Properties of Example: What is Solution:

12 12 Theorem about Theorem: Let n and r be nonnegative integers and suppose r ≤ n. Then Idea of Proof: Consider a set with 4 elements: {a,b,c,d}. The 2-permutations of the set are ab, ba, ac, ca, ad, da, bc, cb, bd, db, cd, dc and there are P (4,2) of them, where P (4,2) =.

13 13 Proof Idea, cont.: Know P (4,2) = But: We can also calculate the number of 2-permutations of the set of 4 elements as follows: Step 1: Choose a subset of 2 elements from the set Step 2: Order the two elements. Thus we also have P (4,2) = Equating the two values of P (4,2) gives and dividing both sides by 2! gives.  ways  2! ways

14 14 Pascal’s Formula Let n and r be positive integers and suppose r ≤ n. Then Proof: Next class Example: Pascal’s Triangle 1 The entry i n row n column r is 1 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 1 6 15 20 15 6 1 etc. For example, and so row 0  row 3 

15 15 The Binomial Theorem Given any real numbers a and b and any nonnegative integer n,, i.e.,

16 16 Example: Prove that for all integers n ≥ 0, Proof: Let n be any integer  0, and apply the binomial theorem with a = 1 and b = 1. Then (1 + 1) n = But 1 + 1 = 2, and 1 to any power equals 1. So this equation becomes

17 17 Example: Find (u – 2v) 4. Solution: Apply the binomial theorem with n = 4, a = u and b = –2v. Substitute u for a and (–2v) for b (use parentheses!): Note: u – 2v = u + (– 2v)

18 18 Cartesian Product of Sets Definition: Given any sets A and B, we define the Cartesian product of A and B, denoted A  B, to be the set of all ordered pairs (a,b) where a is in A and b is in B. In symbols: A  B = { (a,b) | a  A and b  B } Example: Let A = {1, 3, 5} and let B = {u, v}. Find A  B. Solution: A  B = {,,,,, } (1,u)(1,v)(3,u)(3,v)(5,v)(5,u)

19 19 Binary Relations Def: Given any sets What do we mean by a “relation” between two sets? Ex: Let W be the set of all women and P be the set of all people. For any w in W and p in P, we could say “w is related to p” if, and only if, w is the mother of p. Note: An element of W  P is an ordered pair (w,p) where w is a woman and p is a person. The elements of some ordered pairs are related; others are not. Def: We define the relation M (for “is the mother of”) as follows: M is the set of all (w,p) in W  P such that w is the mother of p. (So M is a subset of W  P.)

20 20 Definition of Binary Relation Ex: Let A = {1, 3, 5, 7} and B = {2, 4, 6, 8}. Define a binary relation R from A to B as follows: a R b  a > b. a. Is 3 R 4? Is 5 R 4? Is (7, 2)  R ? b. Write R as a set of ordered pairs. R = {(3, 2), (5, 2), (5, 4), (7, 2), (7, 4), (7, 6)} Definition: A binary relation R from a set A to a set B is a subset of A  B. Given an ordered pair (a, b) in A  B, we say that a is related to b, written a R b, if, and only if, (a, b)  R. In symbols: NoYes a R b  (a, b)  R

21 21 Example of a Binary Relation, cont. c. Draw an “arrow diagram” to represent R, where R = {(3, 2), (5, 2), (5, 4), (7, 2), (7, 4), (7, 6)}. Note: An arrow diagram can be used to define a relation. AB 13571357 24682468

22 22 Definition of Function Definition: A function f from a set A to a set B is a binary relation from A to B that satisfies the following two properties: 1. Every element of A is related by f to some element of B. 2. No element of A is related by f to more than one element of B.

23 23 Definition of Function Example: Which of the relations defined by the following arrow diagrams are functions? 123123 uvwuvw 123123 uvwuvw 123123 uvwuvw 123123 uvwuvw yes no

24 24 The Inclusion/Exclusion Rul e Recall: The union of sets S and T, S  T, is the set consisting of all the elements of S together with all the elements of T: S  T = {x | x  S or x  T }. The intersection of sets S and T, S  T, is the set consisting of all the elements that are common to both S and T: S  T = {x | x  S and x  T }. Example: Let A be the set of numbers from 1 to 15 that are divisible by 2 and B be the set of numbers from 1 to 15 that are divisible by 3. What are N (A)? N (B)? N (A  B)? N (A  B)? How are these related? 75210 10 = 7+ 5 – 2

25 25 Theorem: If A, B, and C are any finite sets, then N (A  B) = N (A) + N (B) – N (A  B) and N (A  B  C) = N (A) + N (B) + N (C) – N (A  B) – N (A  C) – N (B  C) + N (A  B  C) Inclusion/Exclusion Rul e A C BA A  B B A  C A  B B  C A  B  C A  B A  B  C


Download ppt "1 CS 140 Discrete Mathematics Combinatorics And Review Notes."

Similar presentations


Ads by Google