9.5ProductsandQuotientsofGroups372 9.6 Other Mathematical Structures 377
10 Languages and Finite-State Machines 386
11 Groups and Coding 429
Appendix A: Algorithms and Pseudocode
Appendix
Appendix C: Coding Exercises 473
Preface
Discrete mathematicsisaninterestingcoursebothtoteachandtostudyatthe freshmanandsophomorelevelforseveralreasons.Itscontentismathematics, butmostofitsapplicationsandmorethan half ofitsstudentsarefrom computer scienceorengineeringconcentrations.Thus,carefulmotivationoftopicsandpre viewsofapplicationsareimportantandnecessarystrategies.Moreover,thereare a number of substantive and diverse topics covered inthe course, soatextmust proceed clearlyandcarefully, emphasizing keyideaswith suitable pedagogy.In addition,thestudentisgenerallyexpectedtodevelopan important newskill:the abilitytowriteamathematicalproof.Thisskillisexcellenttrainingforwriting computer programs.
Thistextcanbeusedbystudentsasan introduction tothe fundamental ideasof discrete mathematics, andasa foundation forthe development of more advanced mathematical concepts.Ifusedinthisway,thetopics dealing withspecificcom puterscienceapplicationscanbeomittedorselected independently asimportant examples.Thetextcanalsobeusedinacomputerscienceorelectricalandcom puterengineeringcurriculumto present the foundations ofmanybasic computer relatedconcepts,andtoprovideacoherentdevelopmentandcommonthemefor theseideas.The instructor can easily develop a suitable syllabus by referring to the chapter prerequisites which identify material needed bythatchapter.
• Approach
First, wehave limited both the areas covered andthe depth of coverage to what wedeemprudentin afirstcourse taughtatthefreshmanandsophomorelevel.We have identified aset of topicsthatwefeelare of genuine usein computer science and elsewhere andthatcanbe presented ina logically coherent fashion.Wehave presentedanintroductiontothesetopicsalongwithanindicationofhowtheycan bepursuedingreaterdepth.Thisapproachmakesourtextan excellent reference for upper-division courses.
Second,thematerialhasbeen organized and interrelated to minimize themass of definitions andthe abstraction of some of the theory. Relations and digraphs are treated astwoaspectsofthesame fundamental mathematical idea,witha directed graphbeingapictorialrepresentationofarelation.Thisfundamentalideaisthen usedasthebasisofvirtuallyalltheconcepts introduced inthebook,including functions,partialorders,graphs,andmathematicalstructures.Wheneverpossible, eachnewidea introduced inthetextuses previously encountered material and, inturn,is developed insuchawaythatit simplifies the more complex ideasthat follow.
• What Is New in the Sixth Edition
Wehavebeengratifiedbythewide acceptance of thefirstfive editions ofthisbook throughout the25yearsofitslife. Equally pleasing isthe confirmation of theorig inal decisions about content and approach forthe book fromthe earliest editions. For example, the Association of Computing Machinery Special Interest Groupfor Computer Science Education (SIGCSE) and others have recently made recom mendations regarding the structure of a one-semester course in discrete structures that arewell supported bythistext.In preparing this edition, wehave carefully considered these recommendations, as well as many suggestions from faculty and
students for improving the content and presentation ofthe material. Although manychangeshavebeenmadetodevelopthisrevision,ourobjectivehasremained thesameasinthefirstfiveeditions: topresentthebasic notions of discrete math ematicsandsome of itsapplicationsina clear and concise mannerthatwillbe understandable to the student.
We believe thatthisbook works wellinthe classroom becauseofthe unifying roleplayedbythetwokey concepts: relations and digraphs. Substantial strength eningofthelogicmaterialhasbeenmadebytheadditionoftwonewsections, Mathematical Statements and Logic and Problem Solving alongwith accompany ing exercises. New material onfuzzysetsandfuzzylogicintroducesstudentsto atopicthatisextremelyimportantformodernissues of automated feedbackand controlofprocesses.Thepopularpuzzle Sudoku, relatedpuzzles,andtheirunder lying mathematical connections, forma continuing threadinthetext connecting settheory,Booleanmatrices,algorithmsandcoding,logic,thegeneralconstruc tionofproofs,coloring problems and polynomials, andothertopicsinawaythat studentswillfindboth interesting and instructive. Otherimportantchangesin clude:
• Additional emphasis onhowtodevelopaconjectureandhowtoproveor disprove it.
•TheEnd-of-Chaptermaterialfromthefiftheditionhasbeenrearrangedas follows:theconceptualreviewquestionsarenowfoldedintotheSelf-Test attheendofeachchapterandthecodingexerciseshavebeenmovedto Appendix C.
• Exercises
Theexercisesformanintegralpartofthebook.Manyarecomputationalinna ture,whereasothersareofatheoreticaltype.Manyofthelatterandtheexperi ments,tobefurtherdescribedbelow,requireverbalsolutions.Exercisestohelp developproof-writingskillsaskthestudenttoanalyzeproofs,amplifyarguments, orcompletepartialproofs.Guidanceandpracticeinrecognizingkeyelements and patterns havebeen extended inmanynew exercises. Answers toalloddnumbered exercisesand self-test items appear intheback of thebook. Solutions toall exercises appear inthe Instructor's Solutions Manual, which is available (to instructors only)gratisfromthepublisher.The Instructor's Solutions Manual alsoincludesnotesonthe pedagogical ideas underlying eachchapter,goalsand grading guidelines forthe experiments (further described below), andatestbank.
inthetext.Theyare designed as extended-time, out-of-class experiences andare suitable for group work. Each experiment requires significantly more writing than section exercises do.Some additional experiments aretobe found in Appendix B. Content, prerequisites, and goals for each experiment are given inthe Instructor's Solutions Manual.
• Coding Exercises
Aset of coding exercises foreach chapter are included in Appendix C.
• End-of-Chapter Material
Each chapter contains Tipsfor Proofs, a summary of Key Ideas, anda Self-Test including aset of conceptual review questions covering the chapter's material.
• Organization
Chapter 1 contains material thatis fundamental tothe course. This includes sets, subsets,andtheir operations; sequences; properties of theintegers including base n representations; matrices;and mathematical structures. Agoal of this chapter istohelp students developskillsin identifying patterns onmanylevels. Chapter 2 covers logicand related material, including methods of proof and mathematical induction. Although the discussion of proof is based onthis chapter, the commen taryon proofs continues throughout the book. Twonew sections, Mathematical Statements and LogicandProblem Solving have been added. This material isused tobriefly discuss the currently widely popular puzzle Sudoku and related puzzles. Chapter 3,oncounting,dealswith permutations, combinations, the pigeonhole principle, elementsof discrete probability,and recurrence relations.
Chapter 4 presents basictypesand properties of relations, along with their rep resentation as directed graphs. Connections with matrices and other data structures arealsoexploredinthischapter. Chapter 5dealswiththenotionofafunction,and gives important examplesoffunctions, including functions of special interest in computer science.An introduction tothe growth of functions is developed. New material onfuzzysetsandfuzzylogichasbeenadded. Chapter 6coverspar tially ordered sets,includinglatticesand Boolean algebras. A symbolic version forfindinga Boolean function fora Boolean expression is developed alongwith the pictorial Karnaughmethod. Chapter 7 introduces directed and undirected trees alongwith applications oftheseideas. Elementary graph theorywith applications to transport networks and matching problems isthe focus of Chapter 8.
In Chapter 9wereturnto mathematical structures and present thebasicideas of semigroups, groups, rings,andfields.By building on work in previous chapters, onlyafewnew concepts are needed. Chapter 10 is devoted tofinitestate machines. It complements andmakes effective use of ideas developed in previous chapters. Chapter 11 finishesthe discussion of coding for error-detecting and correction and for security purposes. Appendix A discusses Algorithms and Pseudocode. The simplified pseudocode presented hereisusedin some text examples and exercises; these maybe omitted without loss of continuity. Appendix B gives some additional experiments dealing with extensions or previews of topics in various parts of the course. Appendix C contains aset of coding exercises, separated into subsets for each chapter.
• Optional Supplements
There is available withthistexta 406 page workbook: Practice Problems in Dis creteMathematics by Boyana Obrenic (ISBN 0-13-045803-1). It consists entirely
of problem setswithfullyworkedoutsolutions.Inaddition,thereisa316page workbook: DiscreteMathematics Workbook by James Bush (ISBN 0-13-0463272).This item has outlines ofkey ideas, key terms, and sample problem sets (with solutions).
• Acknowledgments
Wearepleasedtoexpressourthankstothefollowingreviewersofthefirstfour editions: Harold Fredrickson, Naval Postgraduate School; Thomas E. Gerasch, George Mason University; Samuel J.Wiley,La Salle College; Kenneth B.Reid, Louisiana SateUniversity;RonSandstrom,FortHaysState University; Richard H.Austing,Universityof Maryland; Nina Edelman, Temple University; Paul Gormley,VillanovaUniversity; Herman Gollwitzer andLorenN. Argabright, both atDrexelUniversity;BillSands,UniversityofCalgary,who brought toouratten tiona number of errorsinthe second edition; Moshe Dror, University of Ari zona,Tucson; Lloyd Gavin, California State University at Sacramento; Robert H. Gilman, StevensInstituteofTechnology;EarlE. Kymala, California State University at Sacramento; andArtLew, University of Hawaii, Honolulu; Ashok T. Amin, University of Alabama at Huntsville; Donald S. Hart, Rochester Institute ofTechnology;MinhuaLiu,WilliamRainey Harper College;CharlesParry,Vir ginia Polytechnic Institute&University; Arthur T.Poe,Temple University; Suk JaiSeo,UniversityofAlabamaat Huntsville; PaulWeiner,St. Mary's Univer sityofMinnesota;andofthefifthedition:EdwardBoylan,RutgersUniversity; AkihiroKanamori,BostonUniversity;CraigJensen,University of NewOrleans; HaroldReiter,UniversityofNorthCarolina; Charlotte Zhong-Hui Duan,Univer sityofAkron;andofthesixthedition:DanrunHuang,St.CloudStateUniversity; George Davis, Georgia State University; Ted Krovetz, California State Univer sity,Sacramento;LesterMcCann,TheUniversityofArizona;SudiptoGhosh, Colorado StateUniversity;BrigitteServatius,Worcester Polytechnic Institute; Carlo Tomasi, DukeUniversity;AndrzejCzygrinow, Arizona StateUniversity; JohanBelinfante,GeorgiaInstituteofTechnology;GaryWalker, Pennsylvania StateUniversity-Erie.Thesuggestions,comments,andcriticismsofthesepeople greatly improved the manuscript.
WethankDennisR.Kletzing,who carefully typesettheentire manuscript; Lil ianN.Bradyforcarefullyandcriticallyreadingpageproofs;BlaisedeSesa,who checked the answers and solutions toall the exercises in the book; and instructors and students frommany institutions inthe United States and other countries, for sharingwithustheirexperienceswiththebookandofferinghelpfulsuggestions.
Finally, a sincere expression of thanks goestoBill Hoffman, Senior Editor, Caroline Celano,AssociateEditor, Linda Behrens, Senior Managing Editor,Kristy Mosch, Production ProjectManager,KatieWinter, Marketing Manager, JonCon nelly, Marketing Assistant, Lisa McDowell, Operations Specialist, Heather Scott, Art Director, Tom Benfatti, Art Editor, and to the entire staff of Pearson for their enthusiasm, interest,andunfailing cooperation duringthe conception, design,pro duction, and marketing phases of this edition.
A Word to Students
Thiscourseislikelytobe different fromyour previous mathematics courses in severalways.Thereareveryfew equations tosolve,evenfewerformulas,and just ahandfulofprocedures.Althoughtherewillbedefinitionsand theorems tolearn, rote memorization alonewillnotcarryyou through thecourse. Understanding conceptswellenoughtoapplytheminavarietyofsettingsisessentialforsuccess.
Thegoodnewsisthatthereisa wealth of interesting and useful material in thistext.Wehavechosentopicsthatformabasisfor applications in everyday life, mathematics, computer science,and other fields.Wehavealso chosen thetopics sothattheyfit together andbuildoneachother;thiswillhelpyouto master the concepts covered.
Two distinctive features of this course area higher level of abstraction and more emphasis onproofsthanyouhave perhaps encountered in earlier mathemat icscourses.Hereisanexampleofwhatwemeanby abstraction. Whenyoustudied algebra,youlearnedthedistributive property of multiplication overaddition.In this course, youwill abstract the concept of a distributive property and investigate this idea formanypairs of operations, not just multiplication and addition.
The other featureisproofs. Before you close the book right here,letustell you something abouthowproofsare handled inthisbook.Thegoalsareforyou tobeabletoreadproofs intelligently andto produce proofs onyourown.Theway wehelpyoutothesegoalsmayremindyouofyour composition classes.Learning towriteapersuasiveessayorameaningful sonnet or another style composition isa complicated process.First,youread,analyze,andstudymanyexamples.Nextyou tryyourhandatthespecificstyle.Typicallythisinvolvesdraft versions, revisions, critiques, polishing, and rewriting to produce a strong essay ora good sonnet or whatever formis required. There areno formulas orrote procedures for writing. Proofs,liketheproductsofa composition course,have structures andstyles. Wegiveyoulotsofproofstoreadandanalyze. Some exercises askthatyou outline,analyze,orcritiqueaproof.Otherexercisesrequirethecompletionof partial proofs.Andfinally,therearemany opportunities foryouto construct a proof onyourown.Believeus,readingand writing proofsare learnable skills. Ona larger scale,wehopethistext helps youto become an effective commu nicator, a critical thinker, a reflective learner, andan innovative problem solver. Best wishes fora successful and interesting experience.
CHAPTER 1 Fundamentals
Prerequisites: There are noformal prerequisites for this chapter; the reader is encouraged to read care fullyand work through all examples.
Inthis chapter we introduce some of the basic tools of discrete mathematics. We beginwithsets,subsets,andtheir operations, notions with which youmay already befamiliar.Nextwedealwith sequences, usingboth explicit andrecursivepat terns. Then wereviewsome of thebasic properties of the integers. Finally we introduce matrices and matrix operations. This givesusthe background needed to beginour exploration of mathematical structures.
Looking Back: Matrices
Theoriginofmatricesgoesbackto approximately 200B.C.E., 1897), aBritish mathematician andlawyer.In 1851, Sylvester whentheywereusedbythe Chinese tosolvelinearsystemsofmetArthurCayley (1821-1895), alsoa British lawyerwitha equations.Afterbeingintheshadowsfornearlytwothousandstronginterestin mathematics. Cayleyquicklyrealizedthe imyears,matricescamebackinto mathematics towardtheendofportanceofthenotionofamatrixandin1858 published abook the seventeenth centuryandfromthen research inthisareapro-showingthebasic operations onmatrices.Healso discovered a ceededatarapidpace.Theterm "matrix" (the singular of"ma- number of important results inmatrix theory, trices") was coined in 1850 by James Joseph Sylvester (1814—
James Joseph Sylvester
Arthur Cayley
1.1 Sets and Subsets
Sets
A set isanywell-definedcollectionofobjectscalledthe elements or members of the set.Forexample,thecollectionofallwoodenchairs,the collection ofall one-legged black birds,orthe collection of real numbers between zero andone areallsets. Well-defined justmeansthatitispossibletodecideifagivenobject belongstothecollectionornot.Almostallmathematicalobjectsarefirstofall sets,regardlessofanyadditionalpropertiestheymaypossess.Thussettheoryis, inasense,thefoundationonwhichvirtuallyallofmathematicsisconstructed.In spiteofthis,settheory(atleasttheinformalbrandweneed)isquiteeasytolearn and use.
Onewayofdescribingasetthathasafinitenumberofelementsisbylisting theelementsofthesetbetweenbraces.Thusthesetofallpositiveintegersthatare less than 4 can be written as
Weuse uppercase letterssuchasA, B, C to denote sets,and lowercase letters suchas ay b, c, x, y, z, t todenotethe members (or elements) ofsets.
Weindicatethefactthat x isanelementoftheset A bywriting x € A,and weindicatethefactthat x isnotanelementof A bywriting x £ A.
Example 1 Let A= {1, 3,5,7}. Then 1 e A, 3 e A,but2 £ A.
Sometimesitis inconvenient orimpossibletodescribeasetbylistingallof itselements.Anotherusefulwaytodefineasetisbyspecifyingapropertythat theelementsofthesethaveincommon.Weusethenotation P(x) todenote asentenceorstatementPconcerningthevariableobject x. Thesetdefinedby P(x), written {x\ P(x)}, isjustthecollectionofallobjectsforwhichPissensi bleand true, {x\P(x)} isread,"thesetofall x suchthat P(x)." Forexample, {x | x isapositiveintegerlessthan 4} istheset{1,2, 3} describedin(1)bylisting its elements.
Example 2 The set consisting ofall the letters in the word "byte" canbe denoted by {b, y, t, e} orby {x\x isaletterintheword"byte"}.
Example 3 We introduce here several sets and their notations that will be used throughout this book.
(a) Z+ = {x | x isa positive integer}.
Thus Z+ consists ofthe numbers usedfor counting: 1,2,3 (b)N= {x | x isa positive integer orzero}= {x\x isa natural number}.
ThusN consists of the positive integers andzero:0,1,2, (c)Z= {jc | x isaninteger}.
Thus Z consists of allthe integers: ..., -3,-2, -1, 0, 1, 2, 3,....
(d) Q = {x | x isa rational number}.
a Thus Q consists of numbers that can be written as -, where a and b are inteb gers and b isnot0.
Figure 1.1
(e) R ={x | x isareal number}.
(f)Thesetthathasno elements initis denoted either by{}orthe symbol 0and is called the empty set.
Example 4 Since the square ofa real number is always nonnegative, {x | x isa real number and x2 = 1} =0.
Setsarecompletelyknownwhentheirmembersareallknown.Thuswesay twosets A and B are equal iftheyhavethesame elements, andwewrite A=B.
Example 5 IfA= {1, 2, 3} and B= {x \x isa positive integer and x2 < 12}, then A= B.
Example 6IfA= {JAVA, PASCAL, C++} and B= {C++, JAVA, PASCAL}, then A= B.
Subsets
Ifevery element of A isalsoan element of B, thatis,if whenever x e A then x € B, wesaythatAisa subset of B orthat A is contained in B, andwewrite A c B. If A isnota subset of B, we write A <£ B. (See Figure 1.1.) Diagrams,suchasthoseinFigure1.1,whichareusedtoshow relationships between sets,are called Venn diagrams after the British logician John Venn.Venn diagrams willbeused extensively in Section 1.2.
Example 7 We have Z+ c Z. Moreover, if Q denotes thesetof rational numbers, then Z c
Example 8Let A= {1,2,3,4,5,6}, B = {2,4,5},and C= {1,2,3,4,5}. Then B c A, B cC,andC c A. However, A £ B, A <£ C,and C £ B.
Example 9IfAis any set, then A c A. Thatis, every setisa subset of itself.
Example 10 LetAbeaset and let B = {A, {A}}. Then, since A and {A} are elements of B, we have A € £ and{A} eB. It follows that {A}c S and {{A}} c B. However, itis not true that Ac B.
ForanysetA,sincethereareno elements of 0thatarenotinA,wehave 0cA.(Wewill look atthis again in Section 2.1.)
Figure 1.2
ItiseasytoseethatA= B ifandonlyifAc B and 5 cA.Thissimple statement isthebasisforproofs of many statements about sets. The collection of everything, it turns out, cannot be considered aset without presenting serious logical difficulties. Toavoidthisand other problems, which need not concern us here, we will assume that for each discussion there isa "uni versal set" U (which willvarywiththe discussion) containing all objects for which the discussion is meaningful. Any other set mentioned inthe discussion willauto matically be assumed tobea subset of U. Thus, if weare discussing real numbers and we mention sets A and B, then A and B must (we assume) be sets of real numbers, not matrices, electronic circuits, or rhesus monkeys. In most problems, a universal setwillbe apparent from the setting of the problem. InVenn diagrams, the universal set U willbe denoted bya rectangle, while sets within U willbe denoted by circles as shown in Figure 1.2.
AsetAis called finite ifithas n distinct elements, where n gN.Inthis case, n iscalledthe cardinality ofAandisdenotedby|A|.Thus,thesetsof Examples 1,2,4,5,and6arefinite.Aset that isnotfiniteis called infinite. The setsintroducedinExample3(except 0) areinfinitesets.
IfAisaset,thenthesetofallsubsetsofAiscalledthe power set ofAandis denotedby P(A). (BesuretodistinguishbetweenP(A),astatementaboutA,and P(A), the power set of A.)
Example 11 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}(orA).Inalatersection,wewillcountthe number of subsets that a set can have.
1.1 Exercises
1.LetA= {1, 2,4, a, b,c}. Identify eachofthe following as true or false.
(a)2 e A(b)3 eA (c) c £ A (d)0gA(e){} i A (f)AgA
2.LetA= {x | x isarealnumberand x< 6}.Identify eachofthe following astrueorfalse.
(a)3gA(b)6gA(c)5 i A (d) 8£ A(e) -8gA (f)3.4 i A
3.Ineachpart,givethesetoflettersineachwordbylisting the elements of the set.
(a) AARDVARK (b) BOOK (c) MISSISSIPPI
4.Givethesetbylistingitselements.
(a)Thesetofallpositiveintegersthatarelessthanten. (b) {jc | x GZand*2 < 12}
5.LetA={1,{2,3},4}.Identifyeachofthefollowingas true or false.
(a)3gA(b) {1,4} cA(c) {2,3} c A (d) {2,3}gA (e) {4}gA (f) {1,2,3}CA
InExercises6 through 9, writethesetintheform{x\ P(x)}, where P(x) isa property thatdescribestheelementsoftheset.
29.If P(B) = {{a},{ },{c},{fc,c}, {a, &},...} and \P(B)\ =8, then B= InExercises30 through 32,drawa Venn diagramthat repre sentstheserelationships.
30.Ac B, A cC, B £ C,andC g B
31. x GA, x G £, x <£ C, y G B, y GC,and y <£ A
32.Ac £, x £ A, * G £, A £ C, y G £, y GC
33. Describe allthe subset relationships thatholdforthesets givenin Example 3.
34. Show that if Ac B and B c C, then Ac C.
35. The statement about sets in Exercise 34 can be restated as"Anysubset of isalsoa subset of anysetthat contains "
36.SupposeweknowthatsetAhas n subsets, Si, S2,..., Sn. If set B consists of the elements of A and one more ele mentso |Z?| = IAI +1, showthat B musthave 2n subsets.
37.ComparetheresultsofExercises 12, 13,26,and28and complete the following: Anysetwithtwo elements has subsets.Anysetwiththree elements has subsets.
If Aand B aresets,we define their union astheset consisting of all elements thatbelong toAor B and denote itbyAU B. Thus
AU B = {x \x e Aorx eB}.
Observe that xe AU B if xeA or xeB or x belongs to both A and B.
Example 1 LetA= {a, b, c, e, f] and B= {b, d, r, s}. Find AU B.
Solution
Since AU B consists of allthe elements that belong to either Aor B, AU B= {a, b, c,d, e, /, r, s}.
We can illustrate the union of twosets with aVenn diagram as follows. If A and B arethesetsin Figure 1.5(a),thenAU B istheset represented bythe shaded region in Figure 1.5(b).
(b)AUfi
1.5
IfAand B aresets,we define their intersection astheset consisting ofall elementsthatbelongtobothAand B anddenoteitbyAfl B. Thus
Afl B = {x | x gA and jc G 5}.
Example 2 Let A= {a, ft, c, e, /}, B = {ft, e, /,r, *}, and C= [a, t, w, u}. Find An fi, Afl C, and B fl C.
Solution
Theelementsft, e, and/aretheonlyonesthatbelongtobothAand B, soAHi?= {ft, e, /}. Similarly, AflC= {a}. Thereareno elements thatbelongtoboth B andC,so B flC={}.
Twosetsthathavenocommonelements,suchas B and C inExample2,are called disjoint sets.
WecanillustratetheintersectionoftwosetsbyaVenndiagramasfollows.If Aand B arethesetsgiveninFigure1.6(a),thenAfl B isthesetrepresentedby theshadedregioninFigure 1.6(b). Figure1.7 illustrates a Venn diagramfortwo disjoint sets.
(b)AHB
1.7
The operations of union and intersection can be defined for three or more sets in an obvious manner:
AU BUC={x | x GA or* G B orx g C] and
Afl B n C={x | x gAand xeB and xeC}.
The shaded region in Figure 1.8(b)isthe union of thesetsA, B, andC shown inFigure1.8(a),andtheshadedregioninFigure1.8(c)isthe intersection of the setsA, B, andC.NotethatFigure1.8(a)saysnothingaboutpossiblerelation shipsbetweenthesets,butallowsforallpossiblerelationships.Ingeneral,if Ai, A2,..., A„ aresubsetsof £/, then A\U A2 U•••U An willbedenotedby
Figure
Figure
M, <ffm^. U
$Mm lift!
wi0k ^•pf >W$i$\ \pC: m|:;v pfttSj lm^JWf W'W
(b)AU£UC (c) A n b nc
Q A*, read as, "the union from 1to n of Asub fc," and Ai DA2 H•••fl An will be denotedby P| A*, readas,"the intersection from1to n ofAsub /:."
Example 3 LetA= {1, 2, 3,4, 5,7}, B= {1, 3,8, 9}, and C= {1, 3,6, 8}. Then AHBDC isthesetofelementsthatbelongtoA, £, andC.ThusAfl B H C={1, 3}.
IfAand B aretwosets,wedefinethe complement of B with respect toAas thesetofallelementsthatbelongtoAbutnotto B, andwedenoteitbyA- B. Thus A- B={x | x GAandjc £ 5}.
Example 4 LetA= {a, 6, c) and £ = {6, c, J, e}. Then A- B= {a} and B-A = {d, e).
IfAand B arethesetsinFigure1.9(a),thenA- B and £ -Aarerepresented bytheshadedregionsinFigures1.9(b)and1.9(c),respectively.
A-B u ( A ( (c) B-A
If U isa universal setcontainingA,then [/ —Aiscalledthe complement of Aandis denoted byA.ThusA= [x \x £ A}.
Example 5 LetA= {x \x isan integer and * < 4} and U =Z. Then A= {x | x isan integer andjc>4}.
Example 6 LetA = {«, ft, c, d] and £ = {a, c, e, /, g}. Then A® B= {b,d, e, /, g}.
(b)
1.10
IfAand B areasindicatedinFigure 1.11(a), theirsymmetricdifferenceisthe shadedregionshowninFigure 1.11(b). Itiseasytoseethat
A 0 B =(A -B) U (B- A).
THEOREM1
1.11
Algebraic Properties of Set Operations
The operations onsetsthatwehavejust defined satisfymany algebraic properties, someofwhichresemblethealgebraicpropertiessatisfiedbytherealnumbersand their operations. Allthe principal properties listedherecanbeprovedusingthe definitions given andthe rules of logic. We shallproveonlyoneofthe properties andleaveproofsofthe remaining onesas exercises forthereader. Proofs are fundamental to mathematics. WediscussprooftechniquesinChapter2,butinthis chaptersomeproofsare given as examples forlaterwork.Somesimpleproofsare required inthe exercises. Venn diagrams areoftenusefultosuggestorjustifythe method of proof.
The operations defined onsets satisfy the following properties: Commutative Properties
1. AUB = BUA
2. ADB = BHA
Associative Properties
3. A U (B UC)= (A U B) U C
4. A n (B n C) = (A n B) n c
Distributive Properties
5. A H (B U C) =(A fl B) U(An C)
6.AU (B fl C)=(AU B) n (AUC)
Figure
(a)
Figure
(b) A H B
Figure 1.12
THEOREM 2
Idempotent Properties
7. AUA=A
8. A fl A=A
Properties of the Complement
9. (A) =A
10. AUA= 17
11. Ar\A =0
12. 0= U
13. £/ =0
14. AU B=A fl B Properties 14and15are known as 15. ADA = AUfl De Morgan's laws.
Properties of a Universal Set
16. AU U=U
17. A H f/ =A
Properties of theEmptySet
18. AU0 = AorAU{ }=A
19.A H 0=0orA D {}={}
Proof
WeproveProperty14hereandleaveproofs of the remaining properties asex ercisesforthereader.A common style of proof for statements aboutsetsisto choose an element inone of thesetsandsee what weknow about it. Suppose that x € AU B. Thenwe know that x i A Ufl,so x £ A and x £ fl. JWhy?) This means x e_A HB (why?), soeachelementofAUfl belongs toAflfl.Thus AU B c AC) fl. Conversely, suppose that x e A D fl. Then x £ A and xjz fl (why?), so x fi AUfl, which means that x e AUfl. Thus each element of AH fl also belongs toAUfl,andA D fl c AUfl. Now wesee that AUfl=Aflfl.•
The Addition Principle
Suppose nowthatAandflarefinitesubsets of auniversalset U. Itisfrequently usefultohaveaformulafor|AU fl|, the cardinality of theunion. If Aandflare disjoint sets,thatis,ifAflfl= 0, theneach element of AUflappearsin either A or B, butnotinboth;therefore, |AUfl| =|A|+ |fl|.IfA andfloverlap,asshown inFigure1.12,thenelementsinAflflbelongtobothsets,andthesum \A\+\B\ countstheseelementstwice.To correct forthis double counting, wesubtract |A fl fl|. Thuswehavethefollowingtheorem, sometimes calledthe addition principle. Because ofFigure1.12,thisisalso called the inclusion-exclusion principle.
IfAandflarefinitesets,then|AUfl|= |A| + |fl| - |A n fl|. •
Example 7 LetA= {a, b, c, d, e] and fl= {c, e, /, h, k, m}. Verify Theorem 2.
Solution
We have AUfl= {a, b, c, d, e, f h, k, m] and Aflfl={c, e). Also, \A\ =5, |fl| =6,|AUfl|=9,and \A D fl| =2. Then |A| + |fl| -|A fl fl|=5+6-2 or 9 and Theorem 2 is verified.
ADB
Figure 1.13
IfAandflaredisjointsets, ADA =0and \A nfl|=0,sotheformulain Theorem2nowbecomes |AUfl| = |A|+ |fl|. Thisspecialcasecanbestatedin awaythatisusefulinavarietyofcountingsituations. Ifatask T\ canbeperformedinexactly n ways,andadifferenttask T2 canbe A n B n C performedinexactly m ways,thenthenumberofwaysofperformingtask T\ or task T2 is n +m.
THEOREM 3 Let A, fl, and Cbe finite sets. Then \A UflU C\ = \A\ + \B\ + \C\ -|Anfl||fl n c| -|AnC|+|Anfln C|. • Theorem 3canbe generalized formorethanthreesets.Thisis done in Exer cises 50 and 51.
Example 8 Let A= {a,b, c, d, e}, fl= {a, b, e, g, /z}, and C= {b,d,e, g,h9k,m,n}. Verify Theorem 3.
Solution
Wehave AUBUC = (a,fe,c,rf, e, g, h, k, m, n}, A flfl= {a, b, e}, AflC= {6, d, e},BDC = {b, e, g, /*}, and AHflHC = {£, <?}, so \A\ =5, |fl| =5, \C\= 8, |AUflUC| =10, |AHfl| =3, |AHC| =3, |flnC|=4,and|AflflnC| =2. Thus |A|+|fl|+|C|-|Anfl|-|flnC|-|AnC|+|AnflnC| = 5+5+8-3-3-4+2 or 10, and Theorem 3is verified.
Example 9 A computer company wants to hire 25 programmers to handle systems program ming jobs and40 programmers for applications programming. Of thosehired,ten willbeexpectedtoperformjobsofbothtypes.Howmany programmers mustbe hired?
Solution
LetAbethesetofsystems programmers hiredandflbethesetof applications programmers hired.The company must have \A\= 25and |fl| =40,and \A fl fl I = 10. The number of programmers thatmustbe hired is|AUfl|,but|AUfl|= \A\ + IA|- IA fl fl|. Sothecompanymusthire25+40-10or55 programmers.
Example 10
Asurveyhasbeentakenonmethodsof commuter travel.Each respondent was askedto check BUS,TRAIN,or AUTOMOBILE asa major method of traveling towork. More thanone answer was permitted. The results reported wereasfol lows:BUS,30people;TRAIN,35people; AUTOMOBILE, 100people;BUSand TRAIN, 15people;BUSand AUTOMOBILE, 15 people; TRAIN and AUTOMO BILE,20people;andallthree methods, 5 people. Howmany people completed a survey form?
Solution
Let fl, 7\ andAbethesets of people who checked BUS, TRAIN, and AUTOMO BILE, respectively. We know |fl| = 30, \T\ =35, \A\= 100, |fl n T\= 15, |fl H A\= 15, \T H A\= 20,and |fl n T D A\ =5.So |fl| + \T\ + \A\ - |fl fl 7| - |fl nA|- |r nA|+ |fl n r nA|=30+35+ 100 -15-15-20+5or 120is IA UflU C|, the number of people who responded.
Bnc
1.2 Exercises
InExercises1through4,letU= [a, b, c, d, e, /, g, h, k], A = (fl,i,c,g), B= [d,e,f,g], C= [a,c,f], and D = [f,h,k}.
1. Compute
(a) AUB (b) flUC (c) A D C (d) flOD (e) (AUfl)-C (f) A-B (g)A(h) A 0 fl (i)Aec U) (Anfl)-c
2. Compute
(a) AUD (b) flUD (c) CflD (d) AHD (e) (AUfl)-(CUfl)
(f)fl-C(g)fl(h)C-fl (i) C0D (J) (Aflfl)-(flnD)
3. Compute (a)AUflUC (b) Anfl n c (c) AH(flUC) (d) (AUfl)HC (e) ATTfl (f) ATTfl
25.Inasurveyof260collegestudents,thefollowingdata were obtained:
64 had taken a mathematics course, 94hadtakena computer science course, 58 had taken a business course, 28 had taken both a mathematics and a business course, 26hadtakenbotha mathematics anda computer science course, 22hadtakenbotha computer science anda business course, and 14hadtakenallthreetypes of courses.
(a)Howmany students were surveyed whohadtaken noneofthethreetypesof courses?
(b)Ofthestudentssurveyed,howmanyhadtakenonly a computer science course?
(a)Howmany people inthesurveywatchallthreekinds of games?
(b)Howmanypeoplewatchexactlyoneofthesports?
27.The Journalism 101 class recently tookasurveytodeter mine where the city's people obtained their news.Un fortunately, some of the reports were damaged. What we knowisthat88 people saidthey obtained theirnewsfrom television,73fromthelocalpaper,and46fromanews magazine. Thirty-four people reported thatthey obtained newsfromtelevisionandthelocalpaper, 16 saidtheyob tainedtheirnewsfromtelevisionandanewsmagazine, and12 obtained theirsfromthelocal paper andanews magazine. Atotal of five people reported thattheyusedall threemedia. If 166 people were surveyed, howmanyuse none of thethree media to obtain their news?Howmany obtain their newsfromanews magazine exclusively?
28.The college catering service mustdecideifthemixof foodthatis supplied for receptions is appropriate. Of
30.Thefollowingtabledisplays information about thesopho more, junior, and senior classes at Old U.
Sophomore(S)
Foreachofthe following tellhowmany students arein the set and describe those students in words.
(a) Dfi; (b) UUR (c) (DUS)HR
31.CreateaVenndiagramthatdisplaysthe information inthe table in Exercise 30.
32. Complete thefollowing proof that A c AUB. Suppose x € A. Then xe AUB, because Thusbythe definition of subset A c AU B.
InExercises33through38, classify eachstatementastrue, false,ornot possible toidentifyastrueor false.
33. Choose jc e A n B.
(a) xeA (b) xeB (c) x $ A (d) x £ B
34. Choose y eAUB.
(a) y € A (b) yeB (c) y £ A
(d) y <£ B (e) yeA n B (f) y <£AHB
35. Choose z € AU(B n C).
(a) zeA (b) z € B (c)zeC
(d) zeBDC (e) z ft A (I) z $ C
36. Choose w e DD(EU F).
(a) w eD (b) weE
(d) w ft D (e) w eFUE
(f) w e(DDE)U(DnF)
37. Choose te DDE.
(c) weF
(a) t eD (b) t e E (c) t i D (d) t i E (e) t € D U £
38. Choose jc e AU(flnC).
(a) jc € A (b) jc € 5 (c) x € C
(d) jc € A U 5 (e) jc€(IU5)n(AUC)
39. Complete the following proof thatAflfl c A.Suppose jc€ A H B. Then jc belongs to Thus A H flCA.
40.(a) Draw aVenn diagram to represent the situation CC A and CC fl.
(b)To prove CcAUfl,we should choose an element from which set?
(c) Prove that if C c A and C cfl,thenC c A U B.
41
(a) Draw aVenn diagram to represent the situation
AcC and B c C.
1.3 Sequences
Example 1
Example 2
1.3 Sequences
(b)Toprove AUB cC,we should choose an element from which set?
(c) Prove that if AcC and B cC, then AUflcC.
42. Prove that A-(A- B) c 5.
43.SupposethatA0 5 = A®C. Doesthisguaranteethat B= C? Justify your conclusion.
44. Prove that A-fi = AflI.
45.IfAUfl=AUC, must B = C? Explain.
46. If A H fl =A O C, must fl= C? Explain.
47. Prove that if Acfl and Cc D, then AUC Q BUD and A H Cc fl n D.
48. When isA-A = fl-A? Explain.
49. Explain thelastterminthesumin Theorem 3.Whyis |A O flfl C\ added and |fl O C\ subtracted?
50. Write the four-set version of Theorem 3;thatis, \AU flU CUD| = ---.
51. Describe in words the /z-set version of Theorem 3.
Some of themost important setsarisein connection with sequences. A sequence is simply alistof objects arranged ina definite order; afirst element, second element, third element, andsoon. The listmaystop after n steps, n e N, oritmay goonforever.Inthefirstcasewesaythatthe sequence is finite, andinthesecond casewesaythatitis infinite. The elements mayallbe different, orsomemaybe repeated.
The sequence 1,0,0,1,0,1,0,0,1,1,1isa finite sequence with repeated items. The digit zero,for example, occurs asthe second, third,fifth, seventh, and eighth elements of the sequence.
Thelist3, 8,13,18,23,... isan infinite sequence. The three dots inthe expression mean "and soon,"thatis, continue the pattern established bythefirstfew elements.
Example 3 Another infinite sequence is 1,4,9,16,25,. integers. ,., thelist of the squares of all positive
Itmay happen thathowa sequence isto continue isnot clear fromthefirstfew terms. Also, itmaybe useful tohavea compact notation to describe a sequence. Twokindsof formulas are commonly usedto describe sequences. In Example 2,a natural description ofthesequenceisthat successive termsare produced byadding 5tothepreviousterm.Ifweusea subscript to indicate a term's position inthe sequence, wecan describe the sequence in Example 2as a\= 3, an an-\ +5, 2< n. Aformula,likethisone,thatrefersto previous termstodefinethenext termis called recursive. Every recursive formula must include a starting place. Ontheotherhand,in Example 3itiseasyto describe atermusingonlyits position number. Inthenth position isthe square of n\ bn = n2, 1< n. Thistype of formula iscalled explicit, because ittellsus exactly whatvalueany particular term has.
Example 4 The recursive formula c\= 5, cn = 2cn-u 2 <n< 6, defines the finite sequence 5,10, 20,40, 80, 160.
Example 5 The infinite sequence 3,7, 11, 15, 19, 23, ... canbe defined by the recursive formula d\ =3, dn = dn-\ +4.
Example 6 The explicit formula sn = (-4)", 1< n, describes the infinite sequence -4,16,-64,256,....
Example 7 The finite sequence 87,82, 77,72, 67canbe defined bythe explicit formula tn = 92 - 5n, 1< n< 5.
Example 8 An ordinary English word such as "sturdy" canbe viewed asthe finite sequence s,t,u,r,d,y composed oflettersfromtheordinary English alphabet.
In examples suchas Example 8,itis common to omit the commas andwrite thewordintheusualway,ifnoconfusionresults.Similarly,evenameaningless wordsuchas "abacabcd" maybe regarded asafinite sequence of length 8.Se quencesoflettersorothersymbols,written without the commas, arealso referred toas strings.
Example 9 An infinite string such as abababab... may be regarded asthe infinite sequence a, b,a,b,a,b,
Example 10 The sentence "now is the time forthe test" canbe regarded asa finite sequence of Englishwords:now,is,the,time,for,the,test.Herethe elements of the sequence are themselves wordsofvaryinglength,sowewouldnotbeablesimplytoomit thecommas.Thecustomistousespaces instead of commas inthiscase.
The set corresponding toa sequence issimplytheset of all distinct elements inthesequence.Notethatan essential feature of a sequence isthe order inwhich the elements are listed. However, the order in which the elements of a set are listed is of no significance atall.
Example 11 (a)Theset corresponding tothe sequence in Example 3is {1,4,9,16,25, (b)Theset corresponding tothe sequence in Example 9is simply {a, b}. .}.
The idea of a sequence is important in computer science, where a sequence is sometimes called a linear array orlist.Wewill make a slight but useful distinc tion between a sequence andanarray,andusea slightly different notation. If we havea sequence S: s\, S2, S3,..., we think of allthe elements of 5as completely determined. The element 54, for example, is some fixed element of 5, located in position four. Moreover, if we change any of the elements, we have anewse quence andwill probably name it something other than S. Thus if we begin with thefinite sequence S: 0,1, 2,3,2,1,1andwe change the3toa4, getting 0, 1,2, 4,2,1,1,wewouldthinkofthisasadifferentsequence,say S'.
THEOREM 1
Array 5:
Figure 1.16
Anarray,ontheotherhand,maybeviewedasasequenceofpositions,which werepresentinFigure 1.16 asboxes.Thepositionsformafiniteorinfinitelist,de pendingonthedesiredsizeofthearray.Elementsfromsomesetmaybeassigned tothepositionsofthearray5.Theelementassignedtoposition n willbedenoted by S[n], andthesequence5[1], 5[2], 5[3],... willbecalledthe sequence of val ues ofthearray5.Thepointisthat5is considered tobea well-defined object, evenifsomeofthepositionshavenotbeen assigned values,orifsomevaluesare changed duringthediscussion.Thefollowingshowsoneuse of arrays.
Characteristic Functions
Averyuseful concept forsetsisthe characteristic function. We discuss functions in Section 5.1,butfornowwecan proceed intuitively,andthink of a function ona setasarulethat assigns some "value" to each element of theset. If Aisa subset of a universal set £/, the characteristic function /a of Ais defined for each x e U as follows:
/a(x) = 10 if x e A ifjc£ A.
Wemayaddand multiply characteristic functions, since their valuesare numbers, and these operations sometimes helpus prove theorems about properties of sub sets.
Characteristic functions ofsubsetssatisfythe following properties:
(b) /aub = fA + fB-fAfB', thatis, /aubW = /aW + /bWfor all x. •/a (*)/*(*)
(c) fA®B =fA+fB-2fAfB;thstis9fAeB(x) = fA(x)+fB(x)-2fA(x)fB(x) for all x.
Proof
(a) fA(x)fB(x) equals1ifandonlyifboth fA(x) and fB(x) areequalto1, andthis happens ifandonly if x isinAand x isin B, that is, x isinA fl B. Since /a/b is 1onAfl B and0 otherwise, it must be /adb(b) If* € A, then A (x) = hso fA(x) + fB(x)-fA(x)fB(x) =l+ fB(x)fB(x) = 1. Similarly, when* € fi, fA(x) + fB(x) - fA(x)fB(x) = 1. If x isnotinAor B, then /a(x) and fB(x) are0,so /a(x) + fB(x) fA(x)fB(x) = 0. Thus /a + fB /a/b is 1onAU B and 0 otherwise, soit must be /aub(c)Weleavethe proof of (c)asan exercise. •
Note that the proof of Theorem 1 proceeds by direct application of the defini tion of the characteristic function.