597

Mathematics and Technology (Springer Undergraduate Texts in

  • Upload
    vuphuc

  • View
    281

  • Download
    21

Embed Size (px)

Citation preview

  • Springer Undergraduate Textsin Mathematics and Technology

  • Series Editors

    Jonathan M. BorweinHelge Holden

    Editorial Board

    Lisa GoldbergArmin Iske

    Palle E.T. JorgensenStephen M. Robinson

  • Christiane RousseauYvan Saint-Aubin

    Mathematics and Technology

    With the participation of Helene Antaya and Isabelle Ascah-Coallier

    Chris Hamilton, Translator

    123

  • Christiane Rousseau Yvan Saint-AubinDepartement de mathematiques Departement de mathematiques

    et de statistique et de statistiqueUniversite de Montreal Universite de MontrealC.P. 6128, Succursale Centre-ville C.P. 6128, Succursale Centre-villeMontreal, Quebec H3C 3J7 Montreal, Quebec H3C 3J7Canada [email protected] [email protected]

    Series EditorsJonathan M. Borwein Helge HoldenFaculty of Computer Science Department of Mathematical SciencesDalhousie University Norwegian University of Science andHalifax, Nova Scotia B3H 1W5 TechnologyCanada Alfred Getz vei [email protected] NO-7491 Trondheim

    [email protected]

    ISBN: 978-0-387-69215-9 e-ISBN: 978-0-387-69216-6DOI: 10.1007/978-0-387-69216-6

    Library of Congress Control Number: 2008926885

    Mathematics Subject Classification (2000): 00-01,03-01,42-01,49-01,94-01,97-01

    c 2008 Springer Science+Business Media, LLCAll rights reserved. This work may not be translated or copied in whole or in part without the written permission of thepublisher (Springer Science+Business Media, LLC, 233 Spring Street, New York, NY 10013, USA), except for briefexcerpts in connection with reviews or scholarly analysis. Use in connection with any form of information storage andretrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafterdeveloped is forbidden.The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identifiedas such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights.

    Printed on acid-free paper

    springer.com

  • Preface

    Of what use is mathematics? Hasnt everything in mathematics already been discov-ered? These are natural questions often asked by undergraduates. The answers providedby their professors are often quite brief. Most university courses, pressed for time andrigidly structured, offer little opportunity to present and study actual applications andreal-world examples.

    Even more high-school students ask the same questions with more insistence. Teach-ers in these schools generally work under even tighter constraints than university profes-sors. If they are able to competently respond to these questions it is probably becausethey received good answers from their teachers and professors. And if they do not havethe answers, then whose fault is it?

    The genesis of this text

    It is impossible to introduce this text without first discussing the course in which itoriginated. The course Mathematics and Technology was created at the Universitede Montreal and taught for the first time in the winter semester of 2001. It was createdafter observing that most courses in the department neglect to present real applications.Since its creation the course has been open to both undergraduate mathematics studentsand future high-school teachers.

    Since no appropriate text or manual for the course we envisioned existed, we wereled to write our own course notes, from which we taught. We got so caught up inwriting these notes that they quickly grew to the size of a textbook, containing muchmore material than could possibly be taught in one semester. Despite the two of usbeing career mathematicians, we must admit that we both knew little or nothing aboutmost of the applications presented in the following chapters.

    The goal of the Mathematics and Technology course

    The primary goals of the course are to demonstrate the active and evolving character ofmathematics, its omnipresence in the development of technologies, and to initiate stu-dents into the process of modeling as a path to the development of various mathematicalapplications.

  • VI Preface

    Although a few of the included subjects fall outside the strict domain of technology,we hope to make it clear that, yes, mathematics is useful, and it plays a major rolein everyday technologies. Several of the subjects treated in this text are still beingactively developed, and this allows students to see, often for the first time, that the fieldof mathematics remains open and dynamic.

    Since the students taking our course include future high school-teachers, it is impor-tant to stress that the point is not simply to provide them with examples and applica-tions that they can repeat to their future students, but rather to give them the tools toformulate and develop real-world examples appropriate to their students. They shouldbe instilled with the feeling that they are teaching a subject that is intrinsically elegant,of course, but whose applications have helped shape our physical environment and ourunderstanding of it.

    The choice of subjects

    In choosing subjects we have paid particular attention to the following points:

    The applications should be recent or affect the students day-to-day life. Moreover,contrary to the mature mathematics typically taught in other undergraduate courses,some of the mathematics used should be modern or even still in development.

    The mathematics should be relatively elementary and if it exceeds the typical first-year undergraduate curriculum (calculus, linear algebra, probability theory), themissing pieces must be covered within the chapter. A special effort is made to makeextensive use of high-school-level mathematics, particularly Euclidean geometry. Ba-sic high-school and undergraduate mathematics form a remarkable toolkit, providedthey are well understood and mastered, allowing students to readily explore theirwide applications and, often for the first time, to discover their power when usedtogether.

    The level of mathematical sophistication required should remain at a minimum:ideas are a scientists most precious commodity, and behind most technological suc-cesses there lies a brilliant yet sometimes elementary observation.

    As a result, the mathematics used in the book covers a very wide spectrum:

    Lines and planes appear in all of their forms (regular equations, parametric equa-tions, subspaces), often in unexpected ways (using the intersection of several planesto decode a ReedSolomon encoded message).

    A large number of subjects make use of basic geometric objects: circles, spheres,and conics. The concept of locus of points in Euclidean geometry is often repeated,for example in problems where we calculate the position of an object through trian-gulation (Chapter 1 on GPS, and Chapter 15 on Science Flashes).

    The different types of affine transformations in the plane or in space (in particularrotation and symmetries) appear several times: in Chapter 11 on image compressionusing fractals, in Chapter 2 on mosaics and friezes, and in Chapter 3 on robot motion.

    Finite groups appear as symmetry groups (Chapter 2 on mosaics and friezes) andalso in the development of primality tests in cryptography (Chapter 7).

  • Preface VII

    Finite fields make an appearance in Chapter 6 on error-correcting codes, in Chapter1 on GPS and in Chapter 8 on random-number generation.

    Chapter 7 on cryptography and Chapter 8 on random-number generation both makeuse of arithmetic modulo n, while Chapter 6 on error-correcting codes makes use ofarithmetic modulo 2.

    Probability theory appears in several unexpected places: in Chapter 9 on GooglesPageRank algorithm, and in the construction of large prime numbers in Chapter 7.It is also used more classically in Chapter 8 on random-number generation.

    Linear algebra is omnipresent: in Chapter 6 on Hamming and ReedSolomon codes,in Chapter 9 on the PageRank algorithm, in Chapter 3 on robot motion, in Chapter2 on mosaics and friezes, in Chapter 1 on GPS, in Chapter 12 on the JPEG standard,etc.

    Using this book as a course text

    The text is written for students who have a familiarity with Euclidean geometry and havemastered multivariable calculus, linear algebra, and elementary probability theory. Wehope that we have not implicitly assumed any other background knowledge. Workingthrough the text nonetheless requires a certain scientific maturity: it involves integratinga variety of mathematical tools in a setting different from the one in which they wereoriginally taught. For that reason, undergraduates in their junior or senior years arethe ideal audience for the course.

    The text presents applications in two forms: the main chapters (all except Chapter15) are long and detailed, while the Science Flashes (sections of Chapter 15) are shortand narrow in scope. Readers will notice a certain unity in the form of the longerchapters: the first sections describe the application and the underlying mathematicalproblem; this is followed by an exploration of simple cases of the problem and, if neces-sary, a development of the required mathematics. We call these parts the basic portionof the chapter. Afterward, one or more sections may explore more-complicated exam-ples, provide more details to the mathematical tools discussed earlier, or simply discussthe fact that mathematics alone is not always sufficient! We refer to this latter part ofa chapter as the advanced portion. Each application is typically covered in 56 hoursof class: two hours for the basic theory, two hours for examples and exercises and, iftime permits, one or two hours for advanced topics. Often we are able only to touchbriefly on the advanced material, unless a second week is spent on the chapter. EachScience Flash can be treated in an hour of class or even assigned as an exercise withoutbeing preceded by any theory development. During a single semester we aim to covera significant part of 8 to 12 chapters and a handful of Science Flashes. Another optionis to significantly reduce the number of chapters being covered and to dig further intotheir advanced sections.

    We are thus forced to select subjects as a function of their intrinsic interest or thestudents mathematical knowledge. The chapters not selected or the advanced portionsof those that were covered are natural points of departure for course projects. Self-guided students who are reading this text on their own may simply jump from chapter

  • VIII Preface

    to chapter as the mood strikes them. Each chapter is (mathematically) independent (orvery nearly so), and any links among them are explicitly stated.

    One last note for professors using this book as a course text. Teaching this coursehas forced us to revise our usual pedagogical methods: here no subject is prerequisite forfurther courses, the definitions and theorems are not the ultimate goals of the course, andthe problems are not drill. These factors can cause some anxiety on the students side.Moreover, we are not specialists in any of the technologies we discuss here. So we hadto revise our teaching. We try to make as many links as possible to the technology. Weencourage students to participate in the course. This allows us to check their backgroundrelative to the mathematical tools being used. As for exams, we choose to reassure themfrom the beginning by stating that the exams are open book, noncumulative, and limitedto the basic material. Emphasis is put on simple mathematical modeling and problemsolving. Our sets of exercises focus on these skills.

    Using this book as a self-directed reader

    During the writing of this text we have always been passionate about presenting themathematics underlying technology and demonstrating both its intrinsic beauty andpower. We believe that this text will be of interest to any reader, from young scientistto experienced mathematician, curious to understand the mathematics that drives tech-nological innovation. Since the chapters are largely independent, the reader can hopfrom subject to subject at will. Hopefully, the reader will be equally interested in themany historical notes scattered throughout the text and, who knows, even find time towork through a few of the exercises.

    The contributions of Helene Antaya and Isabelle Ascah-Coallier

    The first draft of Chapter 14 on the calculus of variations was written by Helene Antayaduring a summer internship at the end of her junior college. Chapter 13 on computingwith DNA was written the following summer by Helene Antaya and Isabelle Ascah-Coallier while they were supported by an Undergraduate Student Research Award fromthe National Sciences and Engineering Research Council (NSERC) of Canada.

    How to use the chapters

    For the most part, chapters are independent. The beginning of each chapter contains abrief how-to, describing the required basic knowledge, the relationships between thesections, and, if necessary, their relative difficulty.

    Christiane RousseauYvan Saint-Aubin

    Departement de mathematiques et de statistiqueUniversite de MontrealJune 2008

  • Preface IX

    Acknowledgments

    The genesis of the Mathematics and Technology course and accompanying coursenotes can be traced back to the winter of 2001. We had to learn a variety of subjectsthat we knew only incidentally or not at all, and also had to construct sets of exercisesand student projects. Throughout the many years of evolution of this text we haveasked numerous questions that required a great level of explanation. We would like tothank those who have supported us in this endeavor. Their assistance has helped usreduce the inevitable ambiguities and errors; we are responsible for any that remain,and we invite our readers to report any they may find.

    We learned much from Jean-Claude Rizzi, Martin Vachon, and Annie Boily, all fromHydro-Quebec, who helped us learn about storm tracking; from Stephane Durand andAnne Bourlioux about the finer points of GPS; from Andrew Granville on recent inte-ger factorization algorithms; from Mehran Sahami about the inner workings of Google;from Pierre LEcuyer about random-number generators; from Valerie Poulin and IsabelleAscah-Coallier about how quantum computers function; from Serge Robert, Jean Le-Tourneux, and Anik Souliere on the relationship between math and music; from PaulRousseau and Pierre Beaudry about basic computer architecture; from Mark Goreskyabout linear shift registers and the properties of the sequences they generate. DavidAustin, Robert Calderbank, Brigitte Jaumard, Jean LeTourneux, Robert Moody, PierrePoulin, Robert Roussarie, Kaleem Siddiqi, and Loc Teyssier provided us with referencesand precious commentary.

    Many of our friends and colleagues read portions of the manuscript and provided uswith feedback, notably Pierre Bouchard, Michel Boyer, Raymond Elmahdaoui, Alexan-dre Girouard, Martin Goldstein, Jean LeTourneux, Francis Loranger, Marie Luquette,Robert Owens, Serge Robert, and Olivier Rousseau. Nicolas Beauchemin and AndreMontpetit helped us on more than one occasion with graphics and the subtleties ofLATEX. We were lucky to have colleagues Richard Duncan, Martin Goldstein, and RobertOwens help us with the English terminology.

    Since the first draft we have freely shared our manuscript. Many of our friendsand colleagues have encouraged us throughout this adventure, including John Ball,Jonathan Borwein, Bill Casselman, Carmen Chicone, Karl Dilcher, Freddy Dumortier,Stephane Durand, Ivar Ekeland, Bernard Hodgson, Nassif Ghoussoub, Frederic Gour-deau, Jacques Hurtubise, Louis Marchildon, Odile Marcotte, and Pierre Mathieu.

    We wish to thank Chris Hamilton, who worked for many months on the excellentEnglish translation of our manuscript. Moreover, it was a great pleasure working withhim. We appreciate his judicious commentary and suggestions. His clever adaptations,when needed, and his discovery of many errors helped to improve the original Frenchversion of the text.

    We thank David Kramer, our copyeditor for his expert assistance and excellentsuggestions. We are grateful to Ann Kostant and Springer, who showed great interestin our book, from the first version to the printed one.

  • X Preface

    We would also like to thank those nearest to us, Manuel Gimenez, Serge Robert,Olivier Rousseau, Valerie Poulin, Anague Robert, and Chi-Thanh Quach, who havealways supported us, including listening to us talk about this project over the years.

  • Contents

    Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . V

    1 Positioning on Earth and in Space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 Global Positioning System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

    1.2.1 Some Facts about GPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21.2.2 The Theory Behind GPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31.2.3 Dealing with Practical Difficulties. . . . . . . . . . . . . . . . . . . . . . . . . . 6

    1.3 How Hydro-Quebec Manages Lightning Strikes . . . . . . . . . . . . . . . . . . . . . 121.3.1 Locating Lightning Strikes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121.3.2 Threshold and Quality of Detection . . . . . . . . . . . . . . . . . . . . . . . . 151.3.3 Long-Term Risk Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

    1.4 Linear Shift Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191.4.1 The Structure of the Field Fr2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 221.4.2 Proof of Theorem 1.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    1.5 Cartography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

    2 Friezes and Mosaics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452.1 Friezes and Symmetries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482.2 Symmetry Group and Affine Transformations . . . . . . . . . . . . . . . . . . . . . . 522.3 The Classification Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 582.4 Mosaics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 642.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83

  • XII Contents

    3 Robotic Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 853.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85

    3.1.1 Moving a Solid in the Plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 873.1.2 Some Thoughts on the Number of Degrees of Freedom . . . . . . . . 89

    3.2 Movements That Preserve Distances and Angles . . . . . . . . . . . . . . . . . . . . 913.3 Properties of Orthogonal Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 943.4 Change of Basis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1033.5 Different Frames of Reference for a Robot . . . . . . . . . . . . . . . . . . . . . . . . . 1063.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117

    4 Skeletons and Gamma-Ray Radiosurgery . . . . . . . . . . . . . . . . . . . . . . . . . . 1194.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1194.2 Definition of Two-Dimensional Region Skeletons . . . . . . . . . . . . . . . . . . . 1204.3 Three-Dimensional Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1304.4 The Optimal Surgery Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1324.5 A Numerical Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

    4.5.1 The First Part of the Algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . 1354.5.2 Second Part of the Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1394.5.3 Proof of Proposition 4.17 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

    4.6 Other Applications of Skeletons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1424.7 The Fundamental Property of the Skeleton . . . . . . . . . . . . . . . . . . . . . . . . 1434.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153

    5 Savings and Loans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1555.1 Banking Vocabulary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1555.2 Compound Interest . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1565.3 A Savings Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1595.4 Borrowing Money . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1615.5 Appendix: Mortgage Payment Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1645.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

    6 Error-Correcting Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1736.1 Introduction: Digitizing, Detecting and Correcting . . . . . . . . . . . . . . . . . 1736.2 The Finite Field F2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1786.3 The C(7, 4) Hamming Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1796.4 C(2k 1, 2k k 1) Hamming Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1826.5 Finite Fields . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1856.6 ReedSolomon Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193

  • Contents XIII

    6.7 Appendix: The Scalar Product and Finite Fields . . . . . . . . . . . . . . . . . . . 1986.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207

    7 Public Key Cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2097.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2097.2 A Few Tools from Number Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2107.3 The Idea behind RSA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2137.4 Constructing Large Primes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2217.5 The Shor Factorization Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2317.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239

    8 Random-Number Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2418.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2418.2 Linear Shift Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2458.3 Fp-Linear Generators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248

    8.3.1 The Case p = 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2488.3.2 A Lesson on Gambling Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . 2538.3.3 The General Case . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253

    8.4 Combined Multiple Recursive Generators . . . . . . . . . . . . . . . . . . . . . . . . . . 2558.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2578.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263

    9 Google and the PageRank Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2659.1 Search Engines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2659.2 The Web and Markov Chains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2689.3 An Improved PageRank . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2789.4 The Frobenius Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2819.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289

    10 Why 44,100 Samples per Second? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29110.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29110.2 The Musical Scale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29210.3 The Last Note (Introduction to Fourier Analysis) . . . . . . . . . . . . . . . . . . 29610.4 The Nyquist Frequency and the Reason for 44,100 . . . . . . . . . . . . . . . . . . 30710.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 317

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323

  • XIV Contents

    11 Image Compression: Iterated Function Systems . . . . . . . . . . . . . . . . . . . 32511.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32511.2 Affine Transformations in the Plane . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32711.3 Iterated Function Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33011.4 Iterated Contractions and Fixed Points . . . . . . . . . . . . . . . . . . . . . . . . . . . 33611.5 The Hausdorff Distance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34011.6 Fractal Dimension . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34511.7 Photographs as Attractors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35011.8 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 361

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367

    12 Image Compression: The JPEG Standard . . . . . . . . . . . . . . . . . . . . . . . . . 36912.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36912.2 Zooming in on a JPEG-Compressed Digital Image . . . . . . . . . . . . . . . . . . 37212.3 The Case of 2 2 Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37312.4 The Case of N N Blocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37812.5 The JPEG Standard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38812.6 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401

    13 The DNA Computer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40313.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40313.2 Adlemans Hamiltonian Path Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40513.3 Turing Machines and Recursive Functions . . . . . . . . . . . . . . . . . . . . . . . . . 409

    13.3.1 Turing Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40913.3.2 Primitive Recursive Functions and Recursive Functions . . . . . . . 416

    13.4 Turing Machines and InsertionDeletion Systems . . . . . . . . . . . . . . . . . . . 42613.5 NP-Complete Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 430

    13.5.1 The Hamiltonian Path Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43013.5.2 Satisfiability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 431

    13.6 More on DNA Computers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43513.6.1 The Hamiltonian Path Problem and InsertionDeletion Systems 43513.6.2 Current Limits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43513.6.3 A Few Biological Explanations Concerning Adlemans

    Experiment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43713.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445

  • Contents XV

    14 Calculus of Variations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44714.1 The Fundamental Problem of Calculus of Variations . . . . . . . . . . . . . . . . 44814.2 EulerLagrange Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45114.3 Fermats Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45514.4 The Best Half-Pipe. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45714.5 The Fastest Tunnel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46014.6 The Tautochrone Property of the Cycloid . . . . . . . . . . . . . . . . . . . . . . . . . 46514.7 An Isochronous Device . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46814.8 Soap Bubbles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47114.9 Hamiltons Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47514.10 Isoperimetric Problems. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47914.11 Liquid Mirrors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48614.12 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499

    15 Science Flashes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50115.1 The Laws of Reflection and Refraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50115.2 A Few Applications of Conics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508

    15.2.1 A Remarkable Property of the Parabola . . . . . . . . . . . . . . . . . . . . . 50815.2.2 The Ellipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51815.2.3 The Hyperbola . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52015.2.4 A Few Clever Tools for Drawing Conics . . . . . . . . . . . . . . . . . . . . . 521

    15.3 Quadratic Surfaces in Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52115.4 Optimal Cellular Antenna Placement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52815.5 Voronoi Diagrams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53215.6 Computer Vision . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53715.7 A Brief Look at Computer Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . 53915.8 Regular Pentagonal Tiling of the Sphere . . . . . . . . . . . . . . . . . . . . . . . . . . 54415.9 Laying Out a Highway . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55115.10 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552

    References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 567

    Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 569

  • This page intentionally left blank

  • 1

    Positioning on Earth and in Space

    This chapter is the best example in the book of how diverse the applications of mathe-

    matics can be to a simple technical question: how can one locate people or events on

    Earth? This diversity is striking, and to spend more than one week on this chapter

    can be a good idea for that reason. Two hours are sufficient to cover the theory behind

    GPS (Section 1.2) and to briefly touch upon the application of GPS to storm tracking

    (Section 1.3). Afterward, there is a choice to be made. If you have already introduced

    finite fields in Chapter 6 on error-correcting codes or Chapter 8 on random-number

    generators, then the mechanics of the GPS signal can be covered in a little more than

    an hour, since you may skip the review of finite fields. If time is limited and finite fields

    have not yet been introduced, a reasonable compromise is simply to state Theorem 1.4

    and to illustrate it using several examples such as Example 1.5. Section 1.5 on car-

    tography will require a minimum of two hours, unless the students are already familiar

    with the notion of conformal maps. Section 1.2 requires only Euclidean geometry and

    basic linear algebra, while Section 1.3 uses elementary probability concepts. Section 1.4

    is more difficult unless one has some knowledge of finite fields. Section 1.5 makes use

    of multivariable calculus.

    1.1 Introduction

    Since the beginning of time man has been interested in determining his position onthe Earth. He started with primitive instruments, navigating through the use of themagnetic compass, the astrolabe, and later the sextant. Recent history has seen thedevelopment of significantly more complex and accurate navigational aids, such as theGlobal Positioning System (GPS). In this chapter we walk backward through time:we will start by discussing modern-day GPS, followed by a brief discussion of ancienttechniques, mostly in the exercises.

    Since such navigational techniques are really useful only if we have accurate mapsof the world, we will dedicate a section to cartography. Since the Earth is a sphere,

    C. Rousseau and Y. Saint-Aubin, Mathematics and Technology,DOI: 10.1007/978-0-387-69216-6 1, c Springer Science+Business Media, LLC 2008

  • 2 1 Positioning on Earth and in Space

    it is impossible to represent it on a sheet of paper in a manner that preserves angles,relative distances, and relative areas. The chosen compromise depends largely on theapplication. The Peters Atlas has chosen to use projections that preserve relative area[2]. Marine charts, on the other hand, have chosen projections that preserve angles.

    1.2 Global Positioning System

    1.2.1 Some Facts about GPS

    The GPS constellation of satellites was completed in July 1995 by the Defense Depart-ment of the USA, and was authorized for use by the general public. When it was firstdeployed, the system consisted of 24 satellites designed such that at least 21 would befunctioning 98% of the time. In 2005 the system consisted of 32 satellites, of which atleast 24 are to be functioning while the others are ready to take over in case a satellitefails. The satellites are positioned 20,200 km from the surface of the Earth. They aredistributed across 6 orbital planes, each tilted at an angle of 55 degrees to the equa-torial plane (see Figure 1.1). There are at least 4 satellites per orbital plane, roughlyequidistant from each other. Each satellite completes a circular orbit around the Earthin 11 hours and 58 minutes. The satellites are situated such that at any moment andat any location on Earth we may observe at least 4 satellites.

    Fig. 1.1. The 24 satellites on 6 orbital planes.

    The 24 satellites emit a signal that repeats periodically, and which is received withthe aid of a special receiver. When we buy a GPS we are in fact buying a device (whichwe will call the receiver) that receives the GPS signals and uses the information inthem to calculate its location. It contains an almanac with which it is able to calculatethe absolute position of each satellite at any given moment of time. However, sinceslight errors in the orbit are inevitable, correcting information for each satellite is coded

  • 1.2 Global Positioning System 3

    directly within the emitted signal (this correcting information is updated every hour).Each satellite emits its signal continuously. The period of the signal is fixed, and thestart time of the cycle may be determined through the use of the almanac. Additionally,each satellite is equipped with an extremely precise atomic clock allowing it to staysynchronized to the start times contained in the almanac. When a receiver records asignal from a satellite, it immediately starts comparing it with one that it generatesand that is supposed to match perfectly the one received. In general, these signals willnot immediately match. Thus, the receiver shifts the copy it generates until it is inphase with the received signal (which it determines through calculating the correlationbetween the two). In such a manner, the device is able to calculate the time it takes forthe signal to arrive from the satellite. We will discuss this system in much more detailin Section 1.4.

    The system described above is the standard precision GPS system. In absenceof more sophisticated ground-based corrections, it permits the calculation of receiverposition to about 20 meters. Prior to May 2000, the Department of Defense intentionallyintroduced inaccuracies to the satellite signals in order to reduce the precision of thesystem to 100 meters.

    1.2.2 The Theory Behind GPS

    How does the receiver calculate its position? We will start by assuming that theclocks of the receiver and all of the satellites are perfectly synchronized. The receivercalculates its position through triangulation. The basic principle of triangulation meth-ods is to determine where a person (object) is located by using some knowledge relatingthe position of the person (object) with respect to reference objects whose positions areknown. In the case of the receiver of the GPS, it calculates its distance to the satellites,whose positions are known.

    The receiver measures the time t1 it takes for the signal emitted from satellite P1to reach it. Given that the signal travels at the speed of light c, the receiver cancalculate its distance from the satellite as r1 = ct1. The set of points situated at adistance r1 from the satellite P1 forms a sphere S1 centered at P1 with radius r1. Sowe know that the receiver is on S1. Consider these points as defined in a Cartesiancoordinate system. Let (x, y, z) be the unknown position of the receiver and let(a1, b1, c1) be the known position of the satellite P1. Then (x, y, z) must satisfy theequation describing points on the sphere S1, namely

    (x a1)2 + (y b1)2 + (z c1)2 = r21 = c2t21. (1.1)

    This piece of information is insufficient to determine the precise position of thereceiver. The receiver therefore records the signal of a second satellite P2, recordingthe time t2 that the signal took to arrive and calculating the distance r2 = ct2 tothe satellite. As before, it must be that the receiver lies on the sphere S2 of radiusr2 centered at (a2, b2, c2):

  • 4 1 Positioning on Earth and in Space

    (x a2)2 + (y b2)2 + (z c2)2 = r22 = c2t22. (1.2)

    This narrows down our search, since the intersection of two overlapping spheres isa circle. Thus, we have now narrowed down the position of the receiver to a circleC1,2 on which the receiver must lie. However, we again do not know precisely wherethe receiver is on this circle.

    In order for the receiver to calculate its final position, it needs to capture and processthe signal received from a third satellite P3. Once again, the receiver measures thetime t3 for the signal to arrive and calculates its distance r3 = ct3 from it. As before,it follows that the receiver lies somewhere on the sphere S3 of radius r3 centered at(a3, b3, c3):

    (x a3)2 + (y b3)2 + (z c3)2 = r23 = c2t23. (1.3)The receiver is therefore at the intersection of the circle C1,2 and the sphere S3.Since a sphere and a circle intersect at two points, it may seem that we are not yetsure of the position of the receiver. Fortunately, this is not the case. In fact, thesatellites have been positioned such that one of the two solutions will be completelyunrealistic, being quite far away from the surface of the Earth. Thus, by finding thetwo solutions of the system () of equations formed by equations (1.1), (1.2), and(1.3), and subsequently eliminating the spurious solution, the receiver may calculateits precise position.

    Solving the system (). The equations of system () are quadratic, not linear, whichcomplicates the solution. You may have observed, however, that if we subtract one ofthe equations from another we obtain a linear equation, since the terms x2, y2, and z2

    cancel. Thus, we replace the system () by an equivalent system obtained by replacingthe first equation by (1.1)(1.3) and the second equation by (1.2)(1.3) and by keepingthe third equation. This results in the system

    2(a3 a1)x + 2(b3 b1)y + 2(c3 c1)z = A1, (1.4)2(a3 a2)x + 2(b3 b2)y + 2(c3 c2)z = A2, (1.5)

    (x a3)2 + (y b3)2 + (z c3)2 = r23 = c2t23, (1.6)

    where

    A1 = c2(t21 t23) + (a23 a21) + (b23 b21) + (c23 c21),A2 = c2(t22 t23) + (a23 a22) + (b23 b22) + (c23 c22).

    (1.7)

    The satellites have been placed in such a manner that no three satellites will ever fallalong a line. This property guarantees that at least one of the 2 2 determinants

    a3 a1 b3 b1a3 a2 b3 b2

    ,

    a3 a1 c3 c1a3 a2 c3 c2

    ,

    b3 b1 c3 c1b3 b2 c3 c2

    is nonzero. In fact, if all three determinants are zero, then the vectors (a3 a1, b3 b1, c3 c1) and (a3 a2, b3 b2, c3 c2) are collinear (their cross product is zero),implying that the three points P1, P2, and P3 fall on a line.

  • 1.2 Global Positioning System 5

    Suppose that the first determinant is nonzero. Using Cramers rule, the first twoequations of (1.6) can give us solutions for x and y as a function of z:

    x =

    A1 2(c3 c1)z 2(b3 b1)A2 2(c3 c2)z 2(b3 b2)

    2(a3 a1) 2(b3 b1)2(a3 a2) 2(b3 b2)

    ,

    y =

    2(a3 a1) A1 2(c3 c1)z2(a3 a2) A2 2(c3 c2)z

    2(a3 a1) 2(b3 b1)2(a3 a2) 2(b3 b2)

    .

    (1.8)

    Substituting these values into the third equation of (1.6) yields a quadratic equationin z, which we may solve to find the two solutions z1 and z2. Back-substituting z forthe values z1 and z2 into the two above equations yields the corresponding values x1,x2, y1, and y2. We could easily find closed forms to these solutions, but the formulasinvolved quickly become too large to offer any insight or convenience.

    Choosing the axes of our coordinate system. Nowhere in the above discussiondid we mention or were we forced to choose a set of axes for our coordinate system.However, to facilitate the translation from absolute coordinates to latitude, longitude,and altitude we make the following choice:

    the center of the coordinate system is the center of the Earth; the z axis passes through the two poles, and is oriented toward the North Pole; the x and y axes both lie in the equatorial plane; the positive x axis passes through the point of 0 degrees longitude; the positive y axis passes through the point of longitude 90 degrees west;Since the radius R of the Earth is approximately 6365 km, a solution (xi, yi, zi) isconsidered acceptable if x2i + y

    2i + z

    2i (6365 50)2. The uncertainty of 50 km allows a

    window for the altitudes of mountains and airplanes. A more natural coordinate systemfor expressing points near the surface of the Earth is the longitude L, the latitude l,and the distance h from the center of the Earth (the altitude above sea level is thereforegiven by h R). Longitude and latitude are angles that will be expressed in degrees.If a point (x, y, z) lies exactly on the sphere of radius R (in other words, if the point liesat altitude zero), then its longitude and latitude may be found by solving the followingsystem of equations:

    x = R cos L cos l,y = R sinL cos l,z = R sin l.

    (1.9)

    Since l [90, 90], we obtain

  • 6 1 Positioning on Earth and in Space

    l = arcsinz

    R, (1.10)

    allowing us to calculate cos l. The longitude L is therefore uniquely determined by thetwo equations

    cos L =x

    R cos l,

    sinL =y

    R cos l.

    (1.11)

    Calculating the position of the receiver. Let (x, y, z) be the position of the receiver.We begin by calculating the distance h of the receiver from the center of the Earth, givenby

    h =

    x2 + y2 + z2.

    We now have two choices for calculating the latitude and longitude: adapt the formulas(1.10) and (1.11) by replacing all occurrences of R with h, or project the position (x, y, z)to the surface of the sphere and use these values in the equations (1.10) and (1.11):

    (x0, y0, z0) =(

    xR

    h, y

    R

    h, z

    R

    h

    )

    .

    The altitude of the receiver is given by h R.

    1.2.3 Dealing with Practical Difficulties.

    We have just presented the theory behind calculating the position, which holds truein a perfect world. Unfortunately, real life is vastly more complicated, since the timesbeing measured are extremely short and must be measured to high precision. Thesatellites are each equipped with an extremely precise (and expensive!) atomic clockallowing them to be (very nearly) perfectly in sync. Meanwhile, the average receiveris typically equipped with only a mediocre clock, allowing it to be within the budgetof most everyone. Assuming that the clocks of the satellites are in sync, the receiveris easily capable of calculating precise transit times for the signals from the satellites.However, given that the receiver is not perfectly in sync, it will actually be calculatingthree fictitious transit times T1, T2, and T3. How do we deal with these inaccuratemeasurements? When we had three unknowns, x, y, z, we had needed three measuredtimes t1, t2, t3, to find the unknowns. Now the fictitious time Ti measured by the receiveris given by

    Ti = (arrival time of the signal on the receivers clock) (departure time of the signal on the satellites clock).

    The solution comes from the fact that the error between the fictitious time Ti calculatedby the receiver and the actual time ti is the same, regardless of the satellite from whichthe measurement was taken. That is, Ti = + ti, for i = 1, 2, 3, where

  • 1.2 Global Positioning System 7

    ti = (arrival time of the signal on the satellites clock) (departure time of the signal on the satellites clock)

    and is given by the equation

    = (arrival time of the signal on the receivers clock) (arrival time of the signal on the satellites clock). (1.12)

    The constant represents the clock offset between the clocks on the satellites and thereceivers clock. This introduces a fourth unknown, , to our original system of threeunknowns x, y, z. In order to resolve the system of equations to a finite set of solutionswe must obtain a fourth equation. This is simple to do in our context: the receiversimply measures the offset signal transit time T4 between itself and a fourth satelliteP4. Since ti = Ti for i = 1, . . . , 4, our system then becomes:

    (x a1)2 + (y b1)2 + (z c1)2 = c2(T1 )2,(x a2)2 + (y b2)2 + (z c2)2 = c2(T2 )2,(x a3)2 + (y b3)2 + (z c3)2 = c2(T3 )2,(x a4)2 + (y b4)2 + (z c4)2 = c2(T4 )2

    (1.13)

    where we have the four unknowns x, y, z, and . As before, we can use elementaryoperations to replace three of these quadratic equations by linear equations. To do thiswe subtract the fourth equation from each of the first three, resulting in:

    2(a4 a1)x + 2(b4 b1)y + 2(c4 c1)z = 2c2(T4 T1) + B1,2(a4 a2)x + 2(b4 b2)y + 2(c4 c2)z = 2c2(T4 T2) + B2,2(a4 a3)x + 2(b4 b3)y + 2(c4 c3)z = 2c2(T4 T3) + B3,

    (x a4)2 + (y b4)2 + (z c4)2 = c2(T4 )2,(1.14)

    where

    B1 = c2(T 21 T 24 ) + (a24 a21) + (b24 b21) + (c24 c21),B2 = c2(T 22 T 24 ) + (a24 a22) + (b24 b22) + (c24 c22),B3 = c2(T 23 T 24 ) + (a24 a23) + (b24 b23) + (c24 c23).

    (1.15)

    In the system of equations (1.14), Cramers rule applied to the first three equationsallows us to determine values for x, y, and z as a function of :

  • 8 1 Positioning on Earth and in Space

    x =

    2c2(T4 T1) + B1 2(b4 b1) 2(c4 c1)2c2(T4 T2) + B2 2(b4 b2) 2(c4 c2)2c2(T4 T3) + B3 2(b4 b3) 2(c4 c3)

    2(a4 a1) 2(b4 b1) 2(c4 c1)2(a4 a2) 2(b4 b2) 2(c4 c2)2(a4 a3) 2(b4 b3) 2(c4 c3)

    ,

    y =

    2(a4 a1) 2c2(T4 T1) + B1 2(c4 c1)2(a4 a2) 2c2(T4 T2) + B2 2(c4 c2)2(a4 a3) 2c2(T4 T3) + B3 2(c4 c3)

    2(a4 a1) 2(b4 b1) 2(c4 c1)2(a4 a2) 2(b4 b2) 2(c4 c2)2(a4 a3) 2(b4 b3) 2(c4 c3)

    ,

    z =

    2(a4 a1) 2(b4 b1) 2c2(T4 T1) + B12(a4 a2) 2(b4 b2) 2c2(T4 T2) + B22(a4 a3) 2(b4 b3) 2c2(T4 T3) + B3

    2(a4 a1) 2(b4 b1) 2(c4 c1)2(a4 a2) 2(b4 b2) 2(c4 c2)2(a4 a3) 2(b4 b3) 2(c4 c3)

    .

    (1.16)

    None of this makes sense unless the denominator is nonzero. However, the denominatoris zero if and only if the four satellites are situated in the same plane (see Exercise1). Once again, the satellites are laid out such that no four of them that are visiblefrom a given point on the Earth will ever lie in the same plane. We forward-substitutethe solutions to the first three equations into the fourth, resulting in a final quadraticequation in , which yields two solutions 1 and 2. Back-substituting these into (1.16)yields two possible positions for the receiver, and we use the same trick as before toeliminate the spurious solution.

    Which satellites should the receiver choose if it can see more than four? Inthis case, the receiver has a choice for which data to use in the calculations. It makessense to use the data that will introduce the minimal amount of error. In reality, thetime measurements are all approximate. This implies that the calculated distances tothe satellites are only approximate. Graphically, we could represent the area of incerti-tude by thickening the shell of each sphere. The intersection of the thick spheres thenbecomes a set, the size of which is related to the uncertainty of the solution. Thinkinggeometrically, it is easy to convince ourselves that the greater the angle between thesurfaces of two intersecting thick spheres, the smaller the volume of space swept outby the intersection. Conversely, if the spheres intersect almost tangentially, then thevolume of intersection (and hence uncertainty) is bigger. We thus want to choose thespheres Si that intersect each other at as large an angle as possible (see Figure 1.2).

    This is the geometric intuition behind our choice. Algebraically, we see that thevalues of x, y, and z in terms of are obtained by dividing by

  • 1.2 Global Positioning System 9

    Fig. 1.2. A small angle of intersection at the left (loss of precision) and a large angle at theright.

    2(a4 a1) 2(b4 b1) 2(c4 c1)2(a4 a2) 2(b4 b2) 2(c4 c2)2(a4 a3) 2(b4 b3) 2(c4 c3)

    .

    The smaller the denominator, the larger the error. Thus, we want to choose the foursatellites that maximize this denominator.

    More advanced investigations into this topic would fit easily into a course project.

    A few refinements:

    Differential GPS (DGPS): One source of imprecision in GPS comes from thefact that distances are calculated to the satellites using the constant c, which is thespeed of light in a vacuum. In reality, the signal is traveling and refracting throughthe atmosphere, which both lengthens its trajectory and decreases its speed. Toobtain a better approximation to the actual average speed of the signal on the pathfrom the satellite to the receiver we can employ a differential GPS system. Theidea is to refine the value of c to be used in calculating satellite distance. We dothis by comparing the transit time measured at the receiver and the transit timemeasured at another nearby receiver at a precisely known position. This allows us toaccurately calculate the average speed of light along the path from a given satelliteto the receiver, which in turn results in more accurate distance calculations. Whenhelped with such a fixed ground station, GPS precision is on the order of centimeters.

    The signal sent by each satellite is a random signal that repeats at regular knownintervals. The period of the signal is relatively short, such that the distance coveredby the signal in one period is on the order of a few hundred kilometers. When thereceiver sees the beginning of a period of the signal it must determine at preciselywhich moment in time this period was emitted from the satellite. A priori we havean uncertainty of some integer number of periods.

    Rapidly moving GPS receiver: installing a GPS receiver on a fast-moving object (anairplane, for example) is a very natural application: if an airplane needs to land in

  • 10 1 Positioning on Earth and in Space

    inclement weather, the pilot needs to know its precise position at every instant, andthe time to calculate the position must be reduced to an absolute minimum.

    The Earth is not really round! In fact, the Earth is more an ellipsoid that is slightlyflattened at the poles and bulging at the equator (an oblate spheroid). The radiusof the Earth is roughly 6356 km at the poles and 6378 km at the equator. Thus, thecalculations for translating Cartesian coordinates (x, y, z) into latitude, longitude,and altitude must be refined to accommodate this fact.

    Relativistic corrections. The speed of the satellites is sufficiently large that all ofthe calculations must be adapted to account for the effects of special relativity. Infact, the clocks on the satellites are traveling very fast compared to those on Earth.As such, the theory of special relativity predicts that these clocks will run slower thanthose on Earth. Furthermore, the satellites are in relatively close proximity to theEarth, which has significant mass. General relativity predicts a small increase in thespeed of the clocks on board the satellites. As a first approximation, we may modelthe Earth as a large nonrotating spherical mass without any electrical charge. Theeffect is relatively easy to compute using the Schwarzschild metric, which describesthe effects of general relativity under these simplified conditions. As it turns out,this simplification is sufficient to capture the actual effect to high precision. The twoeffects must both be considered because even though they are in opposite directions,they only partially cancel each other out. For more details see [4].

    Applications of GPS. The applications of GPS are numerous, and we name only afew here:

    A GPS receiver allows a person to easily find his/her position when outdoors. Assuch, it is immediately useful to hikers, kayakers, hunters, sailors, boaters, etc. Mostreceivers allow the marking of waypoints, which can be saved either when one is phys-ically present at the location (in which case the receiver has calculated its position)or by manually entering map coordinates into the receiver. By joining waypointswith line segments we can in turn represent a route. The receiver may then provideus with our position relative to a chosen waypoint or even give us instructions onhow to follow our route. More sophisticated receivers may even store detailed mapinformation. The receiver may then display our position on a portion of the mapappearing on the screen, annotated with our waypoints and routes.

    More and more vehicles (especially taxis) are equipped with GPS navigation systemsthat allow their drivers to find their way to a particular address. In Western Europeand North America there exist several products that provide precise directions tonearly any address.

    Imagine you have an ancient map on which you wish to plot a route you havefollowed. The route can be saved in the GPS as it is taken, and later uploaded toa computer with the appropriate software. Such software can then superimpose thefollowed route on the digitized map. If you do not already have a digital versionof the map, you may first scan it and (using appropriate software) overlay it with

  • 1.2 Global Positioning System 11

    a coordinate system by simply showing it the location of three known points (seeExercise 5).

    The ubiquitous use of GPS on airplanes allows the size of airways (imaginary corri-dors of air that airplanes follow between points) to be decreased while still ensuringthat airplanes on different airways will stay a safe distance from each other.

    A fleet of delivery vehicles may be equipped with GPS receivers that permit thesimultaneous tracking of all vehicles. Such a system is presently used to direct taxisin Paris. In this application the GPS system must be coupled with a communicationsystem allowing the coordinates of each vehicle to be broadcast (an example of such asystem is the Global System for Mobile Communications, or GSM). Similar systemsare used for tracking wildlife in environmental studies. It is not hard to imaginethe impact on our lives if a car rental company equipped its fleet with a GPS-GSMsystem, allowing it to ensure that clients respect the territorial limits imposed bythe rental contract!

    GPS may be used to help blind people find their way. Geographers use GPS to measure the growth of Mount Everest: this mountain

    continues to grow slowly as its glacier, the Khumbu, descends. Similarly, every twoyears an expedition ascends Mont Blanc to update its official height at the peak.In the nineties, geographers once again asked whether K2 was in fact taller thanMount Everest. Since their 1998 expedition, where they used GPS, the matter isnow definitely closed: Mount Everest is the tallest mountain on Earth, at 8830 m. In1954, the height of Everest was estimated at 8848 m by B. L. Gulatee. At the time,the estimate was computed using theodolite measurements taken from six stations onthe north Indian plains (a theodolite is an optical instrument for measuring angles,used in the field of geodesy).

    There are many military applications, considering that the system was originallydeveloped for the use of the American military. One such use is the precise guidanceof bombs.

    The future: GPS and Galileo. Up until now the United States has had a monopolyin this market. Given that they maintain exclusive control over GPS, the Americangovernment can choose to scramble the GPS signal to block access to it or degradeits accuracy over a certain region for military reasons (under the NAVWAR program,for navigational warfare). In March 2002 the European Union and European SpaceAgency agreed to fund the development and deployment of Galileo, a positioning systemdesigned as an alternative to GPS. Two test satellites were launched in 2005 with theremaining 28 satellites to be launched before the end of 2010. GPS satellites do notactually transmit information regarding the status of the satellite or the quality of thesignal itself. It can thus take several hours before a malfunctioning satellite is detectedand shut down, with the system accuracy being degraded severely during that time.This restricts the applications of GPS for guiding airplanes in inclement weather. TheGalileo satellites are designed to constantly transmit signal quality information, allowingreceivers to ignore the signal from malfunctioning satellites. This is done through a

  • 12 1 Positioning on Earth and in Space

    system of ground stations that accurately measure the actual position of the satelliteand compare it to the satellites calculated position. This information is sent to themalfunctioning satellite, which in turn relays it back to receivers. The US governmentis planning a similar improvement to the GPS system.

    1.3 How Hydro-Quebec Manages Lightning Strikes

    New solutions to existing problems often become apparent as new technology is madeavailable. Hydro-Quebec1 uses GPS as part of its approach to managing lightningstrikes. Mathematics is at work in several places in their lightning-strike-monitoringsystem. As such, this section focuses not only on the application of GPS to managinglightning strikes, but on the mathematics involved elsewhere in their approach.

    1.3.1 Locating Lightning Strikes

    In 1992, Hydro-Quebec installed a lightning strike locating system throughout its net-work. The basic problem is to determine the boundaries of areas affected by storms, inorder to reduce the power transmitted on affected power lines and to reroute it throughpower lines outside of the stormy area. In doing so, the potential impact of a lightningstrike on a power line is minimized: damage caused by a lighting strike is kept local-ized, thereby minimizing the number of customers affected and increasing the overallreliability of the power grid.

    To accomplish this goal, Hydro-Quebec uses a system of 13 detectors distributedacross the lower two-thirds of the province of Quebec (the territory covered by powerlines). Their positions are precisely known, but since the system relies on precise timemeasurements, the clocks in the detectors are required to be perfectly synchronized. Todo this, they each use a GPS receiver.

    Using a GPS receiver as a time reference. It may seem a little surprising that aGPS receiver can be used to tell time. We just observed that GPS receivers are typicallyequipped with cheap clocks of relatively low precision. However, we also observed thatin calculating its position, the receiver calculates , the clock shift between its clock andthose on board the GPS satellites. Thus, the receiver actually calculates the precise timeas measured by the clocks on board the satellites. When great precision is desired andthe receiver is stationary, it is better to replace the calculated values of x, y, z, and by the average of several calculated values (xi, yi, zi, i)Ni=1 at different times. Indeed,there is an error in each calculation (xi, yi, zi, i). The errors in space can be in anydirection around the true receiver position, and they obey a nice statistical law (theyare uniform and Gaussian). Similarly, the error in the calculation of the time shift can

    1Hydro-Quebec is the largest producer, transporter, and distributor of electricity in theprovince of Quebec. Its name comes from the fact that 95% percent of its power generation ishydroelectric.

  • 1.3 How Hydro-Quebec Manages Lightning Strikes 13

    be positive or negative. So the position of the receiver and time shift are more preciselyapproximated by ( 1N

    Ni=1 xi,

    1N

    Ni=1 yi,

    1N

    Ni=1 zi,

    1N

    Ni=1 i).

    In such a manner, a GPS receiver is capable of synchronizing its clock to the satelliteswith a precision of roughly 100 nanoseconds (a nanosecond is 1 billionth of a second).Such an approach is used in the Hydro-Quebec detectors. Indeed, the GPS allows the13 detectors to synchronize their clocks up to 100 nanoseconds. Once the receiver issynchronized with the satellites clocks it can also beat the second, i.e., send a pulseevery second. This is used for other measurements.

    Locating lightning strikes. In addition to maintaining a synchronized clock, the 13detectors are also responsible for monitoring all abnormal electromagnetic activity andidentifying such activity caused by lightning strikes. Hydro-Quebec has positioned thedetectors quite far from the actual power lines since the electromagnetic fields causedby the power lines would disrupt accurate signal detection. The detectors are typicallyplaced on the roof of Hydro-Quebec management buildings, distributed as uniformly aspossible throughout the territory to be monitored. When lightning strikes within thisterritory with sufficient energy to threaten the grid, it is typically recorded by at leastfive detectors. In fact, the detectors are sufficiently sensitive to locate extremely largelightning strikes as far away as Mexico, but with less precision.

    The lightning strike generates an electromagnetic wave, which travels through spaceat the speed of light. Each detector notes the precise time when the wave was perceived.For this, they use a fast oscillator (for example, a quartz crystal) that is synchronizedto the GPS time source. The frequency of such oscillators typically varies from 4 to 16megahertz (a megahertz is a frequency of one million oscillations per second, abbreviatedMHz). The detectors relay this information to a central computer as soon as they havemeasured the wave. This system then calculates the position of the lightning strikethrough triangulation (in other words, by using the differences in the times at whichthe wave was observed by the individual detectors, as explored in Exercise 2).

    Identifying lightning strikes. There exist three types of lightning strikes:

    Lightning strikes between clouds. This type forms the majority of lightning strikes.They are not detected, but they do not affect the grid, since they do not strike theground.

    Negative lightning strikes. In this case the cloud is negatively charged, and thelightning strike consists of a flow of electrons traveling from the cloud to the ground.

    Positive lightning strikes. In this case the cloud is positively charged, and the light-ning strike consists of a flow of electrons traveling from the ground to the cloud. Asyou may have guessed, the wave of a positive strike is thus the mirror image of thatof a negative strike.

    If we limit ourselves to lightning strikes between the ground and the clouds, 90% ofsuch strikes are negative. However, during a strong storm this percentage is reversed,and 90% of the ground lightning strikes are positive. The detectors can differentiatebetween a negative and a positive lightning strike: one is the mirror image of the other.

  • 14 1 Positioning on Earth and in Space

    If one detector were to register a wave for a positive lightning strike, and another wereto register a negative lightning strike, it stands to reason that these two waves could nothave been generated by the same strike. Unfortunately, it is a little more complicatedthan that. A wave that has traveled more than 300 km from its source may be reflectedby the ionosphere, inverting the signal. Thus a detector situated far enough away mayactually be measuring a reflected signal.

    To differentiate between lightning strikes and other electromagnetic signals, the de-tector analyzes the shape of the wave by filtering the signal and looking for the specificsignature of a lightning strike. In particular, the detector notes the beginning of thesignal, the maximum amplitude, the number of peaks, and the slope of the rise, sendingthis information to the central computer. Signal processing is a beautiful subject ofapplied mathematics, but we will not discuss it here.

    From theory to practice. There are several additional tricks that may be employedto correctly identify received signals.

    Let P and Q be the two detectors that are the furthest apart from each other, andlet T be the time necessary for a signal to travel between P and Q at the speed oflight. We can be sure that the time difference between the two detected signals forthe same lightning strike can be no more than T . Thus, if two detectors registereda strike at times t1 and t2 such that |t1 t2| > T , then these signals could not havecome from the same lightning strike.

    The amplitude of the wave generated by the lightning strike is inversely proportionalto the square of the distance to its source. Thus, in order for two detected signals tocorrespond to the same lightning bolt, the amplitudes of the measured signals mustbe compatible with the calculated location.

    If lightning strikes within 20 km of a detector, the readings from the detector areeliminated from the calculation. This is because the measured amplitude is toolarge, and the detector is not able to detect difference between a signal of a singlelightning strike and a superposed signal from two lightning strikes.

    With these methods Hydro-Quebec is able to locate lightning strikes within 500 mof accuracy when they fall within the area covered by the detectors. The accuracydiminishes for lightning strikes outside of the covered territory.

    Locating faults in the power lines. A similar method is used to locate faults in thetransport network: for example, if a lightning strike has damaged a power line, techni-cians need to know where to go in order to repair it. On either end of each power lineto be protected an oscilloperturbograph is installed, synchronized by GPS. This devicemeasures the form of the 60 Hz signal traveling through the power line. Dependingon the fault, there will be different types of perturbation observed. The perturbationtravels along the power line at the speed of light. The two detectors measure the timest1 and t2 at which the perturbation is observed, and using the difference t1 t2, thelocation of the fault can be calculated. These techniques are precise only within a fewhundred meters, but this is generally sufficient. In Quebec the power lines are often

  • 1.3 How Hydro-Quebec Manages Lightning Strikes 15

    very long and traverse immense uninhabited areas; thus the system allows for a rapiddeployment of a repair team to the area of the fault.

    Redistributing power transmission. Lightning-strike detection can be used to de-termine the size and location of a storm. Since lightning strikes occur in a randommanner within a territory, statistical models can be used. For this, the territory is di-vided into an even grid, and a spatiotemporal density of lightning strikes is calculated.For example, a storm with two lightning strikes per km2 within 10 minutes is verystrong. Using the information from the model, the heart of the storm is calculated (thestorm centroid). The calculation is repeated every five minutes, and the displacementof the calculated centroid used to infer the speed and direction of the storm (which canbe anywhere from 0 to 200 km/h). This information can in turn be used to predictwhich areas of the power grid will be affected next. One of the more difficult problemsto be solved is that of two storms near each other: the system must decide whetherthere are in fact two separate storms, or a single larger storm. An interesting challengefor engineers!

    Armed with this information, the distributor draws upon his experience to decidewhether to lower the amount of power being transmitted over a potentially affectedpower line. Keeping a power grid in equilibrium is a very delicate operation. Theremust always be a balance between the amount of power being generated, the amountof power being transmitted, and the amount of power being used. In order to diminishthe amount of power being transmitted on one line, there must be excess capacity onone or more other lines. Thus, in order to make such decisions the distributor musthave a certain margin for maneuver. Each line has a maximum capacity, but as a rule,power grids are always operated slightly below capacity so that the system can absorbthe loss of an entire line at any given moment.

    1.3.2 Threshold and Quality of Lightning-Strike Detection

    The detector equipment is tested to meet minimum standards for detection, but one cangenerally do better. It is thus worthwhile to accurately gauge their actual capabilities,a process that relies principally on statistical methods.

    To this end we will draw upon an empirical law of probability for the random variableX, giving the intensity of a lightning strike. Rather than using the density function f(I)of lightning strikes, we will use the distribution function

    P (I) = Prob(X > I) =1

    1 +(

    IM

    )K. (1.17)

    We have that P (0) = Prob(X > 0) = 1. The values of M and K to be used de-pend on the geographic zone and the particulars of its environment and are determinedempirically. The value of I is given in kA (kiloamperes). Certain values are used suf-ficiently often to merit being given a name. Thus, the function P from (1.17) is calledthe Popolansky function when M = 25 and K = 2. It is called the AndersonErikson

  • 16 1 Positioning on Earth and in Space

    function when M = 31 and K = 2.6. Figure 1.3 represents the Popolansky functionand Figure 1.4 represents the density function f(I) of the associated variable X. Recallthat P (I) =

    I

    f(J)dJ and therefore that f(I) = P (I).

    Fig. 1.3. The Popolansky function.

    Fig. 1.4. The density function associated with the Popolansky function.

    We demonstrate how this empirical law can be used in practice.

    Example 1.1 The Popolansky function

    1. The probability of a random lightning bolt having an amperage greater than 50 kAis

  • 1.3 How Hydro-Quebec Manages Lightning Strikes 17

    P (50) =1

    1 +(

    5025

    )2 =15

    = 0.2. (1.18)

    2. The median of this distribution is the value Im of I such that

    Prob(X > Im) = P (Im) =12. (1.19)

    This gives us the equation 11+( Im25 )

    2 = 12 . Thus 1 +(

    Im25

    )2= 2, or in other words

    (Im25

    )2= 1. Hence Im = 25.

    Calculating the rate of lightning-strike detection. In practice we do not actuallydetect all lightning strikes, but only those with energy greater than a certain threshold.This threshold depends on the position of the lightning strike with respect to the de-tectors and on various sources of interference that may decrease the reception qualityof the detectors at any given moment in time. We will explore how to determine thepercentage of lightning strikes that are detected. In our example we determined that50% of lightning strikes have an amperage higher than 25 kA. Suppose for now that ina sample of detected lightning strikes we observed that 60% had an amperage higherthan 25 kA. Let E be the event the lightning strike is detected. Then we wish tocalculate Prob(E). We know the probability that a detected lightning strike (in otherwords, that event E took place) had an amperage higher than 25 kA. This is a condi-tional probability because we have assumed that the lightning strike was detected, andit may be written as

    Prob(X > 25|E) = 0.6. (1.20)On the other hand, we know that the conditional probability of X > 25 knowing thatE has occurred can be expressed as

    Prob(X > 25|E) = Prob(X > 25 and E)Prob(E)

    . (1.21)

    As such we cannot do much with this expression, since both the numerator and thedenominator are unknown. But suppose we can assume that all lightning strikes withan amperage higher than 25 kA are detected. Then the event X > 25 and E becomessimply X > 25, whose probability is known. Thus (1.21) provides

    Prob(E) =Prob(X > 25)

    Prob(X > 25|E) =0.50.6

    =56

    = 0.83. (1.22)

    Suppose now that for a given limited geographic region we can assume the hypothesis(with a reasonable margin of error) that the only lightning strikes not detected are thosethat have a weaker amperage. We may wish to determine the threshold amperage I0below which lightning strikes are not detected. For this calculation the event E becomesX > I0. We have seen that Prob(E) = 56 = 0.83. Since Prob(E) = Prob(X > I0) =P (I0), this gives the equation

  • 18 1 Positioning on Earth and in Space

    P (I0) =0.50.6

    =56, (1.23)

    while comes to 11+( I025 )

    2 = 56 , or equivalently 1 +(

    I025

    )2= 6

    5. Hence I0 is the value

    satisfying(

    I025

    )2= 1

    5= 0.2, yielding

    I0 = 25

    0.2 = 11.18. (1.24)

    We can therefore conclude that for the given region, the threshold of detection is I0 =11.18 kA, and that lightning strikes with amperages below this value are not detected.

    1.3.3 Long-Term Risk Management

    Managing lightning strikes is not limited to the task of detecting and locating storms.Hydro-Quebec keeps detailed long-term statistics that are used to construct isokeraunicmaps giving the density of lightning strikes over a period of five years. Such a map canthen be used to identify which zones are subject to more risk. In the case of powerlines that have already been built, this information can be used to decide which sectionsshould be better protected. Similarly, such maps allow for ready identification of routesto take during the construction of new power lines. These choices can be rewritten in arisk-management framework.

    Risks due to violent storms are but one of many risks faced by a company thatproduces, transports, and distributes electricity. Hence, all of the tasks of locatinglightning strikes, storm tracking and identifying risk zones may be used as part of ageneral risk-management framework. The problem is to make the distribution networkas reliable as possible. Investment in the grid for this purpose represents the cost. Thus,individual investments in the grid have to be evaluated in terms of their profitability.The more dangerous a given event and the larger its financial impact, the more preparedwe are to invest in protecting the system from the event or limiting its impact. Naturally,this is always subject to the condition that the cost of the protection not be too high!To formalize such a system we introduce three variables:

    the probability p of the event at risk; the projected cost Ci were the event to occur without precautions taken to mitigate

    it; the cost of attenuation Ca, which is to be paid to protect equipment and limit the

    impact of the event occurring.

    We introduce the indexpCiCa

    . (1.25)

    We see that the numerator represents the expected cost of repairs and that the denom-inator represents the cost of protection. We must have this ratio at least 1 in orderfor investing in protection to be profitable. However, there are several other factors

  • 1.4 Linear Shift Registers 19

    that come into play in practice. We are more likely to purchase protection if it is validfor multiple events. Similarly, the situation changes if the protection is only partial,meaning we incur some reduced repair cost if the event occurs, as opposed to beingtotal.

    1.4 Linear Shift Registers and the GPS Signal

    Linear shift registers allow the generation of sequences that have excellent propertiesin terms of allowing a receiver to synchronize with them. These simple-to-build devices(one can build a linear shift register with a few basic electrical components) generatepseudorandom signals. That is, they generate signals that appear to be largely randomeven though they are generated by deterministic algorithms.

    We will construct a linear shift register that generates a periodic signal with aperiod of 2r 1. It will have the property that it is extremely poorly correlated with alltranslations of itself and with other signals generated by the same register using differentcoefficients. This property of having a signal that correlates poorly to its translationsand other similar signals permits GPS receivers to easily identify the signals of individualGPS satellites and synchronize to them. The signal produced by a linear shift registercan be imagined as a sequence of zeros and ones. The register itself may be imagined asa ribbon of r boxes containing the entries an1, . . . , anr, each of which holds a value of0 or 1 (see Figure 1.5). Each box is associated with a number qi {0, 1}. The r values

    Fig. 1.5. A linear shift register.

    qi are fixed and distinct for all satellites. We generate a pseudorandom sequence in thefollowing manner:

    We give ourselves a set of initial conditions a0, . . . , ar1 {0, 1}, not all zero. Given anr, . . . , an1, the register calculates the next element in the sequence as

  • 20 1 Positioning on Earth and in Space

    an anrq0 + anr+1q1 + + an1qr1 =r1

    i=0

    anr+iqi (mod 2). (1.26)

    (To calculate modulo 2 we perform the calculation as normal. The final result is 0if the number is even, and 1 otherwise. As such we write a 0 (mod 2) if a is even,and a 1 (mod 2) if it is odd.)

    We shift each entry to the right, forgetting anr. The calculated value an is insertedinto the leftmost box.

    We iterate the above procedure.Since the above procedure is perfectly deterministic and the number of initial conditionsis finite, we will generate a sequence that must become periodic. Similarly we can seethat the period of the sequence can be at most 2r, since there are only 2r distinctsequences of length r. In fact, we can convince ourselves that if at some momentanr = = an1 = 0, then for all m n we will have am = 0. Thus an interestingperiodic sequence must never contain a sequence of r zeros, and will therefore have amaximal period of 2r1. In order to generate a sequence with interesting properties weneed only carefully choose the coefficients q0, . . . , qr1 {0, 1} and the initial conditionsa0, . . . , ar1 {0, 1}.

    We never see the entire sequence, but rather we only observe a window of M =2r 1 consecutive entries {an}n=m+M1n=m , which we label B = {b1, . . . , bM}. We wishto compare it with another window C = {c1, . . . , cM} of the form {an}n=p+M1n=p . Forexample, sequence B is sent by the satellite, and sequence C is a cyclic shift of the samesequence generated by the GPS receiver. To determine the shift between the two, thereceiver shifts repeatedly its sequence by one unit (by making p p + 1) until it isidentical with B.

    Definition 1.2 We call the correlation between two sequences B and C of length Mthe number of entries i where bi = ci minus the number of entries i where bi = ci. Wedenote this by Cor(B,C).

    Remark: If the register consists of r entries, then the correlation between any pairs ofsequences B and C must satisfy M Cor(B,C) +M , where M = 2r 1. We saythat the sequences are poorly correlated if Cor(B,C) is close to zero.

    Proposition 1.3 The correlation between two sequences is given by

    Cor(B,C) =M

    i=1

    (1)bi(1)ci . (1.27)

    Proof. The number Cor(B,C) is calculated as follows: each time bi = ci we mustadd 1. Similarly, each time bi = ci, we must subtract 1. Recall that bi and ci maytake on only the value 0 or 1. Thus if bi = ci, then either (1)bi = (1)ci = 1 or(1)bi = (1)ci = 1. In either case we see that (1)bi(1)ci = 1. Similarly, if

  • 1.4 Linear Shift Registers 21

    bi = ci, exactly one of (1)bi and (1)ci is equal to 1 and the other to 1. Hence(1)bi(1)ci = 1.

    The following theorem shows that we may initialize a linear shift register in such amanner that it will generate a sequence that is poorly correlated to every translation ofitself.

    Theorem 1.4 Given a linear shift register as shown in Figure 1.5, there exist coeffi-cients q0, . . . , qr1 {0, 1} and initial conditions a0, . . . , ar1 {0, 1} such that thesequence generated by the register has a period of length 2r 1. Consider two win-dows B and C of this sequence of length M = 2r 1, where B = {an}n=m+M1n=m andC = {an}n=p+M1n=p with p > m. If M does not divide p m, then

    Cor(B,C) = 1. (1.28)

    In other words, the number of bits in disagreement is always one more than the numberof bits in agreement.

    The proof of this theorem makes use of finite fields. We will begin by walking throughan example that illustrates the theorem. The proof will follow in Section 1.4.2.

    Example 1.5 In this example we take r = 4, (q0, q1, q2, q3) = (1, 1, 0, 0), and (a0, a1,a2, a3) = (0, 0, 0, 1). We let the reader verify that these values generate a sequence withperiod 24 1 = 15, repeating the following block of symbols:

    0 0 0 1 0 0 1 1 0 1 0 1 1 1 1 .

    If we translate the sequence to the left by one symbol, we send the first 0 to the end,yielding

    0 0 1 0 0 1 1 0 1 0 1 1 1 1 0 .

    We see that the two blocks of symbols differ at positions 3, 4, 6, 8, 9, 10, 11, and 15.Thus, they differ at eight positions and agree at seven positions, yielding a correlationof 1.

    In order to calculate the correlation with the other 14 translations of the sequence weexplicitly write all possible translations. Inspection shows that any two of the followingsequences agree at exactly seven places and differ in the remaining eight. We leave it tothe reader to verify this:

  • 22 1 Positioning on Earth and in Space

    0 0 0 1 0 0 1 1 0 1 0 1 1 1 10 0 1 0 0 1 1 0 1 0 1 1 1 1 00 1 0 0 1 1 0 1 0 1 1 1 1 0 01 0 0 1 1 0 1 0 1 1 1 1 0 0 00 0 1 1 0 1 0 1 1 1 1 0 0 0 10 1 1 0 1 0 1 1 1 1 0 0 0 1 01 1 0 1 0 1 1 1 1 0 0 0 1 0 01 0 1 0 1 1 1 1 0 0 0 1 0 0 10 1 0 1 1 1 1 0 0 0 1 0 0 1 11 0 1 1 1 1 0 0 0 1 0 0 1 1 00 1 1 1 1 0 0 0 1 0 0 1 1 0 11 1 1 1 0 0 0 1 0 0 1 1 0 1 01 1 1 0 0 0 1 0 0 1 1 0 1 0 11 1 0 0 0 1 0 0 1 1 0 1 0 1 11 0 0 0 1 0 0 1 1 0 1 0 1 1 1

    In the preceding example we did not explicitly show why we chose those specificvalues for q0, . . . , q3 and a0, . . . , a3. In order to show this and to prove Theorem 1.4 wewill need to use the theory of finite fields. In particular, we will need to make use ofthe field F2r containing 2r elements. For the case r = 1 the field F2 is the field of 2elements {0, 1} with addition and multiplication modulo 2.

    1.4.1 The Structure of the Field Fr2

    The structure and construction of finite fields of order pn (for p prime) are explored inSections 6.2 and 6.5 of Chapter 6. These sections are self-contained and may be readwithout reading the rest of Chapter 6. For the remainder of this chapter, we will assumethat the reader has knowledge of