You are on page 1of 763
Second Edition Discrete Mathematics for Computer Scientists and Mathematicians Joe L. Mott Abraham Kandel Theodore P. Baker The Florida State University Department of Mathematics and Computer Science Prentice-Hall of India Linaftied) New penis 10001 Indian Reprint—Rs. 350.00 (Original U.S. Edition—Rs. 3547.00) DISCRETE MATHEMATICS FOR COMPUTER SCIENTISTS AND MATHEMATICIANS, 2nd Ed. by Joe L. Mott, Abraham Kandel and Theodore P. Baker © 1986 by Joe L. Mott, Abraham Kandel and Theodore P. Baker. All rights reserved. No part of this book may be reproduced in any form, by mimeograph or any other means, without permission in writing from the publisher. ISBN-978-81-203-1502-0 Published by Asoke K. Ghosh, Prentice-Hall of India Private Limited, M-97, Connaught Circus, New Deihi-110001 and Printed by V.K. Batra at Pearl Offset Press Private Limited, New Delhi-110015. Contents Preface, vii Acknowledgments, xiii A Note to the Reader, xiv Foundations, 1 11 Basics, 1 1.2 Sets and Operations of Sets, 2 1.3 Relations and Functions, 9 1.4 Some Methods of Proof and Problem-Solving Strategies, 17 1.5 Fundamentals of Logic, 33 1.6 Logical Inferences, 45 1.7 Methods of Proof of an Implication, 60 18 First Order Logic and Other Methods of Proof, 79 1.9 Rules of Inference for Quantified Propositions, 97 1.10 Mathematical Induction, 103 Elementary Combinatorics, 125 2.1 Basics of Counting, 126 2.2 Combinations and Permutations, 143 2.3 Enumeration of Combinations and Permutations, 147 24 Enumerating Combinations and Permutations with Repetitions, 162 2.5 Enumerating Permutations with Constrained Repetitions, 172 2.6 Binomial Coefficients, 189 | 2.7 The Binomial and Multinomial Theorems, 201 2.8 The Principle of Inclusion-Exclusion, 211 Recurrence Relations, 237 3.1 Generating Functions of Sequences, 237 3.2 Calculating Coefficients of Generating Functions, 247 3.3 Recurrence Relations, 264 vi Contents 34 3.5 3.6 Solving Recurrence Relations by Substitution and Generating Functions, 280 The Method of Characteristic Roots, 300 Solutions of Inhomogeneous Recurrence Relations, 306 Relations and Digraphs, 331 41 42 43 44 45, 46 47 48 49 Relations and Directed Graphs, 331 Special Properties of Binary Relations, 339 Equivalence Relations, 349 Ordering Relations, Lattices, and Enumerations, 362 Operations on Relations, 379 Paths and Closures, 388 Directed Graphs and Adjacency Matrices, 395 Application: Sorting and Searching, 415 Application: Topological Sorting, 428 Graphs, 437 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 Basic Concepts, 437 Isomorphisms and Subgraphs, 449 Trees and Their Properties, 468 Spanning Trees, 480 Directed Trees, 498 Binary Trees, 507 Planar Graphs, 523 Euler’s Formula, 580 Multigraphs and Euler Circuits, 535 5.10 Hamiltonian Graphs, 452 5.11 Chromatic Numbers, 558 5.12 The Four-Color Problem, 569 Boolean Algebras, 577 6.1 6.2 6.3 6.4 6.5 6.6 Introduction, 577 Boolean Algebras, 578 Boolean Functions, 588 Switching Mechanisms, 595 Minimization of Boolean Functions, 605 Applications to Digital Computer Design, 613 Contents vil Network Flows, 631 TA 1.2 1.3 TA 15 Graphs as Models of Flow of Commodities, 631 Flows, 636 Maximal Flows and Minimal Cuts, 645 The Max Flow-Min Cut Theorem, 659 Applications: Matching and Hall’s Marriage Theorem, 686 Representation and Manipulation of Imprecision, 699 8.1 8.2 8.3 Fuzzy Sets, 699 Possibility Theory, 715 Application of Fuzzy Set Theory to Expert Systems, 720 Bibliography, 735 Index, 739 Preface This text is intended for use in a first course in discrete mathematics in au undergraduate computer science and mathematics curriculum. The level is appropriate for a sophomore or junior course, and the number of topics and the depth of analysis can be adjusted to fit a one-term or a two-term course. A computer science student can take this course concurrently with the first course in programming preliminary to the study of data structures and the design and analysis of algorithms. A mathematics student may take this course concurrently with the first caleulus course. No specific background is prerequisite outside of the material ordi: narily covered in most college algebra courses. In particular, a calculus background is not required for Chapters 1 to 7. While it is not necessary, knowledge of limits would help in understanding the proof of one theorem in Chapter 7 and knowledge of integration would enhance understanding some of the discussions in Chapter 8. We have assumed that students will have had little or no programming experience, although it would be desirable. Our assumption about background has dictated how we have written the text in certain places. For instance, in Chapter 3, we have avoided reference to the convergence of power series by representing the geomet- ric series Dax! as the multiplicative inverse of 1 — aX; in other words, we have considered power series from a strictly algebraic rather than the analyti- cal viewpoint. Likewise, in Chapter 4, we avoid reference to limits when x Preface we discuss the asymptotic behavior of functions and the “big O notation,” but if students understand limits, then exercises 11 and 12 in Section 4.2.1 will greatly streamline the discussion. ‘The Association for Computing Machinery, CUPM, and others have recommended that a computer science curriculum include a discrete mathematics course that introduces the student to logical and algebraic structures and to combinatorial mathematics including enumeration methods and graph theory. This text is an attempt to satisfy that recommendation. Furthermore, we expect that some of the teachers of this course will be mathematicians who are not computer scientists by profession or by training. Therefore, we have purposely suppressed writing many algo- rithms in computer programming language, although on occasions it would have been easier to do so. We believe that a discrete mathematics course based on our book will meet several important needs of both computer science and mathematics majors. While the basic content of the book is mathematics, many applications are oriented toward computer science. Moreover, we have attempted to include examples from computer science that can be discussed without making presumptions about the reader’s background in computer science. Many apparently mathematical topics are quite useful for computer science students as well. In particular, computer science students need to understand graph theory, since many topics of graph theory will be applied in a data structures course. Moreover, they need mathematical induction as a proof technique and to understand recursion, Boolean algebra to prepare for digital circuit design, logic and other proof techniques to be able to prove correctness of algorithms, and recurrence relations to analyze algorithms. Besides that, computer science students need to see how some real life problems can be modeled with graphs (like minimal spanning trees in Section 5.4, scheduling problems and graph coloring in Section 5.11, and network flow problems in Chapter 7). Mathematics majors, on the other hand, will use graphs as a modeling tool, and they will benefit from a study of recurrence relations to understand computer solutions of differential equations. But more than that, discrete mathematics provides a good training ground for the mathematics student to learn to solve problems-and to make correct proofs. For this reason, mathematics majors should take discrete mathe- matics quite early in their program of studies, preferably before those courses that require many proofs. Discrete mathematics embodies the spirit of mathematical and scien- tific research perhaps more than almost any other undergraduate mathe- matics course. In graph theory, for example, powerful concepts can be defined and grasped because they can be visualized and simple examples Preface xi can be constructed easily. This feature and others make the subject both challenging and rewarding to student and teacher alike. ‘The text has evolved over a period of years and, in that time, our curriculum at Florida State University has changed significantly, espe- cially for computer science students. Thus, not only has the list of topics changed, but also the order in which we discuss them. Consequently, we have written the text so that the chapters are more or less independent of each other. The following diagram shows the basic logical relationship among the chapters. Chapter 3 Chapter 2 x Chapter 6 Chapter 1 [|——+| Chapter 4 va Chapter 8 Chapter 5 Ss Chapter 7 SY Chapter 8 Chapter 1, of course, is introductory and as much or as little of it can be discussed as needed depending on the background of the students. Most students likely have been exposed to the material of Sections 1.1, 1.2, and 1.3 except possibly the definitions in Section 1.3 of equivalence relations, composition of relations, and one-to-one and onto functions. We recommend covering, at the minimum, Section 1.7 (Methods of Proof of an Implication) and Section 1.10 (Induction). Sections 1.5 and 1.6 contain introductory material on logic and is the foundation upon which Section 1.7 is built. A thorough understanding of proof by induction is, in our opinion, absolutely essential. Section 1.4 is a general discussion that can be assigned for reading. Section 1.9 (Rules of Inference for Quantified Propositions) may be omitted without injury. Chapter 3 can be taught at any time after Chapter 2 is covered. In particular, in a curriculum that calls for an early introduction to trees and graph theory we recommend that Chapter 3 be postponed until after Chapter 5. Only elementary recurrences are used in Section 5.5, and in Section 5.6 there is only one use of a recurrence relation. But even this does not require any result from Chapter 3, as a solution can be obtained instead from Example 1.10.11 in Chapter 1. Chapter 4 on directed graphs and Chapter 5 on nondirected graphs are related but may be treated as mutually independent chapters since xi Preface definitions given in Chapter 4 for digraphs are repeated and illustrated for Chapter 5. In fact, Sections 4.1 and 4.2 can be taught concurrently with Sections 5.1 and 5.2. We have made several significant changes from the first edition. First we have added two chapters, Chapter 7 on network flows and Chapter 8 on representation and manipulation of imprecision. Next, we have added several exercises in almost every section of the book. Moreover, we have consolidated two separate sections on partial orders into one in this second edition (Section 4.4), and we have removed the material on fuzzy sets from Chapter 1 of the first edition and incorporated that with other material on expert systems into Chapter 8. We have rewritten other sections including the section on methods of proof in Chapter 1, Section 3.6 on solutions of inhomogeneous recurrence relations in Chapter 3, and Sections 5.1 through 5.6 of Chapter 5 on graphs. The most notable change in Chapter 5 is that we have consolidated spanning trees and minimal spanning trees into one section and we have introduced breadth-first search and depth-first search spanning trees as well. Finally, we have added chapter reviews at the end of each chapter. Chapter 5 has a review for Sections 5.1 to 5.6 and then one for Sections 5.1 to 5.12. These reviews contain questions and problems from actual classroom tests that we have given in our own classes. ‘There are several possible course syllabi. For mathematics students only, we suggest Chapters 1, 2, 3, 5, and 7. One for computer science majors alone could be Chapters 1, 2, 4, 5 (at least Sections 5.1 to 5.6), 7, and 8, Chapter 6 on Boolean algebras could replace Chapter 7 or 8 if preparation for a digital design course is needed. At Florida State University our discrete classes contain both mathe- matics majors and computer science majors so we follow this syllabus: Discrete I: : Sections 1.5 to 1.10 of Chapter 1 (Section 1.9 is optional), Chapter 2, and Chapter 5 (at least Sections 5.1 to 5.6) Discrete II: Chapters 3, 4, 7, and selected topics from sections 5.7 to 5.12 as time permits. Exercises follow each section, and as a general rule the level of difficulty ranges from the routine to the moderately difficult, although some proofs may present a challenge. In the early chapters we include many worked-out examples and solutions to the exercises hoping to enable the student to check his work and gain confidence. Later in the book we make greater demands on the student; in particular, we expect the student to be able to make some proofs by the end of the text. Acknowledgments We express our appreciation to the Sloan Foundation for the grant awarded to the departments of Mathematics and Computer Science at Florida State University in 1983. The Sloan Foundation has played a major role in educating the academic community of the need for discrete mathematics in the curriculum, and we appreciate the support that the Foundation has given us. To our colleagues and friends who have taught from an earlier version of the book and made suggestions for improvement we say a heartfelt thank you. The editorial staff at Reston Publishing have been a great help and we thank them. Portions of the material in Chapter 8 are based on recent work by Lofti A. Zadeh [50], Maria Zemankova-Leech and Abraham Kandel [52], L. Applebaum and E. H. Ruspini [46], and many researchers in the fields of fuzzy set theory and artificial intelligence. Special thanks are due Dalya and Peli Pelled, who provided the desk upon which A. Kandel wrote Chapter 8. We wish to express our gratitude to several people who helped with the preparation of the manuscript. Sheila O’Connell and Pam Flowers read early versions and made several helpful suggestions while Sandy Rob- bins, Denise Khosrow, Lynne Pennock, Ruth Wright, Karen Serra, and Marlene Walker typed portions of the manuscript for the first edition. Robert Stephens typed most of the manuscript for the second edition. , Finally, we want to express our love and appreciation to our families for their patience and encouragement throughout the time we were writing this book. xiii xiv A Note to the Reader In each chapter of this book, sections are numbered by chapter and then section. Thus, section number 4.2 means that it is the second section of Chapter 4. Likewise theorems, corollaries, definitions, and examples are numbered by chapter, section, and sequence so that example 4.2.7 means that the example is the seventh example in section 4.2. The end of every theorem proof is indicated by the symbol 0. We acknowledge our intellectual debt to several authors. We have included at the end of the book a bibliography which references many, but not all, of the books that have been a great help to us. A bracket, for instance [25], means that we are referring to the article or book number 25 in the bibliography. An asterisk (*) indicates that the problem beside which the asterisk appears is generally more difficult than the other problems of the section. Joe L. Mott Abraham Kandel Theodore P. Baker Foundations 1.1 BASICS One of the important tools in modern mathematics is the theory of sets. The notation, terminology, and concepts of set theory are helpful in studying any branch of mathematics. Every branch of mathematics can be considered as a study of sets of objects of one kind or another. For example, algebra is concerned with sets of numbers and operations on those sets whereas analysis deals mainly with sets of functions. The study of sets and their use in the foundations of mathematics was begun in the latter part of the nineteenth century by Georg Cantor (1845-1918). Since then, set theory has unified many seemingly disconnected ideas. It has helped to reduce many mathematical concepts to their logical founda- tions in an elegant and systematic way and helped to clarify the relationship between mathematics and philosophy. What do the following have in common? + acrowd of people, + aherd of animals, + a bunch of flowers, and * a'group of children. In each case we are dealing with a collection of objects of a certain type. Rather than use a different word for each type of collection, it is convenient to denote them all by the one word “set.” Thus a set is a collection of well-defined objects, called the elements of the set. The elements (or members) of the set are said to belong to (or be contained in) the set. 2 Chapter 1: Foundations It is important to realize that a set may itself be an element of some other set. For example, a line is a set of points; the set of all lines in the plane is a set of sets of points. In fact a set can be a set of sets of sets and so on. The theory dealing with the (abstract) sets defined in the above manner is called (abstract or conventional) set theory, in contrast to fuzzy set theory which will be introduced later in Chapter 8. This chapter begins with a review of set theory which includes the introduction of several important classes of sets and their properties. In this chapter we also introduce the basic concepts of relations and functions necessary for understanding the remainder of the material. The chapter also describes different methods of proof—including mathe- matical induction—and shows how to use these techniques in proving results related to the content of the text. The material in Chapters 2-8 represents the applications of the concepts introduced in this chapter. Understanding these concepts and their potential applications is good preparation for most computer science and mathematics majors. 1.2 SETS AND OPERATIONS OF SETS Sets will be denoted by capital letters A,B,C, . ..,X,Y,Z. Elements will be denoted by lower case letters a,b,¢,... .x,y,2. The phrase “is an element of” will be denoted by the symbol ©. Thus we write x © A for “x is an element of A.” In analogous situations, we write x A for “x is not an element of A.” There are five ways used to describe a set. 1. Describe a set by describing the properties of the members of the set. 2. Describe a set by listing its elements. 38. Describe a set A by its characteristic function, defined as ualx) = Lifx EA, wax) = Oifx EA, for all x in U, where Uis the universal set, sometimes called the “universe of discourse,” or just the “universe,” which is a fixed specified set describing the context for the duration of the discussion. If the discussion refers to dogs orily, for example, then the universe of discourse is the class of dogs. In elementary algebra or number theory, Section 1.2 Sets and Operations of Sets. 3 the universe of discourse could be numbers (rational, real, complex, etc.). The, universe of discourse must be explicitly stated, because the truth value of a statement depends upon it, as we shall see later. 4. Describe a set by a recursive formula. This is to give one or more elements of the set and a rule by which the rest of the elements of the set may be generated. We return to this idea in Section 1.10 and in Chapter 3. 5. Describe a set by an operation (such as union, intersection, comple- ment, ete.) on some other sets. Example 1.2.1. Describe the set containing all the nonnegative integers less than or equal to 5. Let A denote the set. Then the set A can be described in the following ways: 1, A= {x|x is a nonnegative integer less than or equal to 5}. 2. A = {0,1,2,3,4,5). 1 for x = 0,1 0 otherwise. 5, 3. wax) = 4, A ={xi,. = 2%; + 1,1 =0,1,...,4, where x9 = O}. 5. This part is left to the reader as an exercise to be completed once the operations on sets are discussed. The use of braces and | (“such that”) is a conventional notation which reads: {x | property of x} means “the set of all elements x such that x has the given property.” Note that, for a given set, not all the five ways of describing it are always possible. For example, the set of real numbers between 0 and 1 cannot be described by either listing all its elements or by a recursive formula. In this section, we shall introduce the fundamental operations on sets and the relations among these operations. We begin with the following definitions. Definition 1.2.1. Let A and B be two sets. Then A is said to be a subset of B if every element of A is an element of B; A is said to be a proper subset of B if A is a subset of B and there is at least one element of Bwhich is not in A. If A is a subset of B, we say A is contained in B. Symbolically, we write ACB. If Ais a proper subset of B, then we say A is strictly contained in 4 Chapter 1: Foundations B, denoted by A C B. The containment of sets has the following properties. Let A, B, and C be sets. 1ACA. 2. IfA C Band BC C,thenA CC. 3. IfA C Band BCC, then ACC. 4, IfAC BandA ¢ C, then B ¢ C, where ¢ means “is not contained in.” The statement A C B does not rule out the possibility that B C A. In fact, we have both A C Band B C A if and only if (abbreviated iff) A and B have the same elements. Thus we define the following: Definition 1.2.2, Two sets A and B are equal iff A C Band B CA. We write A = B. ‘Therefore, we have the following principle. Principle. To show that two sets A and B are equal, we must show that each element of A is also an element of B, and conversely. A set containing no elements is called the empty set or null set, denoted by . For example, given the universal set U of all positive numbers, the set of all positive numbers x in U satisfying the equation x +1 = 0 is an empty set since there are no positive numbers which can satisfy this equation. The empty set is a subset of every set. In other words, @ C A for every A. This is because there are no elements in 2; therefore, every element in @ belongs to A. It is important to note that the sets @ and {@} are very different sets. The former has no elements, whereas the latter has the unique element 2. A set containing a single element is called a singleton. We shall now describe three operations on sets; namely, complement, union, and intersection. These operations allow us to construct new sets from given sets. We shall also study the relationships among these operations. Definition 1.2.3. Let Ube the universal set and let A be any subset of U. The absolute complement of A, A, is defined as {x|x ¢ A} or, {x|x © Uand x ¢& A}. If A and Bare sets, the relative complement of A with respect to B is as shown below. B-A-{x|x © Bandx ¢ A}. It is clear that @ -.U, U = @, and that the complement of the complement of A is equal to A. Definition 1.2.4. Let A and B be two sets. The union of A and B is AUB = {x|x © Aor x € Bor both}. More generally, if A,,A,,. . ..A, are Section 1.2 Sets and Operations of Sets 5 sets, then their union is the set of all objects which belong to at least one of them, and is denoted by A, U A, Us ++ UA, or by J Aj. ma Definition 1.2.5. The intersection of two sets A and B is ANB = {x|x € A and x € B}. The intersection of n sets Ay,Ayy. . . Anis the set of all objects which belong to every one of them, and is denoted by ALVA, A+++ OA, or (Aj iat Some basic properties of union and intersection of two sets are as follows: Union Intersection Idempotent: AUA=A ANA=A ‘Commutati AUB=BUA AQ B=BNA Associative: AU (BUC)=(AUB)UC AN(BNC)=(ANB)NC It should be noted that, in general, (AUB) NC#AU(BNO). Definition 1.2.6. The symmetrical difference of two sets A and Bis A AB - {x|x © A, or x © B, but not both}. The symmetrical difference of two sets is also called the Boolean sum of the two sets. Definition 1.2.7. Two sets A and B are said to be disjoint if they do not have a member in common, that is to say, if A B = ©. We can easily show the following theorems from the definitions of union, intersection, and complement. Theorem 1.2.1. (Distributive Laws). Let A, B, and C be three sets. Then, CN (AUB)=(CNA)U (COB), CU(ANB)=(CUA)N (CUB). 6 Chapter 1: Foundations Theorem 1.2.2. (DeMorgan’s Laws). Let A and B be two sets. Then, (AUB) -ANB, (AN B)=AUB. Itis often helpful to use a diagram, called a Venn diagram [after John Venn (1834-1883)], to visualize the various properties of the set opera- tions. The universal set is represented by a large rectangular area. Subsets within this universe are represented by circular areas. A sum- mary of set operations and their Venn diagrams is given in Figure 1-1. DeMorgan’s laws can be established from the Venn diagram. If the area outside A represents A and the area outside B represents B, the proof is immediate. Let U be our universe; applying DeMorgan’s laws, A U B can be expressed as a union of disjoint sets: AUB=(ANB) =U - (ANB) =(ANB)U (ANB) U (ANB). Set Operation Symbol Venn Diagram Set Bis contained in set A eo The absolute complement a of set A The relatsye complement of set B with respect A-B to set A The union of sets Aand B The intersection of D sets A and B 408 82) AUB The symmetrical difference of AAB sets A and B Figure 1-1. Venn diagram of set operations. Section 1.2 Sets and Operations of Sets. 7 Example 1.2.2. A-(A-B)=-A-(ANB) (by definition of A — B), =AN(ANB) (by definition of A — B), -AN (AUB) (by DeMorgan), =(ANAVU(ANB) (by distributive law), = @U(ANB) (byAN A=), “ANB (by 9 UX=X). Clearly, the elements of a set may themselves be sets. A special class of such sets is the power set. Definition’ 1.2.8. Let A be a given set. The power set of A, denoted by P(A), is the family of sets such that X C A iff X € P(A). Symbolically, P(A) = {X|X C A}. Example 1.2.3. Let A — {a,b,c}. The power set of A is as follows: P(A) = {{o]{a},{o),{c},{a,b},{0,cl,le,a},{a,b,cl }. Exercises for Section 1.2 1. List the elements in the following sets. (a) The set of prime numbers less than or equal to 31. (b) {x|x © Rand x? + x — 12 = 0}, where R represents the set of real numbers. (c) The set of letters in the word SUBSETS. . Russell’s paradox: Show that set K, such that K = {S|S is a set such that S S}, does not exist. 3. Prove that the empty set is unique. 4. Cantor’s paradox: Show that set A, such that A = {S| is a set}, does not exist. 5. Let U = {1,2,3,4,5}, A = {1,5}, B = {1,2,3,4}, and C = {2,5}. Determine the following sets. (a) ANB. (b) AU(BNC). (c) (AUB) N (AUC). (@) ANB)U BUG. (e) AUB. ~ 8 Chapter 1: Foundations 6. 1. Let A, B, and C be subsets of U. Prove or disprove: (AUB)N(BUQCANB. Use DeMorgan’s laws to prove that the complement of (AN B)N(AUB)N (AUC) is (AUB)U (AN (BUC). 8. A, are sets of real numbers defined as eo 10. 11. 12. 13, 14, 15. 16. A, = {ala =1} A, = {ala<1+ Wk},k = 1,2, Prove that (0) AnH Ay. hel . List the elements of the set {a/b: a and b are prime integers with 1 d. Likewise, if R is the relation on the set Z of integers defined by xRy iff x divides y, then R~! is the relation where cR~'d means c is an integral multiple of d. The set R(a) contains all elements of B to which the element a is related under R and can be viewed as the set of images of a. In general, R(a) may be either empty or contain many elements. But if R is a function from A to B, then for each a € A, not only is R(a) nonempty, but, more than that, R(a) contains precisely one element. Let us reiterate this observation in another way in the following definition of function. The words mapping, trausformation, corre- spondence, and operator are among these words that are sometimes used as synonyms for function. Definition 1.3.6. Let A and B be two nonempty sets. A function, denoted by f, from A to B is a relation from A to B such that: 1. dom f =A, that is, for each a € A, (a,b) € f for some b € B. In other words, fis defined at each a © A. 2. If (x,y) © f and (x,z) © f then y = z. In this case, we say that f is well-defined or single-valued. Thus, no element of A is related to two elements of B. If (x,y) € f, then we say that y is the image of x under f and we write y ~ f(x). Moreover, if fis a function from A to B, we write f:A > B. An alternate approach to the notion of function can be given in terms of a rule of assignment. In this version, a function from A to B is a rule that assigns to each element x in A a unique element y in B where f(x) = y is written to denote this correspondence. This is essentially the same as the above definition since the term “rule” can be interpreted in such a way that each rule f determines the relation {(x,y) © A x B|f(x) - yh and conversely. Thus, if the rule y = 3x is defined on the set of real numbers, then the function is the set {(x,y) |x and y are real numbers and y = 3x}. To be sure, if f is a function from A to B, and if b € B, then the set f-\(b) may be either empty or may contain several elements. This observation motivates the following two definitions. Definition 1.3.7. A function /:A — B is said to be one-to-one if f(x;) = y and f(x,) = y implies x, = xp. Thus, f is one-to-one iff for each b € ran f, f ~'(b) contains exactly one element. If we describe f ~1(b) as the set of preimages of 6, then fis one-to-one if for each b € ran f, b has precisely one preimage. 14 Chapter 1: Foundations Definition 1.: A function f:A — B is onto iff ran f = B. In other words, f is onto iff f1(b) is nonempty for each b © B. To put it another way, f is onto if each b B has some preimage in A. If the function f:A — B is both one-to-one and onto, then the inverse relation f~' is single-valued, and thus is a function from B to A. In this case, f~' is called the inverse function of f. A one-to-one, onto function f:A — B is usually called a one-to-one correspondence between A and B. If a function /:A —> B is not one-to-one, we call it a many-to-one function. If f is not necessarily onto B, then it is said to be into B. Since a function is a set, two functions f and g from A into B are equal if they are equal as sets. In other words, f ~ g iff f(a) = g(a) for each aA. Example 1.3.8. Let A = {r,s,t}, B = {1,2,3}, and C = (7,s,t,u}. R = {(r,), (,2), (¢,2)} is a relation from A to B but R is not a function since R(r) = {1,2}. The set f = {(r,1), (8,2), (t,2)} is a function from A to B but f is not one-to-one since f ~1(2) = {s,t]. Likewise, f is not onto B since f ~1(3) = 2, the empty set. The function g = {(r,1), (s,2), (t,3)} is both a one-to-one and an onto function from A to B. Moreover, g~! = {(1,r), (2,8), (3,¢)]- On the other hand, the function h:C — B defined as h = {(r,1), (s,1), (t,2), (u,3)} is onto, but not one-to-one since h~"(1) = {r,s}. Definition 1.3.9. Let R be a relation from A to B and S a relation from B to C. The composition of R and S, denoted by R - S or simply RS, is the relation from A to C given by aRSc iff there is an element b € B such that aRb and bSc. In other words, a relates to c under RS iff a relates to some b € B under R where 6, in turn, relates to c under S. The set B in the composition of RC A x Band S C B x C serves as an intermediary for establishing a correspondence between the sets A and C. For instance, suppose that A is a set of hospital patients, B is a list of symptoms, and C is a list of treatments. Suppose, moreover, that R relates a patient to his symptoms, and S relates symptoms to appropriate treatments. Then RS relates a patient to a treatment appropriate for his symptoms. Of course, a given patient may have several symptoms and each may have several treatments so that there may be several treat- ments associated with a patient under RS. Example 1.3.9. If A = {1,2,3}, B = {4,5}, and C = {a,b,c}, let R = {(1,4), (1,5), (2,5)} be a relation from A to B, and let S = {(4,a), (5,c)} be a relation from B to C. Then RS = {(1,a), (1,c), (2,c)} is a relation from A toc. Section 1.3 Relations and Functions 15 IT = {(a,1), (a,2), (6,1), (¢,2), (c,3)} isa relation from C to A, then ST = {(4,1), (4,2), (5,2), (5,3)} is a relation from B to A. Finally, for the relation V = {(1,1), (1,2), (2,3), (3,1)} from A to A, then v?-V- V={(D, 2), (1,3), (2,0), @,0, (3,2)! is a relation from A to A. If, in the definition of composition, the relations R and S are, in fact, functions, then to express the image of an element x under R - S, we get into the peculiar notational anomaly (R - S)(x) = S(R(x)) which means the value of t under R is determined first and then the value of R(x) under S is determined. This anomaly has induced many writers to write (x)(R - S) instead of (R - S)(x), and, in general, for any fun.ction f to write xf for f(x). Nevertheless, we shall stick to the classical notation and face the anomaly as it comes. Example 1.3.10. If R(x)'= x + 1 and S(y) = y? are functions defined on the set of real numbers, then (R - S)(x) = S(R(x)) = (x + 1)? and (S - R)(x) = R(S(x)) = x? +1. Exercises for Section 1.3 1. Let A ~ {1,2,3,4,5,6}. Construct pictorial descriptions of the rela- tion R on A for the following cases. (a) R = {(j,k)|j divides k}. (b) R = {( j,k) |j is a multiple of &}. (c) R={(j,k)|(j — RY E Al. (d) R= {( j,k) | j/k is a prime}. 2. Let R be the relation from A = {1,2,3,4,5} to B = {1,3,5} which is defined by “x is less than y.” Write R as a set of ordered pairs. 3. Let R be the relation in the natural numbers N = {1,2,3,. . .] defined by “x + 2y = 10,” that is, let R = {(x,y)|x © Nyy GN, x + 2y = 10}. Find (a) the domain and range of R (b) R* 4, Prove that if R is an antisymmetric relation so is R ~'. 5. Prove that if R is a symmetric relation, then RM R-' ~ R. 6. Show that if R is an antisymmetric relation and R* is an antisym- metric relation, so is R R*. What about R U R*? 7. Let L be the set of lines in the Euclidean plane and let R be the relation in L defined by “x is parallel to y.” Is R a symmetric relation? Why? Is R a transitive relation? 8. Replace the sentence “x is parallel to y” by the sentence “x is perpendicular to y” in Exercise 7. Is R a symmetric relation? Why? Is F a transitive relation? 16 Chapter 1: Foundations 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. Let D denote the diagonal line of A x A, i.e., the set of all ordered pairs (a,a) € A x A. Prove that the relation R on A is antisymmet- ricifR OR“ CD. Can a relation R in a set A be both symmetric and antisymmet- ric? Let A = {1,2,3}. Give an example of a relation R in A such that R is neither symmetric nor antisymmetric. Show that when a relation R is symmetric, so is R* for any k > 0, where Ris the k™ power of the relation R. If f:A —+ Bisa one-to-one correspondence, prove that f ~':B — Ais a one-to-one correspondence. If f:A — B and g:B — C are both one-to-one correspondences, prove that f - g is a one-to-one correspondence. Show that the function f from the reals into the reals defined by f(x) = x° + Lisa one-to-one, onto function and find f ~'. A function b:A x A — A is called a binary operation on the set A. Moreover, a binary operation on the set A is called commuta- tive if b(x,y) = b(y,x) for all (x,y) © A x A. Which of the following binary operations on the set of real numbers is commuta. tive? (a) b(x,y) =x -y (b) b(x,y) = x? + 9? (c) b(x,y) = max{x,y}, where max{x,y} denotes the larger of the two numbers x and y. (For example, max{5,7} = 7, max{—6,2} = 2) (d) b(x,y) = & + y)/2 A binary operation 6 on a set A is said to be associative if b(x,b(y,z)) = 6(b(x,y),z) for all x,y,z.A. Which of the operations in exercise 16 are associative? Which of the following relations are functions? Define R by xRy iff x? 4 y? = 1 where x and y are real numbers such that (a) O

You might also like