Unformatted Attachment Preview
1. (15 points)
(a) How many bit strings of length 8 are there? Explain.
(b) How many bit strings of length 8 are there which begin with a 0 and end with a 0?
Explain.
(c) How many bit strings of length 8 are there which contain at most 3 ones? Be careful
with this one. Explain. (See your notes, week 10.)
(d) How many bit strings of length 8 are palindromes?
3. (10 points)
(a) Text, page 405, number 2. Explain.
(b) Text, page 406, number 36. Explain
3. (10 points).
Text, page 414, number 30. Explain.
4. (10 points)
(a) Use the Binomial Theorem to write the expansion of (x + y) 6?
(b) Write the coefficient of the term x2y4z5 expansion of (x + y + z) 11. See example 12 in
your notes of week 10
5. Study pages 1-4 of the notes for week 11. Let A = {a, b, c, d}, and let R be the relation
defined on A by the following matrix:
1 0 1 0
0 1 1 0
MR =
0 0 1 1
1 1 0 1
(a) (10 pts.) Describe R by listing the ordered pairs in R and draw the digraph of this
relation.
(b) (15 pts.) (Note this is similar to exercise 7 page 630. Which of the properties:
reflexive, antisymmetric and transitive are true for the given relation? Begin your discussion by
defining each term in general first and then how the definition relates to this specific example.
(c) (5 pts.) Is this relation a partial order? Explain. If this relation is a partial order, draw
its Hasse diagram.
6. (10 points) Use the Hasse diagram of number 26 page 631
(a) List the ordered pairs that belong to the relation. Keep in mind that a Hasse diagram
is a graph of a partial ordering relation so it satisfies the three properties listed in number 5 part
(b).
(b) Find the (Boolean) matrix of the relation.
7. (15 points) Before you do this problem study the example at the end of the exam, as well as
the notes in weeks 12 and 13.
Assume the Boolean matrix below is MR and that MR represents the relation R where R
represents the connecting flights that an airline has between 4 cities: a, b, c, and d.
The 1 in row a column b means there is a flight from city a (Manchester) to city b (Boston). The
1 in row x column x means that there are planes in airport x. In general, there is a 1 in row x
column y iff there is a connecting flight between (from) city x and (to) city y That is, the rows of
the matrix represent the cities of the origins of the flights and the columns represent the
destination cities.
a b c d
a 1
Let MR = b 1
c 1
d 0
1
1
0
0
0
1
1
1
1
0
0
1
(i) Let a stand for the airport in the city of Manchester, let b stand for the airport in Boston, c
stand for the Chicago airport, d for the airport in the city of Denver. Is their a flight from Denver
to Chicago? Explain.
(ii) Compute and interpret the Boolean products: MR 2, and MR 3. (Remember to use Boolean
arithmetic). What do these Boolean products give you? That is, explain what the Boolean entries
in the matrices MR 2 and MR 3 mean.
(iii) Now call the given matrix A and compute A2 and A3 , using regular, not Boolean
arithmetic. What do these products give you?
(v) What does MR + M2R + M3R + M4R give you? Note, this is Theorem 3 page 602where
the text’s symbol, v, for Boolean addition is replaced by +, another symbol for Boolean addition .
Questions that test your knowledge
1.
Make up a question using the idea of question 7 (Something you do at work, home,
something you’re interested in.) See 3 below for an example you can do.
2. In your notes of week 12 Project Evaluation and Review Technique (PERT) is
explained. Make up a meaningful example illustrating this process. Explain all details.
Draw the graphs involved. You should use a reasonable number of tasks.
(a) Determine the minimum time needed to complete your set of tasks.
(b) Determine the Critical Path for your example. Explain what this gives you.
(c) Comment on your example. Which task(s) cause a delay in the project? How would
you fix the problem? Can you obtain more information out of your example?
3. The Network analysis problem.
4. Read Program Evaluation and Review Technique (PERT) in your week 14 notes. Note
the examples given here are a little “ambitious”. Make up an example using PERT and
find and explain the critical path of your example. Google “critical path analysis”, for
more ideas.
5. Pg 406 #38
If #7 is not clear here is an example which may help you to understand #7
Let D = days of the week {M, T, W, R, F},
E = {Brian (B), Jim (J), Karen (K)} be the employees of a tutoring center at a University
and let
U = {Courses the tutoring center needs tutors for}
= {Calculus I (I), Calculus II (II), Calculus III (III), Computers I (C1), Computers II (C2),
Precalculus (P)}.
We define the relation R from D into E by d R e, if employee e is scheduled to work on day d.
We also define S from E into U by e r u, if employee e is capable of tutoring students in course u.
For example, the matrix MR indicates that on R (Thursday) that J (Jim) is available to tutor but
Brian and Karen are not.
B J K
M 1
T 0
Assume MR =
W 1
R 0
F 1
0
1
0
1
1
I
1
1
B 0
and MS =
1
J 1
0
K 0
0
II
III C1 C2 P
1
1
1
1
0
0
0
1
0
0 1
0 1
1 1
(a) Interpret the above matrices with respect to the above relations.
(b) Compute MS R , (use Boolean arithmetic) and use the matrix MS R to determine which
courses will have tutors available on which days.
(c) Multiply the above matrices using regular arithmetic. Can you interpret this result?
The Leading Text in Discrete Mathematics
The seventh edition of Kenneth Rosen’s Discrete Mathematics and Its Applications
is a substantial revision of the most widely used textbook in its field. This new edition
reflects extensive feedback from instructors, students, and more than 50 reviewers. It also
reflects the insights of the author based on his experience in industry and academia.
Key benefits of this edition are:
Rosen
Discrete Mathematics
and Its Applications
Kenneth H. Rosen
SEVENTH
EDITION
MD DALIM 1145224 05/14/11 CYAN MAG YELO BLACK
Discrete Mathematics
and Its Applications
Discrete
Mathematics
and Its
Applications
SEVENTH EDITION
TM
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Discrete
Mathematics
and Its
Applications
Seventh Edition
Kenneth H. Rosen
Monmouth University
(and formerly AT&T Laboratories)
i
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
DISCRETE MATHEMATICS AND ITS APPLICATIONS, SEVENTH EDITION
Published by McGraw-Hill, a business unit of The McGraw-Hill Companies, Inc., 1221 Avenue of the
Americas, New York, NY 10020. Copyright © 2012 by The McGraw-Hill Companies, Inc. All rights reserved.
Previous editions © 2007, 2003, and 1999. No part of this publication may be reproduced or distributed
in any form or by any means, or stored in a database or retrieval system, without the prior written consent of
The McGraw-Hill Companies, Inc., including, but not limited to, in any network or other electronic storage
or transmission, or broadcast for distance learning.
Some ancillaries, including electronic and print components, may not be available to customers outside the
United States.
This book is printed on acid-free paper.
1 2 3 4 5 6 7 8 9 0 DOW/DOW 1 0 9 8 7 6 5 4 3 2 1
ISBN 978-0-07-338309-5
MHID 0-07-338309-0
Vice President & Editor-in-Chief: Marty Lange
Editorial Director: Michael Lange
Global Publisher: Raghothaman Srinivasan
Executive Editor: Bill Stenquist
Development Editors: Lorraine K. Buczek/Rose Kernan
Senior Marketing Manager: Curt Reynolds
Project Manager: Robin A. Reed
Buyer: Sandy Ludovissy
Design Coordinator: Brenda A. Rolwes
Cover painting: Jasper Johns, Between the Clock and the Bed, 1981. Oil on Canvas (72 × 126 1/4 inches)
Collection of the artist. Photograph by Glenn Stiegelman. Cover Art © Jasper Johns/Licensed by VAGA, New York, NY
Cover Designer: Studio Montage, St. Louis, Missouri
Lead Photo Research Coordinator: Carrie K. Burger
Media Project Manager: Tammy Juran
Production Services/Compositor: RPK Editorial Services/PreTeX, Inc.
Typeface: 10.5/12 Times Roman
Printer: R.R. Donnelley
All credits appearing on this page or at the end of the book are considered to be an extension of the copyright page.
Library of Congress Cataloging-in-Publication Data
Rosen, Kenneth H.
Discrete mathematics and its applications / Kenneth H. Rosen. — 7th ed.
p. cm.
Includes index.
ISBN 0–07–338309–0
1. Mathematics. 2. Computer science—Mathematics. I. Title.
QA39.3.R67 2012
511–dc22
2011011060
www.mhhe.com
ii
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Contents
About the Author vi
Preface vii
The Companion Website xvi
To the Student xvii
1
The Foundations: Logic and Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
Propositional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Applications of Propositional Logic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Propositional Equivalences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Predicates and Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Nested Quantifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Rules of Inference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Introduction to Proofs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
Proof Methods and Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
2
Basic Structures: Sets, Functions, Sequences, Sums, and Matrices . 115
2.1
2.2
2.3
2.4
2.5
2.6
Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Set Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Sequences and Summations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
Cardinality of Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
Matrices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
3
Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
3.1
3.2
3.3
Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
The Growth of Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Complexity of Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
4
Number Theory and Cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
4.1
4.2
4.3
4.4
4.5
4.6
Divisibility and Modular Arithmetic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Integer Representations and Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 245
Primes and Greatest Common Divisors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Solving Congruences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Applications of Congruences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Cryptography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 294
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 306
iii
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
iv
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Contents
5
Induction and Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
5.1
5.2
5.3
5.4
5.5
Mathematical Induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 311
Strong Induction and Well-Ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
Recursive Definitions and Structural Induction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 344
Recursive Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
Program Correctness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
6
Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
6.1
6.2
6.3
6.4
6.5
6.6
The Basics of Counting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
The Pigeonhole Principle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
Permutations and Combinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
Binomial Coefficients and Identities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Generalized Permutations and Combinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 423
Generating Permutations and Combinations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 434
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
7
Discrete Probability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
7.1
7.2
7.3
7.4
An Introduction to Discrete Probability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 445
Probability Theory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 452
Bayes’ Theorem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
Expected Value and Variance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 477
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
8
Advanced Counting Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
8.1
8.2
8.3
8.4
8.5
8.6
Applications of Recurrence Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 501
Solving Linear Recurrence Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
Divide-and-Conquer Algorithms and Recurrence Relations . . . . . . . . . . . . . . . . . . . . . . . 527
Generating Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 537
Inclusion–Exclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 552
Applications of Inclusion–Exclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 558
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 565
9
Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
9.1
9.2
9.3
9.4
9.5
9.6
Relations and Their Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
n-ary Relations and Their Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
Representing Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 591
Closures of Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 597
Equivalence Relations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 607
Partial Orderings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Contents
v
10
Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
10.1
10.2
10.3
10.4
10.5
10.6
10.7
10.8
Graphs and Graph Models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
Graph Terminology and Special Types of Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 651
Representing Graphs and Graph Isomorphism . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 668
Connectivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 678
Euler and Hamilton Paths . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 693
Shortest-Path Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
Planar Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 718
Graph Coloring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 727
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 735
11
Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745
11.1
11.2
11.3
11.4
11.5
Introduction to Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 745
Applications of Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 757
Tree Traversal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 772
Spanning Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 785
Minimum Spanning Trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 803
12
Boolean Algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811
12.1
12.2
12.3
12.4
Boolean Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 811
Representing Boolean Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 819
Logic Gates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 822
Minimization of Circuits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 828
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 843
13
Modeling Computation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 847
13.1
13.2
13.3
13.4
13.5
Languages and Grammars . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 847
Finite-State Machines with Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 858
Finite-State Machines with No Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 865
Language Recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 878
Turing Machines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 888
End-of-Chapter Material . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 899
Appendixes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A-1
1
2
3
Axioms for the Real Numbers and the Positive Integers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Exponential and Logarithmic Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Pseudocode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Suggested Readings B-1
Answers to Odd-Numbered Exercises S-1
Photo Credits C-1
Index of Biographies I-1
Index I-2
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
About the Author
K
enneth H. Rosen has had a long career as a Distinguished Member of the Technical Staff
at AT&T Laboratories in Monmouth County, New Jersey. He currently holds the position
of Visiting Research Professor at Monmouth University, where he teaches graduate courses in
computer science.
Dr. Rosen received his B.S. in Mathematics from the University of Michigan, Ann Arbor
(1972), and his Ph.D. in Mathematics from M.I.T. (1976), where he wrote his thesis in the area
of number theory under the direction of Harold Stark. Before joining Bell Laboratories in 1982,
he held positions at the University of Colorado, Boulder; The Ohio State University, Columbus;
and the University of Maine, Orono, where he was an associate professor of mathematics.
While working at AT&T Labs, he taught at Monmouth University, teaching courses in discrete
mathematics, coding theory, and data security. He currently teaches courses in algorithm design
and in computer security and cryptography.
Dr. Rosen has published numerous articles in professional journals in number theory and
in mathematical modeling. He is the author of the widely used Elementary Number Theory and
Its Applications, published by Pearson, currently in its sixth edition, which has been translated
into Chinese. He is also the author of Discrete Mathematics and Its Applications, published by
McGraw-Hill, currently in its seventh edition. Discrete Mathematics and Its Applications has
sold more than 350,000 copies in North America during its lifetime, and hundreds of thousands
of copies throughout the rest of the world. This book has also been translated into Spanish,
French, Greek, Chinese, Vietnamese, and Korean. He is also co-author of UNIX: The Complete
Reference; UNIX System V Release 4: An Introduction; and Best UNIX Tips Ever, all published by
Osborne McGraw-Hill. These books have sold more than 150,000 copies, with translations into
Chinese, German, Spanish, and Italian. Dr. Rosen is also the editor of the Handbook of Discrete
and Combinatorial Mathematics, published by CRC Press, and he is the advisory editor of the
CRC series of books in discrete mathematics, consisting of more than 55 volumes on different
aspects of discrete mathematics, most of which are introduced in this book. Dr. Rosen serves as an
Associate Editor for the journal Discrete Mathematics, where he works with submitted papers in
several areas of discrete mathematics, including graph theory, enumeration, and number theory.
He is also interested in integrating mathematical software into the educational and professional
environments, and worked on several projects with Waterloo Maple Inc.’s MapleTM software
in both these areas. Dr. Rosen has also worked with several publishing companies on their
homework delivery platforms.
At Bell Laboratories and AT&T Laboratories, Dr. Rosen worked on a wide range of projects,
including operations research studies, product line planning for computers and data communications equipment, and technology assessment. He helped plan AT&T’s products and services in
the area of multimedia, including video communications, speech recognition, speech synthesis,
and image networking. He evaluated new technology for use by AT&T and did standards work
in the area of image networking. He also invented many new services, and holds more than 55
patents. One of his more interesting projects involved helping evaluate technology for the AT&T
attraction that was part of EPCOT Center.
vi
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Preface
I
n writing this book, I was guided by my long-standing experience and interest in teaching
discrete mathematics. For the student, my purpose was to present material in a precise,
readable manner, with the concepts and techniques of discrete mathematics clearly presented
and demonstrated. My goal was to show the relevance and practicality of discrete mathematics
to students, who are often skeptical. I wanted to give students studying computer science all of
the mathematical foundations they need for their future studies. I wanted to give mathematics
students an understanding of important mathematical concepts together with a sense of why
these concepts are important for applications. And most importantly, I wanted to accomplish
these goals without watering down the material.
For the instructor, my purpose was to design a flexible, comprehensive teaching tool using
proven pedagogical techniques in mathematics. I wanted to provide instructors with a package
of materials that they could use to teach discrete mathematics effectively and efficiently in the
most appropriate manner for their particular set of students. I hope that I have achieved these
goals.
I have been extremely gratified by the tremendous success of this text. The many improvements in the seventh edition have been made possible by the feedback and suggestions of a large
number of instructors and students at many of the more than 600 North American schools, and
at any many universities in parts of the world, where this book has been successfully used.
This text is designed for a one- or two-term introductory discrete mathematics course taken
by students in a wide variety of majors, including mathematics, computer science, and engineering. College algebra is the only explicit prerequisite, although a certain degree of mathematical
maturity is needed to study discrete mathematics in a meaningful way. This book has been designed to meet the needs of almost all types of introductory discrete mathematics courses. It is
highly flexible and extremely comprehensive. The book is designed not only to be a successful
textbook, but also to serve as valuable resource students can consult throughout their studies
and professional life.
Goals of a Discrete Mathematics Course
A discrete mathematics course has more than one purpose. Students should learn a particular
set of mathematical facts and how to apply them; more importantly, such a course should teach
students how to think logically and mathematically. To achieve these goals, this text stresses
mathematical reasoning and the different ways problems are solved. Five important themes
are interwoven in this text: mathematical reasoning, combinatorial analysis, discrete structures,
algorithmic thinking, and applications and modeling. A successful discrete mathematics course
should carefully blend and balance all five themes.
1. Mathematical Reasoning: Students must understand mathematical reasoning in order to
read, comprehend, and construct mathematical arguments. This text starts with a discussion
of mathematical logic, which serves as the foundation for the subsequent discussions of
methods of proof. Both the science and the art of constructing proofs are addressed. The
technique of mathematical induction is stressed through many different types of examples
of such proofs and a careful explanation of why mathematical induction is a valid proof
technique.
vii
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
viii
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Preface
2. Combinatorial Analysis: An important problem-solving skill is the ability to count or enumerate objects. The discussion of enumeration in this book begins with the basic techniques
of counting. The stress is on performing combinatorial analysis to solve counting problems
and analyze algorithms, not on applying formulae.
3. Discrete Structures: A course in discrete mathematics should teach students how to work
with discrete structures, which are the abstract mathematical structures used to represent
discrete objects and relationships between these objects. These discrete structures include
sets, permutations, relations, graphs, trees, and finite-state machines.
4. Algorithmic Thinking: Certain classes of problems are solved by the specification of an
algorithm. After an algorithm has been described, a computer program can be constructed
implementing it. The mathematical portions of this activity, which include the specification
of the algorithm, the verification that it works properly, and the analysis of the computer
memory and time required to perform it, are all covered in this text. Algorithms are described
using both English and an easily understood form of pseudocode.
5. Applications and Modeling: Discrete mathematics has applications to almost every conceivable area of study. There are many applications to computer science and data networking
in this text, as well as applications to such diverse areas as chemistry, biology, linguistics,
geography, business, and the Internet. These applications are natural and important uses of
discrete mathematics and are not contrived. Modeling with discrete mathematics is an extremely important problem-solving skill, which students have the opportunity to develop by
constructing their own models in some of the exercises.
Changes in the Seventh Edition
Although the sixth edition has been an extremely effective text, many instructors, including
longtime users, have requested changes designed to make this book more effective. I have
devoted a significant amount of time and energy to satisfy their requests and I have worked hard
to find my own ways to make the book more effective and more compelling to students.
The seventh edition is a major revision, with changes based on input from more than 40
formal reviewers, feedback from students and instructors, and author insights. The result is a
new edition that offers an improved organization of topics making the book a more effective
teaching tool. Substantial enhancements to the material devoted to logic, algorithms, number
theory, and graph theory make this book more flexible and comprehensive. Numerous changes
in the seventh edition have been designed to help students more easily learn the material.
Additional explanations and examples have been added to clarify material where students often
have difficulty. New exercises, both routine and challenging, have been added. Highly relevant
applications, including many related to the Internet, to computer science, and to mathematical
biology, have been added. The companion website has benefited from extensive development
activity and now provides tools students can use to master key concepts and explore the world
of discrete mathematics, and many new tools under development will be released in the year
following publication of this book.
I hope that instructors will closely examine this new edition to discover how it might meet
their needs. Although it is impractical to list all the changes in this edition, a brief list that
highlights some key changes, listed by the benefits they provide, may be useful.
More Flexible Organization
Applications of propositional logic are found in a new dedicated section, which briefly
introduces logic circuits.
Recurrence relations are now covered in Chapter 2.
Expanded coverage of countability is now found in a dedicated section in Chapter 2.
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Preface
ix
Separate chapters now provide expanded coverage of algorithms (Chapter 3) and number
theory and cryptography (Chapter 4).
More second and third level heads have been used to break sections into smaller coherent
parts.
Tools for Easier Learning
Difficult discussions and proofs have been marked with the famous Bourbaki “dangerous
bend” symbol in the margin.
New marginal notes make connections, add interesting notes, and provide advice to
students.
More details and added explanations, in both proofs and exposition, make it easier for
students to read the book.
Many new exercises, both routine and challenging, have been added, while many existing exercises have been improved.
Enhanced Coverage of Logic, Sets, and Proof
The satisfiability problem is addressed in greater depth, with Sudoku modeled in terms
of satisfiability.
Hilbert’s Grand Hotel is used to help explain uncountability.
Proofs throughout the book have been made more accessible by adding steps and reasons
behind these steps.
A template for proofs by mathematical induction has been added.
The step that applies the inductive hypothesis in mathematical induction proof is now
explicitly noted.
Algorithms
The pseudocode used in the book has been updated.
Explicit coverage of algorithmic paradigms, including brute force, greedy algorithms,
and dynamic programing, is now provided.
Useful rules for big-O estimates of logarithms, powers, and exponential functions have
been added.
Number Theory and Cryptography
Expanded coverage allows instructors to include just a little or a lot of number theory
in their courses.
The relationship between the mod function and congruences has been explained more
fully.
The sieve of Eratosthenes is now introduced earlier in the book.
Linear congruences and modular inverses are now covered in more detail.
Applications of number theory, including check digits and hash functions, are covered
in great depth.
A new section on cryptography integrates previous coverage, and the notion of a cryptosystem has been introduced.
Cryptographic protocols, including digital signatures and key sharing, are now covered.
P1: 1/1
P2: 1/2
FRONT-7T
QC: 1/1
Rosen-2311T
x
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Preface
Graph Theory
A structured introduction to graph theory applications has been added.
More coverage has been devoted to the notion of social networks.
Applications to the biological sciences and motivating applications for graph isomorphism and planarity have been added.
Matchings in bipartite graphs are now covered, including Hall’s theorem and its proof.
Coverage of vertex connectivity, edge connectivity, and n-connectedness has been
added, providing more insight into the connectedness of graphs.
Enrichment Material
Many biographies have been expanded and updated, and new biographies of Bellman,
Bézout Bienyamé, Cardano, Catalan, Cocks, Cook, Dirac, Hall, Hilbert, Ore, and Tao
have been added.
Historical information has been added throughout the text.
Numerous updates for latest discoveries have been made.
Expanded Media
Extensive effort has been devoted to producing valuable web resources for this book.
Extra examples in key parts of the text have been provided on companion website.
Interactive algorithms have been developed, with tools for using them to explore topics
and for classroom use.
A new online ancillary, The Virtual Discrete Mathematics Tutor, available in fall 2012,
will help students overcome problems learning discrete mathematics.
A new homework delivery system, available in fall 2012, will provide automated homework for both numerical and conceptual exercises.
Student assessment modules are available for key concepts.
Powerpoint transparencies for instructor use have been developed.
A supplement Exploring Discrete Mathematics has been developed, providing extensive
support for using MapleTM or MathematicaTM in conjunction with the book.
An extensive collection of external web links is provided.
Features of the Book
ACCESSIBILITY
This text has proved to be easily read and understood by beginning
students. There are no mathematical prerequisites beyond college algebra for almost all the
content of the text. Students needing extra help will find tools on the companion website for
bringing their mathematical maturity up to the level of the text. The few places in the book
where calculus is referred to are explicitly noted. Most students should easily understand the
pseudocode used in the text to express algorithms, regardless of whether they have formally
studied programming languages. There is no formal computer science prerequisite.
Each chapter begins at an easily understood and accessible level. Once basic mathematical
concepts have been carefully developed, more difficult material and applications to other areas
of study are presented.
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Preface
xi
FLEXIBILITY
This text has been carefully designed for flexible use. The dependence
of chapters on previous material has been minimized. Each chapter is divided into sections of
approximately the same length, and each section is divided into subsections that form natural
blocks of material for teaching. Instructors can easily pace their lectures using these blocks.
WRITING STYLE
The writing style in this book is direct and pragmatic. Precise mathematical language is used without excessive formalism and abstraction. Care has been taken to
balance the mix of notation and words in mathematical statements.
MATHEMATICAL RIGOR AND PRECISION
All definitions and theorems in this text
are stated extremely carefully so that students will appreciate the precision of language and
rigor needed in mathematics. Proofs are motivated and developed slowly; their steps are all
carefully justified. The axioms used in proofs and the basic properties that follow from them
are explicitly described in an appendix, giving students a clear idea of what they can assume in
a proof. Recursive definitions are explained and used extensively.
WORKED EXAMPLES
Over 800 examples are used to illustrate concepts, relate different
topics, and introduce applications. In most examples, a question is first posed, then its solution
is presented with the appropriate amount of detail.
APPLICATIONS
The applications included in this text demonstrate the utility of discrete
mathematics in the solution of real-world problems. This text includes applications to a wide variety of areas, including computer science, data networking, psychology, chemistry, engineering,
linguistics, biology, business, and the Internet.
ALGORITHMS
Results in discrete mathematics are often expressed in terms of algorithms; hence, key algorithms are introduced in each chapter of the book. These algorithms
are expressed in words and in an easily understood form of structured pseudocode, which is
described and specified in Appendix 3. The computational complexity of the algorithms in the
text is also analyzed at an elementary level.
HISTORICAL INFORMATION
The background of many topics is succinctly described
in the text. Brief biographies of 83 mathematicians and computer scientists are included as footnotes. These biographies include information about the lives, careers, and accomplishments of
these important contributors to discrete mathematics and images, when available, are displayed.
In addition, numerous historical footnotes are included that supplement the historical information in the main body of the text. Efforts have been made to keep the book up-to-date by
reflecting the latest discoveries.
KEY TERMS AND RESULTS
A list of key terms and results follows each chapter. The
key terms include only the most important that students should learn, and not every term defined
in the chapter.
EXERCISES
There are over 4000 exercises in the text, with many different types of
questions posed. There is an ample supply of straightforward exercises that develop basic skills,
a large number of intermediate exercises, and many challenging exercises. Exercises are stated
clearly and unambiguously, and all are carefully graded for level of difficulty. Exercise sets
contain special discussions that develop new concepts not covered in the text, enabling students
to discover new ideas through their own work.
Exercises that are somewhat more difficult than average are marked with a single star ∗ ;
those that are much more challenging are marked with two stars ∗∗ . Exercises whose solutions
require calculus are explicitly noted. Exercises that develop results used in the text are clearly
. Answers or outlined solutions to all oddidentified with the right pointing hand symbol
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
xii
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Preface
numbered exercises are provided at the back of the text. The solutions include proofs in which
most of the steps are clearly spelled out.
REVIEW QUESTIONS
A set of review questions is provided at the end of each chapter.
These questions are designed to help students focus their study on the most important concepts
and techniques of that chapter. To answer these questions students need to write long answers,
rather than just perform calculations or give short replies.
SUPPLEMENTARY EXERCISE SETS
Each chapter is followed by a rich and varied
set of supplementary exercises. These exercises are generally more difficult than those in the
exercise sets following the sections. The supplementary exercises reinforce the concepts of the
chapter and integrate different topics more effectively.
COMPUTER PROJECTS
Each chapter is followed by a set of computer projects. The
approximately 150 computer projects tie together what students may have learned in computing
and in discrete mathematics. Computer projects that are more difficult than average, from both
a mathematical and a programming point of view, are marked with a star, and those that are
extremely challenging are marked with two stars.
COMPUTATIONS AND EXPLORATIONS
A set of computations and explorations is
included at the conclusion of each chapter. These exercises (approximately 120 in total) are designed to be completed using existing software tools, such as programs that students or instructors have written or mathematical computation packages such as MapleTM or MathematicaTM .
Many of these exercises give students the opportunity to uncover new facts and ideas through
computation. (Some of these exercises are discussed in the Exploring Discrete Mathematics
companion workbooks available online.)
WRITING PROJECTS
Each chapter is followed by a set of writing projects. To do these
projects students need to consult the mathematical literature. Some of these projects are historical
in nature and may involve looking up original sources. Others are designed to serve as gateways
to new topics and ideas. All are designed to expose students to ideas not covered in depth in
the text. These projects tie mathematical concepts together with the writing process and help
expose students to possible areas for future study. (Suggested references for these projects can
be found online or in the printed Student’s Solutions Guide.)
APPENDIXES
There are three appendixes to the text. The first introduces axioms for real
numbers and the positive integers, and illustrates how facts are proved directly from these axioms.
The second covers exponential and logarithmic functions, reviewing some basic material used
heavily in the course. The third specifies the pseudocode used to describe algorithms in this text.
SUGGESTED READINGS
A list of suggested readings for the overall book and for each
chapter is provided after the appendices. These suggested readings include books at or below
the level of this text, more difficult books, expository articles, and articles in which discoveries
in discrete mathematics were originally published. Some of these publications are classics,
published many years ago, while others have been published in the last few years.
How to Use This Book
This text has been carefully written and constructed to support discrete mathematics courses
at several levels and with differing foci. The following table identifies the core and optional
sections. An introductory one-term course in discrete mathematics at the sophomore level can
be based on the core sections of the text, with other sections covered at the discretion of the
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Preface
xiii
instructor. A two-term introductory course can include all the optional mathematics sections in
addition to the core sections. A course with a strong computer science emphasis can be taught
by covering some or all of the optional computer science sections. Instructors can find sample
syllabi for a wide range of discrete mathematics courses and teaching suggestions for using each
section of the text can be found in the Instructor’s Resource Guide available on the website for
this book.
Chapter
Core
1
2
3
4
5
6
7
8
9
10
11
12
13
1.1–1.8 (as needed)
2.1–2.4, 2.6 (as needed)
4.1–4.4 (as needed)
5.1–5.3
6.1–6.3
7.1
8.1, 8.5
9.1, 9.3, 9.5
10.1–10.5
11.1
Optional CS
Optional Math
2.5
3.1–3.3 (as needed)
4.5, 4.6
5.4, 5.5
6.6
7.4
8.3
9.2
11.2, 11.3
12.1–12.4
13.1–13.5
6.4, 6.5
7.2, 7.3
8.2, 8.4, 8.6
9.4, 9.6
10.6–10.8
11.4, 11.5
Instructors using this book can adjust the level of difficulty of their course by choosing
either to cover or to omit the more challenging examples at the end of sections, as well as
the more challenging exercises. The chapter dependency chart shown here displays the strong
dependencies. A star indicates that only relevant sections of the chapter are needed for study of a
later chapter. Weak dependencies have been ignored. More details can be found in the Instructor
Resource Guide.
Chapter 1
Chapter 2*
Chapter 12
Chapter 3*
Chapter 9*
Chapter 4*
Chapter 10*
Chapter 11
Chapter 13
Chapter 5*
Chapter 6*
Chapter 7
Chapter 8
Ancillaries
STUDENT’S SOLUTIONS GUIDE
This student manual, available separately, contains
full solutions to all odd-numbered problems in the exercise sets. These solutions explain why
a particular method is used and why it works. For some exercises, one or two other possible
approaches are described to show that a problem can be solved in several different ways. Suggested references for the writing projects found at the end of each chapter are also included in
this volume. Also included are a guide to writing proofs and an extensive description of common
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
xiv
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Preface
mistakes students make in discrete mathematics, plus sample tests and a sample crib sheet for
each chapter designed to help students prepare for exams.
(ISBN-10: 0-07-735350-1)
(ISBN-13: 978-0-07-735350-6)
INSTRUCTOR’S RESOURCE GUIDE
This manual, available on the website and in
printed form by request for instructors, contains full solutions to even-numbered exercises in
the text. Suggestions on how to teach the material in each chapter of the book are provided,
including the points to stress in each section and how to put the material into perspective. It
also offers sample tests for each chapter and a test bank containing over 1500 exam questions to
choose from. Answers to all sample tests and test bank questions are included. Finally, several
sample syllabi are presented for courses with differing emphases and student ability levels.
(ISBN-10: 0-07-735349-8)
(ISBN-13: 978-0-07-735349-0)
Acknowledgments
I would like to thank the many instructors and students at a variety of schools who have used
this book and provided me with their valuable feedback and helpful suggestions. Their input
has made this a much better book than it would have been otherwise. I especially want to thank
Jerrold Grossman, Jean-Claude Evard, and Georgia Mederer for their technical reviews of the
seventh edition and their “eagle eyes,” which have helped ensure the accuracy of this book. I
also appreciate the help provided by all those who have submitted comments via the website.
I thank the reviewers of this seventh and the six previous editions. These reviewers have
provided much helpful criticism and encouragement to me. I hope this edition lives up to their
high expectations.
Reviewers for the Seventh Edition
Philip Barry
University of Minnesota, Minneapolis
Miklos Bona
University of Florida
Kirby Brown
Queens College
John Carter
University of Toronto
Narendra Chaudhari
Nanyang Technological University
Allan Cochran
University of Arkansas
Daniel Cunningham
Buffalo State College
George Davis
Georgia State University
Andrzej Derdzinski
The Ohio State University
Ronald Dotzel
University of Missouri-St. Louis
T.J. Duda
Columbus State Community College
Bruce Elenbogen
University of Michigan, Dearborn
Norma Elias
Purdue University,
Calumet-Hammond
Herbert Enderton
University of California, Los Angeles
Anthony Evans
Wright State University
Kim Factor
Marquette University
Margaret Fleck
University of Illinois, Champaign
Peter Gillespie
Fayetteville State University
Johannes Hattingh
Georgia State University
Ken Holladay
University of New Orleans
Jerry Ianni
LaGuardia Community College
Ravi Janardan
University of Minnesota, Minneapolis
Norliza Katuk
University of Utara Malaysia
William Klostermeyer
University of North Florida
Przemo Kranz
University of Mississippi
Jaromy Kuhl
University of West Florida
Loredana Lanzani
University of Arkansas, Fayetteville
Steven Leonhardi
Winona State University
Xu Liutong
Beijing University of Posts and
Telecommunications
Vladimir Logvinenko
De Anza Community College
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
Preface
Darrell Minor
Chris Rodger
Columbus State Community College
Keith Olson
Auburn University
Sukhit Singh
Utah Valley University
Texas State University, San Marcos
Yongyuth Permpoontanalarp
King Mongkut’s University of
Technology, Thonburi
Galin Piatniskaia
David Snyder
Texas State University, San Marcos
Wasin So
University of Missouri, St. Louis
Stefan Robila
San Jose State University
Bogdan Suceava
Montclair State University
California State University, Fullerton
xv
Christopher Swanson
Ashland University
Bon Sy
Queens College
Matthew Walsh
Indiana-Purdue University, Fort
Wayne
Gideon Weinstein
Western Governors University
David Wilczynski
University of Southern California
I would like to thank Bill Stenquist, Executive Editor, for his advocacy, enthusiasm, and
support. His assistance with this edition has been essential. I would also like to thank the original
editor, Wayne Yuhasz, whose insights and skills helped ensure the book’s success, as well as all
the many other previous editors of this book.
I want to express my appreciation to the staff of RPK Editorial Services for their valuable
work on this edition, including Rose Kernan, who served as both the developmental editor and
the production editor, and the other members of the RPK team, Fred Dahl, Martha McMaster,
Erin Wagner, Harlan James, and Shelly Gerger-Knecthl. I thank Paul Mailhot of PreTeX, Inc.,
the compositor, for the tremendous amount to work he devoted to producing this edition, and
for his intimate knowledge of LaTeX. Thanks also to Danny Meldung of Photo Affairs, Inc.,
who was resourceful obtaining images for the new biographical footnotes.
The accuracy and quality of this new edition owe much to Jerry Grossman and Jean-Claude
Evard, who checked the entire manuscript for technical accuracy and Georgia Mederer, who
checked the accuracy of the answers at the end of the book and the solutions in the Student’s
Solutions Guide and Instructor’s Resource Guide. As usual, I cannot thank Jerry Grossman
enough for all his work authoring these two essential ancillaries.
I would also express my appreciation the Science, Engineering, and Mathematics (SEM)
Division of McGraw-Hill Higher Education for their valuable support for this new edition and
the associated media content. In particular, thanks go to Kurt Strand: President, SEM, McGrawHill Higher Education, Marty Lange: Editor-in-Chief, SEM, Michael Lange: Editorial Director,
Raghothaman Srinivasan: Global Publisher, Bill Stenquist: Executive Editor, Curt Reynolds:
Executive Marketing Manager, Robin A. Reed: Project Manager, Sandy Ludovissey: Buyer,
Lorraine Buczek: In-house Developmental Editor, Brenda Rowles: Design Coordinator, Carrie
K. Burger: Lead Photo Research Coordinator, and Tammy Juran: Media Project Manager.
Kenneth H. Rosen
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
The Companion Website
T
he extensive companion website accompanying this text has been substantially enhanced
for the seventh edition This website is accessible at www.mhhe.com/rosen. The homepage
shows the Information Center, and contains login links for the site’s Student Site and Instructor
Site. Key features of each area are described below:
THE INFORMATION CENTER
The Information Center contains basic information about the book including the expanded
table of contents (including subsection heads), the preface, descriptions of the ancillaries, and
a sample chapter. It also provides a link that can be used to submit errata reports and other
feedback about the book.
STUDENT SITE
The Student site contains a wealth of resources available for student use, including the
following, tied into the text wherever the special icons displayed below are found in the text:
Extra Examples You can find a large number of additional examples on the site, covering
all chapters of the book. These examples are concentrated in areas where students often
ask for additional material. Although most of these examples amplify the basic concepts,
more-challenging examples can also be found here.
Interactive Demonstration Applets These applets enable you to interactively explore
how important algorithms work, and are tied directly to material in the text with linkages to
examples and exercises. Additional resources are provided on how to use and apply these
applets.
Self Assessments These interactive guides help you assess your understanding of 14 key
concepts, providing a question bank where each question includes a brief tutorial followed
by a multiple-choice question. If you select an incorrect answer, advice is provided to help
you understand your error. Using these Self Assessments, you should be able to diagnose
your problems and find appropriate help.
Web Resources Guide This guide provides annotated links to hundreds of external websites
containing relevant material such as historical and biographical information, puzzles and
problems, discussions, applets, programs, and more. These links are keyed to the text by page
number.
Additional resources in the Student site include:
xvi
Exploring Discrete Mathematics This ancillary provides help for using a computer algebra system to do a wide range of computations in discrete mathematics. Each chapter provides
a description of relevant functions in the computer algebra system and how they are used, programs to carry out computations in discrete mathematics, examples, and exercises that can be
worked using this computer algebra system. Two versions, Exploring Discrete Mathematics
with MapleTM and Exploring Discrete Mathematics with MathematicaTM will be available.
Applications of Discrete Mathematics This ancillary contains 24 chapters—each with
its own set of exercises—presenting a wide variety of interesting and important applications
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
The Companion Website
xvii
covering three general areas in discrete mathematics: discrete structures, combinatorics, and
graph theory. These applications are ideal for supplementing the text or for independent study.
A Guide to Proof-Writing This guide provides additional help for writing proofs, a skill
that many students find difficult to master. By reading this guide at the beginning of the
course and periodically thereafter when proof writing is required, you will be rewarded as
your proof-writing ability grows. (Also available in the Student’s Solutions Guide.)
Common Mistakes in Discrete Mathematics This guide includes a detailed list of common misconceptions that students of discrete mathematics often have and the kinds of errors
they tend to make. You are encouraged to review this list from time to time to help avoid these
common traps. (Also available in the Student’s Solutions Guide.)
Advice on Writing Projects This guide offers helpful hints and suggestions for the Writing
Projects in the text, including an extensive bibliography of helpful books and articles for
research; discussion of various resources available in print and online; tips on doing library
research; and suggestions on how to write well. (Also available in the Student’s Solutions
Guide.)
The Virtual Discrete Mathematics Tutor This extensive ancillary provides students with
valuable assistance as they make the transition from lower-level courses to discrete mathematics. The errors students have made when studying discrete mathematics using this text has been
analyzed to design this resource. Students will be able to get many of their questions answered
and can overcome many obstacles via this ancillaries. The Virtual Discrete Mathematics Tutor
is expected to be available in the fall of 2012.
INSTRUCTOR SITE
This part of the website provides access to all of the resources on the Student Site, as well as
these resources for instructors:
Suggested Syllabi Detailed course outlines are shown, offering suggestions for courses
with different emphases and different student backgrounds and ability levels.
Teaching Suggestions This guide contains detailed teaching suggestions for instructors,
including chapter overviews for the entire text, detailed remarks on each section, and comments
on the exercise sets.
Printable Tests Printable tests are offered in TeX and Word format for every chapter, and
can be customized by instructors.
PowerPoints Lecture Slides and PowerPoint Figures and Tables An extensive collection
of PowerPoint slides for all chapters of the text are provided for instructor use. In addition,
images of all figures and tables from the text are provided as PowerPoint slides.
Homework Delivery System An extensive homework delivery system, under development
for availability in fall 2012, will provide questions tied directly to the text, so that students
will be able to do assignments on-line. Moreover, they will be able to use this system in a
tutorial mode. This system will be able to automatically grade assignments, and deliver freeform student input to instructors for their own analysis. Course management capabilities will
be provided that will allow instructors to create assignments, automatically assign and grade
homework, quiz, and test questions from a bank of questions tied directly to the text, create
and edit their own questions, manage course announcements and due dates, and track student
progress.
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
To the Student
W
hat is discrete mathematics? Discrete mathematics is the part of mathematics devoted to
the study of discrete objects. (Here discrete means consisting of distinct or unconnected
elements.) The kinds of problems solved using discrete mathematics include:
How many ways are there to choose a valid password on a computer system?
What is the probability of winning a lottery?
Is there a link between two computers in a network?
How can I identify spam e-mail messages?
How can I encrypt a message so that no unintended recipient can read it?
What is the shortest path between two cities using a transportation system?
How can a list of integers be sorted so that the integers are in increasing order?
How many steps are required to do such a sorting?
How can it be proved that a sorting algorithm correctly sorts a list?
How can a circuit that adds two integers be designed?
How many valid Internet addresses are there?
You will learn the discrete structures and techniques needed to solve problems such as these.
More generally, discrete mathematics is used whenever objects are counted, when relationships between finite (or countable) sets are studied, and when processes involving a finite number
of steps are analyzed. A key reason for the growth in the importance of discrete mathematics is
that information is stored and manipulated by computing machines in a discrete fashion.
WHY STUDY DISCRETE MATHEMATICS?
There are several important reasons for
studying discrete mathematics. First, through this course you can develop your mathematical
maturity: that is, your ability to understand and create mathematical arguments. You will not get
very far in your studies in the mathematical sciences without these skills.
Second, discrete mathematics is the gateway to more advanced courses in all parts of
the mathematical sciences. Discrete mathematics provides the mathematical foundations for
many computer science courses including data structures, algorithms, database theory, automata
theory, formal languages, compiler theory, computer security, and operating systems. Students
find these courses much more difficult when they have not had the appropriate mathematical
foundations from discrete math. One student has sent me an e-mail message saying that she
used the contents of this book in every computer science course she took!
Math courses based on the material studied in discrete mathematics include logic, set theory,
number theory, linear algebra, abstract algebra, combinatorics, graph theory, and probability
theory (the discrete part of the subject).
Also, discrete mathematics contains the necessary mathematical background for solving
problems in operations research (including many discrete optimization techniques), chemistry,
engineering, biology, and so on. In the text, we will study applications to some of these areas.
Many students find their introductory discrete mathematics course to be significantly more
challenging than courses they have previously taken. One reason for this is that one of the
primary goals of this course is to teach mathematical reasoning and problem solving, rather
than a discrete set of skills. The exercises in this book are designed to reflect this goal. Although
there are plenty of exercises in this text similar to those addressed in the examples, a large
xviii
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
To the Student
xix
percentage of the exercises require original thought. This is intentional. The material discussed
in the text provides the tools needed to solve these exercises, but your job is to successfully
apply these tools using your own creativity. One of the primary goals of this course is to learn
how to attack problems that may be somewhat different from any you may have previously
seen. Unfortunately, learning how to solve only particular types of exercises is not sufficient for
success in developing the problem-solving skills needed in subsequent courses and professional
work. This text addresses many different topics, but discrete mathematics is an extremely diverse
and large area of study. One of my goals as an author is to help you develop the skills needed
to master the additional material you will need in your own future pursuits.
THE EXERCISES
I would like to offer some advice about how you can best learn discrete
mathematics (and other subjects in the mathematical and computing sciences).You will learn the
most by actively working exercises. I suggest that you solve as many as you possibly can. After
working the exercises your instructor has assigned, I encourage you to solve additional exercises
such as those in the exercise sets following each section of the text and in the supplementary
exercises at the end of each chapter. (Note the key explaining the markings preceding exercises.)
Key to the Exercises
no marking
∗
∗∗
(Requires calculus )
A routine exercise
A difficult exercise
An extremely challenging exercise
An exercise containing a result used in the book (Table 1 on the
following page shows where these exercises are used.)
An exercise whose solution requires the use of limits or concepts
from differential or integral calculus
The best approach is to try exercises yourself before you consult the answer section at the
end of this book. Note that the odd-numbered exercise answers provided in the text are answers
only and not full solutions; in particular, the reasoning required to obtain answers is omitted in
these answers. The Student’s Solutions Guide, available separately, provides complete, worked
solutions to all odd-numbered exercises in this text. When you hit an impasse trying to solve an
odd-numbered exercise, I suggest you consult the Student’s Solutions Guide and look for some
guidance as to how to solve the problem. The more work you do yourself rather than passively
reading or copying solutions, the more you will learn. The answers and solutions to the evennumbered exercises are intentionally not available from the publisher; ask your instructor if you
have trouble with these.
WEB RESOURCES
You are strongly encouraged to take advantage of additional resources available on the Web, especially those on the companion website for this book found
at www.mhhe.com/rosen. You will find many Extra Examples designed to clarify key concepts;
Self Assessments for gauging how well you understand core topics; Interactive Demonstration
Applets exploring key algorithms and other concepts; a Web Resources Guide containing an
extensive selection of links to external sites relevant to the world of discrete mathematics; extra
explanations and practice to help you master core concepts; added instruction on writing proofs
and on avoiding common mistakes in discrete mathematics; in-depth discussions of important
applications; and guidance on utilizing MapleTM software to explore the computational aspects
of discrete mathematics. Places in the text where these additional online resources are available
are identified in the margins by special icons. You will also find (after fall 2012) the Virtual
Discrete Mathematics Tutor, an on-line resource that provides extra support to help you make
the transition from lower level courses to discrete mathematics. This tutorial should help answer
many of your questions and correct errors that you may make, based on errors other students
using this book, have made. For more details on these and other online resources, see the
description of the companion website immediately preceding this “To the Student” message.
P1: 1/1
FRONT-7T
P2: 1/2
QC: 1/1
Rosen-2311T
xx
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
10:21
To the Student
TABLE 1 Hand-Icon Exercises and Where They Are Used
Section
Exercise
Section Where Used
Pages Where Used
1.1
40
1.3
31
1.1
41
1.3
31
1.3
9
1.6
71
1.3
10
1.6
70, 71
1.3
15
1.6
71
1.3
30
1.6
71, 74
1.3
42
12.2
820
1.7
16
1.7
86
2.3
72
2.3
144
2.3
79
2.5
170
2.5
15
2.5
174
2.5
16
2.5
173
3.1
43
3.1
197
3.2
72
11.2
761
4.2
36
4.2
270
4.3
37
4.1
239
4.4
2
4.6
301
4.4
44
7.2
464
6.4
17
7.2
466
6.4
21
7.4
480
7.2
15
7.2
466
9.1
26
9.4
598
10.4
59
11.1
747
11.1
15
11.1
750
11.1
30
11.1
755
11.1
48
11.2
762
12.1
12
12.3
825
A.2
4
8.3
531
THE VALUE OF THIS BOOK
My intention is to make your substantial investment in
this text an excellent value. The book, the associated ancillaries, and companion website have
taken many years of effort to develop and refine. I am confident that most of you will find that
the text and associated materials will help you master discrete mathematics, just as so many
previous students have. Even though it is likely that you will not cover some chapters in your
current course, you should find it helpful—as many other students have—to read the relevant
sections of the book as you take additional courses. Most of you will return to this book as a
useful tool throughout your future studies, especially for those of you who continue in computer
science, mathematics, and engineering. I have designed this book to be a gateway for future
studies and explorations, and to be comprehensive reference, and I wish you luck as you begin
your journey.
Kenneth H. Rosen
P1: 1/1
CH01-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
15:27
C H A P T E R
1
1.1 Propositional
Logic
1.2 Applications of
Propositional
Logic
1.3 Propositional
Equivalences
1.4 Predicates and
Quantifiers
1.5 Nested
Quantifiers
1.6 Rules of
Inference
1.7 Introduction to
Proofs
1.8 Proof Methods
and Strategy
1.1
The Foundations:
Logic and Proofs
T
he rules of logic specify the meaning of mathematical statements. For instance, these rules
help us understand and reason with statements such as “There exists an integer that is
not the sum of two squares” and “For every positive integer n, the sum of the positive integers
not exceeding n is n(n + 1)/2.” Logic is the basis of all mathematical reasoning, and of all
automated reasoning. It has practical applications to the design of computing machines, to the
specification of systems, to artificial intelligence, to computer programming, to programming
languages, and to other areas of computer science, as well as to many other fields of study.
To understand mathematics, we must understand what makes up a correct mathematical
argument, that is, a proof. Once we prove a mathematical statement is true, we call it a theorem. A
collection of theorems on a topic organize what we know about this topic. To learn a mathematical
topic, a person needs to actively construct mathematical arguments on this topic, and not just
read exposition. Moreover, knowing the proof of a theorem often makes it possible to modify
the result to fit new situations.
Everyone knows that proofs are important throughout mathematics, but many people find
it surprising how important proofs are in computer science. In fact, proofs are used to verify
that computer programs produce the correct output for all possible input values, to show that
algorithms always produce the correct result, to establish the security of a system, and to create
artificial intelligence. Furthermore, automated reasoning systems have been created to allow
computers to construct their own proofs.
In this chapter, we will explain what makes up a correct mathematical argument and introduce tools to construct these arguments. We will develop an arsenal of different proof methods
that will enable us to prove many different types of results. After introducing many different
methods of proof, we will introduce several strategies for constructing proofs. We will introduce the notion of a conjecture and explain the process of developing mathematics by studying
conjectures.
Propositional Logic
Introduction
The rules of logic give precise meaning to mathematical statements. These rules are used to
distinguish between valid and invalid mathematical arguments. Because a major goal of this book
is to teach the reader how to understand and how to construct correct mathematical arguments,
we begin our study of discrete mathematics with an introduction to logic.
Besides the importance of logic in understanding mathematical reasoning, logic has numerous applications to computer science. These rules are used in the design of computer circuits,
the construction of computer programs, the verification of the correctness of programs, and in
many other ways. Furthermore, software systems have been developed for constructing some,
but not all, types of proofs automatically. We will discuss these applications of logic in this and
later chapters.
1
P2: 1/2
QC: 1/1
Rosen-2311T
2
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
15:27
1 / The Foundations: Logic and Proofs
Propositions
Our discussion begins with an introduction to the basic building blocks of logic—propositions.
A proposition is a declarative sentence (that is, a sentence that declares a fact) that is either true
or false, but not both.
EXAMPLE 1
All the following declarative sentences are propositions.
1.
2.
3.
4.
Washington, D.C., is the capital of the United States of America.
Toronto is the capital of Canada.
1 + 1 = 2.
2 + 2 = 3.
Propositions 1 and 3 are true, whereas 2 and 4 are false.
▲
CH01-7T
Some sentences that are not propositions are given in Example 2.
EXAMPLE 2
Consider the following sentences.
1.
2.
3.
4.
What time is it?
Read this carefully.
x + 1 = 2.
x + y = z.
Sentences 1 and 2 are not propositions because they are not declarative sentences. Sentences 3
and 4 are not propositions because they are neither true nor false. Note that each of sentences 3
and 4 can be turned into a proposition if we assign values to the variables. We will also discuss
other ways to turn sentences such as these into propositions in Section 1.4.
▲
P1: 1/1
We use letters to denote propositional variables (or statement variables), that is, variables that represent propositions, just as letters are used to denote numerical variables. The
ARISTOTLE (384 b.c.e.–322 b.c.e.) Aristotle was born in Stagirus (Stagira) in northern Greece. His father was
the personal physician of the King of Macedonia. Because his father died when Aristotle was young, Aristotle
could not follow the custom of following his father’s profession. Aristotle became an orphan at a young age
when his mother also died. His guardian who raised him taught him poetry, rhetoric, and Greek. At the age of
17, his guardian sent him to Athens to further his education. Aristotle joined Plato’s Academy, where for 20
years he attended Plato’s lectures, later presenting his own lectures on rhetoric. When Plato died in 347 B.C.E.,
Aristotle was not chosen to succeed him because his views differed too much from those of Plato. Instead,
Aristotle joined the court of King Hermeas where he remained for three years, and married the niece of the
King. When the Persians defeated Hermeas, Aristotle moved to Mytilene and, at the invitation of King Philip
of Macedonia, he tutored Alexander, Philip’s son, who later became Alexander the Great. Aristotle tutored Alexander for five years
and after the death of King Philip, he returned to Athens and set up his own school, called the Lyceum.
Aristotle’s followers were called the peripatetics, which means “to walk about,” because Aristotle often walked around as he
discussed philosophical questions. Aristotle taught at the Lyceum for 13 years where he lectured to his advanced students in the
morning and gave popular lectures to a broad audience in the evening. When Alexander the Great died in 323 B.C.E., a backlash against
anything related to Alexander led to trumped-up charges of impiety against Aristotle. Aristotle fled to Chalcis to avoid prosecution.
He only lived one year in Chalcis, dying of a stomach ailment in 322 B.C.E.
Aristotle wrote three types of works: those written for a popular audience, compilations of scientific facts, and systematic
treatises. The systematic treatises included works on logic, philosophy, psychology, physics, and natural history. Aristotle’s writings
were preserved by a student and were hidden in a vault where a wealthy book collector discovered them about 200 years later. They
were taken to Rome, where they were studied by scholars and issued in new editions, preserving them for posterity.
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
15:27
1.1 Propositional Logic
3
conventional letters used for propositional variables are p, q, r, s, . . . . The truth value of a
proposition is true, denoted by T, if it is a true proposition, and the truth value of a proposition
is false, denoted by F, if it is a false proposition.
The area of logic that deals with propositions is called the propositional calculus or propositional logic. It was first developed systematically by the Greek philosopher Aristotle more
than 2300 years ago.
We now turn our attention to methods for producing new propositions from those that
we already have. These methods were discussed by the English mathematician George Boole
in 1854 in his book The Laws of Thought. Many mathematical statements are constructed by
combining one or more propositions. New propositions, called compound propositions, are
formed from existing propositions using logical operators.
DEFINITION 1
Let p be a proposition. The negation of p, denoted by ¬p (also denoted by p), is the statement
“It is not the case that p.”
The proposition ¬p is read “not p.” The truth value of the negation of p, ¬p, is the opposite
of the truth value of p.
EXAMPLE 3
Find the negation of the proposition
“Michael’s PC runs Linux”
and express this in simple English.
Solution: The negation is
“It is not the case that Michael’s PC runs Linux.”
This negation can be more simply expressed as
“Michael’s PC does not run Linux.”
EXAMPLE 4
▲
CH01-7T
Find the negation of the proposition
“Vandana’s smartphone has at least 32GB of memory”
and express this in simple English.
Solution: The negation is
“It is not the case that Vandana’s smartphone has at least 32GB of memory.”
This negation can also be expressed as
“Vandana’s smartphone does not have at least 32GB of memory”
or even more simply as
“Vandana’s smartphone has less than 32GB of memory.”
▲
P1: 1/1
CH01-7T
P2: 1/2
QC: 1/1
Rosen-2311T
4
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
15:27
1 / The Foundations: Logic and Proofs
TABLE 1 The
Truth Table for
the Negation of a
Proposition.
p
¬p
T
F
F
T
DEFINITION 2
Table 1 displays the truth table for the negation of a proposition p. This table has a row
for each of the two possible truth values of a proposition p. Each row shows the truth value of
¬p corresponding to the truth value of p for this row.
The negation of a proposition can also be considered the result of the operation of the
negation operator on a proposition. The negation operator constructs a new proposition from
a single existing proposition. We will now introduce the logical operators that are used to form
new propositions from two or more existing propositions. These logical operators are also called
connectives.
Let p and q be propositions. The conjunction of p and q, denoted by p ∧ q, is the proposition
“p and q.” The conjunction p ∧ q is true when both p and q are true and is false otherwise.
Table 2 displays the truth table of p ∧ q. This table has a row for each of the four possible
combinations of truth values of p and q. The four rows correspond to the pairs of truth values
TT, TF, FT, and FF, where the first truth value in the pair is the truth value of p and the second
truth value is the truth value of q.
Note that in logic the word “but” sometimes is used instead of “and” in a conjunction. For
example, the statement “The sun is shining, but it is raining” is another way of saying “The sun
is shining and it is raining.” (In natural language, there is a subtle difference in meaning between
“and” and “but”; we will not be concerned with this nuance here.)
EXAMPLE 5
Find the conjunction of the propositions p and q where p is the proposition “Rebecca’s PC has
more than 16 GB free hard disk space” and q is the proposition “The processor in Rebecca’s
PC runs faster than 1 GHz.”
Solution: The conjunction of these propositions, p ∧ q, is the proposition “Rebecca’s PC has
more than 16 GB free hard disk space, and the processor in Rebecca’s PC runs faster than 1
GHz.” This conjunction can be expressed more simply as “Rebecca’s PC has more than 16 GB
free hard disk space, and its processor runs faster than 1 GHz.” For this conjunction to be true,
both conditions given must be true. It is false, when one or both of these conditions are false.
▲
P1: 1/1
DEFINITION 3
Let p and q be propositions. The disjunction of p and q, denoted by p ∨ q, is the proposition
“p or q.” The disjunction p ∨ q is false when both p and q are false and is true otherwise.
Table 3 displays the truth table for p ∨ q.
TABLE 2 The Truth Table for
TABLE 3 The Truth Table for
the Conjunction of Two
Propositions.
the Disjunction of Two
Propositions.
p
q
p∧q
p
q
p∨q
T
T
F
F
T
F
T
F
T
F
F
F
T
T
F
F
T
F
T
F
T
T
T
F
CH01-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
15:27
1.1 Propositional Logic
5
The use of the connective or in a disjunction corresponds to one of the two ways the word
or is used in English, namely, as an inclusive or. A disjunction is true when at least one of the
two propositions is true. For instance, the inclusive or is being used in the statement
“Students who have taken calculus or computer science can take this class.”
Here, we mean that students who have taken both calculus and computer science can take the
class, as well as the students who have taken only one of the two subjects. On the other hand,
we are using the exclusive or when we say
“Students who have taken calculus or computer science, but not both, can enroll in this
class.”
Here, we mean that students who have taken both calculus and a computer science course cannot
take the class. Only those who have taken exactly one of the two courses can take the class.
Similarly, when a menu at a restaurant states, “Soup or salad comes with an entrée,” the
restaurant almost always means that customers can have either soup or salad, but not both.
Hence, this is an exclusive, rather than an inclusive, or.
EXAMPLE 6
What is the disjunction of the propositions p and q where p and q are the same propositions as
in Example 5?
Solution: The disjunction of p and q, p ∨ q, is the proposition
“Rebecca’s PC has at least 16 GB free hard disk space, or the processor in Rebecca’s PC
runs faster than 1 GHz.”
This proposition is true when Rebecca’s PC has at least 16 GB free hard disk space, when the
PC’s processor runs faster than 1 GHz, and when both conditions are true. It is false when both
of these conditions are false, that is, when Rebecca’s PC has less than 16 GB free hard disk
space and the processor in her PC runs at 1 GHz or slower.
▲
P1: 1/1
As was previously remarked, the use of the connective or in a disjunction corresponds
to one of the two ways the word or is used in English, namely, in an inclusive way. Thus, a
disjunction is true when at least one of the two propositions in it is true. Sometimes, we use or
in an exclusive sense. When the exclusive or is used to connect the propositions p and q, the
proposition “p or q (but not both)” is obtained. This proposition is true when p is true and q is
false, and when p is false and q is true. It is false when both p and q are false and when both
are true.
GEORGE BOOLE (1815–1864) George Boole, the son of a cobbler, was born in Lincoln, England, in
November 1815. Because of his family’s difficult financial situation, Boole struggled to educate himself while
supporting his family. Nevertheless, he became one of the most important mathematicians of the 1800s. Although
he considered a career as a clergyman, he decided instead to go into teaching, and soon afterward opened a
school of his own. In his preparation for teaching mathematics, Boole—unsatisfied with textbooks of his day—
decided to read the works of the great mathematicians. While reading papers of the great French mathematician
Lagrange, Boole made discoveries in the calculus of variations, the branch of analysis dealing with finding
curves and surfaces by optimizing certain parameters.
In 1848 Boole published The Mathematical Analysis of Logic, the first of his contributions to symbolic logic.
In 1849 he was appointed professor of mathematics at Queen’s College in Cork, Ireland. In 1854 he published The Laws of Thought,
his most famous work. In this book, Boole introduced what is now called Boolean algebra in his honor. Boole wrote textbooks
on differential equations and on difference equations that were used in Great Britain until the end of the nineteenth century. Boole
married in 1855; his wife was the niece of the professor of Greek at Queen’s College. In 1864 Boole died from pneumonia, which
he contracted as a result of keeping a lecture engagement even though he was soaking wet from a rainstorm.
P1: 1/1
CH01-7T
P2: 1/2
QC: 1/1
Rosen-2311T
6
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
15:27
1 / The Foundations: Logic and Proofs
DEFINITION 4
TABLE 4 The Truth Table for
TABLE 5 The Truth Table for
the Exclusive Or of Two
Propositions.
the Conditional Statement
p → q.
p
q
p⊕q
p
q
p→q
T
T
F
F
T
F
T
F
F
T
T
F
T
T
F
F
T
F
T
F
T
F
T
T
Let p and q be propositions. The exclusive or of p and q, denoted by p ⊕ q, is the proposition
that is true when exactly one of p and q is true and is false otherwise.
The truth table for the exclusive or of two propositions is displayed in Table 4.
Conditional Statements
We will discuss several other important ways in which propositions can be combined.
DEFINITION 5
Let p and q be propositions. The conditional statement p → q is the proposition “if p, then
q.” The conditional statement p → q is false when p is true and q is false, and true otherwise.
In the conditional statement p → q, p is called the hypothesis (or antecedent or premise)
and q is called the conclusion (or consequence).
The statement p → q is called a conditional statement because p → q asserts that q is true
on the condition that p holds. A conditional statement is also called an implication.
The truth table for the conditional statement p → q is shown in Table 5. Note that the
statement p → q is true when both p and q are true and when p is false (no matter what truth
value q has).
Because conditional statements play such an essential role in mathematical reasoning, a
variety of terminology is used to express p → q. You will encounter most if not all of the
following ways to express this conditional statement:
“if p, then q”
“if p, q”
“p is sufficient for q”
“q if p”
“q when p”
“a necessary condition for p is q”
“q unless ¬p”
“p implies q”
“p only if q”
“a sufficient condition for q is p”
“q whenever p”
“q is necessary for p”
“q follows from p”
A useful way to understand the truth value of a conditional statement is to think of an
obligation or a contract. For example, the pledge many politicians make when running for office
is
“If I am elected, then I will lower taxes.”
CH01-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
15:27
1.1 Propositional Logic
7
If the politician is elected, voters would expect this politician to lower taxes. Furthermore, if the
politician is not elected, then voters will not have any expectation that this person will lower
taxes, although the person may have sufficient influence to cause those in power to lower taxes.
It is only when the politician is elected but does not lower taxes that voters can say that the
politician has broken the campaign pledge. This last scenario corresponds to the case when p
is true but q is false in p → q.
Similarly, consider a statement that a professor might make:
“If you get 100% on the final, then you will get an A.”
You might have trouble
understanding how
“unless” is used in
conditional statements
unless you read this
paragraph carefully.
EXAMPLE 7
If you manage to get a 100% on the final, then you would expect to receive an A. If you do not
get 100% you may or may not receive an A depending on other factors. However, if you do get
100%, but the professor does not give you an A, you will feel cheated.
Of the various ways to express the conditional statement p → q, the two that seem to cause
the most confusion are “p only if q” and “q unless ¬p.” Consequently, we will provide some
guidance for clearing up this confusion.
To remember that “p only if q” expresses the same thing as “if p, then q,” note that “p only
if q” says that p cannot be true when q is not true. That is, the statement is false if p is true,
but q is false. When p is false, q may be either true or false, because the statement says nothing
about the truth value of q. Be careful not to use “q only if p” to express p → q because this is
incorrect. To see this, note that the true values of “q only if p” and p → q are different when
p and q have different truth values.
To remember that “q unless ¬p” expresses the same conditional statement as “if p, then
q,” note that “q unless ¬p” means that if ¬p is false, then q must be true. That is, the statement
“q unless ¬p” is false when p is true but q is false, but it is true otherwise. Consequently,
“q unless ¬p” and p → q always have the same truth value.
We illustrate the translation between conditional statements and English statements in Example 7.
Let p be the statement “Maria learns discrete mathematics” and q the statement “Maria will
find a good job.” Express the statement p → q as a statement in English.
Solution: From the definition of conditional statements, we see that when p is the statement
“Maria learns discrete mathematics” and q is the statement “Maria will find a good job,” p → q
represents the statement
“If Maria learns discrete mathematics, then she will find a good job.”
There are many other ways to express this conditional statement in English. Among the most
natural of these are:
“Maria will find a good job when she learns discrete mathematics.”
“For Maria to get a good job, it is sufficient for her to learn discrete mathematics.”
and
“Maria will find a good job unless she does not learn discrete mathematics.”
▲
P1: 1/1
Note that the way we have defined conditional statements is more general than the meaning
attached to such statements in the English language. For instance, the conditional statement in
Example 7 and the statement
“If it is sunny, then we will go to the beach.”
are statements used in normal language where there is a relationship between the hypothesis
and the conclusion. Further, the first of these statements is true unless Maria learns discrete
mathematics, but she does not get a good job, and the second is true unless it is indeed sunny,
but we do not go to the beach. On the other hand, the statement
CH01-7T
P2: 1/2
QC: 1/1
Rosen-2311T
8
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
15:27
1 / The Foundations: Logic and Proofs
“If Juan has a smartphone, then 2 + 3 = 5”
is true from the definition of a conditional statement, because its conclusion is true. (The truth
value of the hypothesis does not matter then.) The conditional statement
“If Juan has a smartphone, then 2 + 3 = 6”
is true if Juan does not have a smartphone, even though 2 + 3 = 6 is false. We would not use
these last two conditional statements in natural language (except perhaps in sarcasm), because
there is no relationship between the hypothesis and the conclusion in either statement. In mathematical reasoning, we consider conditional statements of a more general sort than we use in
English. The mathematical concept of a conditional statement is independent of a cause-andeffect relationship between hypothesis and conclusion. Our definition of a conditional statement
specifies its truth values; it is not based on English usage. Propositional language is an artificial
language; we only parallel English usage to make it easy to use and remember.
The if-then construction used in many programming languages is different from that used
in logic. Most programming languages contain statements such as if p then S, where p is a
proposition and S is a program segment (one or more statements to be executed). When execution
of a program encounters such a statement, S is executed if p is true, but S is not executed if p
is false, as illustrated in Example 8.
EXAMPLE 8
What is the value of the variable x after the statement
if 2 + 2 = 4 then x := x + 1
if x = 0 before this statement is encountered? (The symbol := stands for assignment. The
statement x := x + 1 means the assignment of the value of x + 1 to x.)
Solution: Because 2 + 2 = 4 is true, the assignment statement x := x + 1 is executed. Hence,
x has the value 0 + 1 = 1 after this statement is encountered.
▲
P1: 1/1
Remember that the
contrapositive, but neither
the converse or inverse, of
a conditional statement is
equivalent to it.
CONVERSE, CONTRAPOSITIVE, AND INVERSE We can form some new conditional
statements starting with a conditional statement p → q. In particular, there are three related
conditional statements that occur so often that they have special names. The proposition q → p
is called the converse of p → q. The contrapositive of p → q is the proposition ¬q → ¬p.
The proposition ¬p → ¬q is called the inverse of p → q. We will see that of these three
conditional statements formed from p → q, only the contrapositive always has the same truth
value as p → q.
We first show that the contrapositive, ¬q → ¬p, of a conditional statement p → q always
has the same truth value as p → q. To see this, note that the contrapositive is false only when
¬p is false and ¬q is true, that is, only when p is true and q is false. We now show that neither
the converse, q → p, nor the inverse, ¬p → ¬q, has the same truth value as p → q for all
possible truth values of p and q. Note that when p is true and q is false, the original conditional
statement is false, but the converse and the inverse are both true.
When two compound propositions always have the same truth value we call them equivalent, so that a conditional statement and its contrapositive are equivalent. The converse and
the inverse of a conditional statement are also equivalent, as the reader can verify, but neither is
equivalent to the original conditional statement. (We will study equivalent propositions in Section 1.3.) Take note that one of the most common logical errors is to assume that the converse
or the inverse of a conditional statement is equivalent to this conditional statement.
We illustrate the use of conditional statements in Example 9.
CH01-7T
P2: 1/2
QC: 1/1
Rosen-2311T
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
15:27
1.1 Propositional Logic
EXAMPLE 9
9
What are the contrapositive, the converse, and the inverse of the conditional statement
“The home team wins whenever it is raining?”
Solution: Because “q whenever p” is one of the ways to express the conditional statement
p → q, the original statement can be rewritten as
“If it is raining, then the home team wins.”
Consequently, the contrapositive of this conditional statement is
“If the home team does not win, then it is not raining.”
The converse is
“If the home team wins, then it is raining.”
The inverse is
“If it is not raining, then the home team does not win.”
Only the contrapositive is equivalent to the original statement.
▲
P1: 1/1
BICONDITIONALS We now introduce another way to combine propositions that expresses
that two propositions have the same truth value.
DEFINITION 6
Let p and q be propositions. The biconditional statement p ↔ q is the proposition “p if
and only if q.” The biconditional statement p ↔ q is true when p and q have the same truth
values, and is false otherwise. Biconditional statements are also called bi-implications.
The truth table for p ↔ q is shown in Table 6. Note that the statement p ↔ q is true when both
the conditional statements p → q and q → p are true and is false otherwise. That is why we use
the words “if and only if” to express this logical connective and why it is symbolically written
by combining the symbols → and ←. There are some other common ways to express p ↔ q:
“p is necessary and sufficient for q”
“if p then q, and conversely”
“p iff q.”
The last way of expressing the biconditional statement p ↔ q uses the abbreviation “iff” for
“if and only if.” Note that p ↔ q has exactly the same truth value as (p → q) ∧ (q → p).
TABLE 6 The Truth Table for the
Biconditional p ↔ q.
p
q
p↔q
T
T
F
F
T
F
T
F
T
F
F
T
P2: 1/2
QC: 1/1
Rosen-2311T
10
T1: 2
MHIA017-Rosen-v5.cls
May 13, 2011
15:27
1 / The Foundations: Logic and Proofs
EXAMPLE 10
Let p be the statement “You can take the flight,” and let q be the statement “You buy a ticket.”
Then p ↔ q is the statement
“You can take the flight if and only if you buy a ticket.”
This statement is true if p and q are either both true or both false, that is, if you buy a ticket and
can take the flight or if you do not buy a ticket and you cannot take the flight. It is false when
p and q have opposite truth values, that is, when you do not buy a ticket, but you can take...