Undergraduate Topics in Computer Science John Vince Mathematics for Computer Graphics Sixth Edition Undergraduate Topics in Computer Science SeriesEditor IanMackie,UniversityofSussex,Brighton,UK AdvisoryEditors SamsonAbramsky ,DepartmentofComputerScience,UniversityofOxford, Oxford,UK ChrisHankin ,DepartmentofComputing,ImperialCollegeLondon,London,UK MikeHinchey ,Lero–TheIrishSoftwareResearchCentre,Universityof Limerick,Limerick,Ireland DexterC.Kozen,DepartmentofComputerScience,CornellUniversity,Ithaca, NY,USA AndrewPitts ,DepartmentofComputerScienceandTechnology,Universityof Cambridge,Cambridge,UK HanneRiisNielson ,DepartmentofAppliedMathematicsandComputerScience, TechnicalUniversityofDenmark,KongensLyngby,Denmark StevenS.Skiena,DepartmentofComputerScience,StonyBrookUniversity,Stony Brook,NY,USA IainStewart ,DepartmentofComputerScience,DurhamUniversity,Durham, UK ‘Undergraduate Topics in Computer Science’ (UTiCS) delivers high-quality instructional content for undergraduates studying in all areas of computing and information science. From core foundational and theoretical material to final-year topics and applications, UTiCS books take a fresh, concise, and modern approach and are ideal for self-study or for a one- or two-semester course. The texts are all authoredbyestablishedexpertsintheirfields,reviewedbyaninternationaladvisory board,andcontainnumerousexamplesandproblems,manyofwhichincludefully workedsolutions. TheUTiCSconceptreliesonhigh-quality,concisebooksinsoftbackformat,and generally a maximum of 275–300 pages. For undergraduate textbooks that are likelytobelonger,moreexpository,Springercontinuestoofferthehighlyregarded TextsinComputerScienceseries,towhichwereferpotentialauthors. Moreinformationaboutthisseriesathttps://link.springer.com/bookseries/7592 John Vince Mathematics for Computer Graphics Sixth Edition JohnVince Breinton,UK ISSN1863-7310 ISSN2197-1781 (electronic) UndergraduateTopicsinComputerScience ISBN978-1-4471-7519-3 ISBN978-1-4471-7520-9 (eBook) https://doi.org/10.1007/978-1-4471-7520-9 1st–5theditions:©Springer-VerlagLondonLtd.2001,2006,2010,2014,2017 6thedition:©Springer-VerlagLondonLtd.,partofSpringerNature2022 Theauthor(s)has/haveassertedtheirright(s)tobeidentifiedastheauthor(s)ofthisworkinaccordance withtheCopyright,DesignsandPatentsAct1988. Thisworkissubjecttocopyright.AllrightsarereservedbythePublisher,whetherthewholeorpartof thematerialisconcerned,specificallytherightsoftranslation,reprinting,reuseofillustrations,recitation, broadcasting,reproductiononmicrofilmsorinanyotherphysicalway,andtransmissionorinformation storageandretrieval,electronicadaptation,computersoftware,orbysimilarordissimilarmethodology nowknownorhereafterdeveloped. Theuseofgeneraldescriptivenames,registerednames,trademarks,servicemarks,etc.inthispublication doesnotimply,evenintheabsenceofaspecificstatement,thatsuchnamesareexemptfromtherelevant protectivelawsandregulationsandthereforefreeforgeneraluse. Thepublisher,theauthorsandtheeditorsaresafetoassumethattheadviceandinformationinthisbook arebelievedtobetrueandaccurateatthedateofpublication.Neitherthepublishernortheauthorsor theeditorsgiveawarranty,expressedorimplied,withrespecttothematerialcontainedhereinorforany errorsoromissionsthatmayhavebeenmade.Thepublisherremainsneutralwithregardtojurisdictional claimsinpublishedmapsandinstitutionalaffiliations. ThisSpringerimprintispublishedbytheregisteredcompanySpringer-VerlagLondonLtd.partofSpringer Nature. Theregisteredcompanyaddressis:TheCampus,4CrinanStreet,London,N19XW,UnitedKingdom Thisbookisdedicatedtomywife,Heidi. Preface The first edition of this book began life as part of Springer’s Essential series and containedtenchaptersandapproximately220pages.Thissixthandlasteditionhas twentychaptersandapproximately600pages.Overtheinterveningeditions,Ihave revisedandextendedpreviousdescriptionsandintroducednewchaptersonsubjects that I believe are relevant to computer graphics, such as differential calculus and interpolation, and new subjects that I had to learn about, such as quaternions and geometric algebra. Hopefully, this edition explores enough mathematical ideas to satisfymostpeopleworkingincomputergraphics. AlthoughthefirsteditionofthisbookwasproducedonahumblePCusingWORD, subsequenteditionswereproducedonanAppleiMacusingLATEX.Irecommendto anybuddingauthorsthattheyshouldlearnLATEXanduseSpringer’stemplatesto createtheirfirstmanuscript.Furthermore,today’scomputersaresofastthatIoften compiletheentirebookforthesakeofchangingasinglecharacter—itonlytakes5 or6seconds! Ihaveusedcolourinthetexttoemphasisethepatternsbehindcertainnumbers andintheillustrationstoclarifythemathematics. It is extremely difficult to ensure that there are no spelling mistakes, missing brackets, spurious punctuation marks and, above all, mathematical errors. I truly havedonemybesttocorrectthetextandassociatedequations,butifIhavemissed some,thenIapologisenow. In all of my books, I try to mention the names of important mathematicians associatedwithaninventionordiscoveryandtheperiodoverwhichtheywerealive. Inthisbook,Imention50suchpeople,andtherelevantdatesareattachedtothefirst citation. Whilst writing this book I have borne in mind what it was like for me when I wasstudyingdifferentareasofmathematicsforthefirsttime.Inspiteofreadingand rereadinganexplanationseveraltimes,itcouldtakedaysbefore‘thepennydropped’ andaconceptbecameapparent.Hopefully,thereaderwillfindthefollowingexplana- tionsusefulindevelopingtheirunderstandingofthesespecificareasofmathematics andenjoythesoundofvariouspenniesdropping! vii viii Preface IwouldliketothankHelenDesmond,EditorforComputerScience,forallowing metogiveupholidaysandhobbiesinordertocompleteanotherbook! Breinton,UK JohnVince May2022 Contents 1 Introduction .................................................. 1 1.1 MathematicsforComputerGraphics ....................... 1 1.2 UnderstandingMathematics .............................. 1 1.3 WhatMakesMathematicsDifficult? ....................... 2 1.4 BackgroundtoThisBook ................................ 2 1.5 HowtoUseThisBook ................................... 2 1.6 SymbolsandNotation ................................... 3 References .................................................... 4 2 Numbers ..................................................... 5 2.1 Introduction ............................................ 5 2.2 Background ............................................ 5 2.3 Counting ............................................... 5 2.4 SetsofNumbers ........................................ 6 2.5 Zero ................................................... 7 2.6 NegativeNumbers ....................................... 8 2.6.1 The Arithmetic of Positive and Negative Numbers ..................................... 9 2.7 ObservationsandAxioms ................................ 10 2.7.1 CommutativeLaw ............................. 10 2.7.2 AssociativeLaw ............................... 10 2.7.3 DistributiveLaw .............................. 11 2.8 TheBaseofaNumberSystem ............................ 11 2.8.1 Background .................................. 11 2.8.2 OctalNumbers ................................ 12 2.8.3 BinaryNumbers ............................... 13 2.8.4 HexadecimalNumbers ......................... 13 2.8.5 AddingBinaryNumbers ........................ 16 2.8.6 SubtractingBinaryNumbers .................... 18 ix x Contents 2.9 TypesofNumbers ....................................... 18 2.9.1 NaturalNumbers .............................. 19 2.9.2 Integers ...................................... 19 2.9.3 RationalNumbers ............................. 19 2.9.4 IrrationalNumbers ............................. 20 2.9.5 RealNumbers ................................. 20 2.9.6 AlgebraicandTranscendentalNumbers ........... 20 2.9.7 ImaginaryNumbers ............................ 21 2.9.8 ComplexNumbers ............................. 24 2.9.9 TranscendentalandAlgebraicNumbers ........... 26 2.9.10 Infinity ....................................... 27 2.10 Summary .............................................. 28 2.11 WorkedExamples ....................................... 28 2.11.1 AlgebraicExpansion ........................... 28 2.11.2 BinarySubtraction ............................. 28 2.11.3 ComplexNumbers ............................. 28 2.11.4 ComplexRotation ............................. 29 3 Algebra ...................................................... 31 3.1 Introduction ............................................ 31 3.2 Background ............................................ 32 3.2.1 SolvingtheRootsofaQuadraticEquation ........ 33 3.3 Indices ................................................ 37 3.3.1 LawsofIndices ............................... 38 3.4 Logarithms ............................................. 38 3.5 FurtherNotation ........................................ 40 3.6 Functions .............................................. 40 3.6.1 ExplicitandImplicitEquations .................. 41 3.6.2 FunctionNotation ............................. 41 3.6.3 Intervals ...................................... 42 3.6.4 FunctionDomainsandRanges .................. 43 3.6.5 OddandEvenFunctions ........................ 44 3.6.6 PowerFunctions .............................. 46 3.7 Summary .............................................. 46 3.8 WorkedExamples ....................................... 46 3.8.1 AlgebraicManipulation ........................ 46 3.8.2 SolvingaQuadraticEquation ................... 47 3.8.3 Factorising ................................... 49 References .................................................... 49 4 Trigonometry ................................................. 51 4.1 Introduction ............................................ 51 4.2 Background ............................................ 51 4.3 UnitsofAngularMeasurement ............................ 51