Student's Solutions Guide to accompany

.:..·

~'

··Discrete· .

:

...·.Mathematics·

.

'

.

and Its

Applications SEVENTH EDITION

Prepared by Jerrold Grossman .

Student's Solutions Guide to accompany

Discrete Mathematics and Its Applications Seventh Edition Kenneth H. Rosen Monmouth University (and formerly AT&T Laboratories)

Prepared by Jerrold W. Grossman Oakland University

~~onnect Learn •

Succeed"

The McGrow·Hill Companies

~~onnect learn •

Succeed'

Student's Solutions Guide to accompany DISCRETE MATHEMATICS AND ITS APPLICATIONS, SEVENTH EDITION KENNETH H. ROSEN Published by McGraw-Hill Higher Education, an imprint of The McGraw-Hill Compames, Inc., 1221 Avenue of the Americas, New York, NY 10020. Copyright© 2012 and 2007 by The McGraw-Hill Companies, Inc. All rights reserved. Pnnted in the United States of America. No part of this publication may be reproduced or distributed many form or by any means, or stored ma database or retrieval system, without the prior written consent of The McGraw-Hill Companies, Inc., including, but not limited to, network or other electronic storage or transm1ss10n, or broadcast for distance leammg.

1234567890QDB~DB10987654321

ISBN: 978-0-07-735350-6 MHID: 0-07-735350-1

www.mhhe.com

Preface This Student's Solutions Guide for Discrete Mathematics and Its Applications, seventh edition, contains several useful and important study aids.

• SOLUTIONS TO ODD-NUMBERED EXERCISES The bulk of this work consists of solutions to all the odd-numbered exercises in the text. These are not just answers, but complete, worked-out solutions, showing how the principles discussed in the text and examples are applied to the problems. I have also added bits of wisdom, insights, warnings about errors to avoid, and extra comments that go beyond the question as posed. Furthermore, at the beginning of each section you will find some general words of advice and hints on approaching the exercises in that section. • REFERENCES FOR CHAPTER REVIEWS Exact page references, theorem and example references, and answers are provided as a guide for all the chapter review questions in the text. This will make reviewing for tests and quizzes particularly easy. • A GUIDE TO WRITING PROOFS Near the end of this book is a section on writing proofs, a skill that most students find difficult to master. Proofs are introduced formally in Chapter 1 (and proofs by mathematical induction are studied in Chapter 5), but exercises throughout the text ask for proofs of propositions. Reading this section when studying Sections 1.6-1.8, and then periodically thereafter, will be rewarded, as your proof-writing ability grows. • REFERENCES AND ADVICE ON THE WRITING PROJECTS Near the end of this book you will find some general advice on the Writing Projects given at the end of each chapter. There is a discussion of various resources available in the mathematical sciences (such as Mathematical Reviews and the World Wide Web), tips on doing library research, and some suggestions on how to write well. In addition, there is a rather extensive bibliography of books and articles that will be useful when researching these projects. We also provide specific hints and suggestions for each project, with pointers to the references; these can be found in the solutions section of this manual, at the end of each chapter. • SAMPLE CHAPTER TESTS Near the end of this book you will find a sequence of 13 chapter tests, comparable to what might be given in a course. You can take these sample tests in a simulated test setting as practice for the real thing. Complete solutions are provided, of course. • PROBLEM-SOLVING TIPS AND LIST OF COMMON MISTAKES People beginning any endeavor tend to make the same kinds of mistakes. This is especially true in the study of mathematics. I have included a detailed list of common misconceptions that students of discrete mathematics often have and the kinds of errors they tend to make. Specific examples are given. It will be useful for you to review this list from time to time, to make sure that you are not falling into these common traps. Also included in this section is general advice on solving problems in mathematics, which you will find helpful as you tackle the exercises. • CRIB SHEETS Finally, I have prepared a set of 13 single-page "crib sheets," one for each chapter of the book. They provide a quick summary of all the important concepts, definitions, and lll

theorems in the chapter. There are at least three ways to use these. First, they can be used as a reference source by someone who wants to brush up on the material quickly or reveal gaps in old knowledge. Second, they provide an excellent review sheet for studying for tests and quizzes, especially useful for glancing over in the last few minutes. And third, a copy of this page (augmented by your own notes in the margins) is ideal in those cases where an instructor allows the students to come to a test with notes. Several comments about the solutions in this volume are in order. In many cases, more than one solution to an exercise is presented, and sometimes the solutions presented here are not the same as the answers given in the back of the text. Indeed, there is rarely only one way to solve a problem in mathematics. You may well come upon still other valid ways to arrive at the correct answers. Even if you have solved a problem completely, you will find that reviewing the solutions presented here will be valuable, since there is insight to be gained from seeing how someone else handles a problem that you have just solved. Exercises often ask that answers be justified or verified, or they ask you to show or prove a particular statement. In all these cases your solution should be a proof, i.e., a mathematical argument based on the rules of logic. Such a proof needs to be complete, convincing, and correct. Read your proof after finishing it. Ask yourself whether you would understand and believe it if it were presented to you by your instructor. Although I cannot personally discuss with you my philosophy on learning discrete mathematics by solving exercises, let me include a few general words of advice. The best way to learn mathematics is by solving problems, and it is crucial that you first try to work these exercises independently. Consequently, do not use this Guide as a crutch. Do not look at the solution (or even the answer) to a problem before you have worked on it yourself. Resist the temptation to consult the solution as soon as the going gets rough. Make a real effort to work the problem completely on your own-preferably to the point of writing down a complete solution-before checking your work with the solutions presented here. If you have not been able to solve a problem and have reached the point where you feel it necessary to look at the answer or solution, try reading it only casually, looking for a hint as to how you might proceed; then try working on the exercise again, armed with this added information. As a last resort, study the solution in detail and make sure you could explain it to a fellow student. I want to thank Jerry Grossman for his extensive advice and assistance in the preparation of this entire Guide, Paul Lorczak, Suzanne Zeitman, and especially Georgia Mederer for doublechecking the solutions, Ron Marash for preparing the advice on writing proofs, and students at Monmouth College and Oakland University for their input on preliminary versions of these solutions. A tremendous amount of effort has been devoted to ensuring the accuracy of these solutions, but it is possible that a few scattered errors remain. I would appreciate hearing about all that you find, be they typographical or mathematical. You can reach me using the Reporting of Errata link on the companion website's Information Center at www.mhhe.com/rosen. One final note: In addition to this Guide, you will find the companion website created for Discrete Mathematics and Its Applications an invaluable resource. Included here are a Web Resources Guide with links to external websites keyed to the textbook, numerous Extra Examples to reinforce important topics, Interactive Demonstration Applets for exploring key algorithms, Self Assessment question banks to gauge your understanding of core concepts, and many other helpful resources. See the section titled "The Companion Website" on page xvi of the textbook for more details. The address is www.mhhe.com/rosen. Kenneth H. Rosen iv

Contents Preface

iii

CHAPTER 1

The Foundations: Logic and Proofs 1.1 Propositional Logic 1 8 1.2 Applications of Propositional Logic 1.3 Propositional Equivalences 11 1.4 Predicates and Quantifiers 17 1.5 Nested Quantifiers 23 1.6 Rules of Inference 32 1. 7 Introduction to Proofs 36 Proof Methods and Strategy 40 1.8 Guide to Review Questions for Chapter 1 44 Supplementary Exercises for Chapter 1 45 48 Writing Projects for Chapter 1

CHAPTER 2

Basic Structures: Sets, Functions, Sequences, Sums, and Matrices 2.1 Sets 50 2.2 Set Operations 53 Functions 59 2 .3 68 2.4 Sequences and Summations Cardinality of Sets 75 2.5 2.6 Matrices 79 83 Guide to Review Questions for Chapter 2 Supplementary Exercises for Chapter 2 84 Writing Projects for Chapter 2 87

CHAPTER 3

Algorithms 3.1 Algorithms 88 3.2 The Growth of Functions 97 3.3 Complexity of Algorithms 103 Guide to Review Questions for Chapter 3 107 Supplementary Exercises for Chapter 3 108 112 Writing Projects for Chapter 3

CHAPTER 4

Number Theory and Cryptography 4.1 Divisibility and Modular Arithmetic 113 116 4.2 Integer Representations and Algorithms 4.3 Primes and Greatest Common Divisors 122 130 4.4 Solving Congruences 4.5 Applications of Congruences 137 Cryptography 140 4.6 Guide to Review Questions for Chapter 4 142 Supplementary Exercises for Chapter 4 143 Writing Projects for Chapter 4 147

v

1

50

88

113

CHAPTER 5

CHAPTER 6

CHAPTER 7

CHAPTER 8

Induction and Recursion 5.1 Mathematical Induction 149 Strong Induction and Well-Ordering 161 5.2 5.3 Recursive Definitions and Structural Induction 5.4 Recursive Algorithms 176 Program Correctness 182 5.5 Guide to Review Questions for Chapter 5 183 Supplementary Exercises for Chapter 5 185 Writing Projects for Chapter 5 195 Counting 6.1 The Basics of Counting 197 The Pigeonhole Principle 206 6.2 6.3 Permutations and Combinations 211 Binomial Coefficients and Identities 6.4 216 6.5 Generalized Permutations and Combinations 6.6 Generating Permutations and Combinations Guide to Review Questions for Chapter 6 230 Supplementary Exercises for Chapter 6 231 237 Writing Projects for Chapter 6 Discrete Probability 7.1 An Introduction to Discrete Probability Probability Theory 242 7.2 7.3 Bayes' Theorem 247 7.4 Expected Value and Variance 250 Guide to Review Questions for Chapter 7 255 Supplementary Exercises for Chapter 7 256 261 Writing Projects for Chapter 7

149

167

197

220 227

239

239

Advanced Counting Techniques 8.1 Applications of Recurrence Relations 262 Solving Linear Recurrence Relations 272 8.2 8.3 Divide-and-Conquer Algorithms and Recurrence Relations 8.4 Generating Functions 286 8.5 Inclusion-Exclusion 298 8.6 Applications of Inclusion-Exclusion 300 Guide to Review Questions for Chapter 8 304 Supplementary Exercises for Chapter 8 305 Writing Projects for Chapter 8 310

CHAPTER 9 9.1 9.2 9.3 9.4

Relations Relations and Their Properties 312 n-ary Relations and Their Applications Representing Relations 322 Closures of Relations 325 Vl

262

282

312

320

9.5 Equivalence Relations 329 Partial Orderings 337 9.6 345 Guide to Review Questions for Chapter 9 Supplementary Exercises for Chapter 9 347 351 Writing Projects for Chapter 9

CHAPTER 10 Graphs 10.1 Graphs and Graph Models 352 10.2 Graph Terminology and Special Types of Graphs 355 10.3 Representing Graphs and Graph Isomorphism 361 10.4 Connectivity 368 10.5 Euler and Hamilton Paths 375 10.6 Shortest-Path Problems 381 10.7 Planar Graphs 385 10.8 Graph Coloring 389 Guide to Review Questions for Chapter 10 393 Supplementary Exercises for Chapter 10 395 Writing Projects for Chapter 10 401

352

Trees CHAPTER 11 11.1 Introduction to Trees 403 11.2 Applications of Trees 408 11.3 Tree Traversal 417 Spanning Trees 421 11.4 11.5 Minimum Spanning Trees 427 Guide to Review Questions for Chapter 11 Supplementary Exercises for Chapter 11 Writing Projects for Chapter 11 434

403

429 430

CHAPTER 12 Boolean Algebra 12.1 Boolean Functions 436 12.2 Representing Boolean Functions 440 12.3 Logic Gates 443 12.4 Minimization of Circuits 445 Guide to Review Questions for Chapter 12 453 Supplementary Exercises for Chapter 12 454 Writing Projects for Chapter 12 456

436

CHAPTER 13 Modeling Computation 13.1 Languages and Grammars 457 Finite-State Machines with Output 464 13.2 469 13.3 Finite-State Machines with No Output Language Recognition 474 13.4 Turing Machines 478 13.5 482 Guide to Review Questions for Chapter 13 483 Supplementary Exercises for Chapter 13 Writing Projects for Chapter 13 487

457

Vll

APPENDIXES Appendix 1 Appendix 2 Appendix 3

489

Axioms for the Real Numbers and the Positive Integers 489 Exponential and Logarithmic Functions Pseudocode 491

491

A Guide to Proof-Writing

492

References and Advice on Writing Projects

503

Sample Chapter Tests with Solutions

511

Common Mistakes in Discrete Mathematics Solving Problems in Discrete Mathematics List of Common Mistakes 541

540

540

551

Crib Sheets

Vlll

Section 1.1

Propositional Logic

1

CHAPTERl The Foundations: Logic and Proofs SECTION 1.1

Propositional Logic

Manipulating propositions and constructing truth tables are straightforward. A truth table is constructed by finding the truth values of compound propositions from the inside out; see the solution to Exercise 31, for instance. This exercise set also introduces fuzzy logic. 1. Propositions must have clearly defined truth values, so a proposition must be a declarative sentence with no

free variables. a) This is a true proposition.

b) This is a false proposition (Tallahassee is the capital). c) This is a true proposition. d) This is a false proposition. e) This is not a proposition (it contains a variable; the truth value depends on the value assigned to x).

f) This is not a proposition, since it does not assert anything. 3. a) Mei does not have an MP3 player.

b) There is pollution in New Jersey. c) 2+1#3 d) It is not the case that the summer in Maine is hot and sunny. In other words, the summer in Maine is not hot and sunny, which means that it is not hot or it is not sunny. It is not correct to negate this by saying "The summer in Maine is not hot and not sunny." [For this part (and in a similar vein for part (b)) we need to assume that there are well-defined notions of hot and sunny; otherwise this would not be a proposition because of not having a definite truth value.]

5. a) Steve does not have more than 100 GB free disk space on his laptop. (Alternatively: Steve has less than or equal to 100 GB free disk space on his laptop.) b) Zach does not block e-mails and texts from Jennifer. (Alternatively, and more precisely: Zach does not block e-mails from Jennifer, or he does not block texts from Jennifer. Note that negating an "and" statement produces an "or" statement. It would not be correct to say that Zach does not block e-mails from Jennifer, and he does not block texts from Jennifer. That is a stronger statement than just the negation of the given statement.) c) 7·11·13#999. d) Diane did not ride her bike 100 miles on Sunday. 7. a) This is false, because Acme's revenue was larger. b) Both parts of this conjunction are true, so the statement is true. c) The second part of this disjunction is true, so the statement is true. d) The hypothesis of this conditional statement is false and the conclusion is true, so by the truth-table definition this is a true statement. (Either of those conditions would have been enough to make the statement true.)

2

Chapter 1

The Foundations: Logic and Proofs

e) Both parts of this biconditional statement are true, so by the truth-table definition this is a true statement. 9. This is pretty straightforward, using the normal words for the logical operators. a) Sharks have not been spotted near the shore.

b) Swimming at the New Jersey shore is allowed, and sharks have been spotted near the shore. c) Swimming at the New Jersey shore is not allowed, or sharks have been spotted near the shore. d) If swimming at the New Jersey shore is allowed, then sharks have not been spotted near the shore. e) If sharks have not been spotted near the shore, then swimming at the New Jersey shore is allowed.

f) If swimming at the New Jersey shore is not allowed, then sharks have not been spotted near the shore. g) Swimming at the New Jersey shore is allowed if and only if sharks have not been spotted near the shore.

h) Swimming at the New Jersey shore is not allowed, and either swimming at the New Jersey shore is allowed or sharks have not been spotted near the shore. Note that we were able to incorporate the parentheses by using the word "either" in the second half of the sentence. 11. a) Here we have the conjunction p A q.

b) Here we have a conjunction of p with the negation of q, namely p A --.q. Note that "but" logically means the same thing as "and." c) Again this is a conjunction: --.p A --.q.

d) Here we have a disjunction, p V q. Note that V is the inclusive or, so the "(or both)" part of the English sentence is automatically included. e) This sentence is a conditional statement, p -> q. f) This is a conjunction of propositions, both of which are compound: (p V q) A (p-> --.q). g) This is the biconditional p

f-+

q.

13. a) This is just the negation of p, so we write --.p.

b) This is a conjunction ("but" means "and"): p A --.q. c) The position of the word "if" tells us which is the antecedent and which is the consequence: p d) -ip - t --.q e) The sufficient condition is the antecedent: p

->

->

q.

q.

f)qA--.p

g) ''Whenever" means "if": q

-> p.

15. a) "But" is a logical synonym for "and" (although it often suggests that the second part of the sentence is likely to be unexpected). So this is r A --.p.

b) Because of the agreement about precedence, we do not need parentheses in this expression: --.p A q A r. c) The outermost structure here is the conditional statement, and the conclusion part of the conditional statement is itself a biconditional: r -> ( q f-+ --.p) .

d) This is similar to part (b): --.q A --.p A r. e) This one is a little tricky. The statement that the condition is necessary is a conditional statement in one direction, and the statement that this condition is not sufficient is the negation of the conditional statement in the other direction. Thus we have the structure (safe -> conditions) A--.( conditions -> safe). Fleshing this out gives our answer: (q -> (--.r A --.p)) A --.( (--.r A --.p) -> q). There are some logically equivalent correct answers as well.

f) We just need to remember tha...