0% found this document useful (0 votes)
2K views520 pages

Discrete Mathematical Structures (Fourth Edition)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
2K views520 pages

Discrete Mathematical Structures (Fourth Edition)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
ie ee Ce a a rest L ot St mee UE ea kry aE VEE oe en) ae Aa 8) DISCRETE MATHEMATICAL STRUCTURES COX eee UEC) cor onic [oes kem tT Tenet eg secs aca es Higher Education Press Peet Teel Cer Taro bi mo OR Al APRA ARF DIMA RAE SARAWREAB Ba ay (SBUORR SCEDKED DISCRETE MATHEMATICAL STRUCTURES (Fourth Edition ) Bernard Kolman Robert C. Busby Sharon Cutler Ross Batata me [I Pearson Education 14 W461 B+: 01-2001-2169 S English Reprint Copyright © 2001 by PEARSON EDUCATION NORTH ASIA LIMIED and HIGHER EDUCATION PRESS Discrete Mathematical Structure from Prentice Halls edition ofthe work Discrete Mathematical Structure, 4th edition by Bernard Kolman, Robert C. Busby, Sharon Cutler Ross, Copyright © 2001,1996 ‘All Rights Reserved Published by arrangement with Prentice Hall, In., a Pearson Education company This edition is authorized for sale only in the People’s Republic of China (excluding the Special Administrative Regions of Hong Kong and Maca) SEK BCP) a BRBERH / GH) ARB (Kolman,B.) ¥, 4 CEDAR) . —ACR BRL Hi ARAL 2001. 7 TLR ISBN 7 ~ 04 ~ 010096 ~ 7 LS... Lt... TL ake Fe H-RX N.o0158 5 BEAR R548 CIP BABAK (2001) BB 044740 F aE CO BORD Bernard Kolman % MAAS ASP wR tk ADKAREO MBH SS B6RIRT 100009 % —- o10—eaosess8 fe Holo s4or04s, FA it http://www. hep. edusen buep.//worw. hep. com.cn & mh Het 2 M BSR TENET H -& Terx1002 1/16 Bo DoT ABA BK 32.75 Bk 2001 FASB 1 BL Fm 798-000 zh D.590% AA TAT RTE AT ET A A WT TEMA BASE To the memory of Lillie BLK. To my wife, Patricia, and our sons, Robert and Scott RCB. To Bill and bill S.C.R. PREFACE Discrete mathematics is a difficult course to teach and to study at the freshman and sophomore level for several reasons. It is a hybrid course. Its content is mathemat- ‘es, but many of its applications and more than half its students are from computer science. Thus careful motivation of topics and previews of applications are im- portant and necessary strategies. Moreover, the number of substantive and diverse topics covered in the course is high, so that student must absorb them rather quickly. At the same time, the student may also be expected to develop proof-writing skills. APPROACH First, we have limited both the areas covered and the depth of coverage to what we deemed prudent in a frst course taught at the freshman and sophomore level. We hhave identified a set of topics that we feel are of genuine use in computer science and elsewhere and that can be presented in a logically coherent fashion. We have presented an introduction to these topics along with an indication of how they can bbe pursued in greater depth. For example, we cover the simpler finite-state machines, not Turing machines, ‘We have limited the coverage of abstract algebra to a discussion of semigroups and groups and have given application of these to the important topics of finite-state ‘machines and error-detecting and error-correcting codes. Error-correcting codes, in ‘umn, have been primarily restricted to simple linear codes. ‘Second, the material has been organized and interrelated to minimize the mass of definitions and the abstraction of some of the theory. Relations and digraphs are treated as two aspects of the same fundamental mathematical idea, with a directed graph being a pictorial representation of a relation. This fundamental idea is then used as the basis of virtually all the concepts introduced in the book, including functions, partial orders, graphs, and algebraic structures. Whenever possible, each ‘new idea introduced in the text uses previously encountered material and, in tun, is developed in such a way that it simplifies the more complex ideas that follow. Thus partial orders, latices, and Boolean algebras develop from general relations. This ‘material in urn leads naturally to other algebraic structures. xu Preface WHAT IS NEW IN THE EOURTH EDITION EXERCISES EXPERIMENTS We continue to be pleased by the reception given to earlier editions of this book. We still believe that the book works well in the classroom because of the unifying role played by two key concepts: relations and digraphs. For this edition we have ‘modified the order of topics slightly and made extensive revisions of the exercise sets. The discourse on proof has been expanded in several ways. One of these is the insertion of comments on nearly every proof in the book. Whatever changes we hhave made, our goal continues to be that of maximizing the clarity of presentation. As the audience for an introductory discrete mathematics course changes and asthe course is increasingly used asa bridge course, we have added the following features. + A-new section, Transport Networks, introduces this topic using ideas from Chapter 4 + Arnow section, Matching Problems, applies the techniques of transport net- works to a broad class of problems. ‘+ The section on mathematical induction now includes the strong form of in- duction as well. + The discussion of proofs and proof techniques is now woven throughout the book with comments on most proofs, more exercises related to the mechanics of proving statements, and Tips for Proofs sections. Tips for Proofs highlight the types of proofs commonly seen for that chapter’s material and methods for selecting fruitful proof strategies. ‘+ A Self-Test is provided for each chapler with answers for all problems given atthe back of the book. + Exercise Sets have a broader range of problems: moze routine problems and ‘more challenging problems. More exercises focus on the mechanics of proof and proof techniques. As with writing in general, students learn to write proofs rot only by reading, analyzing, and recognizing the structure of proofs, but especially by writing, re-wrting, and writing more proofs themselves, ‘The exercises form an integral part of the book. Many are computational in nature, whereas others are of a theoretical type. Many of the latter and the experiments, to be further described below, require verbal solutions. Exercises to help develop proof-writing skills ask the student to analyze proofs, amplify arguments, or com- plete partial proofs. Answers to all odd-numbered exercises appear in the back of the book. Solutions to all exercises appear in the Instructor’s Manual, which is available (to instructors only) gratis from the publisher. The Instructor's Manual also includes notes on the pedagogical ideas underlying each chapter, goals and ‘grading guidelines forthe experiments further described below, and a test bank. Appendix B contains a number of assignments that we call experiments. These ‘provide an opportunity for discovery and exploration, or a more-in-depth Took at Preface xiii various topics discussed in the text, These are suitable for group work. Content prerequisites for each experiment are given in the Instructor's Manual END OF CHAPTER MATERIAL CONTENT USE OF THIS TEXT Each chapter contains Tips for Proofs, a summary of Key Ideas, a set of Coding Exercises, and a Self-Test covering the chaptet’s material Chapter 1 contains a miscellany of basic material required inthe course. This in- cludes sets, subsets, and their operations; sequences; division in te integers; matr- ces; and mathematical structures. A goa ofthis chapter is to help students develop skills in identifying atteras on many levels. Chapter 2 covers logic and related ma- terial, including methods of proof and mathematical induction. Although the dis- cussion of proof is based on this chapter, the commentary continues troughout the book. Chapter 3, on counting, deals with permutations, combinations, the pigeon- hole principle, elements of probability, and recurrence relations. Chapter 4 presents basic types and properties of relations, along with their representation as directed ‘graphs. Connections with matrices and other data structures are also explored in {his chapter. The power of mulple representations forthe concept of relation is fully exploited. Chapter 5 deals with the notion ofa function and gives important examples of functions. including functions of special interest in computer science ‘An introduction tothe growth of functions is developed. Chapter 6 covers partially ordered sets, including latices and Boolean alge- bras. Chapter 7 inwoduces directed and undirected trees along with applications of these ideas. Elementary graph theory is the focus of Chapter 8. New to this edi- tion are sections on Transport Networks and Matching Problems; these build on the foundation of Chapter 4. In Chapter 9 we give the basic theory of semigroups and groups. These ideas are applied in Chapters 10 and 11. Chapter 10 is devoted to finite-state machines. t-complements and makes effective use of ideas developed in previous chapters. Chapter 11 teats the subject of binary coding. ‘Appendix A discusses algorithms and pseudocode. The simplified pseudocode presented here is used in some text examples and exereises; these may be omitted without los of continuity. Appendix B gives a collection of experiments dealing with extensions or previews of topics in various parts of the course. ‘This text can be used by students in mathematics as an introduction to the funda- mental ideas of discrete mathematics, and as @ foundation for the development of ‘more advanced mathematical concepts. If used in this way, the topics dealing with specific computer science applications can be ignored ot selected independently as important examples. The text can also be used in a computer science or computer ‘engincering curriculum to present the foundations of many basic computer-related ‘concepts, and provide a coherent development and common theme for these ideas x Preface ACKNOWLEDGMENTS: ‘The instructor can easily develop a suitable course by referring to the chapter pre- requisites, which identify material needed by that chapter. ‘We are pleased to express our thanks to the following reviewers ofthe first uhree edi- tions: Harold Fredrickson, Naval Postgraduate School; Thomas E. Gerasch, George ‘Mason University ; Samuel J. Wiley, La Salle College; Kenneth B. Reid, Louisiana ‘Sate University; Ron Sandstrom, Fort Hays State University; Richard H. Austing, University of Maryland; Nina Edelman, Temple University; Paul Gormley, Vil- lanova University; Herman Gollwitzer and Loren N. Argabright, both at Drexel University; Bill Sands, University of Calgary, who brought to our atention a num- ber of errors in the second edition; Moshe Dror, University of Arizona, Tucson; Lloyd Gavin, California State University at Sacramento; Robert H. Gilman, Stevens Institute of Technology; Earl E. Kymala, California State University at Sacramento; and Art Lew, University of Hawaii, Honolulu; and of the fourth edition: Ashok Amin, University of Alabama at Huntsville; Donald S. Hart, Rochester Institute of Technology; Minhua Liu, William Rainey Harper College; Charles Parry, Vir- ginia Polytechnic Institute & University; Arthur T. Poe, Temple University; Suk Jai Seo, University of Alabama at Huntsville; Paul Weiner, St. Mary's University ‘of Minnesota, The suggestions, comments, and criticisms of these people greatly improved the manuscript. We thank Dennis R. Klewzing, Stetson University, who carefully typeset the ‘entire manuscript; Nina Edelman, Temple University, for critically reading page proofs; Blaise DeSesa, Allentown College of St. Frances de Sales, who checked the ‘answers and solutions to all the exercises in the book; and instructors and students from many institutions in the United States and other countries, for sharing with us their experiences with the book and for offering helpful suggestions. Finally, a sincere expression of thanks goes to Betsy Williams, George Lo- bell, Gale Epps, and the entire staff at Prentice Hall for their enthusiasm, interest, and unfailing cooperation during the conception, design, production, and marketing phases of this edition. BK. RCB. SCR. Ba SH CONTENTS Preface xi 1 Fundamentals 1 LL Setsand Subsets 1 1.2 Operations on Sets 5 13 Sequences 13 14 Division in the Integers 21 15) Matrices 30 1.6 Mathematical Stroctures 38 2 Logic 46 2.1 Propositions and Logical Operations 46 2.2 Conditional Statements 52 23. Methods of Proof 58 24° Mathematical Induction 64 3° Counting 73 341 Permutations 73, 32 Combinations 78 33. Pigeonhole Principle 83 34 Elements of Probability 86 3.5 Recurrence Relations 95 Contents A. Relations and Digraphs 103 4 42 43 44 45 46 47 48 Product Setsand Partitions 103, Relations and Digraphs 107 Paths in Relations and Digraphs 115, Properties oF Relations 121 Equivalence Relations 128 ‘Computer Representation of Relations and Digraphs 133 Operations on Relations 140 ‘Transitive Closure and Warshall’s Algorithm 150 5 Functions 161 51 52. 53 54 Functions 161 Functions for Computer Science 170 Growth of Functions 175 Permutation Functions 180 6 Order Relations and Structures 191 61 Partially Ordered Sets 191 62 Exremal lementsof Paraly Ordered Sets 202 63 Lawics 207 GA Finite Boolean Algebras 217 65 Functionson Boolean Algebras 225 66 Circuit Designs 229 7 ‘Trees 145 71 Tees 25 72, Labeled Trees 250 73. Thee Searching 254 74 Undivected Tres 264 78 Minimal Spanning Trees 271 8 Topics in Graph Theory 280 8a 82 83 a4 Graphs 280 Euler Paths and Circuits 286 Hamiltonian Paths and Cireuits 293 TransportNetworks 297 10 11 Contents ix 85° Matching Problems 305 86 Coloring Graphs 311 Semigroupsand Groups 319 9.1 Binary Operations Revisited 319 9.2 Semigroups 324 9.3. Products and Quotients of Semigroups 331 9.4 Grows 338 9.5 Products and Quotints of Groups 349 Languages and Finite-State Machines 357 101 Languages 357 10.2. Representations of Special Grammars and Languages 366, 103, Finite-State Machines 375 10.4 Semigroups, Machines, and Languages 381 10.5 Machines and Regular Languages 386 10.6 Simplification of Machines 393, Groups and Coding 401 11.1 Coding of Binary Information and Error Detection 401 11.2 Decoding and Error Correction 413 Appendix A: Algorithms and Pseudocode 425 Appendix B: Experiments in Discrete Mathematics 438 Answers to Odd-Numbered Exercises 455 Answers to Chapter Self-Tests 489 Index 502 FUNDAMENTALS Prerequisites: There are no formal prerequisites for this chapter; the reader is encouraged to read carefully and work through all examples. 1.1 SETSAND SUBSETS Sets ‘A setis any well-defined collection of objects called the elements or members of the set. For example, the collection of all wooden chairs, the collection of all one- legged black birds, othe collection of real numbers between zero and one is each @ set, Well-defined just means that it is possible to decide if a given object belongs to the collection or not. Almost all mathematical objects are first of all sets, regardless of any additional properties they may possess. Thus set theory is, in a sense, the {oundation on which virtually all of mathematics is constructed. In spite ofthis, set theory (at leat the informal brand we need) is quite easy to learn and use. ‘One way of describing a set that has finite number of elements is by listing the elements ofthe set between braces. Thus the setof all postive integers that are Jess than 4 can be writen as (12,3). @ ‘The order in which the elements of a set are listed is not important. Thus {1,3.2), (3.2, 1), (3.1.2) (2,1, 3). and (2, 3,1) are all representations ofthe set siven in (1), Moreover, repeated elements inthe listing ofthe elements of a set can be ignored. Thus, (1, 3,2, 3,1} is another representation of the st given in (I). ‘We use uppercase letters such as A, B, C to denote sets and lowercase leters such as a,b, 6, %, ¥, 2, £10 denote the members (or elements) of sets, 1 2 Chapter 1 Fundamentals EXAMPLE 2 Site Blue Brune Bre We indicate the fact that x is an element of the set A by writing x € A, and ‘we indicate the fact that x isnot an element of A by writing x ¢ A. Let A= {1,3,5,7}. Then 1 €A,3 € A, but2 ¢ A . ‘Sometimes it is inconvenient or impossible to describe a set by listing all its elements. Another useful way to define a set is by specifying a property that the clements of the set have in common. We use the notation P(x) to denote a sentence or statement P conceming the variable object x. The set defined by P(x), written {x | PG), is just the collection of all objects for which P is sensible and true. For cexample, (x | x isa positive integer less than 4) is the set {1, 2, 3} described in (1) by listing its elements. ‘The set consisting ofall the letters inthe word “byte” can be denoted by (b, 9,4, cor by (x | xis a letter in the word “byte. . We introduce here several sets and their aotations that will be used throughout this book. (a) Z* = (x | xis a positive integer). Tins Z* consists ofthe numbers used for counting: 1, 2,3... () N= (x |x isa positive integer or zero}. ‘Thus V consists of the positive integers and zero: 0,1, 2, (© Z= (x |x isan integer} Thus Z consists ofall the integers: ..., (@ Q= (| xis rational number) ‘Thus @ consists of numbers that can be written as, where a and b are integers and bis not 0. (@) R= (x | xisareal number) () The set that has no elements in itis denoted either by ( } or the symbol 2 andis called the empty set. . 1,0,1,2,3, Since the square of a real number is always nonnegative, {x | xis areal number and x’ ‘Sets are completely known when their members are all known. Thus we say two sets A and B are equal if they have the same elements, and we write A = B. IA = (1,2, 3} and B = (x | x is a positive integer and x? < 12}, then A If A = {BASIC, PASCAL, ADA) and B = (ADA, BASIC, PASCAL}, then A = B. . Figure t 1 EXAMPLE 7 EXAMPLE 8 Ea) Brrnta) Figure 1 2 LiL Sets and Subsets Subsets Ifevery element of A is also an element of B, that is if whenever x € A then x € B, we say that A is a subset of B or that A is contained in B, and we write AS B. If Ais aot a subset of B, we write A ¢ B. (See Figure 1.1.) Diagrams, such 3s those in Figure 1.1, which are used to show relationships between sets, are called Venn diagrams after the British logician John Venn. Venn diagrams will be used extensively in Section 1.2. We have Z* ¢ Z. Moreover, if @ denotes the set of rational numbers, then Z ¢ Q. ™ ,2,3,4,5,6], B = (2,4,5}, and C = (1,2,3,4,5). Then BS A, BCC,andC CA. However, Ag'B, Ag C,andC ¢ B. . If Ais any set, then AC A. That is, every set isa subset of self. Let A be a set and let B = (A, {A)}. Then, since A and (A) are elements of B, we have A € B and {A} € B. It follows that {A} © B and {{A}) © B. However, itis not true that AS B. . For any set A, since there are no elements of & that are not in A, we have @ CA. (We will look at this again in Section 2.1.) is easy to see that A = B if and only if A‘C Band BC ‘The collection of everything, it turns out, cannot be considered a set without presenting serious logical difficulties. To evoid this and other problems, which need ‘hot concern us here, we will assume that for each discussion there is a “universal set” U (which will vary with the discussion) containing all objects for which the discussion is meaningful. Any other set mentioned in the discussion will automati- cally be assumed to be a subset of U. Thus, if we are discussing real numbers and ‘we mention sets A and B, then A and B must (Wwe assume) be sets of real numbers, ‘not matrices, electronic circuits, or rhesus monkeys. In most problems, a universal set will be apparent from the setting of the problem. In Venn diagrams, the universal set U will be denoted by a rectangle, while sets within U will be denoted by circles as shown in Figure 1.2, Asset A is called finite if it has n distinct elements, where n € N In this case, nis called the cardinality of A and is denoted by [4]. Thus, te sets of Examples 1, 2,4, 5, and 6 are finite. A set that isnot finite is called infinite. The ses introduced jn Example 3 (except 2) are infinite sets. If A is ast, then the set of all subsets of A is called the power set of A and is denoted by P(A). Let A = (1, 2,3}. Then P(A) consists of the following subsets of A: { }, {1}, (2), {3} {1,2}, (1,3), (2,3), and (1,2, 3} (or A). Ina later section, we will count the ‘number of subsets that 2 set can have, . 4 Chapter 1 Fundamentals 1, Let A = (1,2,4, 4,6, ). Identify each ofthe following as tre o false @2eA b3eA cea sed @(1eA ACA 2 Let A = (x | risareal number and x <6. Identify cach ofthe following a te or false. (@3eA bed SEA SEA BEA (H34EA ‘3 In each part, give the set of letters in each word by listing the elements ofthe set. (@) AARDVARK (©) MIssIssIPPr 4. Give the set by listing its elements (2) The set of al positive imepers tht are les than ten () (x) xe Zandx? < 12) (6) BOOK 5. Let A = (1, (2,3}.4), Tdemtity each ofthe following as true or false @3eA WULACA (©) 2.3)CA @ RICA CMEA © 1,23)C4 {In Exercises 6 through 9, write the set inthe form (x | PG), where P(x) isa property that describes the elements ofthe et 6 (2.4,6,8,10) 7. (aeiso.a) 8. (1,8,27,64,125) 9 (-2,-1,0,1,2) 10, Let A = (1,2,3,4,5). Which ofthe following ses are equal to A? () (4,1,2,3,5) ©) (23.4) (©) 11,2,3,4,5,6 (@) (x | xis am imeger and x? < 25} () (x |x isa positive integer and x < 5} (® (x | xis apositive rational number and x <5} 1, Which ofthe following et are the empty set? (@) {| xis areal oumberand x? — 1 = 0} () (| xis areal number and x? + | = 0) (©) (x | xis areal number and x? = ~9) (@ (x | xisaeal number and x = 2x + 1) () (x | xis area oumberandx =z | 1) 12, List all the subsets of fa, 6]. 13, List all the subsets of (BASIC, PASCAL ADA}, 14, List all de subsets of { . 15, Let A = (1,2,5,8, 11]. Mentfy each of the following as taue or false @ GSA © Blea © (821,524 OCA © 6g © cA @) GEA () AC (11,2,5.1,8,4) 16. Let A = {x | xis an integer and x* < 16). Identify each ofthe following a8 tue or false. @) OL23EA — O) {-3.-2-CA @(1CA (@) (x | xis an integer and x] < 4). A (©) ASE-3,-2,-1,0,1,2,3) 1}, B = (1,a,2,b,€),C = (b.c}, D= (a,b), (1,a,2,6,e,d)._ For each part, replace the symbol C with either Cor ¢ to give a te statement @ ADB @)eZ0A (BIC @Ccoze @paC © BIE {In Exercises 18 through 20, find the set of smallest cardinality ‘that contains the given sets. as subsets. 1B, (a, biel fardse, Sh fb.c.e.8) 19. (1,2), (1.3},8 20. (2, 4,65... 20), (3,6,9,...,21) 21. Is it possible to have two different (appropriate) univer- ‘il ses for a collecton of sets? Would having different ‘universal sets create any problems? Explain, 22, Use the Venn diagram in Figure 1.3 to identify each ofthe following as true or false. @ACB MBSA |CSB @xeB @xed HyeB a Figure 1.3 — 1.2 Operations on Sets 5 23. Use the Venn diagram in Figure 1.4 w identify each ofthe (©) Whatis Al? (@) Whats 1P(4)/? following as te or false @ BCA Acc @wea @red Figure 1.4 24, (a) IFA = (3,7), find PLA) (b) What is 4?) Whats 1P(A)1? eoeohiy tip ebipraara 25, (a) IFA = (3,7, 2}, find PCA) Geen Jn Exercises 26 through 28, draw a Venn diagram that repre- § sents these relanonships © wes WACBASCBEC mds B I EATER EC YE BEC amy eA BACB EAT EBALC IEBYEC 29, Describe al the subset relationships that hold forthe sets given in Example 3. 30. Show that if A ¢ Band BSC, thea A EC. 31. Suppose we know that set A has n subsets, Si, Sis ++ Sw I set B consists ofthe elements of A and one more ele ‘ment so|B| = |A|+1, show that B must have 2n subsets. 32, Compare the results of Exercises 12, 13, 24, and 25 and. complete the following: Any set with (wo elements bas subsets 1.2 OPERATIONS ON SETS ate) Bune In this section we will discuss several operations that will combine given sets to yield new sets. These operations, which are analogous to the familiar operations on the real numbers, will play a key role in the many applications and ideas that follow. If A and B are sets, we define their uniom as the set consisting ofall elements that belong to A or B and denote it by AU B. Thus AUB=(x]x€ Aorxe B). Observe that x € AUB ifx € A orx € B or x belongs to both A and B. Let A = {a,b,c,¢, f) and B = (b,d, r,s}. Find AUB, Solution Since AU B consists of all the elements that belong to either A or B,AUB={a,b,c,d,e, f.r,5) . We can illustrate the unio of two sets with a Venn diagram as follows. If A ‘and B are the sets in Figure 1.5(a). then A UB is the set represented by the shaded region in Figure 1.50). If A and B are sets, we define their intersection as the set consisting of all elements that belong to both A and B and denote itby A.B. Thus ANB=(x|xeAandx eB). Let A = (a,b, c.€, f}, B= {b.e, f,rs},and C = (a, t,u,}. Find ANB, ANC, and BNC. 6 Chapter 1 Fundamentals o aus Figure 1.5 Solution ‘The elements b, e, and f are the only ones that belong to both A and B, so AB = {b, e, f}. Similarly, A.C = (a). There are no elements that belong to both B and C, so BNC = { }. . ‘Two sets that have no common elements, such as B and C in Example 2, are called disjoint sets, ‘We can illustrate the intersection of two sets by a Venn diagram as follows. If A and B are the sets given in Figure 1.6(a), then A" B is the set represented by the shaded region in Figure 1.6(b). Figure 1.7 illustrates a Venn diagram for two disjoint sets. 2 A u ©) @) v v ® wane Figure 1.6 Figure 1.7 ‘The operations of union and intersection can be defined for three or more sets in an obvious manner: AUBUC ={r|x6Aorx Bor eC) and ANBNC=(x|x€ Aandx € Bandx eC). ‘The shaded region in Figure 1.8(b) is the union of the sets A, B, and C shown in ‘Figure 1.8(a), and the shaded region in Figure 1.8(c) isthe intersection of the sets A, 2B, and C. Note that Figure 1.8(a) says nothing about possible relationships between the sets, but allows for all possible relationships. In general, if Ay, Az... Ay ate subsets of U, then AyUA2U- ++ Ay will be denoted by (J A and A, 430---M1Ay will be denoted by (Ay. ? bet Grune 1.2 Operations on Sets. 7 Dee @ AuBuc @ananc Figure 1.8 Let A = {1,2,3,4,5,7}, B= (1,3, 8,9}, and C = (1,3,6,8). Then AN BOCis the set of elements that belong to'A, B,andC. Thus ABC = {1,3}. If A and B are two sets, we define the complement of B with respect to A as the set of all elements that belong to A but not to B, and we denote it by A — B. Thus AW B=(x|xeAandr¢ 3), Let A = (a,b,c) and B = (6, ¢,d,e). Then A— B= (a) and B—A=(d,e), © If A and B are the sets in Figure 1.9(a), then A~B and B — A are represented by the shaded regions in Figures 1.9(b) and 1.9(c), respectively. EU is a universal set containing A, then U ~ A is called the complement of ‘A and is denoted by A. Thus A= (x |x ¢ A}. © u o o Figure 1.9 Let A = (x | xis an integer and x < 4) and U = Z. Then andx > 4). If A isthe set in Figure 1.10, its complement is the shaded region in that figure. If A and B are two sets, we define their symmetric difference as the set of all elements that belong to A or to B, but not to both A and B, and we denote it by A@B. Thus A@B=(x | (x € Aandx ¢ B)or(x eB andx ¢ A)}. ‘= {x | xis an integer . 8 Chapter 1 Fundamentals Figure 1.10 Let A= (a,b,6,d) and B= (a,c,¢, fg) Then A@B=(b,d,e, fig If A and B are as indicated in Figure 1.11(a), their symmetric difference is the shaded region shown in Figure 1.11(b). It is easy to sce that A@B=(A~B)U(B~ A). wo wares Figure 1.14 Algebraic Properties of Set Operations ‘The operations on sets that we have just defined satisfy many algebraic properties, some of which resemble the algebraic properties satisfied by the real numbers and their operations. All the principal properties listed here can be proved using the def- initions given and the rules of logic. We shall prove only one of the properties and leave proofs ofthe remaining ones as exercises for the reader. Proofs ae fundamen- tal to mathematics. We discuss proof techniques in Chapter 2, but in this chapter ‘some proofs ae given as examples for later work. Some simple proofs are required in the exercises. Venn diagrams are often useful to suggest or justify the method of proof. Theorem 1 The operations defined on sets satisfy the following properties: Commutative Properties L AUB=BUA 2. ANB=BOA Figure 1.12 1.2 Operations on Sets 9 Associative Properties 3. AU(BUC) 4. AN(BNC) Distributive Properties 5. AN(BUC) =(ANB)U(ANC) 6 AU(BNC)=(AUB)N(AUC) Idempotent Properties 7. AUA= 8 ANA Properties of the Complement 9. A =A 10. AUA WANA 12, 13. 4. 15. (auByuc (angync Properties 14 and 15 are known as De Morgan's laws Properties of a Universal Set 16. AUU 17. ANU=A Properties ofthe Empty Set 18, AUS = Aor AU 19. AN@=oorAn( =() . Proof We prove Property 14 here and leave proofs of the remaining properties as exereises forthe reader. A common style of proof for statements about sts is to choose_an element in one of the sets and see what we know about it. Suppose that x © AUB, Then we know that x ¢ AU B, sox ¢ A andx ¢ B. (Why?) ‘This means x € AB (why?), so each element of AU belongs to AB. Thus AUB CAMB. Conversely, suppose that x € ANB. Then x ¢ Aand x ¢ B (why, sox ¢ AUB, which means thats ¢ AUB. Thus each element of AB also belongs © AUB, and ANB C AUB. Now we see that AUB= ANB. ¥ The Addition Principle Suppose now that A and B are finite subsets of a universal set U. It is frequently useful to have a formula for |A UB), the cardinality of the union. If A and B are disjoint sets, that is, if AB = , then each element of AUB appears in either A or B, but notin both; therefore, |A U B| = |4l + |B. If A and B overlap, as shown in Figure 1.12, then elements in AB belong to both sets, and the sum |4|+|B} counts 10 Chapter 1 Fundamentals Theorem 2 Etna Figure 1.13 Theorem 3 Brune Bruns these elements twice. To correct for this double counting, we subtract [4B]. Thus we have the following theorem, sometimes called the addition principle. Because of Figure 1.12, this is also called the inclusion-exclusion principle. If A and B are finite sets, then | U BI = |Al + 18-14 9B}, . Let A = (a,b,c,d,e} and B = (c,¢, f,/t,k, m). Verify Theorem 2. Solution We have AU B = {a,b, c,d, €, f,h,k,m) and ANB = {e,e} Also, {Al = 5, [Bl = 6, |A U BI = 9, and [A 7 Bl = 2. Then |Al + |B] — [AB] =5 +6 ~2 or 9and Theorem 2 is verified. . If A and B are disjoint sets, A 0 B = @ and |A 9 B| = O, so the formula in ‘Theorem 2 now becomes |A U B| = |A| + |B]. This special case can be stated in a ‘way that is useful in a variety of counting situations. The Addition Principle for Di If a task 7; can be performed in exactly n ways, and a different tsk Ts can be performed in exactly m ways then the number of ways of performing task 7; or {ask Tis tm. The situation for three sets is shown an Figure 1.13. We state the thee-set audition principle without discussion, Let A, B, and C be finte sets. Then |A UB UC| = |A| +181 + IC] AB) — IBNCl—jancl+langncl, . Theorem 3 can be generalized for more than three sets. This is done in Exer- cises 37 and 38, Let A = (a,b, ,d,e), B = (a,b, e, g,h), and C = {b,d, e, 8, hk, m,n). Verify ‘Theorem Solution We have AUBUC = (a,b, c,d, e,8,h, km.) ANB = (a,b, e), ANC = {b, d,e), BNC = (b,c, 8, hh, and AN BNC = {b,e},$0 Al =5, [B| = 5,1C| = 8,|AUBUC| = 10, |ANB| = 3, |ANC| = 3, [BNC] = 4,and lANBNC| = 2. Thus |A\+]B/+{C|-|ANB|-|BNC|=|ANC+|ANBNC| 545+8—3—3~4+ 204 10, and Theorem 3 is verified, . A computer company wants to hire 25 programmers to handle systems program- ‘ming jobs and 40 programmers for applications programming. Of those hired, ten will be expected to perform jobs of both types. How many programmers must be hired? Solution Let A be the set of systems programmers hired and B be the set of applications programmers hired. The company must have |A] = 25 and [B| = 40, and |A 9 B| = 10. The number of programmers that must be hired is |AU B), but |AU B| = [A| + |B] ~ |B], So the company must hire 25 +40 — 10 oF 55 programmers. . 1.2 Operations on Sets 11 A sary hs ten ken on methods of commu wave, Each response mas asked to check BUS, TRAIN, or AUTOMOBILE as a major method of traveling to Work. More than one answer was permitted. ‘The results reported were as fol- lows: BUS, 30 people; TRAIN, 35 people; AUTOMOBILE, 100 people; BUS and TRAIN, 15 people; BUS and AUTOMOBILE, 15 people; TRAIN and AUTOMO- BILE, 20 people; and all three methods, 5 people. How many people completed a survey form? Solution Let B, T, and A be the sets of people who checked BUS, TRAIN, and AUTOMOBILE, respectively. We know |B| = 30, |T| = 35, |A| = 100, IBOT) = 15, BO Al = 15, [TO Al = 20, and |ROT NA [B|+ IT] +|Al— 1B 7|- [BN Al= [TAL +|BAT NAL 100 ~ 15 ~ 15 ~ 20 + 5 or 120 is |A UB U Cl, the number of people who responded, . Jn Exercises 1 through, let U = (0, .6.4.0, f.Bsho ke @ Buc @ Ane AnD A= (a bregh, B= Whe, hugh © = (ase, f), and @ anc a cop Daithny ‘ 6 Compute 1. Compute @ 4-8 @) B-A @ C-D @ AUB @ BUC anc @e © a © AaB (BOD @(AUB)-C_ A-B @ CoD @ Bec @i was @ Aec 2 compute @ nae (@ auauc ® Ansac 2 Compute © Anguc) — @ auBND @ Aud @ BUD @CnD © 105 ANB @ AnD @ (AUB)~(CUB) 8 Compute © B-c @E c~B @ BucuD ) BncnD © CD @ (ANB)~(BND) @ ava (@ ana 3. Compute @ aut An€un) @ auBuc ananc In Exerwes 9 and 10, let U = (a, brevdef.8.M © AnBLE) —@ (AUA)NE (a,c, fuah B= (ayeland C = (0h) © AUB 0 ANB 9. Compute 4 Compute @a oF © 1B @ Aue AVY @ BUR @AE wt OA-B @cn) CUD enD 10, Compute In Exercises 5 through 8, let U = (1, 9), CAO ee awe A= 11.2.4.6,8}, B= (2,4,5,9}, C = [x | rie apostve @CAC WASR WH BOC lmeger and x? = 16), and D = (7,8). 11, Let Ube the set of real numbers, A = [x i solution 5. Compute ofs*—1-=0), and B = (1,4), Compute @ AUB @) AUC @ AUD @ OF @AUE Ww ANB 12° Chapter 1 Fundamentals {In Exercises 12 and 13, refer to Figure 1.14 Figure 1.14 12, Identify the following as tre oF false (@ yeAnB (@) re BUC © weane @ugc 13, Identify the following as tre or false. @xEANBNC — (b) yeAUBUC © zeane @veanc 14, Descrite the shaded region shown in Figure 1.15 using unions and intersections ofthe sets A, B, and C. (Several ‘descriptions are possible) Figure 1.15 15, Let A, B, and C be finite sets with || = 6, 18 Cl =6,jAU BUC] = 11, [An a) =3,1Ancl and |BAC| = 5. Find |A NB NCI {In Exercises 16 through 18, very Theorems 2 for the given 16, (@) A= (1,2,3,4}, B= [2,3,5,6,8) 0) A= (1.2.3.4), B= 5.6,7,8,9} 17. @ A=(a,b.e.de, f1,B= [ae hahir) ) A= (abcde), B=(fasrssta) 18, (a) A= (x | xis posiuve integer < 8), B= (x |x isan integer such that 2 < x <5) {x | xis. a positive integer and x? < 16), {| xis a negative integer and 1? < 25) [Al what © 19, ICA and B are disjoint sets such that [AUB] ‘must be tue about 8°” {In Exercises 20 through 22, verly Theorem 3 for the given sets 20, A = (a,b,6,dseh, B= lds f. 8, Cm laederkrst) A= (1,2,3,4,5,6), B= (2,4,7,8,9), C= (1.2.4.7, 10, 12) A= (x xis a postive integer < 8), {| x isan integer such hat? < x <4}, (|x is an integer such that x* < 16} 23, Ina survey of 260 college stems, the following data ‘were obtained (64 ad taken a mathematics course, ‘94 ad taken a computer science course, ‘58had taken a business course, 28 had taken both a mathematics and business course, 26 had taken both a mathematics and v computer science 22 had taken both a computer science and a business ‘cours, and 14 had taken all three types of courses. (®) How many students were surveyed who bad taken ‘none ofthe three types of courses? (©) Of the students surveyed, how many had taken only a computer science course? 24, A survey of $00 television watchers produced the follow ing information: 285 watch football gumes, 195 watch hockey games, 115 watch basketball games, 45 watch foorball and basketball games, 70 watch football and Ihockey games, 50 watch hockey and basketball games, and 50 do not watch any ofthe tree kinds of games, (2) How many people inthe survey watch all three kinds of games? () How many people watch exactly one ofthe sports? 25. Ina psychology experiment, the subjects understudy were classified according to body type and gender as follows: ———_—__. ENDO-ECTO. _MESO- MORPH MORPH MORPH Male na 4 35 Female __& a 33 (a) How many male subjects were there? (&) How many subjects were ectomorphs? (©) How many subyects were either female or endo- morphs? (4) How many subjects were not male mesomerphs? (©) How many subyects were either male, ectomorph, of smesomorph? 26. Complete the following proof that A C A U B. Suppose x€ A, Then x © AUB, because ——. Thus by the Sefiniton of subset A C AUB. 27. Complete the following proof that A 7B © A. Suppose 13 Sequences 13, (©) To prove AUB C C, we should choose an element rom which set? (©) Provethatif AC Cand BC C,then AUBEC 30, Prove that A — (A ~ B) ¢ B. 3. Suppose tat A 9 B = A © C. Docs his garni hat 7 Justify your conclusion, 32, Prove that A= B= ANB, 33. AUB = AUC, must B CP Explain, © ANB. Then x belongs to 28. (a) Draw a Venn diagram to represent the situstion CoAaM CCE. (©) Toprove C © AUB, we should choose an element from which et? (©) Prove tat if hat FC SA and © SB, cen UB 29. (a) Draw a Venn diagram to represent the situation AC Cand BEC. 1.3 SEQUENCES Bre Brune Erne MAN B= ANC, must B 35. Prove thatif AC B and C ¢ D, then AUC © BUD ad ANC C BAD, 36, When is A— B= B~ A? Explain ‘37. Explain the last term inthe sum in Theorem 3. Why is JAN BNC) added and |B 7 subtracted? 38. (a) Write the four-set version of Theorem 3; that is, lauBuCcUD = (©) Describe in words the n-st version of Theorem 3, Thus ANB SA ? Explain Some of the most important sets arise in connection with sequences. A sequence is simply a lst of objects arranged in a definite order, a first element, sevond element, third element, and so on. The list may stop after n steps, n € N, or it may go on forever. Inthe first case we say thatthe sequence is finite, and in the second case we say that itis infinite. The elements may all be different, or some may be repeated. ‘The sequence 1, 0,0, 1, 0, 1, 0, 0,1, 1, 1 isa finite sequence with repeated items, ‘The digit zero, for example, occurs as the second, third, fifth, seventh, and eighth clements of the sequence. . ‘The list 3, 8, 13, 18, 23, ... is an infinite sequence. The three dots inthe expression ‘mean “and so on,” thats, continue the pattern established by the first few elements . Another infinite sequence is 1, 4,9, 16,25, .... the ist of the squares of all positive integers. . [Ie may happen that how a sequence is to continue is not clear from the first few terms. Also, it may be useful to have a compact rotation to describe a sequence. ‘Two kinds of formulas are commonly used to describe sequences. In Example 2, & natural description of the sequence is that successive terms are produced by adding 5 to the previous term. If we use a subscript to indicate a term’s position in the sequence, we can describe the sequence in Example 2 as a; = 3, dy = dq-1 +5, “4 Chapter 1 Fundamentals Gre Ere Bre Brune Brum Blues EXAMPLE 10 2 ee or bexin wih atl ofm © Orepeton of O ad end wih Some number PE Gert ths etic frenanpe, sings 111101, 010101 Oiororott iit andor ‘ 20 Chapter 1 Fundamentals In Exercises | through 4, give the set corresponding to the sequence WAWLALWLAL 2, 0.2,4,6.8, 10, 3. aabbecddee...22 4. abbeeeddda 5. Give tree diferent sequences that have (x,y, 2) a8 a corresponding set 6, Give tee diferent sequences that have (1,2,3,.... 88 a corresponding set Jn Exercises 7 through 10, write out the fis four terms (begin ith n = 1) of the sequence whose general term is given Daas 8 by =3n? 420-6 9) = 25.64 Our HLS 10, dy = ~3.dy = 2d +1 Jn Exercises 11 through 16,,erite a formula forthe nth term of the sequence. Identify your formula as recarsive or explicit. 14 1.3,5.2.. 12. 0,3,8,15.24,38. Boay-b-t, 14, 0,20,2.0,2 1. 1447.10,13.16 Lb bbb 17, Write an explicit formula for the sequence 2, 5,8, 11, 1417, 18, Write a recursive formula forthe sequence 2 5,7, 12, 19,31, 19, Let A = {x | x isaveal umber and 0 0, we can write m = gn +r for integers q and r with 0 ¢, then a | (bo). (©) Ifa | bora |, thena | be (@) ha | bandd | c, then a |e. . Proof, (a) a) banda | ¢, then b = ha and bre= (ky +h)a mda | (b+0). (b) This can be proved in exactly the same way as (a), (© As in (a), we have 6 = kia or c = kya, Then either be = kac or bbe = kaab, so in either case be is a muliple of a and a | be. (@) Ifa | b ands | c, we have b = kya and c = kxb, s0.¢ = ky = ka(ksa) = (kok:)a and hence a | v ‘a for integers ky and kp, So Note that again we have a proof that proceeds directly from a definition by restating the original conditions. As a consequence of Theorem 2, we have that if | banda | c, then a | (mb + nc), for any integers m and n A number p > Lin Z* iscalled prime if the only positive integers that divide pace p and! ‘The numbers 2, 3,5,7, 11, and 13 are prime, while 4, 10, 16, and 21 are not prime. Its easy 10 write a set of steps, or an algorithm’, to determine if a positive integer n > 1 isa prime number. First we check to see if 18 2. Ifn > 2, we could divide by every integer from 2 to n ~ 1, and if none ofthese i a divsor of m, then ‘nis rime. To make the process more efficient, we note that if mk =, then ether tm ot kis less than or equal to v/a. Thus means that nis not prime, it has a divisor K satisfying the inequality 1 < k < Jn. so we need only test for divisors in this range, Also, ifm has any even number as a divisor, it must have 2 asa divisor. Thus after checking for dvisbilty by 2, we may skp all even integers @ ALGORITHM to est whether an integer N > 1 is prime: ‘Step 1 Check whether N is 2. Ifs0, N is prime. Ifnot, proceed to ‘Step 2 Check whether 2 | N If so, is not prime; otherwise, proceed to ‘Step 3 Compute the largest integer K < VW, Then ‘Step 4 Check whether D | N, where D is any odd number such that 1 < D =K.IED|N, then N is not prime; otherwise, NV is prime. "Algoridm are discussed in Appendix A. Theorem 3 Brno Theorem 4 1.4 Division in the Integers 23, ‘Testing whether an integer is prime is a common task for computers, The algorithm ziven here is too inefficient for testing very large numbers, but there are many other algorithms for testing whether an integer is prime, Every postive integer nm > 1 can be written uniquely os pi! p!?--- pl, where pi < pa b > O (otherwise interchange @ and b). Then by Theorem 1, we may write a=kb+n, — where ky isin Z* and 0 b> ry > ry > ry > ry > ++, the remainder will evertually become 0. ‘We now show that r, = GCD(a, b). We saw previously that zero, $0 at some point we have rz cpa,» GeDe,n). Repeating tis argument with band 7, we see that GCDe, n) = GeDIn, n. Upon continuing, we have GcD(a,b) = ICD, 71) = GCD(ry. 7; = GCD(rp-4. 79). Since ra1 = ksi tay We See that GCD(7q-1. 4) = re. Hence ry = GCD(a, 6) EXAMPLE L.A Division in the Integers 25 Leta be 190 and b be 34. Ther, using the Euclidean algorithm, we divide 190 by 34: 190 = 534420 divide 34by 20: -34=1-20414 divide 20by 14: -20= 1-14-46 divide 14 by 6: 14=2-6+2 divide 6 by 2: 6=3-240 80 GCD(190, 34) = 2, the last of the nonzero divisors. . In Theorem 4(a), we observed that if d = GCD(a, b), we can find integers s and r such that d = sa + 1b. The integers s and t can be found as follows. Solve the next-to-last equation in (2) for ry @ Now solve the second-to-last equation in (2), rq-3 = kn-1-2-+ fat £08 My-y Pact = Tad — htt and substitute this expression in (3: Py aa haltana — htt ae Continue to work up through the equations in (2) and (1), replacing r; by an expres: sion involving r,-1 andr,» and finally arriving at an expression involving only @ and’, (@) Leta = 190 and b = 34s in Example 5. Then GCD(I90, 34) = 2 = 14-26) = 14— 2(20- 1(14)] 4 3(14) — 2(20) = 3134-1020] 220) 14 = 34-120 334) — 5(190- 5-34) 20= 190-534 28(34) ~ 5(190) Hence s = ~5 and ¢ = 28, Note that the key is to carry out the arithmetic only partially, (b) Leta = 108 and b = 60. Then GCD(108, 60) = 12 = 60 ~ 1148) 60 — 1[108— 1(60)]_ 48= 108 - 1-60 = 2(60) — 108. Hence s = —1 ands = . Theorem 5 fa and b are in Z*, then GCD\a, 6) = GCD(b, b+ a) . 26 Chapter 1 Fundamentals Theorem 6 Proof If cdivides a and &, it divides b-ta, by Theorem 2. Since a = b~(b—a} —b-+ (b +a), we ser, also by Theorem 2, that a common divisor of b and b +a also divides a and b, Since a and b have the same common divisors as b and b +, they must have the same greatest common divisor. v This is another direct proof, but one that uses a previous theorem as well as definitions. Least Common Multiple fa, 6, and kare in Z*, and a | k, b | k, we say #18 a common multiple of a and », The smallest such k, call tc, is called the Teast common multiple, or LCM, of @ and 6, and we write c= LCM(a, b). The following result shows that we can obtain the least common multiple from the greatest common divisor, so we do not need a separate procedure for finding the least common mulple. If and b are two positive integers, then GCD(a, 6) -LCM(a, b) = ab. . pee ge ce a= Pip pf and b= plot whee Some of the nd yay be 2. Henlow tht GCD{a, by = ppest pene), pamienh) and pnt Hence GCD(a, 6) -LOM(a, b) = pf" pF... ppv (PE PS BI (oP De pe) =ab ’ Leta = 540 and b 04. Factoring a and b into primes, we obtain =540= 2.3.5 and b= 504 = 2.37.7. ‘Thus all the prime numbers that are factors of either a or B are py = 2, pr = 3, Ps = 5S, and py = 7. Then a = 2-37. 5!-7 and b = 2+ 3*. 50.7), We then have yri2.3) 0003.2, sean.) 80.) 232570 3 oF 36 GCD(S40, 504) = Big Baud 1.4 Division in the Integers 27 Also, poms) ami2 gmail yeaa 1) 3? «51.7! 0 71560. Then GCD(S40, 504) - LCM(S40, 504) = 36 - 7560 = 272,160 = $40 - 504. As a verification, we ean also compute GCD(S40, 504) by the Euclidean algorithm and obtain the same result . fm and m are integers and n > 1, Theorem I ells us we can wnte m = a+r, 0. Y) THEN 1 XeX~¥ b. ELSE L Y¥er-x 2, RETURN (X) END OF FUNCTION GCD Uh pulses fr GCD clas the gest conmos dvr of 19s 34 Example 5), Solution The following table gives the values of X, ¥, X — ¥,or ¥ — X as wwe go through the program. x poetic yenye ge 9034S 6D ease 88 OM 54 4M 20 2 38 4 4 6 6 is 8 6 8 2 6 2 4 4 2 2 2 2 Since the last value of X is 2, the greatest common divisor of 190 and 34 is 2. . (1.4 Exercises )— ‘in Exercises 1 through 4, for the given integers m and n, write masgn+r.withO sJme-[3 S a] mm 1 6-2 Rate Sicgeed aT=|-3 1] and BT=|4 -1 6 Sa S02, a ‘The following theorem summarizes the basic properties of the transpose oper- ation. AA and B are matrices, then (@) (AT =A. (b) (A+B)? = AT + BT, (©) (AB)! = BTAT, . Axmatrix A = [a, ]is called symmetric if AT = A. Thus if Ais symmetric, it must be a square matrix. Its easy to show that A is symmetric if and only if 4, = ay. Thatis, A is symmetic if and only if the entries of A are symmetric with respect tothe main diagonal ofA ls 123 WA=] 2 4 S}andB=]2 4 0], thenAis symmetric and B 3 5 6 321 is noc sytametic. . Boolean Matrix Operations ‘A Boolean matrix is an m x n matrix whose entries are either zero or one. We shall now define three operations on Boolean matrices that have useful applications in Chapter 4 Let A'= (a, ] and B = [6, ] be m xn Boolean matrices. We define AVB -y ).the join of A and B, by ify = 10rb, =1 ifa, and b,, are both O if. and b,, are both 1 ify =0orb, = Brune 1.5 Matrices 35 ‘Note that these operations are only possible when A and B have the same size, just as in the case of matrix addition. Instead of adding corresponding elements in A and B, to compute the entries of the result, we simply examine the corresponding ‘elements for particular patterns. 101 110 ond re08t Leta 11 0/4 oon ooo) 110 (@ Compute AVB, — (&) Compute AA. Solution (@ Let AV B = [ey]. Then, since ays and bys are both 0, we see that 4) = 0, Inall other cases, either ay, oF bis 1, 80 cy is also 1. Thus rid 114 Ay Dee (ate 110 (©) Let ANB = [4 J. Then since yy and Dy: are both 1, dy = 1, and since 4y3 and bay ate both 1, day = I. In all other cases, either dy of by 180, $0 4 100 oot =|o00 000 Finally, suppose that A = [ a, ]is an m x p Boolean matix and B = [ J is ‘ap xn Boolean matrix. Notice that the condition oa the sizes of A and Bis exactly the condition needed to form the matrix product AB. We now define another kind of product. “The Boolean product of A and B, denoted ACB, isthe m xr Boolean matrix 6; ] defined by of} ‘This multiplication is similar to ordinary matrix multiplication. The preceding for ‘ula states that for any i and j the element c,, of C = A © B can be computed in the following way, as illustrated in Figure 1.21. (Compare this with Figure 1.20.) 1. Select row i of A and column j of B, and arrange them side by side. 2. Compare corresponding entries. If even a single pair of corresponding en- tries consists of two I's, then cy, = 1. Ifthis is not the case, then ¢,, = O. 1 forsomek,1 0, we can write gn-ty for integers q andr with 0 * (@) How many stadents study all three languages? (©) How many students study only BASIC? (©) How many students donot study any ofthe languages? 10, aL. 2. Ghapter 1 Self-Test 45 Define a sequence as follows: ay = 0, a1 = 0, = 1 3ay-1 + 2ay-2. Compute the fist six terms of tis sequence Let U = tanbrerdre, fissrirjhs A = larbrds fh B= {a,b,c,h,jhoC = (6.6, fos i}, and D = (g,h). Represent each ofthe following sets by an array of eres and ones @ AUB @ Ane © AnwuO @ @nwup Let I = {a,b,c}. In each par that follows is listed string in" and a regular expression over I, For each, state ‘whether the sting belongs tothe regular set corresponding tothe expression (ab atbet () acho ((acb) vB)" © be (lab) ve) @) abaca (ab) ‘Use the Facidean algorithm to compute GCD (4389, 7293) and write itas (7293) + (4389). vaaa[_2 $ SJoan-[_3 9] compar ponies often. oa mA om ave oan 10 10 10 @CoD mCvD @caDd Let § = (2x 2 Boolean matrices, A, V, O} and A be a 2'x 2 Boolean matrix. Describe the ‘inverse of A in S. LOGIC Prerequisites: Chapter 1 2.1 PROPOSITIONS AND LOGICAL OPERATIONS A statement or proposition isa declarative sentence that is either true or false, but ot both: Which of the following are statements? (@) The earth is round. (b) 24355 (©) Do you speak English? @3-x=5 (©) Take two aspirins. (© The temperature on the surface of the planet Venus is 800°F. (g) The sun will come out tomorrow. Solunon (@) and (b) are statements that happen to be true. (©) is a question, so itis not a statement. (@) isa declarative sentence, but not a statement, since pending on the value of x. (©) is nota statement; its a command. Table 2. Tae, Fir Table 2.2 pa | pa caer Ts leak Reet jae Fel & Bree 2.1 Propositions and Logical Operations 47 (0 is declarative sentence whose truth oF falsity we do not know at this time; however, we can in principle determine if is true o false, soit a statement, () is a statement since itis either true or false, but not both, although we would have to wait until tomorrow to find out if it is true or false, mt Logical Connectives and Compound Statements In mathemaues, the eters x, y, 2,... often denote variables that can be replaced by real numbers, and these vaiiables can be combined with the familiar operations +, x, —, and =. In logic, the leters p, g, r,... denote propositional variables: that is, variables that can be replaced by statements. Thus we can write p: The sun is shining today. q: Itis cold. Statements or propositional variables can be combined by logical connectives to obtain compound statements. For example, ‘we may combine the preceding statements by the connective and to form the com- pound statement p and q: The sun is shining and it is cold. The truth value of ‘a compound statement depends only on the truth values of the statements being combined and on the types of connectives being used. We shall look at the most important connectives. If p is a statement, the negation of p is the statement not p, denoted by ~>. ‘Thus ~p is the statement “it isnot the case that p.” From this definition, it follows that if p is wue, then ~p is false, and if p is false, then ~p is tue. The truth value of ~p relative to p is given in Table 2.1. Such a table, giving the truth values ‘of @ compound statement in terms of its component parts is called a truth table. Strictly speaking, not 1s not a connective, since it does not join two satements, and ~pis not really a compound statement. However, nor is @ unary operation for the collection of statements and ~p is a statement if pis, Give the negation ofthe following statements: (@) p:243>1 — (b) g:ltiscold Solution (a) ~p: 2-43 is not greater than 1. That is, ~p: 243 < 1. Since p is true in tis case, ~p is false (b) ~q"Itis not the case that itis cold. More simply, ~g° It is not cold. If p and q are statements, the conjunction of p and q is the compound state: ‘ment “p and,” denoted by p Ag. The connective and is denoted by the symbol A. In the language of Section 1.6, and is a binary operation on the set of statements. ‘The compound statement p A q is true when both p and q are true; otherwise, itis false. The truth values of p A q in terms of the truth values of p and q are given in the truth table shown in Table 2.2. Observe that in giving the truth table of pAg we need to look at four possible cases. This follows from the fact that each of p and q ccan be true or fase. Form the conjunction of p and q for each of the following, (2) p: Itis snowing. 4g: Lam cold.

You might also like