Functions and Relations II CS2100 Ross Whitaker University of Utah
Infinitely Big Sets Counting and size: thought experiment How many elements does the following set have? How do we know? What do we mean by the number of things?
Size of Sets: Cardinality Sets A and B have the same cardinality if there exists an invertible function f:a->b Intuition: An invertible function establishes a kind of unique correspondence between sets. Thus, invertible functions help to establish things as being the same size.
Example Show that N and Z have the same cardinality. Define a function that maps one to the other f:z->n with f(a) = { 2a a 0 2a 1 a<0
Example Is f invertible? Two options Show one-to-one and onto or produce g and show g is the inverse g(b) = { b 2 b even (b + 1) 2 b odd a=g(b) -> b=f(a) Let b be even. a=g(b)=b/2. f(a)=2a=b. Let b be odd. a=g(b)=-(b+1)/2. f(a)=-2a-1=-2 -(b+1)/2-1=b+1-1=b. b=f(a) -> a=g(b) Let a be positive. b=f(a)=2a. b is even. g(b)=b/2=a. Let a be negative. f(a)=-2a-1. b is odd. g(b)=-(b+1)/2 = - (-2a-1+1)/2 = a.
Sizes of Sets: Infinity The set A is infinite if there exists a function f:a->a that is one-to-one but not onto Intuition: If set is finite in size, then a mapping onto itself must have either: a full unique correspondence (invertible) or have multiple inputs to the same output (not one-toone) infinite sets can be neither and they maintain this discrepancy by never running out of elements
Example N is infinite Proof. Construct a function f:n->n that is one-to-one but not onto. f(a)=2a Prove f(a) is one-to-one. Division theorem says that for every number there is a unique quotient (divisor=2). I.e. b=2a and a is unique Prove f(a) is not onto Find bn such that a s.t. b=f(a). Take b to be odd. By the definition of odd and division theorem b=2k+1, and this is unique. Thus, there is no a such that 2a=2k+1=b
Proving Cardinality Sometimes finding an invertible function can be hard. So Cantor-Bernstein theorem: Given sets A and B, if there is a one-to-one function f:a->b and a one-to-one function g:b->a, then the sets A and B have the same cardinality.
Example Prove that Q 0 has the same cardinality as N. Since NQ, identity on N (denoted I:N->N) is one-to-one. For g:q->n, consider the prime factorization x=a/b (which is unique). Now construct z=g(x)=2 a 3 b. Prime factorizations are unique, so there is no other xq that can lead to z
Georg Ferdinand Ludwig Philipp Cantor 1845 1918 St Petersburg, Russia Fundamental results on sizes of infinite sets Equivalence and nesting of infinite spaces Cantor s theorem implies the existence of an infinity of infinities.
Cantor s Theorem For every set A, P(A) has a greater cardinality than A Book has a weaker form What this means for any infinitely large set, you can always produce a bigger set
Countable An infinite set is countable if it has the same cardinality as N not countable is uncountable E.g. Z and Q 0 are countable
Arrow Diagrams Relations
Relations: Definitions R is a binary relation on A (RAA) Reflexive: (a,a)r aa Antisymmetric: a,ba, a b, (a,b)r- >(b,a) R Transitive: a,b,ca, ((a,b)r)((b,c)r) ->(a,c)r Relation R on A is partial ordering if it is antisymmetric, transitive, and reflexive
Hasse Diagram No loops (reflexive is implied) Segment instead of arrow height on page is direction Draw only shortest links Draw (a,b) and (b,c), but not (a,c)
Example A={1,2,3,4} (x,y)r iff x y Enumerate R Draw the Hasse diagram
Example Let A=P({x,y,z}). Define (a,b)r iff ab
Proofs about Relations Claim: R is SOMEPROPERTY Let SOMEASSUMPTION Show that the property holds
Example A={1,2,3,6,9,18}, R={(x,y)A, y is a multiple of x} Prove that R is reflexive Let aa. Because a 1=a, a is a multiple of itself (true for all ints) Therefore (a,a)r
Example R={(a,b)ZZ: a-b even} Prove that R is reflexive Prove that R is transitive Prove that R is not a partial ordering
Example Let A={1,2,3,4,6,9,12,18,36} Let R={(a,b)A 2 : b is a multiple of a} Draw the Hasse Diagram Prove that R is a partial ordering
Other Types of Ordering Relax the reflexive requirement: strict partial ordering E.g. A={1,2,3,4,5}, R={(a,b)A 2 : a<b} Total ordering: Requirements of partial ordering Additional requirement a,ba, if a b, either (a,b)r or (b,a)r Can also be strict
Practice A=P({1,2,4,8}) Identify the type of ordering: R 1 ={(S,T)A 2 : (as)(bt) -> a b} R 2 ={(S,T)A 2 : S < T } R 2 ={(S,T)A 2 : sum of elements in S sum of elements in T}
Relations and Equivalence Two things can be the same or equivalent Equivalent ratios: (5,2) and (20,8) because 5/2 = 20/8 Similar triangles: Equivalence relation
Partitions of a Set A partition of a set A, is a set of sets S={S 1,, S n } such that: 1. i, S i (each part is nonempty) 2. i,j if S i S j then S i S j = (disjoint) 3. S 1 S n =A (complete) The S i s are called parts of S
Equivalence Relation Given set A and relation R on A, R is an equivalence relation on A if there exists a partition S of A such that (x,y)r iff are in the same part of S.
Examples A={1,2,3,4,5,6} R 1 ={(a,b)a 2 : b=a+1} R 2 ={(a,b)a 2 : a-b is even} 2 2 1 3 1 3 5 4 5 4 5 5
Example Cards numbered A={1,2,3,4,5} Each player gets two cards H=AA Two hands are the same if sum of values on cards is the same What is the partition?
Practice Is equivalence relation? If so, partition? A={1,2,3,4,5,6,7,8,9}, R={(a,b)A 2 : k,l,mz s.t. a=km, b=lm, and m>1} R={(x,y)Z 2 : mz s.t. x-y=4m} A={0,1,2,3,4,5,6}{1,2,3}, R={((a,b), (c,d))a 2 : ad=bc}
Euivalence Every object is similar to itself (a,a)r reflexive If a is similar to b, then b is similar to a (a,b)r -> (b,a)r symmetric
Practice Let A={0,1,2,3,4,5} and let R={(a,b)A 2 : a 2 -b 2 =3m, mz} Prove that R is reflexive. Let aa, then a 2 -a 2 =0=3 0 (multiple of 3) Therefore (a,a)r aa Prove that R is symmetric. Let a,ba, such that (a,b)r Thus, a 2 -b 2 =3m, mz. Therefore b 2 -a 2 =-3m=3 (-m). mz -> -mz. Therefore (b,a)r because (b,a) satisfies the setbuilder predicate
Equivalence Relations If the relation R is reflexive, symmetric, and transitive, then R is an equivalence relation Proof: For each element aa, define P a ={xa: (x,a)r} Claim 1: each P a is nonempty R is reflexive, therefore (a,a)r Therefore ap a and P a is nonempty
Equivalence Relations (cont.) Claim 2: For all a,ba, if P a P b then P a P b =. Proof by contradiction. Let P a P b then c s.t. cp a and cp b. If P a P b then d s.t. dp a and d P b -> (c,a)r, (d,a)r -> (a,d)r (sym) -> (c,d)r (trans.) cp b -> (b,c)r -> (b,d)r (trans) -> (d,b)r (sym) -> dp b (contradiction)
Equivalence Relations (cont.) Claim 3: Union of P s equals A R reflexive -> (a,a)r aa Therefore aa ap a Therefore every element of A is in the union of the P s