1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Solutions Guide Discrete mathematics and its applications 7th edition

576 3,1K 30

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 576
Dung lượng 29,29 MB

Nội dung

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 (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, 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 The Foundations: Logic and Proofs 1.1 Propositional Logic 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 Introduction to Proofs 36 Proof Methods and Strategy 40 1.8 Guide to Review Questions for Chapter 44 Supplementary Exercises for Chapter 45 48 Writing Projects for Chapter CHAPTER Basic Structures: Sets, Functions, Sequences, Sums, and Matrices 2.1 Sets 50 2.2 Set Operations 53 Functions 59 68 2.4 Sequences and Summations Cardinality of Sets 75 2.5 2.6 Matrices 79 83 Guide to Review Questions for Chapter Supplementary Exercises for Chapter 84 Writing Projects for Chapter 87 CHAPTER Algorithms 3.1 Algorithms 88 3.2 The Growth of Functions 97 3.3 Complexity of Algorithms 103 Guide to Review Questions for Chapter 107 Supplementary Exercises for Chapter 108 112 Writing Projects for Chapter CHAPTER 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 142 Supplementary Exercises for Chapter 143 Writing Projects for Chapter 147 v 50 88 113 CHAPTER CHAPTER CHAPTER CHAPTER 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 183 Supplementary Exercises for Chapter 185 Writing Projects for Chapter 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 230 Supplementary Exercises for Chapter 231 237 Writing Projects for Chapter 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 255 Supplementary Exercises for Chapter 256 261 Writing Projects for Chapter 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 304 Supplementary Exercises for Chapter 305 Writing Projects for Chapter 310 CHAPTER 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 Supplementary Exercises for Chapter 347 351 Writing Projects for Chapter 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 Appendix Appendix 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 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 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 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.] 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 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.) Crib Sheets 553 Crib Sheet for Chapter An algorithm is a finite sequence of precise instructions for performing a computation or solving a problem Algorithms can be expressed in pseudocode Most algorithms have the following properties: having input, having output, definiteness, correctness, finiteness, effectiveness, generality Algorithms that make what seems to be the "best" choice at each step are called greedy algorithms Sometimes they work; sometimes they don't For example, the greedy change-making algorithm works for American coins, but does not work for some other combinations of denominations There are important algorithmic paradigms besides greedy, including brute force (examine all possible solutions in order to determine the best solution) and some that will be studied in later chapters (dynamic programming, probabilistic algorithms, and divide-and-conquer) The halting problem is unsolvable: There is no algorithm to test whether a given computer program with a given input will ever halt Big-0 notation: "f(x) is O(g(x))" means :JC:Jk\ix(x > k -> lf(x)I S: Clg(x)I) Big-0 of a sum is largest (fastest growing) of the functions in the sum; big-0 of a product is the product of the big-O's of the factors If f is O(g), then g is O(f) ("big-Omega") If f is both big-0 and big-Omega of g, then f is 8(g) ("big-Theta") Little-0 notation: This was introduced in the exercise set We say that f(x) is o(g(x)) iflimx_, 00 f(x)/g(x) = Powers grow faster than logs: (logn)c is O(xd) but not the other way around, where c and d are positive numbers If fi(x) is O(g1(x)) and h(x) is O(g2(x)), then (!1 + h)(x) is O(max(g1(x),g2(x))) and (f1h)(x) is O(g1(x)g2(x)) logn! is O(nlogn) Binary search has time complexity O(logn), whereas linear search has (worst case and average case) time complexity O(n); both have space complexity 0(1) (not counting input) Bubble sort and insertion sort have O(n ) worst case time complexity Matrix multiplication by the standard algorithm has time complexity O(m 1m m 3) if the matrices have dimensions m1 x m and m x m3 More efficient algorithms can reduce the complexity of multiplying two n x n matrices from O(n ) to O(nv'7) Important complexity classes include polynomial (nb), exponential (bn for b > 1), and factorial (n!) A problem that can be solved by an algorithm with polynomial worst-case time-complexity is called tractable; otherwise they are called intractable The class P is the class of tractable problems The class NP consists of problems for which it is possible to check solutions (as opposed to finding solutions) in polynomial time Clearly P ~ NP The P versus NP problem asks whether in fact P =NP; no one knows the answer 554 Crib Sheets Crib Sheet for Chapter Divisibility: a I b means a -1- /\ :3c(ac = b) (a is a divisor or factor of b; bis a multiple of a) Base b representations: (an-lan-2 a2a1ao)b = an-1bn-l + · · · + a2b + aib + ao To convert from base 10 to base b, continually divide by band record remainders as a , a , a 2, (b = is octal; b = 16 is hexadecimal, using A through F for digits 10 through 15) Convert from binary to octal by grouping bits by threes, from the right, to hexadecimal by grouping by fours Addition of two binary numerals each of n bits ((an_ 1an_ a 2a 1a )2) requires O(n) bit operations Multiplication requires O(n 2) bit operations if done naively, O(n 585 ) steps by more sophisticated algorithms Division "algorithm": \fa \Id> :Jq :Jr(a = dq + r /\ :::; r < d); q is the quotient and r is the remainder; we write a mod d for the remainder Example: -18 = · ( -4) + 2, so -18 mod = Congruent modulo m: a = b (mod m) iff m Ia - b iff a mod m = b mod m One can arithmetic in Zm = {0, 1, , m - 1} by working modulo m There are fast algorithms for computing bn mod m, based on successive squaring Integer n > is prime iff its only factors are and itself (2, 3, 5, 7, ); otherwise it is composite (4, 6, 8, 9, ) There are infinitely many primes, but it is not known whether there are infinitely many twin primes (primes that differ by2) or whether every even positive integer greater than is the sum of two primes (Goldbach's conjecture) or whether there are infinitely many Mersenne primes (primes of the form 2P - 1) Naive test for primeness (and method for finding prime factorization): To find prime factorization of n, successively divide it by all primes less than y7i (2, 3, 5, ); if none is found, then n is prime If a prime factor pis found, then continue the process to find the prime factorization of the remaining factor, namely n/p; this time the trial divisions can start with p Continue until a prime factor remains The prime number theorem states that there are approximately n/ ln n primes less than or equal ton Fundamental theorem of arithmetic: Every integer greater than can be written as a product of one or more primes, and the product is unique except for the order of the factors (Proof based on fact that if a prime divides a product of integers, then it divides at least one of those integers.) Euclidean algorithm for greatest common divisor: gcd(x, y) = gcd(y, x mod y) if y -1- O; gcd(x, 0) = x Using extended Euclidean algorithm or working backwards, one can find Bezout coefficients and write gcd(a, b) = sa+tb Two integers are relatively prime if their greatest common divisor (gcd) is l The integers ai, a 2, , an are pairwise relatively prime iff gcd( ai, a1 ) = whenever :::; i < j :::; n Chinese remainder theorem: If m , m 2, , mn are pairwise relatively prime, then the system \fi(x = (mod mi)) has unique solution modulo m m · · ·mn Application: handling very large integers on a computer Fermat's little theorem: av- = (mod p) if p is prime and does not divide a The converse is not true; for example 2340 = (mod 341), so 341 (=11·31) is a pseudoprime If a and bare positive integers, then there exist integers sand t such that as+bt = gcd(a, b) (linear combination) = This theorem allows one to compute the multiplicative inverse a of a modulo b (i.e., aa (mod b)) as long as a and bare relatively prime, which enables one to solve linear congruences ax= c (mod b) A primitive root modulo a prime pis an integer r in Zp such that every nonzero element of Zp is a power of r Discrete logarithms: logr a = e modulo p if re mod p = a and :::; e :::; p - l A common hashing function: h(k) = k mod m, where k is the key Check digits, for error-correcting codes like UPCs, involve modular arithmetic Pseudorandom numbers can be generated by the linear congruential method: Xn+l = (axn + c) mod m, where x is arbitrarily chosen seed Then {xn/m} will be rather randomly distributed numbers between and l Shift cipher: f(p) = (p + k) mod 26 [A f(p) = (ap + b) mod 26 with gcd(a, 26) = l f 0, B f 1, ] Julius Caesar used k = Affine cipher uses RSA public key encryption system: An integer M representing the plaintext is translated into an integer C representing the ciphertext using the function C = l'vfe mod b, where n is a public number that is the product of two large (maybe 100-digit or so) primes, and e is a public number relatively prime to (p-l)(q-1); the primes p and q are kept secret Decryption is accomplished via M = Cd mod n, where d is an inverse of e modulo (p - 1) (q - 1) It is infeasible to compute d without knowing p and q, which are infeasible to compute from n Similar methods can be used for key exchange protocols and digital signatures 555 Crib Sheets Crib Sheet for Chapter The well-ordering property: Every nonempty set of nonnegative integers has a least element Principle of mathematical induction: Let P(n) be a propositional function in which the domain (universe of discourse) is the set of positive integers Then if one can show that P(l) is true (basis step or base case) and that for every positive integer k the conditional statement P( k) + P( k + 1) is true (inductive step), then one has proved VnP(n) The hypothesis P(k) in a proof of the inductive step is called the inductive hypothesis More generally, the induction can start at any integer, and there can be several base cases Strong induction: Let P(n) be a propositional function in which the domain (universe of discourse) is the set of positive integers Then if one can show that P(l) is true (basis step or base case) and that for every positive integer k the conditional statement [P(l) A P(2) A··· A P(k)] + P(k + 1) is true (inductive step), then one has proved VnP(n) The hypothesis Vj"5_k P(j) in a proof of the inductive step is called the (strong) inductive hypothesis Again, the induction can start at any integer, and there can be several base cases Sometimes inductive loading is needed, where we must prove by mathematical induction or strong induction something stronger than the desired statement so as to have a powerful enough inductive hypothesis (this concept was introduced in the exercises) Inductive or recursive definition of a function J with the set of nonnegative integers as its domain: specification of J(O), together with, for each n > 0, a rule for finding J(n) from values of J(k) fork< n Example: O! = and (n + 1)! = (n + 1) · n! (factorial function) Inductive or recursive definition of a set S: a rule specifying one or more particular elements of S, together with a rule for obtaining more elements of S from those already in it It is understood that S consists precisely of those elements that can be obtained by applying these two rules Structural induction can be used to prove facts about recursively defined objects Fibonacci numbers: Jo, Ji, h, : Jo= 0, Ji = 1, and Jn =Jn-I+ Jn-2 for all n 2 Lame's theorem: The number of divisions used by the Euclidean algorithm to find gcd(a, b) is O(log b) An algorithm is recursive if it solves a problem by reducing it to an instance of the same problem with smaller input It is iterative if it is based on the repeated use of operations in a loop There is an efficient recursive algorithm for computing modular powers (bn mod m), based on computing bln/ J mod m Merge sort is an efficient recursive algorithm for sorting a list: break the list into two parts, recursively sort each half, and merge them together in order It has 0( n log n) time complexity in all cases A program segment S is partially correct with respect to initial assertion p and final assertion q, written p{ S}q, if whenever pis true for the input values of S and S terminates, q is true for the output values of S A loop invariant for while condition S is an assertion p that remains true each time S is executed in the loop; i.e., (p A condition){S}p If pis true before the program segment is executed, then p and -,condition are true after it terminates (if it does) In symbols, p{ while condition S}(-,condition A p) Crib Sheets 556 Crib Sheet for Chapter Sum rule: Given t mutually exclusive tasks, if task i can be done in n, ways, then the number of ways to exactly one of the tasks is ni + n2 + · · · + nt IA1 U A2 U · · · U Anl = IA1I + IA2I + · · · + IAnl· of inclusion-exclusion: IA U Bl= IAI + IBI - IA n BJ Size of union of disjoint sets: Two-set case Product rule: If a task consists of successively performing t tasks, and if task i can be done in n, ways (after previous tasks have been completed), then the number of ways to the task is n · n · · · nt A set with n elements has 2n subsets (equivalently, there are 2n bit strings of length n) Tree diagrams can be used to organize counting problems Pigeonhole principle: If more than k objects are placed in k boxes, then some box will have more than object Generalized version: If N objects are placed ink boxes, then some box will have at least IN/kl objects Ramsey number R( m, n) is the smallest number of people there must be at a party so that there exist either m mutual friends or n mutual enemies (assuming each pair of people are either friends or enemies) R(3, 3) = r-permutation of set with n objects: ordered arrangement of r of the objects from the set (no repetitions allowed); there are P(n, r) = nf/(n - r)! such permutations r-combination of set with n objects: unordered selection (i.e., subset) of r of the objects from the set (no repetitions allowed); there are C(n,r) = n!/[r!(n - r)!] such combinations Alternative notation is G), called binomial coefficient Pascal's identity: C(n, k - 1) + C(n, k) = C(n + 1, k) if n ~ k ~ 1; allows construction of Pascal's triangle of binomial coefficients, using C(n, 0) = C(n, n) = along the sides Combinatorial identities often have combinatorial proofs: C(n, r) = C(n, n-r); (a+ b)n = "L,~=O C(n, k)an-kbk (binomial theorem), with corollary "L,~=o C(n, k) = 2n; C(m+n, r) = "L,~=O C(m, r-k)C(n, k) (Vandermonde's identity) Number of r-permutations of an n-set with repetitions allowed is nr; number of r-combinations of an n-set with repetitions allowed is C(n + r - 1, r) This latter value is the same as the number of solutions in nonnegative integers to x + x + · · · + Xn = r Permutations with indistinguishable objects: Number of n-permutations of an n-set with n, indistinguishable objects of type t for 1::::; t::::; k is n!/(n !n2! · · · nk!) This also gives the number of ways to distribute n distinguishable objects into k distinguishable boxes so that box t gets nt objects For distributing distinguishable object into distinguishable boxes, use product rule (or the formula n!/(n !n2! · · · nk!) if the number in each box is specified) For distributing indistinguishable object into distinguishable boxes, use formula for the number of combinations with repetitions allowed For distributing distinguishable object into indistinguishable boxes, there is no good closed formula; Stirling numbers of the second kind are involved Distributing indistinguishable object into indistinguishable boxes involves partitions of positive integers, and there is no good closed formula There are good algorithms for finding the lexicographically "next" permutation or combination and thereby for generating all permutations or combinations Crib Sheets 557 Crib Sheet for Chapter If all outcomes are equally likely in a sample space S with n outcomes, then the probability of an event E is = IEl/n; more generally, if p(si) is probability of ith outcome si, then p(E) = Ls,EEp(si)· p(E) Probability distributions satisfy these conditions: :::; p( s) :::; for each s E S, and Ls ES p( s) = For complementary event, p(E) = - p(E); for union of two events (either one or both happen), p(E U F) = p(E) + p(F) - p(E n F); for independent events, p(E n F) = p(E)p(F) The conditional probability of E given F (probability that E will happen after it is known that F happened) is p(EIF) = p(E n F)/p(F) Bernoulli trials: If only two outcomes are success and failure, withp(success) = p andp(failure) = q = 1-p, then the binomial distribution applies, with probability of exactly k success inn trials being b(k; n, p) = C( n, k )pkqn-k Bayes' theorem: If E and Fare events such that p(E) :j: and p(F) :j: 0, then p p(E I F)p(F) - p(E I F)p(F) + p(E I F)p(F) (FIE) - A random variable assigns a number to each outcome Expected value (expectation) of random variable Xis E(X) = L~= p(si)X(s,); alternatively, E(X) = LrEX(S)P(X = r)r Expected number of successes for n Bernoulli trials is pn Variance of random variable Xis V(X) = L~= p(si)(X(s,)-E(X)) ; variance can also be computed as V(X) = E(X ) - E(X)2; square root of variance is standard deviation a(X); variance of number of successes for n Bernoulli trials is npq X1 and X2 are independent if p(X1 = r1 and X2 = r2) = p(X1 = r1) · p(X2 = r2) In this case E(XY) = E(X)E(Y) Expectation is linear even when the variables are not independent This means that the expectation of a sum is sum of expectations, and E(aX + b) = aE(X) + b Variance of a sum is the sum of the variances (V(X1 +X2) = V(X1) + V(X2)) when the variables are independent The random variable X that gives the number of flips needed before a coin lands tails, when the probability of tails is p and the flips are independent, has the geometric distribution: p(X = k) = (1 - p)k-lp for k = 1, 2, ; E(X) = l/p Chebyshev's inequality: p(IX(s) - E(X)I ~ r):::; V(X)/r A probabilistic algorithm is an algorithm that might give the incorrect answer but only with small probability For example, there are good probabilistic tests as to whether or not a natural number is prime The probabilistic method is a proof technique that shows the existence of an object with a given property by showing that there is a nonzero probability of choosing such an object if choices are made at random For example, there is a probabilistic proof that the Ramsey number R( k, k) is at least 2k/ Crib Sheets 558 Crib Sheet for Chapter A recurrence relation for a sequence a , a , a2, , is a formula expressing each an in terms of previous terms (for all n > n ); initial conditions specify ao through an ; a solution to such a system is an explicit formula for an in terms of n that satisfies the recurrence relation and initial conditions The Fibonacci numbers are defined recursively by Jo = 0, Ji = 1, and f n = fn-l + f n-2 for n ;::: 2; continues h = 1, h = 2, /4 = 3, fs = 5, f6 = 8, h = 13, /8 = 21, ; explicit formula is that f n equals nearest integer to ((1 + y'5)/2)n /y'S A recurrence relation is linear of degree k if it is of the form an = c1an-l + c2an-2 + · · · + ckan-k + f(n); if all the c, 's are constants, then it has constant coefficients; if f(n) is identically 0, then it is homogeneous Such a recurrence relation and k initial conditions completely determine the sequence Recurrence relations of degree can often be solved by iteration Given an expressed in terms of an-1, rewrite an-l in this equation using the same recurrence relation with n - in place of n This expresses an in terms of an_ Then rewrite an_ in terms of an_ , again using the recurrence relation Continue in this way, noting the pattern that evolves, until finally you have an written explicitly in terms of a (or a ), probably as a series This gives the explicit solution (preferably with the series summed in closed form) To solve linear homogeneous recurrence relation with constant coefficients: (1) write down the characteristic equation rk - c1rk-l - c2rk- - · · · - Ck = and find all its roots, with multiplicities; (2) each distinct root (characteristic root) r gives rise to a solution an = rn; if a root is repeated, occurring s times, then there are solutions an = n'rn for i = 0, 1, , s - 1; (3) take arbitrary linear combination of all solutions so obtained, with coefficients a , a , , ak; ( 4) plug in the k initial conditions to solve for the a's To solve linear nonhomogeneous recurrence relation with constant coefficients: (1) solve the associated homogeneous recurrence relation (with the f(n) term omitted) to obtain a general solution a~h) with some yet-tobe-calculated constants a,; (2) obtain a particular solution a~) of the nonhomogeneous recurrence relation using the method of undetermined coefficients (the form to use depends on f(n) and on the solution of the associated homogeneous recurrence relation); (3) write down the general solution: an = a~h) +a~{>); (4) plug in the k initial conditions to solve for the a 's Divide-and-conquer relation: f(n) = af(n/b) + g(n) If f is an increasing function satisfying this relation whenever n is a power of b, where g(n) =end, then f(n) = O(nd) if a< bd, f(n) = O(ndlogn) if a= bd, and f(n) = O(n 10gba) if a> bd (master theorem) Divide-and-conquer algorithms work by dividing a problem into simpler non-overlapping subproblems; dynamic programming algorithms work by dividing a problem into simpler overlapping subproblems Matrix multiplication can be done in O(n10g ) ~ O(n · ) steps, rather than the naive O(n ), using a divide-and-conquer algorithm Talks in a lecture hall can be scheduled using dynamic programming to maximize total attendance Generating functions are expressions of the form f (x) = 2::%°=o akxk, associated with an infinite sequence {ak} They can be used to solve recurrence relations, prove combinatorial identities, and solve counting problems To model a combinatorial situation (such as counting how many ways there are to distribute cookies), let ak be the quantity of interest (the answer when there are k cookies); choices are modeled by adding (corresponding to "or" situations-the person can get 1, 2, or cookies) or multiplying (corresponding to "and" situations-Tom, Dick, and Jane must each receive cookies) polynomials in x The combinatorics is then replaced by the algebra of multiplying out the polynomials or obtaining a closed form expression The most important generating function in applications is 1/(1 - ax)n = 2::%°=o C(n + k - 1, k)akxk Partial fractions must sometimes be used when solving recurrence relations using generating functions Inclusion-exclusion principle: (for n = 3) IAUBUCI = IAI + IBI + ICl- IAnBl-IAnCl-IBnCI + IAnBnCI; (general case) IA1 u A2 u u Anl = L, IA,I - Li

Ngày đăng: 27/12/2016, 08:51

w