/
Cartesian Products and Relations Denition Cartesian product If and are sets the Cartesian Cartesian Products and Relations Denition Cartesian product If and are sets the Cartesian

Cartesian Products and Relations Denition Cartesian product If and are sets the Cartesian - PDF document

luanne-stotts
luanne-stotts . @luanne-stotts
Follow
547 views
Uploaded On 2014-12-12

Cartesian Products and Relations Denition Cartesian product If and are sets the Cartesian - PPT Presentation

In each ordered pair the 64257rst component is an element of and the second component is an element of Example Cartesian product If and ab cd then ab cd ab cd Determining If and are 64257nite sets then 57527 because there are choices for the ID: 22731

each ordered pair

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "Cartesian Products and Relations Denitio..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

CartesianProductsandRelationsDe nition(Cartesianproduct)IfAandBaresets,theCartesianproductofAandBisthesetAB=f(a;b):(a2A)and(b2B)g.Thefollowingpointsareworthspecialattention:TheCartesianproductoftwosetsisaset,andtheelementsofthatsetareorderedpairs.Ineachorderedpair,the rstcomponentisanelementofA,andthesecondcomponentisanelementofB.Example(Cartesianproduct)IfA=ff1;2g;f3ggandB=f(a;b);(c;d)g,thenAB=f(f1;2g;(a;b));(f1;2g;(c;d));(f3g;(a;b));(f3g;(c;d))g:DeterminingjABj.IfAandBare nitesets,thenjABj=jAjjBjbecausetherearejAjchoicesforthe rstcomponentofeachorderedpairand,foreachofthese,jBjchoicesforthesecondcomponentoftheorderedpair.CartesianProductisnotcommutativeForthesetsAandBoneparagraphabove,BA=f((a;b);f1;2g);((a;b);f3g);((c;d);f1;2g);((c;d);f3g)g:Thisexampleshowsthat,ingeneral,AB6=BA.TheunderlyingreasonisthatifAandBarenon-emptyandoneset,sayA,containsanelementxwhichisnotinB,thenABcontainsanorderedpairwith rstcomponentequaltox,butBAcontainsnosuchorderedpair.TheconditionthatAandBarenon-emptyisrequiredbecauseofthefollowingProposition.PropositionCPR1.IfAisaset,thenA;=;and;A=;.Proof.Wearguebycontradictionusingthede nitionofCartesianproduct:SupposeA;6=;andconsider(x;y)2A;.Then,byde nitionofCartesianproduct,y2;,acontradiction.Therefore,thesetA;mustbeempty.Theproofthat;A=;issimilar,andisleftasanexercise. PropositionCPR2.IfAandBaresets,AB=BAifandonlyifA=B,orA=;,orB=;.Proof.(()IfA=BthensubstitutingBforAgivesAB=AA=BA.IfA=;orB=;,thenbyPropositionCP1,AB=;=BA.())SupposethatAandBarenon-emptysetsandAB=BA.Letx2A.SinceB6=;,thereexistsanelementy2B,sothat(x;y)2AB.SinceAB=BA,wehavethat(x;y)2BA(too).Bythede nitionofCartesianproduct,x2B.Therefore,AB.SimilarlyBA.Thus,A=B. ItissometimestruethattheCartesianproductdistributesoverothersetoperationssimilarlytothedistributivelawofmultiplicationoveraddition.1 PropositionCPR3.LetA;BandCbesets.Then,(a)A(B\C)=(AB)\(AC);(b)A(B[C)=(AB)[(AC);(c)(A\B)C=(AC)\(BC);(d)(A[B)C=(AC)[(BC).Proof.Weprovepart(b)andleavetheproofsoftheremainingpartsasanexercise.Wehave(x;y)2A(B[C),x2Aandy2B[C,(x2A)and(y2Bory2C),[(x2A)and(y2B)]or[(x2A)and(y2C)](byadistributivelawoflogic),[(x;y)2AB]or[(x;y)2AC],(x;y)2(AB)[(AC). Exercise.Investigate,andproveordisproveasappropriate,similarstatementsinvolvingthesetoperationsrelativecomplement(A�B),andsymmetricdi erence.De nition(relation).ArelationfromasetAtoasetBisasubsetofAB.A(binary)relationonAisasubsetofAA.Itisimportanttorememberthatarelationisasetororderedpairs.Thereneedbenorelationshipbetweenthecomponentsoftheorderedpairs;anysetoforderedpairsisarelation.Usually,however,wechoosewhichorderedpairsbelongtotherelationsothatcomponentsarerelatedinsomeway,sowethinkoftherelationassomehowrepresentingtheconnection.Forexample,ifA=fGary;Jing;KeikagandB=f7447;7448;7455g,thenR=f(Gary;7448);(Jing;7447);(Keika;7455)gisarelationfromAtoBthatpairseachUVicMathinstructorinsetAandher/hisUVictelephoneextensioninsetB.Countingrelations.SinceanysubsetofABisarelationfromAtoB,itfollowsthatifAandBare nitesetsthenthenumberofrelationsfromAtoBis2jABj=2jAjjBj.OnewaytoseethisisasthenumberofsubsetsofAB.Adirectwaytocountisthesamewayonecountssubsets:observethatforeachofthejABj=jAjjBjorderedpairsinABtherearetwopossibilities,eithertheorderedpairbelongstotherelationoritdoesn't,sobytheruleofproductthenumberofrelationsfromAtoBis2222(jAjjBjtwos).Similarly,ifAisa nitesetthenthenumberofrelationsonAis2jAjjAj.LetA=f1;2;:::10g.Bytheabove,thereare2100relationsonA.Thenumberofthesethatcontainthepairs(1;1);(2;2);:::;(10;10)is110290=290:eachofthe10speci edpairsmustbeintherelation(1waytodothis),andtherearetwopossibilities{inornot{foreachoftheremaining90pairs.SimilarreasoningshowsthatthenumberofrelationsonAthatcontainnoneof(1;2);(3;4);(5;6)is297.ThenumberofrelationsonAthatcontain(2;5)or(7;9)is2100�298(totalminusthenumberthatcontainneitherorderedpair).Adi erentwayofcountingthesegivestheequivalentexpression299+299�298(thenumberthatcontain(2;5)plusnumberthatcontain(7;9)minusthenumberthatcontainboth).Finally,thenumberofrelationsonAthatcontaineither(2;5)or(7;9)butnotbothis298+298(thenumberthatcontain(2;5)andnot(7;9)plusthenumberthatcontain(7;9)andnot(2;5)).2 Example(lessthanorequaltorelation)TherelationRonthesetA=f1;2;3ggivenbyR=f(1;1);(1;2);(1;3);(2;2);(2;3);(3;3)gisthesetofallorderedpairs(a;b)ofelementsofAsuchthatabandwecanthinkofthesetRasrepresentingthe\lessthanorequalto"relation.In xnotationforrelations.IfRisarelationonAand(a;b)2R,wesometimesusethein xnotationaRbandsay\aisrelatedtob(underR)".IfaisnotrelatedtobunderR,wesometimesusethein xnotationwithaslashthroughtheR.Example(subsetrelation,in xnotation).LetB=fa;b;cgandletSbetherelationonP(B)(thepowersetofB,i.e.thesetofallsubsetsofB)de nedbyXSY,XY.Thatis,asubsetXofBisrelatedtoasubsetYofBunderSexactlywhenXisasubsetofY.ThesymbolScanberegardedasasynonymforthesymbolor,alternatively,thesymbolcouldberegardedasthenameofthesetofallorderedpairs(X;Y)whereX;Y2P(B)andXisasubsetofY.Example(recursivelyde nedrelations).Relationsaresets(oforderedpairs),andthuscansometimesbede nedrecursively.Forexample,letDbetherelationonZ+(thepositiveintegers)de nedby:BASIS:1R5;RECURSION:Forallx;y2Z+,ifxRythen(x+1)R(y+5).Aftergeneratingafewterms,itisnotdiculytoguessandprovethatR=f(a;b)2Z+Z+:b=5ag.ThestatementtobeprovedisP(a):Anorderedpair(a;b)belongstoRifandonlyifb=5a.We rstprovebyinductiononathatifa2Z+andb=5a,then(a;b)2R:BASIS(a=1):(1;5)2Rbyde nitionofR.Thus,thestatementistruefora=1.INDUCTIONHYPOTHESIS:Forsomek1,supposethatifn=5kthen(k;n)2R.INDUCTIONSTEP:Supposem=5(k+1).Thenm�5=5k,sobytheinductionhypothesis(k;m�5)2R.Bythede nitionofR;(k;m�5)2R)(k+1;m�5+5)2R.Thus,ifm=5(k+1),then(k+1;m)2R.Therefore,byinduction,foralla2Z+,ifa2Z+andb=5a,then(a;b)2R.Tocompletetheproof,weshowbyinductiononathatif(a;b)2Rthenb=5a:BASIS(a=1):Byde nitionofR,theonlyorderedpairinRwith rstcomponentequalto1is(1;5).Since5=51,thestatementistruefora=1.INDUCTIONHYPOTHESIS:Forsomek1,supposethatif(k;n)2R,thenn=5k.INDUCTIONSTEP:Suppose(k+1;m)2R.Byde nitionofR,thiscanhappenonlyif(k;m�5)2R.Bytheinductionhypothesis,m�5=5k.Hencem=5k+5=5(k+1).Thus,if(k+1;m)2R,thenm=5(k+1).Therefore,byinduction,foralla2Z+,if(a;b)2Rthenb=5a.Foramoredicultexample,considertherelationSonZ+de nedby:BASIS:(1;2);(1;3)2S;RECURSION:Forallx;y2Z+,if(x;y)2Sthen(x+1;y+2);(x+1;y+3)2S.Exercise:ProvebyinductionthatS=f(k;n)2Z+Z+:2kn3kg.3 FunctionsDe nition(function).AfunctionfromasetAtoasetBisarelationffromAtoBwiththepropertythatforeveryelementa2Athereexistsoneandonlyoneelementb2Bsuchthat(a;b)2f.De nition(image,value,preimage).IffisafunctionfromAtoB,thenweusethenotationf:A!B.�Fromthede nitionofafunctioniff:A!B,thenfcanbeviewedasanassignment,toeachelementa2A,ofauniqueelementbinB.If(a;b)2f,thenwedenotetheassignmentofbtoabywritingb=f(a)andcallingbtheimageofaunderf,orthevalueoffat(a);theelementaiscalledapreimageofb.(Notethatitisapreimageratherthanthepreimage;morethanoneelementofAcouldmaptob.)Itiscommonusagetosay\fmapsAtoB".ThisexpressionarisesfromtheusualarrowdiagramwhereeachelementofAisjoinedbyanarrowtotheelementofBassignedtoit.Unfortunately,thistendstoleadtotheconfusionthattheelementsofAaresomehowassignedtotheelementsofB,whichisbackwards!ItistheelementsofBthatareassignedtotheelementsofA.Itisimportanttokeepthefollowingfactsstraight.EveryelementofAhassomeelementofBassignedtoit.NoelementofAisassignedmorethanoneelementofB,eachisassignedexactlyone.Thereisnoguaranteethatdi erentelementsofAareassigneddi erentelementsofB.WhenwesaythateachelementofAisassignedauniqueelementofB,wemeanthateachelementofAisassignedoneandonlyoneelemntofB.Thisdoesnotmeanthatifa16=a2,thenf(a1)6=f(a2);itisquitepossiblethatf(a1)=f(a2)(Wehaveaspecialnameforfunctionswiththepropertythata16=a2impliesf(a1)6=f(a2):1-1.)ThereisnoguaranteethatanyparticularelementofBisassignedtoanyelementofA.(WehaveaspecialnameforfunctionswiththepropertythateveryelementofBistheimageofatleastoneelementofA:onto.)De nition(domain,inputs,codomain,range).Beforewecantalkaboutfunctions,weneednamesfortheobjectswewanttotalkabout:ThesetAiscalledthedomain,andtheelementsofAarecalledinputstof(sothedomainiswheretheinputslive).ThesetBiscalledthecodomain.ThesubsetofBconsistingoftheelementswhicharevaluesoff(i.e.,areassignedtosomeelementinA)iscalledtherangeoff.(Think:thevaluesoffrangeovertheelementsinthisset.)Therangeoffisthesetf(A)=fb:b2Bandb=f(a)forsomea2Ag.Example(function,domain,codomain,range,image,preimage).LetAbethesetofallfacultyandstudentsatUVic,andletBbethesetofallamountsofmoneyindollarsandcents.LetfbetherelationfromAtoBwhere(a;b)2f,persona2Aowesamountbtothelibrary.Sinceforeverypersona2Athereisauniqueamountofmoneythats/heowestothelibrary(possibly$0),fisafunction.ThedomainoffisA,itscodomainisB,anditsrangeisthesetofallamountsofmoneythatareowed(eachbyatleastoneperson).If(Gary,$1:59)2f,thenf(Gary)=$1:59,theimageofGary4 is$1:59,apre-imageof$1:59isGary,andtheamount$1:59belongstotherangeoff.(Note:anypersonwhoowes$1:59tothelibraryisalsoapre-imageof$1:59.)Theaboveexampledemonstratesafunctionwhichcannotbede nedby\givingaformula"forf(a).Inthede nitionoffunctionAandBarejustsets{theredon'thavetobeanynumbersanywhere{soitmaybeverydiculttogiveaformula.Example(function,domain,codomain,range,image,preimage).Letf:R!Rde nedbyf(x)=2dxe.(Recallthat,forarealnumberx,theceilingofx,denoteddxeisthesmallestintegerwhichisgreaterthanorequaltox.Hencefisafunction.)ThedomainoffisthesetRofrealnumbers.Thecodomainisalsothesetofrealnumbers.Therangeoffisthesetofevenintegers:sincedxeisaninteger,f(x)=2dxeisaneveninteger.Thus,therangeisasubsetoftheevenintegers.Toseethateveryeveninteger2t;(t2Z)isavalueoff,observethatfort2Z,f(t)=2dte=2t.Exercises.Weleaveasanexerciseforthereadertodeterminetherangeofthefunctiong:R!Rde nedbyg(x)=bxc2.(Recallthatforarealnumberx,the oorofx,denotedbxcisthelargestintegerwhichislessthanorequaltox.)Formoreexercises, ndtherangeofh:R!Rde nedbyh(x)=b2xc,andshowthattherangeof`:Z!Zde nedby`(n)=n2+4n+4isfk2:k2Ng=f02;12;22;:::g.Countingfunctions.LetAandBbe nitesets,sayA=fa1;a2;:::;amgandB=fb1;b2;:::;bng.WecountthenumberoffunctionsfromAtoB.Bythede nitionoffunction,foreacha2Athereisexactlyoneb2Bsuchthat(a;b)2f.Thus,therearenchoicesfortheelementtobepairedwitha1,nchoicesfortheelementtobepairedwitha2,andsoon.Ingeneral,foreachchoiceforatherearen=jBjchoicesfortheelementbsuchthat(a;b)2f.Bytheruleofproduct,thenumberoffunctionsfromAtoBisthereforennn(mterms,allequalton),whichequalsnm(orjBjjAj).De nition(imageofaset,preimageofaset).Thenotionsofimageandpreimagecanbegeneralizedtosets.Supposef:A!Bisafunction.IfA1A,thentheimageofA1underfisthesetf(A1)=fb2B:b=f(a)forsomea2A1g.Thatis,f(A1)isthesetwhoseelementsaretheimagesunderfoftheelementsinA1.IfB1B,thenthepreimageofB1underfisthesetf�1(B1)=fa2A:f(a)2B1g.Thatis,f�1(B1)isthesetofelementsinAwhoseimageunderfisinB1.Example(imageofaset,preimageofaset).LetA=f1;2;3;4;5g;B=fa;b;c;dgandf:A!Bbegivenbyf=f(1;d);(2;a);(3;c);(4;a);(5;c)g.Thenf(f1;2;3g)=fd;a;cg,andf�1(fd;a;cg)=f1;2;3;4;5g.Noticethatthisshowsthatiff(A1)=B1thenitneednotbethecasethatf�1(B1)=A1;itishowever,truethatiff(A1)=B1,thenf�1(B1)A1.(Toseethis,lety2B1.theny=f(x)forsomex2A1.Hencex2f�1(B1).)Weleaveitasanexercisetoprovethatequalityoccurs,thatisf�1(f(A1))=A1,ifandonlyifthereisnoelementa2A�A1suchthatf(a)2f(A1).Asafurtherexercise,provethatforB1Bwehavef(f�1(B1))B1,5 withequalityifandonlyifB1isasubsetoftherangeoff(thatis,everyelementofB1istheimageofsomeelementofA).Observethatiff:A!Bisafunctionthen,byde nirtionoffunctionf�1(B)=Aandf(A)istherangeoff(whichisasubsetofB).LetB1B.Byde nitionofpreimageofasubsetofthecodomainwehavef�1(B1)=;ifandonlyifthereisnoelementx2Awithf(x)2B1.Thusf�1(;)=;and,intheexampleabovef�1(fbg)=;.Example( ndingtherange).Letf:R!Zbede nedbyf(x)=d2xe+b2xc.Todeterminetherangeoff,webeginbytestingafewvaluesofx:f(0)=0;Ifx2(0;1=2),then2x2(0;1)sod2xe=1andb2xc=0,hencef(x)=1;f(1=2)=2;Ifx2(1=2;1)then2x2(1;2)d2xe=2andb2xc=1,hencef(x)=3;f(1)=4;Ifx2(1;3=2),then2x2(2;3)sod2xe=3andb2xc=2,hencef(x)=5.f(3=2)=6.Basedonthesecomputations,itseemsreasonabletoguessthattherangeoffisZ.Weprovethatthisisthecase.First,observethatf(x)isanintegerforeveryx2R,sof(R)Z.Toshowtheoppositeinclusion,lety2Z.Wemust ndx2Rsuchthatf(x)=y.Ifyiseven,sayy=2t;t2Z,thenf(t=2)=d2t=2e+b2t=2c=2t=y.Ifyisodd,sayy=2t+1;t2Z,thenforanyx2(t=2;t=2+1=2)wehave2x2(t;t+1),hencef(x)=(t+1)+t=2t+1=y.HencetherangeoffisZ.Asanexercise,showthattheimageofthesetNofnaturalnumbersisf(N)=f4n:n2Ng.Example( ndingpreimages).Letg:R!Zbede nedbyg(x)=b3xc.Wedeterminethepreimageoff�1;1gandofT=f2n:n2Ng.Todetermineg�1(f�1;1g)weneedto gureoutthepreimagesofeachelementoff�1;1g.Wehaveg(x)=�1,b3xc=�1,3x2[�1;0)$x2[�1=3;0).Similarly,g(x)=1,x2[1=3;2=3).Thus,g�1(f�1;1g)=[�1=3;0)[[1=3;2=3).Thesetg�1(T)canbedeterminedinthesameway.Forn2Nwehaveg(x)=2n,b3xc=2n,3x2[2n;2n+1),x2[2n=3;(2n+1)=3).Therefore,g�1(T)=S1n=0[2n=3;(2n+1)=3)=[0;1=3)[[2=3;1)[[4=3;5=3)[[3;7=3)[.TheoremF1.Letf:A!Bbeafunction,A1;A2AandB1;B2B.Then(a)f(A1[A2)=f(A1)[f(A2);(b)f(A1\A2)f(A1)\f(A2).(c)f�1(B1[B2)=f�1(B1)[f�1(B2).(d)f�1(B1\B2)=f�1(B1)\f�1(B2).Proof.Weprove(b)andleavetheothersasexercises.Lety2f(A1\A2).theny=f(x)forsomex2A1\A2.Sincex2A1\A2ifandonlyifx2A1andx2A2,wehavey=f(x)forsomex2A1andy=f(x)forsomex2A2.Therefore,y2f(A1)andy2f(A2),i.e.y2f(A1)\f(A2). Toseethatstrictcontainmentcanoccurinpart(b)ofTheoremF1,considerthefunctionf:f1;2;3g!f1;2gwheref=f(1;1);(2;1);(3;2).TakeA1=f1;3gandA2=f2;3g.Thenf(A1\A2)=f(f3g)=f2gwhereasf(A1)\f(A2)=f1;2g\f1;2g=f1;2g.6 De nition(equalityoffunctions).Twofunctionsf:A!Bandg:A!Bareequaliff(x)=g(x)foreveryx2A.Iffandgareequal,wewritef=g.Thereisasubtlepointhiddeninthede nitionofequalityoffunctions.Fortwofunctionstobeequal,theymusthavethesamedomain,thesamecodomain,andgivethesamevalueforthesameinput.Thus,technically,thefunctionf:Z!Zde nedbyf(x)=jxjisnotequaltothefunctiong:Z!Nde nedbyg(x)=jxjbecausethesetwofunctionsdonothavethesamecodomain.De nition(restrictionofafunction,extensionofafunction).Letf:A!Bbeafunction.ForXA,therestrictionofftoXisthefunctionfjX:X!Bde nedbyfjX(x)=f(x)forallx2X.IfA0A,anextensionofftoA0isanyfunctiong:A0!Bforwhichg(x)=f(x)foreveryx2A.Therestrictionofafunctionf:A!BisthenewfunctionobtainedbyretrictingtheallowedinputsforftoasubsetofitsdomainA.AnextensionoffisanyfunctionthatisidenticaltofontheinputsinA,andisalsode nedfortheinputsinA0�A.Observethatfcan,andprobablydoes,havemorethanoneextension.Thisiswhywesaanextension,ratherthantheextension.Observethatifgisanextensionoff,thengjA=f.Example(restriction).Letf:R!Zbede nedbyf(x)=2dxe�bxc.TherestrictionfjZofftotheintegersisthefunctionfjZ:Z!ZwherefjZ(n)=nforalln2Z(becauseifnisanintegerthenbxc=dne=n).Countingrestrictionsandextensions.LetA=f1;2;3;4;5g;B=fs;t;u;v;w;x;y;zgandf:A!Bbef=f(1;t);(2;x);(3;x);(4;s);(5;t)g.Thenumberofextensionsofftoafunctionfromf1;2;:::;9gtoBis84,sincethereare8choicesfortheimageofeachof6;7;8and9(inanextensiontheimagesof1;2;3;4and5mustbethesameasforf).TherangeoffisR=fs;t;xg,andthenumberofsubetsA0AsuchthatfjA0alsohasrangeRis133,sinceA0:mustcontain4(sincef�1(fsg)=f4g),mustcontainatleastoneof1and5(sincef�1(ftg=f1;5g)mustcontainatleastoneof2and3(sincef�1(fxg)=f2;3g).De nition(converseofarelation).LetRbearelationfromAtoB.TheconverseofRistherelationRcfromBtoAde nedbyRc=f(b;a):(a;b)2Rg.(ThisistherelationobtainedbyreversingthecomponentsofeachorderedpairinR.)Motivatingquestion.Supposef:A!Bisafunction.Then,byde nition,fisrelationfromAtoB.Itisnaturaltowonderwhentheconverserelation,fc,isafunction(fromBtoA).Example(fcnotafunction).LetA=f1;2;3g;B=fa;b;c;dg;andf=f(1;a);(2;b);(3;c)g.Then,fc=f(a;1);(b;2);(c;3)gisnotafunctionbecauseitcontainsnoorderedpairwith rstcomponentequaltod.(Equivalently,thepreimageofsome1-elementsubsetofBistheemptyset.)ThesamesituationwillariseforanyfunctionffromasetAtoasetBwheretherangeisapropersubsetofthecodomain.Hence,forfctohaveachanceatbeingafunction,itmustbetruethatf(A)=B.(Thesearecalledontofunctions.)7 Example(fcnotafunction).LetA=f1;2;3g;B=fa;bg;andf=f(1;a);(2;b);(3;b)g.Then,fc=f(a;1);(b;2);(b;3)gisnotafunctionbecauseitcontainstwoorderedpairswith rstcomponentequaltob.ThesamesituationwillariseforanyfunctionffromasetAtoasetBwheresometwoelementsofAhavethesameimage.(Thatis,thereexista1;a22Awherea16=a2butf(a1)=f(a2)).Equivalently,thepreimageofsome1-elementsubsetofBcontainstwoormoreelements.)Hence,forfctohaveachanceatbeingafunction,itmustbetruethatifa1;a22Aanda16=a2,thenf(a1)6=f(a2).(Thesearecalled1-1functions.)Wewilldevelopsomeresultsaboutthefunctionswiththepropertiessuggestedbythetwoexamplesabove,andafterthatwewillreturntothequestionofwhentheconverseofafunctionfromAtoBisafunctionfromBtoA.De nition(1-1function).Afunctionf:A!Biscalledone-to-one(1-1,orinjective,oraninjection)iff(x)=f(y)impliesx=y,forallx;y2A.(Thatis,fis1-1ifandonlyifdi erentelementsofAhavedi erentimagesinB.Equivalently,fis1-1ifandonlyifeveryelementofBistheimageunderfofatmostoneelementofA.)PropositionF2.IfAandBare nitesetsandf:A!Bisa1-1function,thenjAjjBj.Proof.SupposejAj=m.IfnotwoelementsofAhavethesameimageunderf,thentherangeoffcontainsexactlymelements.SincetherangeoffisasubsetofB,wehavejAj=mjBj. Proving1-1.Toproveafunctionfis1-1,startwith\Assumef(x)=f(y)."andthenargue,usingwhatyouaregivenaboutf,thatx=y(thelastclauseis...x=y.Thereforefis1-1.)Equivalently,youcouldprovethecontrapositive:startwith\Assumex6=y."andargueuntilyoucanconcludewith\Thenf(x)6=f(y).".Example(provingafunctionis1-1).Letf:Z!Nbede nedbyf(x)=5x�7.Weprovefis1-1.Assumef(x)=f(y).Then5x�7=5y�7.Inturn,thisimplies5x=5xandx=y.Thereforefis1-1.Disproving1-1.Toprovethatafunctionfisnot1-1, nddistinctelementsxandyinthedomainsothatf(x)=f(y).Bydoingthis,youhavedemonstratedthattheimplication(f(x)=f(y))!(x=y)isFalse,andsof(x)=f(y)impliesx=y,forallx;y2A,isFalse.Example(provingafunctionisnot1-1).Letf:Z+!Z+bede nedbyf(1)=1,andforn2;f(n)isthelargestprimefactorofn.Computingafewvaluesoffyieldsf(2)=2;f(3)=3;andf(4)=2.Sincef(4)=f(2)and46=2,thefunctionfisnot1-1.Adviceaboutinvestigatingfunctionsre:1-1.Ifitisnotpossibletoeasilyidentifyelementsxandyinthedomainsothatf(x)=f(y),thenstarttryingtoprovethatfis1-1.Iffisn't1-1,thentheproofwillbreakdownatsomepoint,andthiswillleadtotherequiredxelements.Forexample,letf:R!Rbef(x)=x2�14x+57=(x�7)2+8.Now,f(x)=f(y))(x�7)2+8=(y�7)2+8,(x�7)2=(y�7)2.Toprovefis8 1-1,itisnecessarytoobtainx=y,butthelastequalitygivesx�7=(y�7),whichleadstox=yory=�x�14.Thelastoftheseequationsgivestheelementsxandyrequiredtoshowfisnot1-1:Choosex=0(say)andy=�0�14=�14.Thenx6=y,andf(x)=57=f(y)(checkthearithmetic!),sofisnot1-1.Counting1-1functions.SupposejAj=mandjBj=n.Wecountthenumberof1-1functionsfromAtoB.ByPropositionF2,ifm�ntherearenone.Assumemn.SupposeA=fa1;;a2;:::;amg.Therearenchoicesfortheimageofa1and,foreachofthesetherearen�1choicesfortheimageofa2,n�2choicesfortheimageofa3,andsoonuntil, nally,therearen�(m�1)=n�m+1choicesfortheimageofam.Thus,bytheruleofproduct,thenumberof1-1functionsfromAtoBisn(n�1)(n�m+1)=n!=(n�m)!.OnetoonefunctionsallowustodescribeasituationwhenequalityholdsintheoremF1(b).PropositionF3.Letf:A!Bbea1-1functionandA1;A2A.Thenf(A1\A2)=f(A1)\f(A2).Proof.ByTheoremF1(b),f(A1\A2)f(A1)\f(A2).Thus,itremainstoprovetheoppositeinclusion.Supposefis1-1,andlety2f(A1)\f(A2).Theny=f(x1)forsomex12A1andy=f(x2)forsomex22A2.Sincefis1-1,f(x1)=f(x2))x1=x2.Hence,y=f(x)forsomex2A1\A2,thatis,y2f(A1\A2).Thus,f(A1\A2)f(A1)\f(A2),asrequired. Comparethepartoftheargumentwherethepropertythatfis1-1wasusedtotheparagraphfollowingTheoremF1.ToseethattheconverseofPropositionF3isfalse,considerf:Z!Zwheref(n)=0foralln2Z.De nition(ontofunction).Afunctionf:A!Biscalledonto(orsurjective,orasurjection)ifforeveryelementb2Bthereisanelementa2Asuchthatf(a)=b.(Thatis,fisontoifandonlyifeveryelementofBistheimageunderfofsomeelementofA.Equivalently,fisontoifandonlyifeveryelementofBistheimageunderfofatleastoneelementofA.)PropositionF4.IfAandBare nitesetsandf:A!Bisanontofunction,thenjAjjBj.Proof.Supposefisonto.TheneveryelementofBhasatleastonepreimage.Bythede nitionoffunction,eachelementofAisapreimageforauniqueelementofB.Thus,jAj=Pb2Bjf�1(fbg)jPb2B1=jBj. Provingonto.Toprovethatafunctionisontoyoumustarguethatforeveryb2B(equivalently,anarbitrarilychosenb2B)thereisana2Asuchthatf(a)=b.Thus,the rstlineoftheproofis\Letb2B.Wemust nda2Asuchthatf(a)=b.".WhatyoudonextdependsonthedescriptionoffandofthesetB.Usually,you\solve"f(a)=bforaintermsofb(aswrittenitgivesbintermsofa).Then,youverifythatwhatyouhaveisanelementofA.Finally,yousubstitutethisbackintofandshowthatitgivesb.Thelastlineoftheproofis\Henceifa=:::,thenf(a)==b,andsofisonto.".9 Example(provingonto).Weshowthatthefunctionf:R+!R+de nedbyf(x)=�9+(x+3)3isonto.Lety2R+.Thenf(x)=y,�9+(x+3)3=y,(x+3)3=y+9,x+3=p y+9.Sincex2R+;x+3�0andwecandisregardthenegativesquareroottoobtainx=�3+p y+9.Wemustverifythatthisxbelongstothedomain.Sincey2R+wehavey+9�9andp y+9�3.Therefore�3+p y+92R+.Hence,ifx=�3+p y+9,thenf(x)=�9+((�3+p y+9)+3)3=�9+(p y+9)2=y,andsofisonto.Disprovingonto.Toprovethatafunctionisnotontoyoumust ndanelementb2Bwhichisnotf(a)foranya2A.Howyoudothisdependsonf.Ingeneral,itisusefultotrytoprovethatfisontoasabove.Ifitisn'tonto,thenyouwillreachapointwhereeitheryoucan'tsolveforaintermsofb,oryouwillsucceedindoingthisbuttheonlypossibilitiesyou ndarenotelementsofA.Ineithercaseyouaredone.Whatyouaredoingisassumingthatfisontoandshowingthatleadsto(logicallyimplies)acontradiction.SinceonlyaFalsestatementlogicallyimpliesacontradiction,itmustbethattheassumptionthatfisontoisFalse.Example(disprovingonto).Considerthefunctionf:R!Rde nedbyf(x)=(x�2)2�10.Lety2R.Thenf(x)=y,(x�2)2�10=y,(x�2)2=y+10.Ifyischosensothaty+100(sayy=�11)thenthereisnorealnumberxsothat(x�2)2=y+10because(x�2)20forallrealnumbersx.Thus,thereisnox2Rsothatf(x)=�11,sofisnotonto.Example(disprovingonto).Considerthefunctionf:Z!Zde nedbyf(n)=2n+3.Lety2Z.Thenf(n)=y,2n+3=y,n=(y�3)=3.But(y�3)=262Zforally2Z:Inparticularify=0then(y�3)=2=�3=2.Wenowhavethatiff(n)=0,thenn=�3=2.Thus,thereisnon2Zsuchthatf(n)=0,sofisnotonto.Ontodependsonthecodomain.ObservethatthefunctionfintheexampleaboveisontoasafunctionfromRtoR.Exercise:WhataboutfromQtoQ?For nitesetsAandB,ithasbeenstraightforwardtocountthenumberoffunctionsfromAtoB,andalsothenumberof1-1functionsfromAtoB.WedonotpresentlyhavethetechniquesnecessarytocountthenumberofontofunctionsfromAtoB.ThiswillhavetowaituntilwehavecoveredthePrincipleofInclusionandExclusion,lateron.However,westateandusetheresultnow.FactF5.LetAandBbesetswithjAj=mandjBj=n.Then,thenumberofontofunctonsfromAtoBisPnk=0(�1)k�nk(n�k)m.Example(countingusingontofunctions).Wecountthenumberofwaysthatacollectionof5labelled(distiguishable)containerscanholdacollectionof8labelled(dis-tinguishable)balls,ifnocontainerisleftempty.Thisisthesameasthenumberoffunctionsfromthesetofballsontothethesetofcontainers(f(b)isthecontainerthatholdsballb),whichisP5k=0(�1)k�5k(5�k)8=�5058��5148+�5238��5328+�5418��5508=126000.Thenumberofwaysinwhichthe rst3containersholdthe rst5ballsandthelast2containersholdthelast3balls(and,still,nocontainerisleftempty)equalsthenumberoffunctionsfromasetof5labelledballstotheasetof3labelledcontainers,timesthe10 numberoffunctionsfromasetof3labelledballstotheasetof2labelledcontainers.ThisisP3k=0(�1)k�3k(3�k)5P2k=0(�1)k�2k(2�k)3=864.CorollaryF6.LetAandBbe nitesets.Iff:A!Bisboth1-1andonto,thenjAj=jBj.Proof.Sincefis1-1,wehavejAjjBjbyPropositionF2.Sincefisonto,wehavejAjjBjbyPropositionF4.Theresultnowfollows. De nition(1-1correspondence).Afunctionf:A!Biscalleda1-1correspondence(orbijective,orabijection)ifitisboth1-1andonto.Bythede nitionsof1-1andonto,afunctionfisa1-1correspondenceifandonlyifeveryelementofBistheimageofexactlyoneelementofAunderf.Todetermineifafunctionisa1-1correspondence,usethemethodsdiscussedabovetocheckwhetheritis1-1andonto.(Ofcourse,youcanstoponceitfailstohaveoneoftheseproperties.)CorollaryF6isanimportantcountingprinciple.Itsaysthatiftwo nitecollectionsofobjectscanbeputinto1-1correspondence,thentherearethesamenumberofobjectsineachcollection.Forexample,thereisa1-1correspondencebetweenthesubsetsofA=fa1;a2;:::;angandthesetBofbinarysequencesb1b2:::bnoflengthn:Itisgivenbythefunctionf:P(A)!Bde nedbyf(X)isthebinarysequenceb1b2:::bnwherefori=1;2;:::;n,bi=1ifai2X0ifai62X:Toseethatfis1-1,notethatiff(X)=f(Y)thenthede nitionoffimpliesthatXandYcontainexactlythesameelements.Toseethatfisonto,letb1b2:::bn2BandconstructX2P(A)bytheruleai2X,bi=1.Iffollowsfromthede nitionoffthatf(X)=b1b2:::bn.Hence,thenumberofsubsetsofAequalsthenumberofbinarysequencesoflengthn,whichequals2n(twochoicesforeachposition).Exercises.SupposethatjAj=jBj.Prove:(a)Iff:A!Bisa1-1function,thenitisa1-1correspondence(i.e.fisalsoonto).(b)Iff:A!Bisanontofunction,thenitisa1-1correspondence(i.e.fisalso1-1).PropositionF7.Letf:A!Bbeafunction.(a)Iffis1-1,thenanyrestrictionofftoasubsetA1Ais1-1.(b)Iffisonto,thenforanyA0A,anyextensionofftoafunctiong:A0!Bisonto.Proof.(a):Letx;y2A1andsupposef(x)=f(y).SinceA1A,wehavex;y2A.Sincefis1-1,f(x)=f(y).ThereforefjA1is1-1.(b):Letb2B.Sincefisonto,thereexistsx2Asuchthatf(x)=y. De nition(compositionoffunctions).LetA;BandCbesets,andf:A!Bandg:B!Cbefunctions.Thecompositionoffandg(orthecompositefunction)isthefunction(gf):A!Cde nedby(gf)(a)=g(f(a))foreveryelementainA.11 Functioncompositionisnotcommutative.Ingeneral,ordermatters.Forfandgasabove,thecompositionoffandgisusuallynotthesameasthecompositionofgandf.Forexample,letf:Z!Zbede nedbyf(x)=x2andg:Z!Zbede nedbyg(x)=x+3.Then,(gf)(x)=g(f(x))=g(x2)=x2+3and(fg)(x)=f(g(x))=f(x+3)=(x+3)2=x2+6x+9.Since(gf)(0)=3and(fg)(0)=9,wehavegf6=fg.Itisalsopossiblethat,dependingonthesetsA;BandC,thefunctiongfisde nedbutthefunctionfgisnot.Weleaveitasanexerciseto ndanexamplethatdemonstratesthis.De nition(identityfunctiononaset).TheidentityfunctiononthesetXisthefunction1X:X!Xde nedby1X(x)=xforeveryelementxofX.Theinteger0isanidentityelementwithrespecttoadditionofrealnumbers:x+0=0+x=xforallx2R.Similarly,1isanidentitywithrespecttomultiplicationofnonzerorealnumbers:1x=x1=xforallx2R�f0g.Theidentityfunctiononasetactsinasimilarwaywithrespecttofunctioncomposition.PropositionF8.LetAandBbesetsandf:A!Bbeafunction.Then(a)f1A=f,and(b)1Bf=f.Proof.Weprove(a)andleave(b)asanexercise.Letx2A.Then,f1A(x)=f(1A(x))=f(x).Hence,f1A=f. Eventhoughfunctioncompositionisnotcommutative,itisassociative.Wenowprovethis.PropositionF9.LetA;B;C,andDbesetsandf:A!B;g:B!C,andh:C!Dbefunctions.Thenh(gf)=(hg)f.Proof.Byde nitionoffunctioncomposition,bothh(gf)and(hg)farefunctionsfromAtoD,sotheyhavethesamedomainandcodomain.Letx2A.Then,(h(gf))(x)=h((gf)(x))=h(g(f(x))=(hg)(f(x))=((hg)f)(x),asrequired. PropositionF10.LetA;BandCbesetsandg:A!Bandf:B!Cbefunctions.Then,(a)Iffandgare1-1,thengfis1-1.(b)Iffandgareonto,thengfisonto.(c)Iffandgare1-1correspondences,thengfisa1-1correspondence.Proof.Weprove(a)andleavetheproofof(b)foranexercise.Statement(c)isanimmediateconsequenceof(a)and(b).Suppose(gf)(x)=(gf)(y).Theng(f(x))=g(f(y)).Sincegis1-1,f(x)=f(y).Sincefis1-1,x=y.therefore,gfis1-1. 12 Exercises: ndexamplestodemonstratethattheconverseofeachstatementinpropo-sitionF10isfalse,butthefollowingstatementistrue:Iffgisa1-1correspondence,thenfis1-1andgisonto(butfneednotbeontoandgneednotbe1-1).Also, ndanexampletodemonstratethattheconverseoftheaboveimplicationisFalse(nevermindthepartinbrackets).Wenowreturntothequestionofwhentheconverseofafunctionisitselfafunction.PropositionF11.Letf:A!Bbeafunction.Thenfcisafunctionifandonlyiffis1-1andonto.Proof.())Supposefcisafunction.Bythede nitionoffunction,foreveryb2Bfccontainsexactlyoneorderedpairwith rstcomponentequaltob.Thus,foreveryb2Bfcontainsexactlyoneorderedpairwithsecondcomponentequaltob.Thatis,fis1-1andonto.(()Supposefis1-1andonto.Then,foreveryb2Bfcontainsexactlyoneorderedpairwithsecondcomponentequaltob.Thismeansthatforeveryb2Bfccontainsexactlyoneorderedpairwith rstcomponentequaltob.Thatis,fcisafunction. Supposefisa1-1andontofunction.Then,byPropositionF11,fcisafunction.Since(fc)c=fandfisafunction,PropositionF11impliesthatthefunctionfcis(also)1-1andonto.Inthearithmeticofrealnumbers,theinverseofxis�xbecausex+(�x)equalstheadditiveidentity,zero.Forx6=0,themultiplicativeinverseofxis1=xbecausex(1=x)equalsthemultiplicativeidentity,one.Theinverseofafunctionisanalogous,andisde nedbelow.De nition(invertiblefunction).Afunctionf:A!Biscalledinvertibleifthereexistsafunctiong:B!Asuchthatgf=1Aandfg=1B.Supposef:A!Bisa1-1correspondence.Then,byPropositionF11,fcisafunction.Considerthecompositefunctionfcf.Fora2Awehave(fcf)=fc(f(a))=a,byde nitionofconverse.Thus,fcf=1A.Similarly,forb2Bwehave(ffc)(b)=fc(f(b))=b.Thus,ffc=1B.Therefore,a1-1andontofunctionisinvertible.PropositionF12.Supposef:A!Bisinvertible.Thenthefunctiongsuchthatgf=1Aandfg=1Bisunique.Proof.Supposeg:B!Aandh:B!Aarefunctionssuchthatgf=1Aandfg=1Bandhf=1Aandfh=1B.Weneedtoshowg=h.Letb2B.Theng(b)=g(1B(b))=(g1B)(b)=(g(fh))(b)=((gf)h)(b)=(1Ah)(b)=1A(h(b))=h(b).Thus,g=h.Thiscomepletestheproof. De nition(inverse).Letf:A!Bbeaninvertiblefunction.Theinverseoffistheuniquefunctiongsuchthatgf=1Aandfg=1B.Itiscustomarytodenotetheinverseoffbyf�1.Inthecasewheref:A!Bis1-1andonto,wehaveabovethatfisinvertibleandfc=f�1.13 Donotconfusethenotationfortheinverseofafunction,(whichexistsonlysometimes)andthenotationforthepreimageofasubsetofthecodomain(whichalwaysexists).Theyusethesamesymbols,buttheformeroftheseisafunctionandthelatterisaset.Itshouldbeclearfromthecontextwhichobjectisunderdiscussion.PropositionF13.Letf:A!Bbeafunction.Then,fisinvertibleifandonlyifitis1-1andonto.Proof.(()Supposefis1-1andonto.Wehavenotedabovethatinthiscasefisinvertibleandfc=f�1.())Supposethatfisinvertible.Then,thereisafunctionf�1:B!Asuchthatf�1f=1Aandff�1=1B.Supposef(x)=f(y).Thenf�1(f(x))=f�1(f(y)).TheLHSofthisequationis(f�1f)(x)=1A(x)=xandtheRHSis(f�1f)(y)=1A(y)=y.Thus,x=y,andfis1-1.Letb2B.Sincef�1isafunction,thereexistsa2Asuchthatf�1(b)=a.Byde nitionofinversefunction,wehavef(a)=f(f�1(b))=(ff�1)(b)=1B(b)=b.Thereforefisonto.Thiscompletestheproof. CombiningPropositionsF12andF13givesthatiffisaninvertiblefunction,thenf�1=fc.Byde nitionofconverse,thismeansthatf�1hasthepropertythat,fora2Aandb2B,f(a)=b,f�1(b)=a.(ComparethistothelastparagraphintheproofofPropositionF13.)Some(inverse)functionsarede nedinexactlythisway{forexampleforx2R+andy2R,wehavelog10(x)=y,10y=xProvingfisinvertibleand ndingtheinverse.Therearetwowaystoprovethatafunctionf:A!Bisinvertible.Onewayistowritedowntherightfunctiong:B!Aandthencheckthatgf=1Aandfg1B.AnotherwayistousePropositionF13andcheckiffis1-1andonto.Intheproofthatfisonto,onestartswith"Lety2Bandsupposef(x)=y."andultimatelyderives\Thenx=g(y).".Byourdiscussioninthepreviousparagraph,gistheinversefunction.Thus,adescriptionoftheinversefunctionisabyproductoftheproofthatfisonto.Noticethatthede nitionofaninvertiblefunctionissymmetricinfandg(a.k.a.f�1).Thus,iffisinvertible,soisf�1and(f�1)�1=f.Example(provingfisinvertibleand ndingf�1).Letf:R+!Rbede nedbyf(x)=2ln(x)�7.Weshowthatfisinvertibleand ndf�1.Supposef(a)=f(b).Then,wehave2ln(a)�7=2ln(b)�7,2ln(a)=2ln(b),ln(a)=ln(b),eln(a)=eln(b),a=b,sincetheexponentialandlogarithmfunctionsareinverses.Thus,fis1-1.Now,supposey2R.Then,f(x)=y,2ln(x)�7=y,ln(x)=(y+7)=2,x=e(y+7)=2.Fory2Rthequantitye(y+7)=22R+,thedomainoff.Hence,ifx=e(y+7)=2thenf(x)=f(e(y+7)=2)=2ln(e(y+7)=2)�7=2(y+7)=2�7=y,sofisonto.Moreoverf�1:R!R+isdescribedbyf�1(y)=e(y+7)=2.14