SETS AND FUNCTIONS, MATH 215 FALL 2015 (WHYTE) 1. Intro to Sets After some work with numbers, we want to talk about sets. For our purposes, sets are just collections of objects. These objects can be anything - numbers, words, other sets, etc. We use the notation : { } for a set, with the elements listed in the middle. Some examples: {1, 2, 3, 4} {cat, dog, house} {2m +1:m 2 Z} {0, 1, 2, 3,...} The third and fourth sets listed here show two common methods of defining sets. In the third we are taking every number of the form 2m +1 where m is allowed to be any integer. For the fourth we have used... to indicated that the sequence continues in the given pattern indefinitely. This is not completely rigorous, since we have not specified what the pattern is - this notation should not be used if there is any doubt about what is intended. Definition 1.1. Two sets S and T are equal, written S = T, if they have the same elements. In other words, if x 2 S () x 2 T. Definition 1.2. Given sets S and T,wesayS is a subset of T, written S T, if all the elements of S are also elements of T (sox 2 S =) x 2 T ). The following is a common strategy for proving two sets are the same: Proposition 1.3. Given sets S and T, S = T if and only if both S T and T S. We can build new sets out of ones we already have. Definition 1.4. Given a set S, its complement, written S c is defined by x 2 S c () x/2 S Definition 1.5. Given sets S and T, their union, S [ T is defined by x 2 S [ T () (x 2 S or x 2 T ) Definition 1.6. Given sets S and T, their intersection, S \ T is defined by x 2 S \ T () (x 2 S and x 2 T ) One common set is the set which has no elements, called the empty set. We will use the symbol ; for this set. 1
2 SETS AND FUNCTIONS, MATH 215 FALL 2015 (WHYTE) Some basic facts about these operations on sets: Proposition 1.7. Let A,B, and C be sets. A [ B = B [ A (A [ B) c =(A c \ B c ) (A [ B) [ C = A [ (B [ C) A \ B = B \ A (A \ B) c =(A c [ B c ) (A \ B) \ C = A \ (B \ C) (A [ B) \ C =(A \ C) [ (B \ C) A \;= ; A [;= A ; A (hint :All of these can be proven in a straightforward way from the definitions, sometimes with the help of Prop 1.3). Sets can have other sets as elements, and this can be confusing. For example: Question 1.8. Let S = {a, b, {x, y}} How many elements does S have? Is x an element of S? Is a an element of S? Is {x, y} an element of S? Is {x, y} a subset of S? Is {a, b} an element of S? Is {a, b} a subset of S? One source of examples of sets with other sets as elements is the power set: Definition 1.9. Let S be a set. The power set of S, written P (S), isthe set of all subsets of S. Sox 2 P (S) () x S. Example 1.10. If S = {a, b} then P (S) ={;, {a}, {b}, {a, b}} Proposition 1.11. For any set S, P (S) has at least one element. Proposition 1.12. If S is a set such that P (S) has only one element then S = ;. Work out examples of the power sets of some (small) sets. In particular, for the example above of S = {a, b}, what is P (P (S))? Problem 1.13. Suppose S is a set with n elements. Make a conjecture about how many elements P (S) has, then prove your conjecture using induction (hint: the answer is also an explanation for the name power set ).
SETS AND FUNCTIONS, MATH 215 FALL 2015 (WHYTE) 3 2. Cartesian Products There is another process that creates a new set out of old ones, called the Cartesian product. You are already familiar with this as the process that builds the Cartesian plane R 2 out of the real numbers R. A point in R 2 is a an ordered pair of real numbers (x, y). Notice that an ordered pair is more than just the set {x, y} since the order matters : the point (2, 3) is not the same as the point (3, 2). Definition 2.1. Let A and B be two sets. An ordered pair with first coordinate from A and second coordinate from B is a pair (x, y) with x 2 A and y 2 B. With this definition in hand, we can define the Cartesian product: Definition 2.2. Let A and B be two sets. Their Cartesian product, written A B is the set of ordered pairs with first coordinate from A and second coordinate from B. Problem 2.3. Write down the Cartesian products, A B, forthefollowing sets: A = {1, 2}, B = {cat} A = {a, b, c}, B = {a, b} A = {a, b}, B = {a, b, c} Notice that the last two examples show that A B is not the same as B A. Proposition 2.4. Let S be any set. Prove that ; S and S ; are both equal to ;. Problem 2.5. If A has n elements and B has m elements, how many elements does A B have? Can you prove it? One of the reasons the Cartesian product construction is important is that it gives a framework for talking about how elements of di erent sets can be related. To define a relationship between elements of A and elements of B we simply indicate all the pairs (a, b) where the relationship holds. More precisely: Definition 2.6. A relation between A and B is a subset R of the product A B. If(a, b) 2 R we say that the relation R holds between a and b. For example, take A as the set of all English words, and B the set of all 26 English letters. Some natural relations between A and B are starts with, ends with, and contains. Example 2.7. As a smaller version of the above, let A = {cat, dog, frog, cow} and let B be the set of letter 26 letters. Write down the sets that correspond to the three relations starts with, ends with, and contains. How many elements are in each relation?
4 SETS AND FUNCTIONS, MATH 215 FALL 2015 (WHYTE) There are three special kinds of relations that will be particularly important for us: A relation R between A and B is called a mapping ( or sometimes function ) from A to B is for every element x 2 A there is exactly one y 2 B so that (x, y) 2 R. In this case we usually give the mapping a name (like f) and write y = f(x) for the y that is related to x. The other two kinds occur only when A and B are the same set: A relation R between A and A is called a linear ordering if it satisfies : For all a 1 and a 2 in A, exactly one of the following is true: a 1 = a 2 (a 1,a 2 ) 2 R (a 2,a 1 ) 2 R If (a 1,a 2 ) and (a 2,a 3 ) are in R, thensois(a 1,a 3 ) In this case we usually write a 1 <a 2 instead of (a 1,a 2 ) 2 R A relation R between A and itself is called an equivalence relation if it satisfies : For all a in A, wehave(a, a) 2 R If (a 1,a 2 )isinr then so is (a 2,a 1 ) If (a 1,a 2 ) and (a 2,a 3 ) are in R, thensois(a 1,a 3 ) In this case we usually write a 1 a 2 or a 1 a 2 instead of (a 1,a 2 ) 2 R. Problem 2.8. Suppose A = B = Z. For each of the following relations, decide if they are functions A to B, linear orderings, and/or equivalence relations ( they may be more than one or none ). (1) R = {(n, 0) for all n 2 Z} (2) R = {(0,n) for all n 2 Z} (3) R = {(n, n) for all n 2 Z} (4) R = {(n, n 2 ) for all n 2 Z} (5) R = {(n 2,n) for all n 2 Z} (6) R = {(n, n +3m) for all n, m 2 Z} (7) R = {(n, n + m) for all n 2 Z and m 2 N} (8) R = {(n, n + m) for all n 2 N and m 2 Z} (9) R = {(n, m) such that n + m = 10 and n, m 2 Z} (10) R = {(n, m) such that n 2 + m 2 = 10 and n, m 2 Z} (11) R = {(n, m) such that n 2 = m 2 and n, m 2 Z} Problem 2.9. Is it possible for a relation to be both an equivalence relation and a function? If so how? Problem 2.10. Is it possible for a relation to be both an equivalence relation and a linear order? If so how? Problem 2.11. Is it possible for a relation to be both a linear order and a function? If so how?
SETS AND FUNCTIONS, MATH 215 FALL 2015 (WHYTE) 5 3. Functions Definition 3.1. Let f be a function from S to T. f is called injective if f(s 1 )=f(s 2 ) implies s 1 = s 2 f is called surjective if for all t 2 T there is s 2 S with f(s) =t f is called bijective if f is both injective and surjective. Problem 3.2. Which of the following functions are injective? surjective? bijective? (1) f(x) =x 2 as a function R! R (2) f(x) =2x +1 as a function Z! Z (3) f(x) =2x +1 as a function R! R (4) For sets A and B, the function f : A B! B A defined by f(a, b) =(b, a) Problem 3.3. Let A and B be sets. Define f : P (A) P (B)! P (A [ B) by f(s, T )=S [ T. (1) Prove that f is surjective. (2) Prove that f is injective if and only if A \ B = ; Problem 3.4. Let S and T be finite sets, and f : S! T a function. Show that if f is injective then S apple T Show that if f is surjective then S T Assume S = T. Showthatf is injective i f is surjective. One important way of building functions is to combine known functions. One way to do this is as follows: given f : A! B and g : B! C we can define the composition, writteng f, as a function from A! C, bythe rule : g f(a) =g(f(a)) It is important to note that this only makes sense when the range of f is the same as the domain of g, so that it is possible to use f(a) as an input value for g. Problem 3.5. Which of the following five functions can be composed, and in what orders? For those that can, work out the compositions. a(x) =x 2 from R! R b(x) =2x +1 from R! R c : {cat, dog, tree}!r, where c(cat) =1, c(dog) =0,andc(tree) = 1 d : R!{cat, dog, tree}, where d(x) =cat for x<0, c(0) = dog, and c(x) =tree for x>0 e : {cat, dog, tree}!{cat, dog, tree} where e(cat) =tree, e(tree) = dog, ande(dog) =dog.