PURE MTH 3002 Topology & Analysis III (3246) 2002 Notes on Sets, Relations and Functions These are some notes taken from Mathematical Applications (now Mathematics for Information Technology (MIT)). They may be useful for students who have not come across sets, functions and relations before. NB Not all the notation and definitions are the same as in Topology and Analysis. In particular N includes 0 and range is used for image. A good reference beyond these notes is the text for MIT which is Discrete Mathematics 4th Ed, Ross, K. A., Wright, C. R. B. (Prentice Hall 1992). There are about ten copies in the short loan section of the library. Its call number is 510 R824d. 1. SETS AND RELATIONS A set is a collection of objects, called the elements of the set. We specify a set by either (1) listing the elements Example: A = {1, 3, 5, 7, 9, 11} or (2) describing the elements of the set according to some formula Example: A = {x x is an odd integer and 1 x 11}. If x is an element of a set A we write x A. Also, x A means x is not an element of A. Example: With A as above, 3 A but 15 A, 10 A. A finite set S is a set which contains a finite number of elements. The number of elements in a set S is called the order or cardinality of S and denoted by S. Example: The set A has order 6; A = 6. The set of real numbers R is of course an infinite set. Two sets A and B are equal, A = B, if they have the same elements, that is, x A if and only if x B. A is a subset of B, A B, if every element of A is also an element of B, that is, if x A then x B. To show A = B we show A B and B A. The union of A and B is A B = {x x A or x B} that is, the set of elements in either A or B (or both). The intersection of A and B is A B = {x x A and x B} that is, the set of elements in both A and B. Example: A = {1, 3, 5, 7, 9, 11} B = {3, 6, 9} A B = {1, 3, 5, 6, 7, 9, 11} A B = {3, 9} Note that A B and also B A; however if D = {1, 3, 5} then D A. Most mathematical discussions are carried on within some context. That is, all our sets and elements belong to some large set. We call this the universal set. Suppose we have a universal set U. The complement of A is A c = {x x A} The difference of the sets A and B is = {x x U and x A} A\B = {x x A and x B} = A B c 1
Example: U = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11} and A, B as above A c = {2, 4, 6, 8, 10} B c = {1, 2, 4, 5, 7, 8, 10} A\B = {1, 5, 7, 11} If C = {2, 4, 10}, then A C has no elements; we write A C = φ. The empty set φ is the set which has no elements, so φ = { }. (φ is the Greek letter phi.) Example: The set {0} has an element, namely 0, so is NOT the empty set. Example: Let U be any universal set and let A U. Then A A c = {x x A and x A c } = {x x A and x A} = φ The power set P(A) of a set A is the set of all subsets of A. Example: A = {a, b, c}. Note: The elements of P(A) are sets!!! Example: Consider A = {a} P(A) = {φ, {a}, {b}, {c}, {a, b}, {b, c}, {a, c}, {a, b, c} = A} P(A) = {φ, {a}} P(P(A)) = set of all subsets of P(A) = {φ, {φ}, {{a}}, {φ, {a}} Note: φ, {φ} are different: φ = { }. {φ} has an element, namely φ. (Homework: If the set A has n elements, how many elements in P(A)?) Algebraic Properties of Sets Sets satisfy many algebraic properties involving,, c, as follows: Let A, B, C be subsets of a universal set U. (1) (A c ) c = A. Proof: (A c ) c = {x x A c } = {x x A} = A (2) A B = B A (commutative A B = B A laws) Proof: A B = {x x A or x B} = {x x B or x A} = B A (3) A (B C) = (A B) C (associative A (B C) = (A B) C laws) (4) A (B C) = (A B) (A C) (distributive A (B C) = (A B) (A C) laws) Proof: A (B C) = {x x A and (x B or x C)} = {x (x A and x B) or (x A and x C)} = {x x A B or x A C} = (A B) (A C) (5) A A = A (idempotent A A = A laws) 2
(6) A φ = φ A φ = A (identity A U = A A U = U laws) (7) A A c = U (inverse A A c = φ laws) (8) (A B) c = A c B c (De Morgan s (A B) c = A c B c laws) (9) A A B A B A All these laws can be proved in a similar way to the above proofs. The Cartesian product of two sets S, T is S T = {(s, t) s S and t T } = set of all ordered pairs with the first element from S and the second element from T. Note: (s, t) = (u, v) if and only if s = u and t = v. Example 1: S = R, T = R where R = real numbers. S T = R R = R 2 = Cartesian plane {(x, y) x R and y R}. Example 2: S = {0, 1}, T = {1, 2, 3}. S T = {(0, 1), (0, 2), (0, 3), (1, 1), (1, 2), (1, 3)} Note: In general S T T S. In our example, (0, 3) S T since 0 S, 3 T but (0, 3) T S since 0 T, 3 S. A relation R from a set S to a set T is a subset of S T, that is, R S T. If (s, t) R we say s is related to t and we write srt. Note: We say R is a binary relation as it is a subset of the Cartesian product of the two sets S and T. Example 1: Take S = set of character strings where a character string is a string of symbols which can be entered from a keyboard and N = {0, 1, 2,...} Let R = {(c, n) the character string c has length n} S N. Thus (b 2; +, 5) R but (ABC, 4) R. Example 2: S = T = R real numbers. R = {(x, y) x y} R R. That is (x, y) R iff x y; so (2, 3) R, (3, 3) R but (4, 3) R. When S = T we say R is a relation on S. Example 3: Using the sets S = {0, 1}, T = {1, 2, 3} above, let R = {(0, 1), (0, 3), (1, 2)} S T. (Can you tell what this relation is, i.e. how these pairs differ from the others in S T?) Example 4: A ternary relation. S = set of students at Adelaide Uni. T = set of subjects offered U = set of tutorial times R = {(x, y, z) student x takes subject y and has a tutorial in y at time z} S T U 3
Example 5: Let S = T = Z (set of integers). Let n be a fixed positive integer. For any integer x, x = nq + r where 0 r < n (this is called the Division Algorithm). q is called the quotient and r is called the remainder. The relation congruence modulo n is R = {(x, y) x y (mod n)} and x y (mod n) means x and y have the same remainder when divided by n. Example: n = 10. Then so but so Suppose x y (mod n). Then 17 = 1.10 + 7 and 127 = 12.10 + 7 17 127 (mod 10) 37 = 4.10 + 3 (0 3 < 10) 37 17 (mod 10) x = q.n + r y = q.n + r 0 r < n Subtracting, x y = (q q )n. Thus x y is a multiple of n, or n divides x y. We can therefore describe congruence mod n in another (equivalent) way: x y (mod n) if x y is a multiple of n, or x y is (exactly) divisible by n. Example: 127 17 (mod 10) as 127 17 = 110, divisible by 10. 37 17 (mod 10) as 37 17 = 54, NOT divisible by 10. Example: n = 2. x 0 (mod 2) iff x is even integer x 1 (mod 2) iff x is odd integer If R S S then R is a relation on S. For such relations: R is reflexive if srs for all s S. R is symmetric if srt trs s, t S R is transitive if srt and tru implies sru s, t, u S. A relation R on S which is reflexive, symmetric and transitive is called an equivalence relation. Example 1: R = {(x, y) x y} R R. (a) R is reflexive since x x (b) R is not symmetric x y y x (so R is not an equivalence relation) (c) R is transitive: x y and y z x z. Example 2: Let A denote all people living in Australia (Malaysia) and C = {(x, y) x lives close to y} where we say x lives close to y if they live at most 50 km. apart. C is reflexive and symmetric but not transitive. Example 3: R = {(x, y) x = y} R R (a) R is reflexive : x = x (b) R is symmetric : x = y y = x (c) R is transitive : x = y y = z x = z Hence R is an equivalence relation. Example 4: Congruence modulo 10 is an equivalence relation! R = {(x, y) x y (mod 10)} Z Z 4
(a) R is reflexive: x x (mod 10) (as x x = 0 is divisible by 10) (b) R is symmetric: x y (mod 10) y x (mod 10) (x, y have same remainder on division by 10 y, x have same remainder on division by 10) (c) R is transitive: x y (mod 10) and y z (mod 10) x z (mod 10) (in this case each of x, y, z has the same remainder when divided by 10.) If we take n as any positive integer, then congruence modulo n will be an equivalence relation (as for 10). Partitions A collection of subsets A 1, A 2,..., A n partition a set A if (i) A = A 1 A 2... A n (ii) for each i j, A i A j = φ (i, j = 1,..., n). Example: The sets A 1 = {3}, A 2 = {1, 2, 5, 6} and A 3 = {4} partition A = {1, 2, 3, 4, 5, 6}. Equivalence Classes Let R be an equivalence relation on S. For any x S, is the equivalence class containing x. The equivalence classes partition S. [x] = {y S xry} Example 1: Let R be congruence modulo 10 on Z. The equivalence classes are: [0] = {0, ±10, ±20,...} = {n n 0 (mod 10)} [1] = {1, 11, 21,..., 9, 19,...} = {n n 1 (mod 10)} [2] = {2, 12, 22,..., 8, 18,...} = {n n 2 (mod 10)}. [9] = {9, 19, 29,..., 1, 11,...} = {n n 9 (mod 10)} [10] = [0]. There are exactly 10 equivalence classes, [0], [1],..., [9]. Example 2: Let D denote the set of words in the (Oxford) Dictionary. The relation R = {(w 1, w 2 ) words w 1 and w 2 begin with the same letter} is an equivalence relation. The equivalence classes consist of all words starting with the same letter. There are of course 26 classes! Example 3: Let S = {0, 1, 2, 3,..., 10} and R the (equivalence) relation R = {(x, y) x y (mod 3)} S S. Write out the equivalence classes and verify they partition S. Classes : [0] = {0, 3, 6, 9}, [1] = {1, 4, 7, 10}, [2] = {2, 5, 8}. Functions A relation R S T from S to T is a function if (1) for each s S, there exists a pair (s, t) R (2) for each s S, there is only one pair (s, t) R. We write R(s) = t instead of srt. The set of S is the domain of the function. Example 1: Let S = T = R, and R = {(x, x 2 ) x R} this is the familiar function R(x) = x 2. Example 2: R = {(n, m) n, m N and n m}. n divides m, e.g. (2, 6), (3, 6) R but (6, 3) R. 1. Let n N. There exists (n, 2n) R, hence (1) is satisfied. 2. Let 2 N. Then (2, 4) R and (2, 6) R, so (2) is not satisfied. 5
Thus R is not a function (R(2) cannot be uniquely defined). Example 3: S = {students doing Mathematical Applications} M = {0, 1,..., 100} R = {(x,m) student x, gets mark m in Math Applications} S M. 1. Let x S. There exists (x, m) R, where m = mark obtained by student x. 2. This mark is uniquely defined. Thus R is a function, R(x) = m = mark obtained by student x. Example 3: A sequence is a function with domain N = {0, 1, 2,...} or {1, 2,...}; or possibly some finite subset of N. Some sequences: FACT(n) = n! so FACT(0) = 1, FACT(1) = 1, FACT(2) = 2,... P(x) = 2 n. P(0) = 1, P(1) = 2, P(2) = 4,.... Let f S T be a function. We usually write f : S T and write f (s) = t for (s, t) f. The range of f is f is one-to-one (1-1) if range (f ) = {t T f (s) = t} T = set of images of f. whenever f (s) = f (t) then s = t (alternatively: if s t then f (s) f (t). (distinct elements have distinct images). f is onto T if t T there exists x S such that f (s) = t (every element in T is the image of an element in S) range(f ) = T Example 1: FACT is not 1-1 since P is 1-1, since FACT(0) = FACT(1) = 1 if n m then 2 n 2 m i.e. P(n) P(m). FACT is not onto N, e.g., there is no integer n satisfying FACT(n) = 3. Similarly, P is not onto N, since range(p) = {1, 2, 4, 8,...} N. If S, T are finite sets then f : S T is 1 1 and onto T if and only if S and T have the same number of elements ( S = T ); e.g. Let S be the set of the top 200 ranked women tennis players and T = {1, 2, 3,..., 200}. Then if f assigns to each player their ranking, f is 1 1 (f ( Hingis ) = 1, f ( Graf ) = 2 etc.!) On the other hand if S has more elements than T, ( S > T ) then f : S T can not be 1 1 and for some element t of T, there are at least two elements of S, say s 1 and s 2 with This is known as the Pigeonhole Principle. f (s 1 ) = f (s 2 ) = t. 6
Examples: (1) In Adelaide there must be at least two people with the same number of hairs on their head. (The latter is known to be at most 300,000. Adelaide has over 1 million residents.) (2) In a group of 700 people there must be at least two people with the same first and last initials. (3) In a small town of 400 people at least two residents must celebrate their Birthday on the same day of the year. For finite sets a function f : S T can only be onto if S has at least as many elements as T ; S T. Example: No function f : S T, S = {1, 2, 3, 4}, T = {2, 4, 6, 8, 10} can be onto T. Conversely the function g : T S, g(2) = 1, g(4) = 2, g(6) = 3, g(8) = 4 and g(10) = 4 is onto S, but is not 1 1. Example 2: Consider g : P(S) P(S) for some set S, where g(a) = A c. g is 1-1: if A B then A c B c. g is onto P(S) : for any set B S, g(b c ) = (B c ) c = B so every element of P(S) is the image of some (exactly one) set under g. Inverse Relations Corresponding to every relation R S T there is an inverse relation R 1 T S: (s, t) R if and only if (t, s) R 1. Examples 1. Let R = {(n, m) n divides m}; then R 1 = {(m, n) m is a multiple of n} (2, 6) R so (6, 2) R 1. Note: (6, 2) R. 2. Let R = {(x, y) x y} R R. R 1 = {(y, x) y x}. 3. Let S = T = people in Australia and R = {(x, y) x is the parent of y} S T ; then R 1 = {(y, x) y is the child of x}. A function f : S T is a relation and so we can always define an inverse relation: f 1 = {(f (s), s) s S} T S. We are usually interested in f 1 only when it is also a function. In order for f to have an inverse function f 1 : T S, the function f must be 1 1 and onto T. Examples. 1. f = {(x, x 2 ) x R} is the familiar function f : R R, f (x) = x 2. f is not 1 1 and so has no inverse function; the inverse relation {(x 2, x) x R} is not a function as it contains both (4, 2) and (4, 2). 2. f : R R +, (R + the positive real numbers) f (x) = 2 x does have an inverse, f 1 (x) = log 2 x. 3. FLOOR (x) = x = n = [[x]] = greatest integer less than or equal to x, so FLOOR : R Z. FLOOR is not 1 1, FLOOR (1) =FLOOR (3/2) = 1 and so has no inverse. (Suggest CEIL (x) = x = least integer x be given as an Assignment question.) For a function to have an inverse it must be 1 1. If f is not onto T, change T to range (f ); and then f has an inverse f 1 : range (f ) S. 4. If S, T are finite sets and f : S T has an inverse f 1 : T S then f is 1 1 and onto T. This means S = T ; S and T must have the same number of elements. 7