Sets and Functions. (As we will see, in describing a set the order in which elements are listed is irrelevant).

Similar documents
Week Some Warm-up Questions

MATH 220 (all sections) Homework #12 not to be turned in posted Friday, November 24, 2017

Theorem. For every positive integer n, the sum of the positive integers from 1 to n is n(n+1)

REVIEW FOR THIRD 3200 MIDTERM

Chapter Summary. Sets (2.1) Set Operations (2.2) Functions (2.3) Sequences and Summations (2.4) Cardinality of Sets (2.5) Matrices (2.

Sets and Functions. MATH 464/506, Real Analysis. J. Robert Buchanan. Summer Department of Mathematics. J. Robert Buchanan Sets and Functions

0 Sets and Induction. Sets

Foundations of Mathematics MATH 220 FALL 2017 Lecture Notes

Math 300 Introduction to Mathematical Reasoning Autumn 2017 Inverse Functions

Section 4.4 Functions. CS 130 Discrete Structures

Sets, Functions and Relations

Chapter Summary. Sets The Language of Sets Set Operations Set Identities Functions Types of Functions Operations on Functions Computability

2.1 Sets. Definition 1 A set is an unordered collection of objects. Important sets: N, Z, Z +, Q, R.

Chapter 1. Sets and Mappings

Mathematics Course 111: Algebra I Part I: Algebraic Structures, Sets and Permutations

Seminaar Abstrakte Wiskunde Seminar in Abstract Mathematics Lecture notes in progress (27 March 2010)

f(x) x

Notes. Functions. Introduction. Notes. Notes. Definition Function. Definition. Slides by Christopher M. Bourke Instructor: Berthe Y.

RELATIONS AND FUNCTIONS

Chapter 1 : The language of mathematics.

MATH 215 Sets (S) Definition 1 A set is a collection of objects. The objects in a set X are called elements of X.

SOLUTIONS TO EXERCISES FOR. MATHEMATICS 205A Part 1. I. Foundational material

Topology. Xiaolong Han. Department of Mathematics, California State University, Northridge, CA 91330, USA address:

9/21/2018. Properties of Functions. Properties of Functions. Properties of Functions. Properties of Functions. Properties of Functions


MAT115A-21 COMPLETE LECTURE NOTES

4.1 Real-valued functions of a real variable

3 FUNCTIONS. 3.1 Definition and Basic Properties. c Dr Oksana Shatalov, Fall

5 Set Operations, Functions, and Counting

Cartesian Products and Relations

Foundations of Mathematics

Functions and cardinality (solutions) sections A and F TA: Clive Newstead 6 th May 2014

Study skills for mathematicians

Review Problems for Midterm Exam II MTH 299 Spring n(n + 1) 2. = 1. So assume there is some k 1 for which

Introduction to Functions

Func%ons. function f to the element a of A. Functions are sometimes called mappings or transformations.

Discrete Mathematics. W. Ethan Duckworth. Fall 2017, Loyola University Maryland

Mathematics Review for Business PhD Students

UMASS AMHERST MATH 300 SP 05, F. HAJIR HOMEWORK 8: (EQUIVALENCE) RELATIONS AND PARTITIONS

Lecture 3: Sizes of Infinity

Day 15. Tuesday June 12, 2012

ADVANCED CALCULUS - MTH433 LECTURE 4 - FINITE AND INFINITE SETS

Introduction to Proofs

and problem sheet 6

Introduction to Proofs in Analysis. updated December 5, By Edoh Y. Amiran Following the outline of notes by Donald Chalice INTRODUCTION

Sets. We discuss an informal (naive) set theory as needed in Computer Science. It was introduced by G. Cantor in the second half of the nineteenth

SETS AND FUNCTIONS JOSHUA BALLEW

Set theory. Math 304 Spring 2007

Section Summary. Definition of a Function.

One-to-one functions and onto functions

Mathematics Review for Business PhD Students Lecture Notes

In this initial chapter, you will be introduced to, or more than likely be reminded of, a

Infinite constructions in set theory

Sec$on Summary. Definition of a Function.

Functions as Relations

1 Homework. Recommended Reading:

CHAPTER 0: BACKGROUND (SPRING 2009 DRAFT)

Section 0. Sets and Relations

Countability. 1 Motivation. 2 Counting

Discrete Mathematics. Thomas Goller. January 2013

Definition: Let S and T be sets. A binary relation on SxT is any subset of SxT. A binary relation on S is any subset of SxS.

Math 4603: Advanced Calculus I, Summer 2016 University of Minnesota Notes on Cardinality of Sets

Relations, Functions, and Sequences

ABOUT THE CLASS AND NOTES ON SET THEORY

Foundations Revision Notes

6 CARDINALITY OF SETS

Analysis 1. Lecture Notes 2013/2014. The original version of these Notes was written by. Vitali Liskevich

MATH FINAL EXAM REVIEW HINTS

3 FUNCTIONS. 3.1 Definition and Basic Properties. c Dr Oksana Shatalov, Fall

A Short Review of Cardinality

Introductory Analysis I Fall 2014 Homework #5 Solutions

1 Basic Combinatorics

Lecture Notes 1 Basic Concepts of Mathematics MATH 352

Name (print): Question 4. exercise 1.24 (compute the union, then the intersection of two sets)

Selected problems from past exams

Writing proofs for MATH 51H Section 2: Set theory, proofs of existential statements, proofs of uniqueness statements, proof by cases

CITS2211 Discrete Structures (2017) Cardinality and Countability

Functions. If x 2 D, then g(x) 2 T is the object that g assigns to x. Writing the symbols. g : D! T

Math 42, Discrete Mathematics

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Today s Topics. Methods of proof Relationships to logical equivalences. Important definitions Relationships to sets, relations Special functions

RED. Name: Instructor: Pace Nielsen Math 290 Section 1: Winter 2014 Final Exam

Notes on ordinals and cardinals

2 Lecture 2: Logical statements and proof by contradiction Lecture 10: More on Permutations, Group Homomorphisms 31

1.2 Functions What is a Function? 1.2. FUNCTIONS 11

INFINITY: CARDINAL NUMBERS

Functions If (x, y 1 ), (x, y 2 ) S, then y 1 = y 2

FOUNDATIONS & PROOF LECTURE NOTES by Dr Lynne Walling

In N we can do addition, but in order to do subtraction we need to extend N to the integers

3 FUNCTIONS. 3.1 Definition and Basic Properties. c Dr Oksana Shatalov, Spring

MATH 13 SAMPLE FINAL EXAM SOLUTIONS

Background for Discrete Mathematics

Math 250A, Fall 2004 Problems due October 5, 2004 The problems this week were from Lang s Algebra, Chapter I.

Notes for Math 290 using Introduction to Mathematical Proofs by Charles E. Roberts, Jr.

Chapter 2 - Basics Structures MATH 213. Chapter 2: Basic Structures. Dr. Eric Bancroft. Fall Dr. Eric Bancroft MATH 213 Fall / 60

Discrete Mathematics

COM S 330 Homework 05 Solutions. Type your answers to the following questions and submit a PDF file to Blackboard. One page per problem.

9/19/2018. Cartesian Product. Cartesian Product. Partitions

Sets McGraw-Hill Education

Chapter 2 - Basics Structures

Transcription:

Sets and Functions 1. The language of sets Informally, a set is any collection of objects. The objects may be mathematical objects such as numbers, functions and even sets, or letters or symbols of any sort, or objects of thought, or objects that we observe in the real world. For the purposes of this course we are primarily interested in sets whose objects are mathematical in nature, but we will also consider other kinds of sets for illustrative purposes. The objects of the set are called the elements of the set. Notation 1.1. If S is a set, and a is an object, then we write a S to mean that a is an element of the set S ( we also say that a belongs to S) and a S means that a is not an element of the set S. Example 1.2. Let S be the set of all people and T the set of all living people. Then Julius Caesar S but Julius Caesar T. Notation 1.3. We use braces ({ and }) to describe sets in an explicit way. The set whose elements are the letters a, b and c and the numbers 3, 5 and 7 (and which has no other elements) is denoted {a, b, c, 3, 5, 7}. (As we will see, in describing a set the order in which elements are listed is irrelevant). Here are some standard sets in mathematics: (1) The set of natural numbers N := {1, 2, 3,...}. Thus 1 N but 1 N. (2) The set of integers Z = {..., 2, 1, 0, 1, 2,...}: 57 Z, 1 2 Z. (3) The set of rational numbers Q: 1 2 Q, 58 Q, 2 Q. (4) The set of all real numbers R: 2 R. 2 R Example 1.4. The elements of sets may be sets themselves. The following set has three elements, one of which is a set: A := {1, 2, {3, 4}}. Thus 1 A, 2 A, {3, 4} A, but 3 A, 4 A. 1

2 1.1. Subsets. Notation 1.5. If A and B are sets we write A B (and say A is contained in B or A is a subset of B ) if every element of A is also an element of B:i.e. A B x x A = x B. Example 1.6. We have N Z, Z Q, Q R. Example 1.7. Let A be the set {1, 2, {3, 4}}, as above. Then {1, 2} A. However, {3, 4} A (since 3 A, 4 A). Of course, {3, 4} A. Example 1.8. Let B be the set {1, 2, {1, 2}}. Then {1, 2} B and {1, 2} B. (It is, needless to say, a very rare situation when a set is both an element and a subset of another set.) Here we prove an obvious statement: Lemma 1.9. If A, B and C are sets and if A B, B C then A C. Proof. Let a be any element of A. Since A B, a B. Since B C every element of B is an element of C. In particular, a C. We ve shown that every element of A is also an element of C. Thus A C. Remark 1.10. Note that, by definition, any set A is a subset of itself (since it is always true that x A = x A). Thus, it is always true that A A. Definition 1.11. If A is a set, then by a proper subset of A we mean a subset other than A itself. If B is a proper subset of A we sometimes denote this by B A. 1.2. The empty set. There is a unique set which has no elements. It is called the empty set or the nullset. It is denoted. Thus the following statement follows: x, x. Note furthermore that the empty set is a subset of every other set (since the statement x = x A is vacuously true for any object x: the hypothesis x is always false). Thus for any set A we have A. Remark 1.12. Note that the empty set is itself a mathematical object; it is a particular example of a set. It is something rather than nothing. It may help to visualize it as an empty bag. Example 1.13. Let X = { }. Then X, since X has an element, namely. Observe that X (true for every set) and X (rare).

1.3. Unions of sets. If A and B are sets then we form a new set A B ( A union B ) by pooling together the elements of A and the elements of B into a single set. Thus x A B x A or x B. Note that any given element can occur in a set only once. Example 1.14. If A = {1, 2, 3} and B = {3, 5, 7} the A B = {1, 2, 3, 5, 7}. Similarly {1, 2, a, b, c} {1, 3, b, d, f} = {1, 2, 3, a, b, c, d, f}. Example 1.15. If A is the set of all Irish people and B is the set of all astronomers, then A B is the set of all people who are either Irish or astronomers. Remark 1.16. Note that if A and B are any two sets, then A A B, B A B. More generally, if A 1, A 2, A 3... is any list of sets, we define A 1 A 2 A 3 = (A 1 A 2 ) A 3 to be the set consisting of those elements which belong to (at least) one of the three sets and 3 etc. A 1 A 2 A 3 A 4 = ((A 1 A 2 ) A 3 ) A 4 1.4. Intersection of Sets. If A and B are sets then we form a new set A B ( A intersect B or the intersection of A and B) by including only the elements which belong both to A and to B. Thus x A B x A and x B. Example 1.17. If A = {1, 2, 3} and B = {3, 5, 7} the A B = {3}. {1, 2, a, b, c} {1, 3, b, d, f} = {1, b}. Example 1.18. If A is the set of all Irish people and B is the set of all astronomers, then A B is the set of all people who are both Irish and astronomers; i.e. the set of all Irish astronomers. Remark 1.19. Note that if A and B are any two sets, then A B A, and A B B. As in the case of unions, we can take intersections of three or more sets: A 1 A 2 A 3 = (A 1 A 2 ) A 3 is the set consisting of those elements which belong to all three sets. Etc.

4 1.5. Disjoint sets. Definition 1.20. We say that two sets A and B are disjoint if A B = ; i.e. if they have no elements in common. Example 1.21. The set of all cats is disjoint from the set of all dogs. Example 1.22. The set N is disjoint from the set R <0 := {x R x < 0}. Example 1.23. The set of all integers divisible by 3 is not disjoint from the set of all integers divisible by 4, since the integer 12 belongs to both sets. Definition 1.24. We say that a set A is the disjoint union of two subsets B and C if A = B C and B C =. We often denote this by A = B C. Example 1.25. Z is the disjoint union of the set of even integers and the set of odd integers. More generally we say that A is the disjoint union of the subsets A 1,..., A n if (1) A = A 1 A n and (2) A i A j = when i j (we say that the collection A 1,..., A n is pairwise disjoint) and we denote this by A = A 1 A 2 A n. Example 1.26. Let A 0 = {m Z m 0 (mod 3)}, A 1 = {m Z m 1 (mod 3)} and A 2 = {m Z m 2 (mod 3)}. Then Z = A 0 A 1 A 2. 1.6. Equality of Sets. A set is completely determined by its elements: i.e. two sets are equal if they have precisely the same elements. Thus if A and B are sets then A = B A B and B A. Thus if we wish to prove that A = B we must prove that A B and that B A, or equivalently that for any x, x A = x B and x B = x A. Here is a simple example of proving a (fairly obvious) statement using these definitions: Lemma 1.27. Let A and B be any two sets. Prove that A B B = A B.

Proof. = : Suppose that A B. We must show that B = A B. Now it is always true that B A B. It remains to prove that A B B: Let x A B. Then, by definition, x B or x A. If x B then x B. Otherwise x A and hence x B since A B. So either way, x B and we are done. =: Conversely, suppose that B = A B. Then A A B (always true) = A B. 1.7. Subsets defined by properties. Any given set has many subsets in general. In practice most are either uninteresting or impossible to describe or imagine. (It will never be possible to describe or fully imagine all the infinitely many subsets of the set R of real numbers.) The interesting or useful subsets are those which correspond to some property or list of properties. Let P (x) denote a statement about a variable x; eg, x is an astronomer, x > 0, x is prime. If a is the name of an object then we can substitute it in for x to get a statement P (a) which may be either true or false: Kepler is an astronomer, 5 > 0, 12 is prime If A is any set, then we write {a A P (a)} to denote the subset of A consisting of those elements a for which the statement P (a) is true; it is the subset of A described by the property P. Example 1.28. N = {m Z m > 0}. Example 1.29. The interval [1, 2] consisting of all real numbers between (or equal to) 1 and 2 is the set {x R x 1 and x 2} = {x R 1 x 2}. Example 1.30. If A and B are any sets then A B = {x A x B} = {x B x A}. Example 1.31. {m Z 2 m} is the set of all even integers. {m Z 3 m and m > 11} is the set of all integers which are greater than 11 and divisible by 3. 1.8. Differences and complements. If A and B are any sets then the (set-theoretic) difference A \ B is defined by A \ B := {x A x B}. Example 1.32. Let A = {1, 2, 3, a, b, c} and B = {2, 4, 6, a, c, e}. Then A \ B = {1, 3, b} and B \ A = {4, 6, e}. Remark 1.33. Note that A B is always disjoint from A \ B and that A = (A B) (A \ B). 5

6 Example 1.34. Let A = {m Z 2 m} and A = {m Z 3 m}. Then while A \ B = {m Z 2 m and 3 m} = {..., 2, 2, 4, 8, 10, 14,...} A B = {m Z 2 m and 3 m} = {m Z 6 m} = {..., 12, 6, 0, 6, 12,...}. Remark 1.35. If A and B are any sets and if x A B then one and only one of the following three statements about x is true: Thus (1) x belongs to A but not B: x A \ B. (2) x belongs to B but not A: x B \ A. (3) x belongs to both A and B: x A B. A B = (A \ B) (A B) (B \ A). Exercise 1.36. Draw a picture illustrating this last remark. 1.9. The Power Set of a set. Definition 1.37. If A is any set then the power set of A, which we will denote P(A), is the set whose elements are precisely the subsets of A. Example 1.38. Let A = {a}. Then A has precisely two subsets; namely, and A. Thus P(A) = {, A} = {, {a}}. Remark 1.39. If A is any nonempty set, then A always has the two subsets and A. So P(A) always has at least two elements. Example 1.40. Let A = {1, 2}. Then A has four subsets:, {1}, {2} and A = {1, 2}. Thus P(A) = {, {1}, {2}, {1, 2}}. Remark 1.41. The set {a} whose only element is the object a should not be confused the object a itself. Example 1.42. Note that P( ) = { }. This is not the empty set. Exercise 1.43. Let A = {1, 2, 3}. Then A has eight subsets in total; P(A) has eight elements. List them. 1.10. Cartesian products. Definition 1.44. Let A and B be any nonempty sets (we allow A = B). The cartesian product of A and B, denoted A B is the set whose elements are all ordered pairs of the form (a, b) where a A and b B: A B := {(a, b) a A, b B}.

Remark 1.45. The key property of ordered pairs is that order of the elements matters: If a b then (a, b) (b, a). More generally the rule governing ordered pairs is the following: The ordered pair (a, b) is equal to the ordered pair (c, d) if and only if a = c and b = d. Example 1.46. If A = {1, 2} and B = {a, b, c} then A B = {(1, a), (1, b), (1, c), (2, a), (2, b), (2, c)}. So A B has 2 3 = 6 elements. Example 1.47. R R, also denoted R 2, is the cartesian plane consisting of all pairs (x, y) of real numbers x and y. It is visualized as an infinite plane containing two perpendicular lines (or axes ), one horizontal and the other vertical, in which the element (x, y) labels the point whose (perpendicular) distance to the vertical axis is x and whose distance to the horizontal axis y. The numbers x and y are the coordinates of the point. (See your calculus course for details.) Example 1.48. Z Z = Z 2 R 2 is the integer lattice in R 2 ; it is the set of all points both of whose coordinates are integers. Definition 1.49. If we have three sets A, B, C we can form the product A B C whose elements are all ordered triples (a, b, c) with a A, b B and c C. More generally, if A 1,..., A n is a list of sets then A 1 A n is the set whose elements are all ordered n-tuples (a 1,..., a n ) with a i A i for i = 1, 2,..., n. Remark 1.50. Clearly we can identify the set (A B) C with the set A B C. The elements of the first have the form ((a, b), c) and those of the second look like (a, b, c). Either way, these are just ordered triples, and it is both convenient and reasonable to regard them as being the same. 2. Functions Notation 2.1. Let A and B be any two sets. Informally, a function ( or map ) f from A to B associates to each element of A one and only one element of B. The set A is called the domain of the function f, and the set B is called the codomain or target of f. (We will sometimes refer to elements of the domain as inputs of the function.) If a A, the element of the set B which the function f associates to a is called the value of f at a and is usually denoted f(a). (We will sometimes refer to this as the output of f at a, but this is not really standard mathematical terminology.) 7

8 We often encapsulate this information with the notation: f : A B, a f(a). Example 2.2. Let A = {1, 2, 3} and let B = {a, b}. We can define or construct maps from A to B at will, simply by specifying the value of the function at each input, 1, 2 and 3: For example, let f : A B be the following function: f(1) = b f(2) = b f(3) = a. Let g : A B be the function g(1) = b g(2) = a g(3) = b. (Q: How many functions are there from A to B?) Similarly, we can construct functions from B to A: Let h : B A be the function h(a) = 2 h(b) = 3. (Q: How many functions are there from B to A?) If the domain of a function is infinite, then, of course, we cannot describe the function, input by input, in this way. The functions of mathematical interest in such cases are usually constructed via a formula or procedure of some kind: i.e. we describe a procedure for determing the value of the function at a typical element of the domain x. Example 2.3. The squaring function on R is the function f : R R, x x 2. Thus for any real number x, the value of this function is x 2 ; i.e. R, f(x) = x 2. Thus f(0) = 0 2 = 0, f(5) = 5 2 = 25, f(π) = π 2, f( 5) = ( 5) 2 = 25,... x

9 Example 2.4. The identity function on R is the function f : R R, x x. Thus f(x) = x for all real numbers x. Example 2.5. In fact, we can do the same for any set A. The identity function on a set A is the function whose value at any input a is again a. This is one of the most basic and important examples of a function. We will use the notation Id A for this function. Thus, the domain and codomain of Id A are both A: Id A : A A, a a. If we take the set A = {1, 2, 3}, for example, then Id A (1) = 1 Id A (2) = 2 Id A (3) = 3. Example 2.6. We have already met the floor x of a real number x: it is the largest integer which is less than or equal to x. We can use it to construct a function: f : R Z, x x. So f(π) = π = 3, f(78.2) = 78.2 = 78, f(28/6) = 28/6 = 4 etc. Example 2.7. Let A be any set and let B be a subset of A. The indicator function of B in A is the function, 1 B, which sends a to 1 if a B and to 0 otherwise: It is the function defined by 1 B : A {0, 1} a A, 1 B (a) = { 1, a B 0, a B. For example, if A = {a, b, c, d} and B = {a, c} then 1 B (a) = 1 1 B (b) = 0 1 B (c) = 1 1 B (d) = 0.

10 Example 2.8. Let B A. The the map f : B A, f(b) = b is called the inclusion map of B in A. (Note that if B A it is not equal to the identity function Id B ; it has a different codomain. See 2.2 below.) 2.1. Composition of Functions. Suppose that A, B and C are any sets (not necessarily distinct from each other) and that f : A B and g : B C are functions. Thus if a A, the value of f at a, f(a), is an element of B, and therefore is an admissible input for the function g. The value of g at f(a), g(f(a)) is an element of C. Thus, using f and g, we have a method by doing f first, and then g to associate to any element a A an element g(f(a)) in C; i.e. by doing g after f, we have a new function from A to C. Definition 2.9. Given two functions f : A B and g : B A, g composed with f, denoted g f is the function described as follows: g f : A C, a g(f(a)). Example 2.10. Let A = {1, 2, 3}, B = {a, b} and C = {5, 6, 7}. f : A B be the function and let g : B C be the function Then g f : A C is the function f(1) = a f(2) = b f(3) = b g(a) = 5 g(b) = 7. (g f)(1) = g(f(1)) = g(a) = 5 (g f)(2) = g(f(2)) = g(b) = 7 (g f)(3) = g(f(3)) = g(b) = 7. Example 2.11. Let f : R R be the function defined by f(x) = x 3, and let g : R R be the function g(x) = x + 3. Then the function g f : R R is given by (g f)(x) = g(f(x)) = g(x 3 ) = x 3 + 3 x R. On the other hand, the composite f g : R R is also defined, and it is given by (f g)(x) = f(g(x)) = f(x + 3) = (x + 3) 3 x R. Note that the functions g f and f g are quite different. Remark 2.12. Observe that if f and g are any two functions then the composite function g f is defined only if the codomain of f is the same as the domain of g. When this happens we say that g can be composed with f. Let

2.2. Equality of Functions. It will be important to us below to understand exactly what is meant by saying that the function f equals the function g: Definition 2.13. Let f and g be any two functions. The f = g if and only if (1) The domain of f is equal to the domain of g, (2) The codomain of f is equal to the codomain of g and (3) f(a) = g(a) for all elements a of the domain. Example 2.14. Let f : R Z be the function f(x) = x and let g : R R be the function g(x) = x. Then f g since the codomain of f is not the same as the codomain of g. Example 2.15. Let f : R R be the function f(x) = x 2 and let g : [0, ) R be the function g(x) = x 2. (Here [0, ) is a notation for the interval {x R x 0} of all nonnegative real numbers.) Then f g since they have different domains. Example 2.16. Let A = {1, 2, 3}, B = {a, b, c}, C = A = {1, 2, 3}. Consider the following four functions: f 1 : A B, f 1 (1) = a, f 1 (2) = b, f 1 (3) = c f 2 : A B, f 2 (1) = b = f 2 (2), f 2 (3) = c 11 and g 1 : B C, g 1 (a) = 1 = g 1 (b), g 1 (c) = 2 g 2 : B C, g 2 (a) = 3, g 2 (b) = 1, g 2 (c) = 2. Note that f 1 f 2 and g 1 g 2. However, I Claim that g 1 f 1 = g 2 f 2. First note that both of these functions have the same domain (A) and the same codomain (C). We need finally to check that they take the same value at each input: (g 1 f 1 )(1) = g 1 (f 1 (1)) = g 1 (a) = 1, (g 2 f 2 )(1) = g 2 (f 2 (1)) = g 2 (b) = 1 (g 1 f 1 )(2) = g 1 (f 1 (2)) = g 1 (b) = 1, (g 2 f 2 )(2) = g 2 (f 2 (2)) = g 2 (b) = 1 (g 1 f 1 )(3) = g 1 (f 1 (3)) = g 1 (c) = 2, (g 2 f 2 )(3) = g 2 (f 2 (3)) = g 2 (c) = 2 Lemma 2.17. Let f : A B be any function. Then (1) f Id A = f. (2) Id B f = f.

12 Proof. (1) First note that f can be composed with Id A since the codomain of Id A is A, which is the domain of f. The functions f and f Id A both have domain A and codomain B. Finally, for any a A, we have (f Id A )(a) = f(id A (a)) = f(a). So the two functions are equal. (2) Similar. Do it as an exercise. Remark 2.18. Note that if f : A B is a function and if A B, then the composites Id A f and f Id B are not defined. 2.3. Surjective maps. Definition 2.19. Given a function f : A B, the image (or range) of f, denoted Image(f) or f(a), is the subset of B consisting of all values (or outputs) of the function f; i.e. it is the set {b B b = f(a) for some a A}. Definition 2.20. A map f : A B is surjective or onto if Image(f) = B; i.e. f is surjective if for every b B there is at least one a A with f(a) = b. Remark 2.21. Another informal way to say this is that the function f is surjective if every element of the target gets hit. Example 2.22. The doubling function f : R R, f(x) = 2x is surjective. Proof. To prove this we must show that any element, y say, in the codomain R lies in the image of this function; i.e. we must show that every real number y is twice some other real number. We spell out the argument: Let y R. Then y = 2 y ( y ) 2 = f. 2 Example 2.23. The squaring function f : R R, f(x) = x 2 is not surjective. The number 1 R does not lie in the image of this map. Example 2.24. However, the function f : R [0, ), f(x) = x 2 is onto: Let y [0, ). Then y 0. So y = ( y) 2 = f( y) lies in Image(f).

Example 2.25. The map f : R R, x sin(x) is not surjective (for example 2 is not in the image). But the map f : R [ 1, 1], x sin(x) is surjective. For real functions functions f : R R surjectivity can often be read off from the graph of the function. Recall that the graph of the function is the set {(x, y) R 2 y = f(x)} R 2. We have the following criterion: Lemma 2.26. Let f : R R be a real function. Then f is surjective if and only if every horizontal line cuts the graph at least once. Proof. Suppose f is surjective. Let L be a horizontal line. The equation of L is y = b for some real number b. Since f is surjective, b = f(a) for some a R. Thus the point (a, b) lies on the graph and the line L. Conversely suppose every horizontal line cuts the graph. Let b R. The horizontal line y = b cuts the graph at some point; i.e. the graph contains the point (a, b) for some a R. By definition of the graph, it follows that b = f(a). Thus b Image(f) and f is surjective. The following is an important general criterion for the surjectivity of a map: Theorem 2.27. Let f : A B be a function. The following statements are equivalent: (1) f is surjective. (2) There exists a function g : B A with the property that f(g(b)) = b for all b B. Proof. (1)= (2): Suppose f is surjective. We describe how to construct a function g : B A with the required property: For each b B choose some a A with f(a) = b and define g(b) = a. Then, by definition, f(g(b)) = f(a) = b. (2)= (1): Suppose that a function g exists with the stated property. Let b B. Let a = g(b). Then f(a) = f(g(b)) = b. So b Image(f) and f is surjective. Example 2.28. Let f : R [0, ) be the function f(x) = x 2. We have seen already that f is surjective. Let g : [0, ) R be the function g(x) = x. Then g has the property stated in the theorem: Let b [0, ). Then f(g(b)) = f( b) = ( b) 2 = b. However g is not the only function with this property. For example the function h : [0, ) R, x x also has this property: Let b [0, ). Then f(h(b)) = ( b) 2 = b. 13

14 Example 2.29. Let f : R Z be the floor function x x. f is surjective. In fact it is easy to find a function g as in the theorem. For example, let g : Z R be the inclusion map defined by g(n) = n. Then, for all n Z, f(g(n)) = f(n) = n = n. However there are an infinity of other functions Z R with the required property. For example, fix some number a lying between 0 and 1. We use this number to define a function from Z to R which we ll name g a : Then for every n Z g a : Z R, n n + a. f(g a (n)) = f(n + a) = n + a = n since n < n + a < n + 1. Let us consider the situation described in the Theorem: We have two functions f : A B and g : B A satisfying f(g(b)) = b for all b B. Note that this later statement is entirely equivalent to the equation of functions f g = Id B. Thus we can rephrase the Theorem as saying that f : A B is surjective if and only if there is a function g : B A satisfying f g = Id B. Definition 2.30. Suppose given two functions f : A B and g : B A which satisfy f g = Id B. Then g is said to be a right inverse of f and f is said to be a left inverse of g. With this terminology, we can - yet again - rephrase the theorem: Theorem 2.31. A map is surjective if and only if it has a right inverse. Note, however, that our examples show that a surjective function can have many even infinitely many distinct right inverses. (Thus, we are not usually entitled to talk of the right inverse of a function.) 2.4. Injective maps. Definition 2.32. A function f : A B is said to be injective or 1-to-1 if it has the property that unequal elements of the domain have unequal values: For all a 1, a 2 A if a 1 a 2 then f(a 1 ) f(a 2 ). Note that an equivalent and often more useful way to state this is: f is injective if it has the property that, for all a 1, a 2 A, f(a 1 ) = f(a 2 ) = a 1 = a 2. Example 2.33. The doubling function f : R R, x 2x is injective: For suppose f(a 1 ) = f(a 2 ). Then 2a 1 = 2a 2. Dividing by 2, we get a 1 = a 2 as required.

Example 2.34. Let f : R R be the map f(x) = x 2. Then f is not injective: 1 1 in R, but f( 1) = 1 = f(1). So two different inputs yield the same output. Example 2.35. However, the function f : [0, ) R, x x 2 is injective. For suppose that f(a 1 ) = f(a 2 ). Then a 2 1 = a 2 2. It follows that a 2 1 = a 2 2. But a 1 = a 2 1 and a 2 = a 2 2 since a 1, a 2 0. Thus a 1 = a 2 as required. Example 2.36. The map f : {1, 2, 3} {1, 2, 3} defined by f(1) = 1, f(2) = 3 and f(3) = 1 is not injective since 1 3 but f(1) = f(3). Lemma 2.37. Let f : R R be a function. Then f is injective if and only if every horizontal line in R 2 intersects the graph at most once. Proof. Suppose that f is injective and that L is a horizontal line. The equation of L is y = b for some b R. Suppose, for the sake of contradiction that L intersects the graph at two points. Thus there are distinct points (a 1, b) and (a 2, b) lying on L and on the graph of f. By definition of the graph, we have f(a 1 ) = b = f(a 2 ), which contradicts injectivity of f. Conversely, suppose that every horizontal line cuts the graph at most once. Suppose that f(a 1 ) = f(a 2 ) for some a 1, a 2 R. We must show that a 1 = a 2. Let b = f(a 1 ) = f(a 2 ). The points (a 1, b) and (a 2, b) lie on the graph and on the horizontal line y = b. By our hypothesis, they must be the same point and hence a 1 = a 2. We also have the following general criterion of injectivity: Theorem 2.38. A function f : A B is injective if and only if it has a left inverse g : B A; i.e. if and only if there is a function g : B A satisfying g f = Id A. Equivalently, f : A B is injective if and only if f has a left inverse g : B A. Proof. Observe that the condition g f = Id A is equivalent to g(f(a)) = a for all a A. Suppose now that f is injective. We construct a left inverse g : B A as follows: Choose once and for all some fixed element, call it p, in A. Let b B. We must describe the element g(b) A. There are two possibilities: (1) If b Image(f), then b = f(a) for some unique a A. We set g(b) = a. (2) If b Image(f), we simply let g(b) = p. Now let a be any element of A. Let b = f(a). Then b Image(f) and a is the unique element of A which is mapped to b by f. So g(b) = a by definition. Thus g(f(a)) = g(b) = a as required. 15

16 Conversely, suppose that f has a left inverse g : B A. We will show that f is injective: Suppose that a 1, a 2 A satisfy f(a 1 ) = f(a 2 ). Then a 1 = g(f(a 1 )) = g(f(a 2 )) = a 2. Example 2.39. Let f : Z R be the inclusion map n n. This is clearly injective. Note that the floor function g : R Z, x x is a left inverse: For all n Z, g(f(n)) = g(n) = n = n. There are, however, (infinitely) many other left inverses of f. For example, let h : R Z be the function described as follows: { x, x Z h(x) = 0, x Z Then h(f(n)) = h(n) = n for all n Z; i.e. h f = Id Z. 2.5. Bijective maps. Definition 2.40. A map f : A B is said to be bijective if it is both injective and surjective. We often call such a map a bijection or a bijective correspondence. Thus f : A B is bijective if every element b of B is the value of f at one and only one element a and A; i.e. the function f pairs the elements of A with the elements of B in such a way that each element of A gets paired with one and only one element B and vice versa. Example 2.41. The map f : {1, 2, 3} {a, b, c} given by f(1) = a f(2) = b and f(3) = c is one example of a bijection between these two sets. The map g : {1, 2, 3} {a, b, c} given by g(1) = b, g(2) = c and g(3) = a is another bijection between these two sets. Example 2.42. For any set A the identity map Id A is a simple example of a bijection from A to itself. Example 2.43. The map f : {1, 2, 3} {1, 2, 3} given by f(1) = 2, f(2) = 1 and f(3) = 3 is bijection from the set {1, 2, 3} to itself. Definition 2.44. A permutation of a finite set A is a bijection from A to itself. Putting together Lemmas 2.26 and 2.37 we get: Lemma 2.45. A real function f : R R is bijective if and only if every horizontal line cuts the graph exactly once. On the other hand, by Theorems 2.27 and 2.38 an arbitrary function f : A B is bijective if and only if f has both a right inverse g : B A and a left inverse h : B A.

Theorem 2.46. Suppose that f : A B has both a right inverse and a left inverse. Then they are equal to each other and f has only one right or left inverse. Proof. First Proof Let g : B A be a right inverse of f, and let h : B A be a left inverse. h and g have the same domain and codomain, so it remains to show that g(b) = h(b) for all b B. Let b B. Since f is bijective, there is a unique a A satisfying f(a) = b. Since g is a right inverse, we have f(g(b)) = b also. By uniqueness of a, this implies g(b) = a. On the other hand, since h is a left inverse, we have h(f(a)) = a. But f(a) = b. So h(b) = a = g(b). Thus g = h as required. If g is another right inverse, then we also have g = h and hence g = g. So there is only one right inverse. Similarly there is only one left inverse (which is also a right inverse). Second Proof Let g : B A be a right inverse. Then f g = Id B. Let h : A B be a left inverse. Then h f = Id A. We show that g = h as follows: h = h Id B = h (f g) = (h f) g = Id A g = g. Definition 2.47. Given a function f : A B, a function g : B A is called a (2-sided) inverse if it is both a left and a right inverse. Note that if g is a 2-sided inverse of f then f is a 2-sided inverse of g by symmetry. If a 2-sided inverse exists then there is only one (by Theorem 2.46). We denote it f 1. We conclude: Theorem 2.48. A function f is bijective if and only it has a 2-sided inverse f 1. If f : A B is a bijection, then the inverse map is the map which sends every element of B back to where it came from. Example 2.49. Let f : {1, 2, 3} {a, b, c} be the bijection f(1) = a, f(2) = b and f(3) = c. The inverse map f 1 : {a, b, c} {1, 2, 3} is then the map f 1 (a) = 1, f 1 (b) = 2 and f 1 (c) = 3. 17

18 We often prove that a map is bijective by constructing a (2-sided) inverse. Example 2.50. I claim that the map f : [0, ) [0, ), x x 4 bijective. is Proof. Let g : [0, ) [0, ) be the map g(x) = 4 x. For all x [0, ) we have f(g(x)) = f( 4 x) = ( 4 x) 4 = x. So g is a right inverse of f. For all x [0, ) we have g(f(x)) = g(x 4 ) = 4 x 4 = x (since x 0). So g is a left inverse of f. Thus f is bijective and g = f 1. Example 2.51. Let f : R R be the map f(x) = 5x and let g : R R be the map g(x) = x/5. Then g = f 1 : f(g(x)) = f(x/5) = 5 (x/5) = x and g(f(x)) = g(5x) = (5x)/5 = x for all x R. Lemma 2.52. If f : A B is a bijection and g : B C is a bijection, then g f : A C is a bijection. Proof. We have inverses g 1 : C B and f 1 : B A. We show that f 1 g 1 is an inverse of g f: (f 1 g 1 ) (g f) = f 1 (g 1 g) f = f 1 Id B f = f 1 f = Id A. Similarly, (g f) (f 1 g 1 ) = Id C. Appendix A. The mathematical definition of Function In Section 2 above, we gave an informal account of what a function is, good enough for our purposes. But we did not say precisely what a function is. The word associates has no precise mathematical meaning and we didn t attempt to explain it. Our informal definition does not address questions such as: (1) Is a function itself a kind of set or some new kind of mathematical object, and if so, what kind of object? (2) How can we determine whether something is or is not a function? In modern mathematics, we define the concept of function as follows:

Definition A.1. Let A and B be sets (possibly equal). A function f from A to B is a subset of A B with the following property: For every a A, there is one and only one b B such that (a, b) f. The set A is called the domain of the function f, and B is called the codomain or target. We denote this by f : A B. For any a A the unique b B with the property that (a, b) f is called the value of f at a and is denoted f(a). Example A.2. For example, consider the subset f := {(1, a), (2, a), (3, b), (4, c)} of {1, 2, 3, 4} {a, b, c, d}. Then f is a function from {1, 2, 3, 4} to {a, b, c, d} since each of 1, 2, 3 and 4 occur exactly once as the first entry (or coordinate) of an element of f. We can equally describe the function f as follows: f : {1, 2, 3, 4} {a, b, c, d}, f(1) = a, f(2) = a, f(3) = b, f(4) = c. Example A.3. The subset g := {(1, a), (1, b), (2, c), (3, d), (4, d)} of {1, 2, 3, 4} {a, b, c, d} is not a function from {1, 2, 3, 4} to {a, b, c, d} since both (1, a) and (1, b) belong to it. 19