Subsets Sets 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 x A x B A B means A is a proper subset of B A B but A B, so x B x / A Illustrate with a Venn diagram. C-N Math 207 - Massey, 71 / 125
Subsets Sets 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 207 - Massey, 72 / 125
Sets Union / Intersection / Complement union A B = {x x A or x B} intersection A B = {x x A and x B} Let U be the universe that contains all objects under consideration. complement A = A c = {x U x / A} A and B are disjoint if A B = relative complement A\B = A B = {x A x / B} = A B C-N Math 207 - Massey, 73 / 125
Set Example Sets U = {x N x 10} A = {x U x is odd } B = {x U x is prime } Illustrate with a Venn diagram. C-N Math 207 - Massey, 74 / 125
Algebra of Sets Sets A U = U and A U = A what about? A A = U ; A A = A = A A (B C ) = (A B) C Demonstrate that A (B C ) (A B) C with a VD, and construct a specific counter-example. distributive laws, DeMorgan s laws, etc. C-N Math 207 - Massey, 75 / 125
United Kingdom Sets C-N Math 207 - Massey, 76 / 125
Nerds Sets C-N Math 207 - Massey, 77 / 125
Symmetric Difference Sets symmetric difference A B = (A B) (A B) (A or B) but not (A and B) equilalently A B = (A B) (B A) Show that is commutative and associative. Sketch the Venn diagram of A B C see [wiki] C-N Math 207 - Massey, 78 / 125
Cardinality Sets S is the cardinality or size of the S Inclusion-Exclusion Principle: if A and B are finite, then A B = A + B A B. Generalize to obtain a formula for A B C. C-N Math 207 - Massey, 79 / 125
Power Set Sets A meta-set is often referred to as a collection of sets. power set of A: the set of all subsets of A P(A) = {B B A} remember that sets are unordered P(A) = 2 A C-N Math 207 - Massey, 80 / 125
Partitions Sets Let S be a nonempty set. The collection of nonempty subsets {A i } is a partition of S if each x S belongs to exactly one of the A i. The A i are called cells or blocs. S = A i A i A j = if i j evens / odds conferences C-N Math 207 - Massey, 81 / 125
Cartesian Product Sets Cartesian product is the set of ordered pairs: A B = {(a, b) a A, b B} one coordinate from each set generalize to n-tuples, e.g. A B C A 2 = A A find the formula for A B C-N Math 207 - Massey, 82 / 125
Ordered vs Unordered Counting Let A = {1, 2, 3, 4, 5} Cartesian product: ordered ( ) A 2 = {(a, b) a, b A} sets: unordered { } S 2 = {B A B = 2} a permutation is an ordered list, e.g. L 2 = {(a, b) a, b A, and a b} count the members of A 2, S 2, L 2 P(A) = 5 k=0 S k = 2 5 C-N Math 207 - Massey, 83 / 125
Counting Subsets Counting permuatations: 5P2 is the number of ways you can rank 2 out of 5 items combinations: 5C 2 is the number of ways you can choose 2 out of 5 items fundamental counting rule - multiply the number of choices you have at each step Select 2 out of 5 in 5P2 = (5)(4) = 20 ways. But since {1, 2} = {2, 1}, you ve double-counted each set, so 5C 2 = 10 ways. C-N Math 207 - Massey, 84 / 125
Counting Subsets Counting 8P3 = (8)(7)(6) = 8! 5! Each of these lists: (a, b, c), (a, c, b), (b, a, c), (b, c, a), (c, a, b), (c, b, a) corresponds to just one set {a, b, c}. there are 3! = 6 permutations of 3 items 8C 3 = 8P3 3! C-N Math 207 - Massey, 85 / 125
Counting Subsets Counting Generalize to lists and subsets with k out of n npk = n! (n k)! each list corresponds to k! ways of writing the same ( subset ) n nck = = k npk k! = n! k!(n k)! ( ) ( ) n n Explain the identity = k n k C-N Math 207 - Massey, 86 / 125
Counting Examples Counting 1. How many permutations of all people in this classroom? 2. How many top 5 rankings in FBS football? 3. How many 7 member Senate committees? C-N Math 207 - Massey, 87 / 125
Counting Partitions Counting Are they distinguishable? 1. How many ways can you partition a set of 12 objects into blocks of 3, 4, and 5? 2. How many ways could the new Pac-12 football conference split into North, Central, and South divisions of 4 teams each? 3. How many ways could the new Pac-12 split into three unnamed divisions? C-N Math 207 - Massey, 88 / 125
Binomial Theorem Counting Consider the binomial expansion of (x +y) 5 = (x +y)(x +y)(x +y)(x +y)(x +y). Each term will select either x or ( y, so( the 5 5 number of ways to get x 3 y 2 is =. 3) 2) binomial theorem: n ( ) (x + y) n n = x k k y n k k=0 C-N Math 207 - Massey, 89 / 125
Binomial Theorem Counting 1. ( n k ) is often called the binomial coefficient 2. Expand ( 3 x + 5x ) 3. 2 3. Coefficient of the x 5 term in (2x 7) 8 4. Prove that ( n n k=0 = 2 k n by computing (1 + 1) n with the binomial theorem. ) C-N Math 207 - Massey, 90 / 125
Pascal s Triangle Counting Prove Pascal s triangle theorem: ( ) ( ) ( ) n n 1 n 1 = + k k 1 k C-N Math 207 - Massey, 91 / 125
Pizza Toppings Counting How many 3 topping pizzas if: 1. no repeats, CPB BCP 2. no repeats, CPB = BCP 3. repeats, CCP CPC 4. repeats, CCP = CPC Find general formulas for counting k topping pizzas from n available toppings. pineapple Bacon Cheese Ham Mushroom Onion Pepperoni C-N Math 207 - Massey, 92 / 125
Relation Relations R A B is called a relation from A to B. if B = A, then R is a relation on A if (a, b) R, we may write arb domain: Dom(R) = {a A b B, (a, b) R} range: Ran(R) = {b B a A, (a, b) R} C-N Math 207 - Massey, 93 / 125
Visualizing Relations Relations Consider the relation on A = {1, 2, 3}. Represent as: Cartesian graph matrix (grid, pixels) directed graph C-N Math 207 - Massey, 94 / 125
Relation Examples Relations 1. A = B = Z; arb iff b a 2 2. A = B = R; arb iff a 2 + b 2 = 1 3. A = B = N; arb iff gcd(a, b) = 1 4. A = Z 3, B = Z 5 R = {(0, 4), (2, 1), (1, 2), (0, 1), (0, 2), (2, 2)} 5. A = B = R; a < b 6. A = R, B = Z; a < b 7. A = B = people; arb iff a is ancestor of b C-N Math 207 - Massey, 95 / 125
Counting Relations Relations List all relations on Z 2 Given A and B, how many relations exist from A to B? C-N Math 207 - Massey, 96 / 125
Reflexive Relations The relation R on A is reflexive if (a, a) R for all a A irreflexive if (a, a) / R for all a A. The graph of a reflexive relation contains the diagonal. a b, a loves b (reflexive) a > b (irreflexive) Given a set A, how many reflexive relations are possible? C-N Math 207 - Massey, 97 / 125
Symmetric Relations The relation R on A is symmetric if arb = bra anti-symmetric if arb, bra = a = b The graph of a symmetric relation has symmetry across the diagonal. a = b, a is married to b (symmetric) a b (anti-symmetric) find R that is neither sym nor anti-sym find R that is both sym and anti-sym C-N Math 207 - Massey, 98 / 125
Transitive Relations The relation R on A is transitive if arb and brc implies arc a > b a ancestor of b [Ipso-facto] C-N Math 207 - Massey, 99 / 125
Equivalence Relation Relations R is an equivalence relation if it is reflexive, symmetric, and transitive. example: a b if R is an equivalence, it is sometimes denoted by If R is an equivalence relation on Z 5 and {(1, 3), (4, 3), (2, 2), (2, 0)} R, list all other ordered pairs that must be in R. C-N Math 207 - Massey, 100 / 125
Relations Equivalence Relations and Partitions Let be an equivalence relation on A. equivalence class of a A [a] = {b A a b} either [a] = [b] or [a] [b] = the set of equivalence classes form a partition of A (quotient set of A mod ) visualize by block structure in matrix representation C-N Math 207 - Massey, 101 / 125
Relation Grids Relations reflexive X X X X X X X X - X - irreflexive X - X X - neither? both? C-N Math 207 - Massey, 102 / 125
Relation Grids Relations symmetric anti-symmetric neither? both? X X X X X X X X X X X - - X X - X X C-N Math 207 - Massey, 103 / 125
Relation Grids Relations intransitive ( not transitive) 1 2 3 4 1 X 2 X 3 X X 4 X Which others must be filled in to make it transitive? C-N Math 207 - Massey, 104 / 125
Relation Grids equivalence relation (R,S,T) Relations 1 2 3 4 5 1 X X 2 X X X 3 X X X 4 X X 5 X X X reorder to reveal partitions (blocks) 1 4 2 3 5 1 X X 4 X X 2 X X X 3 X X X 5 X X X C-N Math 207 - Massey, 105 / 125
Classify the Relation Relations R, IR, S, AS, T, E 1. a is the boss of b 2. card a has the same suit as card b 3. actor a was in a movie with actor b 4. team a played team b 5. webpage a links to webpage b 6. set A is a subset of set B 7. (A, B) R iff A > B 8. xry iff y < x 2 C-N Math 207 - Massey, 106 / 125
Relation Operations Relations identity relation I = {(a, a) a A} I is R, S, AS, T, E R 1 = {(b, a) (a, b) R} R I is the reflexive closure of R R R 1 is the symmetric closure of R C-N Math 207 - Massey, 107 / 125
Composition of Relations Relations Let R A B and S B C The composition of S with R is S R = {(a, c) (a, b) R, (b, c) S} direct paths from Dom(R) to Ran(S) composition is associative C-N Math 207 - Massey, 108 / 125
Composition Examples Relations 1. Relational database table R (school, city) table S (city, state) (CN, TN ) S R 2. let P, S, C be parent, sibling, child relations P 2 S P P S S = C P cousin? C-N Math 207 - Massey, 109 / 125
Functions Functions Definition: the relation f P(A B) is a function (map, correspondence) from A to B if Dom(f ) = A if (x, y) f and (x, z ) f, then y = z Note that We may write f : A B. If (x, y) f we say y = f (x ). Each member of A maps to exactly one member of B ( vertical line test ) C-N Math 207 - Massey, 110 / 125
Functions Functions Let f : A B be a function from A to B. Ran(f ) is often called the image of A. The target set B is called the codomain. f is onto (surjective) if Ran(f ) = B f is one-to-one (injective) if f (x 1 ) = f (x 2 ) = x 1 = x 2 If Ran(g) Dom(f ), then define the composition function f g where (f g)(x ) = f (g(x )). C-N Math 207 - Massey, 111 / 125
Grid Representation Functions The function {(1, 2), (2, 5), (3, 1)} could be represented as: 1 2 3 4 5 1 X 2 X 3 X How many functions from {1, 2, 3} to {1, 2, 3, 4, 5} are possible? One-to-one functions? Onto functions? C-N Math 207 - Massey, 112 / 125
Inverse Functions Functions Let f : A B be 1-1 and onto f is called bijective or a 1-1 correspondence f is said to be invertible since f 1 : B A is a function from B to A. The identity function I A : A A is defined by I (x ) = x. For an invertible function, f 1 f = I A and f f 1 = I B. Show that (f g) 1 = g 1 f 1 C-N Math 207 - Massey, 113 / 125
Function Example Functions The formula y = x 2 needs to be given a domain/codomain to fully specify a function. f : R R f : [0, ) R f : [0, ) [0, ) f : Z 5 Z 5 C-N Math 207 - Massey, 114 / 125
Function Example Functions Let f (x ) = 3e x /2 Specify a domain/codomain so that f is a bijection. Find f 1 by solving y = 3e x /2 for x. Notice how the domain/range flip-flop. C-N Math 207 - Massey, 115 / 125
Circle Functions x 2 + y 2 = 1 is a relation, not a function f : [ 1, 1] R, f (x ) = 1 x 2 is a function, not invertible f : [0, 1] [0, 1], f (x ) = 1 x 2 invertible function C-N Math 207 - Massey, 116 / 125
Function Examples Functions f : Z Z defined by f (n) = gcd(30, n) piecewise { f : N N defined by 5 n n 5 f (n) = 0 n > 5 C-N Math 207 - Massey, 117 / 125
Sequences Functions A sequence is a function whose domain is some subset of Z (often N). Examples: f : N + N defined by f (n) equals the sum of the proper factors of n n is a perfect number if f (n) = n geometric sequence: f n = cr n geometric series: s n = n k=0 cr n C-N Math 207 - Massey, 118 / 125
Recursive Sequences Functions A sequence may be seeded and then defined recursively f (0) = 1, f (n) = f (n 1)/2 f 0 = 1, f n = nf n 1 Mortgage balance B n = (1 +.06/12)B n 1 800 Fibonacci sequence f 0 = 0, f 1 = 1, f n = f n 2 + f n 1 C-N Math 207 - Massey, 119 / 125
Pigeonhole Principle Functions If m pigeons must be put into n < m holes, then there must be at least one hole containing more than one pigeon. If f : A B and A > B, then f cannot be one-to-one. If f : A B and A < B, then f cannot be onto. C-N Math 207 - Massey, 120 / 125
Pigeonhole Principle Functions Write down any six natural numbers. Prove that there must be some consecutive number(s) in your list whose sum is divisible by six. Let a k be the numbers, and s k the partial sums. If 6 s k for some k, you are done. Otherwise, each s k is an alias of 1, 2, 3, 4, or 5 (mod 6). By the PHP, k < l with s k s l (mod 6). Therefore a k+1 + a l 0 (mod 6). C-N Math 207 - Massey, 121 / 125
Acquaintances Functions There are several people in the room. Some are acquaintances (a symmetric, non-reflexive relation), others are not. Prove that some pair of people have exactly the same number of acquaintances. Each person can have between 0 and n 1 acquantances. But it can t be that one person has 0 and another n 1. C-N Math 207 - Massey, 122 / 125
1-1 Correspondence Functions Find a bijection from N to Z (0, 1) R [0, 1) [0, ) C-N Math 207 - Massey, 123 / 125
Infinite Sets Infinity We say A = B if there exists a 1-1 correspondence between A and B. A set is finite if it can be put in 1-1 corresponence with Z n for some n N. A set is infinite if it can be put in 1-1 correspondence with a proper subset of itself. When we ve been here ten thousand years Bright shining as the sun. We ve no less days to sing God s praise Than when we ve first begun. C-N Math 207 - Massey, 124 / 125
Countable Sets Infinity A set is called countably infinite if it can be put in 1-1 correspondence with N. In this case we say A = ℵ 0. Countable (listable) refers to finite or countably infinite sets. Z and Q are countable. R is not countable. C-N Math 207 - Massey, 125 / 125