discrete mathematics - tomlr.free. e9matiques/math%20complete/discrete%20... · discrete...

Download Discrete Mathematics - tomlr.free. e9matiques/Math%20Complete/Discrete%20... · Discrete Mathematics

Post on 06-Sep-2018




9 download

Embed Size (px)


  • Discrete Mathematicsfor New TechnologySecond Edition

    Rowan GarnierandJohn TaylorUniversity of Brighton, UK

    Institute of Physics PublishingBristol and Philadelphia

  • c IOP Publishing Ltd 2002

    All rights reserved. No part of this publication may be reproduced, storedin a retrieval system or transmitted in any form or by any means, electronic,mechanical, photocopying, recording or otherwise, without the prior permissionof the publisher. Multiple copying is permitted in accordance with the termsof licences issued by the Copyright Licensing Agency under the terms of itsagreement with the Committee of Vice-Chancellors and Principals.

    British Library Cataloguing-in-Publication Data

    A catalogue record for this book is available from the British Library.

    ISBN 0 7503 0652 1

    Library of Congress Cataloging-in-Publication Data are available

    First Edition published 1992First Edition reprinted 1996, 1997, 1999

    Commissioning Editor: James RevillProduction Editor: Simon LaurensonProduction Control: Sarah PlentyCover Design: Frederique SwistMarketing Executive: Laura Serratrice

    Published by Institute of Physics Publishing, wholly owned by The Institute ofPhysics, London

    Institute of Physics Publishing, Dirac House, Temple Back, Bristol BS1 6BE, UK

    US Office: Institute of Physics Publishing, The Public Ledger Building, Suite1035, 150 South Independence Mall West, Philadelphia, PA 19106, USA

    Typeset in LATEX 2 by Text 2 Text, Torquay, DevonPrinted in the UK by MPG Books Ltd, Bodmin, Cornwall

  • Contents

    Contents v

    Preface to the Second Edition ix

    Preface to the First Edition xi

    List of Symbols xv

    Chapter 1: Logic 11.1 Propositions and Truth Values 11.2 Logical Connectives and Truth Tables 21.3 Tautologies and Contradictions 131.4 Logical Equivalence and Logical Implication 151.5 The Algebra of Propositions 201.6 More about Conditionals 241.7 Arguments 251.8 Predicate Logic 281.9 Arguments in Predicate Logic 38

    Chapter 2: Mathematical Proof 442.1 The Nature of Proof 442.2 Axioms and Axiom Systems 452.3 Methods of Proof 492.4 Mathematical Induction 63

    Chapter 3: Sets 733.1 Sets and Membership 733.2 Subsets 79

  • vi Contents

    3.3 Operations on Sets 853.4 Counting Techniques 943.5 The Algebra of Sets 983.6 Families of Sets 1053.7 The Cartesian Product 1163.8 Types and Typed Set Theory 128

    Chapter 4: Relations 1484.1 Relations and Their Representations 1484.2 Properties of Relations 1584.3 Intersections and Unions of Relations 1654.4 Equivalence Relations and Partitions 1694.5 Order Relations 1824.6 Hasse Diagrams 1924.7 Application: Relational Databases 199

    Chapter 5: Functions 2145.1 Definitions and Examples 2145.2 Composite Functions 2325.3 Injections and Surjections 2405.4 Bijections and Inverse Functions 2545.5 More on Cardinality 2645.6 Databases: Functional Dependence and Normal Forms 271

    Chapter 6: Matrix Algebra 2856.1 Introduction 2856.2 Some Special Matrices 2886.3 Operations on Matrices 2906.4 Elementary Matrices 3026.5 The Inverse of a Matrix 312

    Chapter 7: Systems of Linear Equations 3257.1 Introduction 3257.2 Matrix Inverse Method 3317.3 GaussJordan Elimination 3367.4 Gaussian Elimination 349

    Chapter 8: Algebraic Structures 3558.1 Binary Operations and their Properties 3558.2 Algebraic Structures 3648.3 More about Groups 3738.4 Some Families of Groups 3788.5 Substructures 3908.6 Morphisms 3988.7 Group Codes 412

  • Contents vii

    Chapter 9: Boolean Algebra 4319.1 Introduction 4319.2 Properties of Boolean Algebras 4359.3 Boolean Functions 4429.4 Switching Circuits 4599.5 Logic Networks 4689.6 Minimization of Boolean Expressions 475

    Chapter 10: Graph Theory 48710.1 Definitions and Examples 48710.2 Paths and Cycles 50010.3 Isomorphism of Graphs 51410.4 Trees 52110.5 Planar Graphs 53010.6 Directed Graphs 539

    Chapter 11: Applications of Graph Theory 55011.1 Introduction 55011.2 Rooted Trees 55111.3 Sorting 56511.4 Searching Strategies 58211.5 Weighted Graphs 59111.6 The Shortest Path and Travelling Salesman Problems 59911.7 Networks and Flows 612

    References and Further Reading 626

    Hints and Solutions to Selected Exercises 630

    Index 727

  • Preface to the Second Edition

    In the nine years since the publication of the first edition, we have receivedfeedback on the text from a number of users, both teachers and students. Mosthave been complimentary about the clarity of our exposition, some have pointedout errors of detail or historical accuracy and others have suggested ways in whichthe text could be improved. In this edition we have attempted to retain the styleof exposition, correct the (known) errors and implement various improvementssuggested by users.

    When writing the first edition, we took a conscious decision not to root themathematical development in a particular method or language that was currentwithin the formal methods community. Our priority was to give a thoroughtreatment of the mathematics as we felt this was likely to be more stable overtime than particular methodologies. In a discipline like computing which evolvesrapidly and where the future direction is uncertain, a secure grounding in theoryis important. We have continued with this philosophy in the second edition.Thus, for example, Z made no appearance in the first edition, and the objectconstraint language (OCL) or the B method make no appearance in this edition.Although the discipline of computing has indeed changed considerably sincethe publication of the first edition, the core mathematical requirements of theundergraduate curricula have remained surprisingly constant. For example, inthe UK, the computing benchmark for undergraduate courses, published by theQuality Assurance Agency for Higher Education (QAA) in April 2000, requiresundergraduate programmes to present coherent underpinning theory. In theUSA, the joint ACM/IEEE Computer Society Curriculum 2001 project listsDiscrete Structures (sets, functions, relations, logic, proof, counting, graphsand trees) as one of the 14 knowledge areas in the computing curriculum toemphasize the dependency of computing on discrete mathematics.


  • x Preface to the Second Edition

    In this edition we have included a new section on typed set theory andsubsequently we show how relations and functions fit into the typed world. Wehave also introduced a specification approach to mathematical operations, viasignatures, preconditions and postconditions. Computing undergraduates will befamiliar with types from the software design and implementation parts of theircourse and we hope our use of types will help tie together the mathematicalunderpinnings more closely with software development practice. For themathematicians using the text, this work has a payoff in providing a frameworkin which Russells paradox can be avoided, for example.

    The principal shortcoming reported by users of the first edition was the inclusionof relatively few exercises at a routine level to develop and reinforce themathematical concepts introduced in the text. In the second edition, we haveadded many new exercises (and solutions) which we hope will enhance theusefulness of the text to teachers and students alike. Also included are a numberof new examples designed to reinforce the concepts introduced.

    We wish to acknowledge, with thanks, our colleagues who have commentedon and thus improved various drafts of additional material included in thesecond edition. In particular, we thank Paul Courtney, Gerald Gallacher, JohnHowse, Brian Spencer and our reviewers for their knowledgeable and thoughtfulcomments. We would also like to thank thosemost notably Peter Kirkegaardwho spotted errors in the first edition or made suggestions for improving the text.Nevertheless, any remaining shortcomings are ours and we have no one to blamefor them but each other.

    RG and JTApril 2001

  • Preface to the First Edition

    This book aims to present in an accessible yet rigorous way the core mathematicsrequirement for undergraduate computer science students at British universitiesand polytechnics. Selections from the material could also form a one- or two-semester course at freshmansophomore level at American colleges. The formalmathematical prerequisites are covered by the GCSE in the UK and by high-schoolalgebra in the USA. However, the latter part of the text requires a certain level ofmathematical sophistication which, we hope, will be developed during the readingof the book.

    Over 30 years ago the discipline of computer science hardly existed, except asa subdiscipline of mathematics. Computers were seen, to a large extent, asthe mathematicians tool. As a result, the machines spent a large proportion oftheir time cranking through approximate numerical solutions to algebraic anddifferential equations and the mathematics appropriate for the computer scientistwas the theory of equations, calculus, numerical analysis and the like.

    Since that time computer science has become a discipline in its own right and hasspawned its own subdisciplines. The nature and sophistication of both hardwareand software has changed dramatically over the same time period. Perhaps lesspublic, but no less dramatic, has been the parallel development of undergraduatecomputer science curricula and the mathematics which underpins it. Indeed, thewhole relationship between mathematics and computer science has changed sothat mathematics is now seen more as the servant of computer science than viceversa as was the case formerly.

    Various communities and study groups on both sides of the Atlantic have studiedand reported upon the core mathematics requirements for computer scientistseducated and trained at various levels. The early emphasis on continuous