130 88 4MB
English Pages 220 Year 2014
Instructor’s solutions MANUAL FOR Puzzles, Paradoxes, and Problem Solving by
Marilyn Reba and Douglas Shier
K25544_SM_Cover.indd 1
11/17/14 7:45 PM
K25544_SM_Cover.indd 2
11/17/14 7:45 PM
Instructor’s solutionS MANUAL FOR Puzzles, Paradoxes, and Problem Solving by
Marilyn Reba and Douglas Shier
Boca Raton London New York
CRC Press is an imprint of the Taylor & Francis Group, an informa business
K25544_SM_Cover.indd 3
11/17/14 7:45 PM
CRC Press Taylor & Francis Group 6000 Broken Sound Parkway NW, Suite 300 Boca Raton, FL 33487-2742 © 2015 by Taylor & Francis Group, LLC CRC Press is an imprint of Taylor & Francis Group, an Informa business No claim to original U.S. Government works Printed on acid-free paper Version Date: 20141114 International Standard Book Number-13: 978-1-4987-0912-5 (Ancillary) This book contains information obtained from authentic and highly regarded sources. Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for the validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint. Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or in any information storage or retrieval system, without written permission from the publishers. For permission to photocopy or use material electronically from this work, please access www.copyright.com (http://www.copyright.com/) or contact the Copyright Clearance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. CCC is a not-for-profit organization that provides licenses and registration for a variety of users. For organizations that have been granted a photocopy license by the CCC, a separate system of payment has been arranged. Trademark Notice: Product or corporate names may be trademarks or registered trademarks, and are used only for identification and explanation without intent to infringe. Visit the Taylor & Francis Web site at http://www.taylorandfrancis.com and the CRC Press Web site at http://www.crcpress.com
K25544_SM_Cover.indd 4
11/17/14 7:45 PM
Introduction This Instructor’s Solution Manual is intended to accompany the textbook “Puzzles, Paradoxes, and Problem Solving: An Introduction to Mathematical Thinking” (2014) by Marilyn Reba and Douglas Shier. It contains extensive solutions for all the exercises in the textbook, arranged by chapter and by topic within each chapter. This resource was prepared by Marilyn Reba and Douglas Shier, with the excellent assistance of Patrick Buckingham and Drew Lipman. The authors would appreciate knowing of any errors present in the solutions; we can be contacted at the email addresses [email protected] or [email protected], respectively.
1
K25544_SM_Cover.indd 5
11/17/14 7:45 PM
Contents 1 Graphical Representation and Search
4
2 Greedy Algorithms and Dynamic Programming
19
3 Shortest Paths, DNA Sequences, and GPS Systems
26
4 Routing Problems and Optimal Circuits
36
5 Traveling Salesmen and Optimal Orderings
45
6 Vertex Colorings and Edge Matchings
57
7 Inductive and Deductive Arguments
71
8 Deductive Arguments and Truth-Tables
76
9 Deductive Arguments and Derivations
83
10 Deductive Logic and Equivalence
96
11 Modeling Using Deductive Logic
107
12 Probability and Counting
115
13 Counting and Unordered Outcomes
120
14 Independence and Conditional Probabilities
123
15 Bayes’ Law and Applications of Conditional Probabilities
131
2
K25544_SM_Cover.indd 6
11/17/14 7:45 PM
16 Expected Values and Decision Making
140
17 Voting Methods
151
18 Fairness Criteria and Arrow’s Impossibility Theorem
157
19 Weighted Voting Systems and Voting Power
163
20 Apportionment
172
21 Assessing Apportionment Methods
181
22 Modular Arithmetic and Cryptography
189
23 Binary Representation and Symmetric Cryptosystems
198
24 Prime Numbers and Public-Key Cryptosystems
206
3
K25544_SM_Cover.indd 7
11/17/14 7:45 PM
Chapter 1
Graphical Representation and Search Graph Representation of Puzzles 1. (a) The undirected graph is shown below: A
E
B
D
I Z
You
G C
F
H
(b) One efficient solution path is You → B → D → E → I → Z. Yes, there are other shortest paths: namely, You → B → D → H → G → Z and You → B → F → H → G → Z. 2. (a) The directed graph is shown below: L C
E
G
Prize
D
A B
F
H
M
J
(b) There are three paths to the prize that do not reuse any vertex. (c) The shortest path to the prize is A → B → D → E → G → Prize. 3. (a) The undirected graph is shown next:
4
K25544_SM_Cover.indd 8
11/17/14 7:45 PM
(3,1)
(3,2)
(3,3)
(2,1)
(2,2)
(1,1)
(2,3)
(1,2)
(1,3)
(b) There are 10 paths from (3, 3) to (2, 1). (c) A shortest path has length 3. 4. (a) The undirected graph is shown below: OOHS
OHOS
OOSH OHSO
HOOS
OSOH
HOSO
OSHO
HSOO
SOHO
SOOH
SHOO
(b) A shortest path is OOHS → OHOS → HOOS → HOSO → HSOO → SHOO. Other shortest paths are OOHS → OHOS → OHSO → HOSO → HSOO → SHOO, OOHS → OHOS → OHSO → OSHO → SOHO → SHOO, OOHS → OOSH → OSOH → OSHO → SOHO → SHOO, OOHS → OOSH → OSOH → SOOH → SOHO → SHOO. (c) The solution path is OOHS → OOSH → OSOH → SOOH → SOHO → OSHO → OHSO → OHOS → HOOS → HOSO → HSOO → SHOO. 5. (a) The undirected graph is shown next:
5
K25544_SM_Cover.indd 9
11/17/14 7:45 PM
A
1 2
3
4
5
6
7
8
9 10
11 B
1
5
11
9
10
3
7
6
2
8
4
(b) The shortest path is A = 1 → 5 → 11 → 9 → 3 → 7 → 6 → 2 → 8 = B. (c) Eight moves are needed. 6. (a) The undirected graph is shown below: D F
C
A
E
G B
(b) The BFS tree is shown in bold: D F
C
A
E
G B
(c) Since everyone can be reached from A within three steps, it takes 3×15 = 45 minutes for the gossip to spread. Maze Problems 7. (a) The maze with labeled decision points is shown next:
6
K25544_SM_Cover.indd 10
11/17/14 7:45 PM
J
I H
G
K
L M
O
E
F
S
N R
P
B
Q
D C
Z
A
(b) The associated graph is J D
F
K
G
L
I
Q
P
Z A C
E
R
M
H
B
O
N
S
(c) A shortest path is A → C → E → H → M → P → Z, which produces the following solution in the maze: J
I H
G
E
K
L M
O F
S
N R
P
B
Q
D C
Z
A
8. (a) The maze with labeled decision points is shown next:
D
C A
G
B
J P
E I
R
F H
K
Q
L
O
Z
M N
(b) The associated graph is 7
K25544_SM_Cover.indd 11
11/17/14 7:45 PM
I
C
J
E
P
D
A
R M O
G
B
K
H
F
Z L
Q
N
(c) A shortest path is A → B → D → E → G → K → M → O → Z, which produces the following solution in the maze:
D
C A
G
B
J P
E I
R
F H
K
Q
L
O
Z
M N
9. The path is A → C → D → F → G → I → K → M → Z and it produces the following solution in the maze: Z L
M B
H
E
I
A
C D
K F G J
10. One path is A → C → D → E → F → G → I → K → M → Z and it produces the following solution in the maze: Z L
M B
H
E
A
C D
I K
F G J
8
K25544_SM_Cover.indd 12
11/17/14 7:45 PM
Another path is A → C → D → F → E → G → I → K → M → Z and it produces the following solution in the maze: Z L
M B
H
E
I
A
C D
K F G J
11. (a) The maze with labeled decision points is shown next: A B N
I
G D Z
M
C
H L J K F E
(b) The associated graph is L B
E
H
G
N
K M A
C
D
Z
F I J
(c) The BFS tree in the graph is L B
E
H
G
N
K M A
C
D
Z
F I J
A shortest path is A → C → D → F → K → H → M → Z. 9
K25544_SM_Cover.indd 13
11/17/14 7:45 PM
(d) This path produces the following solution in the maze: A B I
N
G D Z
M
C
H L J K F E
12. (a) The maze with labeled decision points is shown next:
D Q P L
M
O
K
A
I
G
E
H F
J
C N B
Z
(b) The associated graph is F
H J
G C
E
I
K
P
A
L Z
B O D
N
Q
M
(c) The BFS tree in the graph is
10
K25544_SM_Cover.indd 14
11/17/14 7:45 PM
F
H J
G E
C
I
K
P
A
L Z
B O D
N
Q
M
A shortest path is A → B → C → E → P → O → Z. (d) This path produces the following solution in the maze:
D Q P L
M
O
K
A
I
G
E
H F
J
C N B
Z
Two-Jug Problems 13. (a) The extended BFS tree is 54
50
14
10
01
44
80
84
93
90
00
94
04
40
(b) Six pourings is the minimum, achieved by the path (0, 0) → (0, 4) → (4, 0) → (4, 4) → (8, 0) → (8, 4) → (9, 3). (c) Fill the 4-pint jug and transfer its contents into the 9-pint jug. Refill the 4-pint jug and pour it into the 9-pint jug. Refill the 4-pint jug and pour into the 9-pint jug until it is full. This leaves 3 pints in the 4-pint jug. 11
K25544_SM_Cover.indd 15
11/17/14 7:45 PM
14. (a) The BFS tree is 53
50
23
20
02
33
60
63
81
80
00
83
03
30
(b) Six pourings is the minimum, achieved by the path (0, 0) → (0, 3) → (3, 0) → (3, 3) → (6, 0) → (6, 3) → (8, 1). (c) Fill the 3-pint jug and transfer its contents into the 8-pint jug. Refill the 3-pint jug and pour it into the 8-pint jug. Refill the 3-pint jug and pour into the 8-pint jug until it is full. This leaves 1 pint in the 3-pint jug. 15. (a) The BFS tree is 50
55
91
01
10
15
60
40
04
94
85
80
35
05
00
95
90
45
(b) Eight pourings is the minimum, achieved by the path (0, 0) → (0, 5) → (5, 0) → (5, 5) → (9, 1) → (0, 1) → (1, 0) → (1, 5) → (6, 0). (c) Fill the 5-gallon jug and transfer its contents into the 9-gallon jug. Refill the 5-gallon jug and pour into the 9-gallon jug until it is full. Empty the 9-gallon jug. Transfer the contents of the 5-gallon jug into the 9-gallon jug. Refill the 5-gallon jug and transfer its contents into the 9-gallon jug. This leaves 6 gallons in the 9-gallon jug. 16. (a) The BFS tree is 50
55
91
01
10
15
60
65
92
40
04
94
85
80
35
30
03
05
00
95
90
45
12
K25544_SM_Cover.indd 16
11/17/14 7:45 PM
(b) Ten pourings is the minimum, achieved by the path (0, 0) → (0, 5) → (5, 0) → (5, 5) → (9, 1) → (0, 1) → (1, 0) → (1, 5) → (6, 0) → (6, 5) → (9, 2). (c) Fill the 5-gallon jug and transfer its contents into the 9-gallon jug. Refill the 5-gallon jug and pour into the 9-gallon jug until it is full. Empty the 9-gallon jug. Transfer the the contents of the 5-gallon jug into the 9-gallon jug. Refill the 5-gallon jug and transfer its contents into the 9gallon jug. Refill the 5-gallon jug again and pour into the 9-gallon jug until it is full. This leaves 2 gallons in the 5-gallon jug. 17. (a) The BFS tree is 25
20
02
72
45
40
04
55
73
03
30
35
71
70
00
75
05
50
(b) Eight pourings is the minimum, achieved by the path (0, 0) → (0, 5) → (5, 0) → (5, 5) → (7, 3) → (0, 3) → (3, 0) → (3, 5) → (7, 1). (c) The extended BFS tree is 25
20
02
72
45
40
04
74
65
55
73
03
30
35
71
01
10
70
00
75
05
50
Ten pourings is the minimum, achieved by the path (0, 0) → (7, 0) → (2, 5) → (2, 0) → (0, 2) → (7, 2) → (4, 5) → (4, 0) → (0, 4) → (7, 4) → (6, 5). 18. The following BFS tree shows all states that can be generated starting at (0, 0). However, none corresponds to measuring out five gallons. So, it would be impossible to disarm the bomb.
13
K25544_SM_Cover.indd 17
11/17/14 7:45 PM
36
30
03
66
93
90
00
96
06
60
Three-Jug Problems 19. The path is (8, 0, 0) → (5, 0, 3) → (5, 3, 0) → (2, 3, 3). Transfer 3 pints from the 8-pint jug to fill the 3-pint jug, transfer the 3 pints in the 3-pint jug into the 5-pint jug, and transfer 3 pints from the 8-pint jug to fill the 3-pint jug. Now there are 2 pints in the 8-pint jug, 3-pints in the 5-pint jug, and 3 pints in the 3-pint jug. 20. (a) The extended BFS tree is 503
530
233
251
620
602
053
800 350
323
(b) Four is the minimum number of pourings, achieved by the path (8, 0, 0) → (5, 0, 3) → (5, 3, 0) → (2, 3, 3) → (2, 5, 1). 21. (a) The BFS tree is 503
530
233
251
701
710
413
620
602
152
143
440
053
800 350
323
(b) Seven is the minimum number of pourings, achieved by the path (8, 0, 0) → (3, 5, 0) → (3, 2, 3) → (6, 2, 0) → (6, 0, 2) → (1, 5, 2) → (1, 4, 3) → (4, 4, 0).
14
K25544_SM_Cover.indd 18
11/17/14 7:45 PM
22. (a) The BFS tree is
9,0,5 0,9,5
10,0,4
1,9,4
1,8,5
6,8,0
9,5,0
4,5,5
4,9,1
10,3,1
6,3,5
10,4,0
5,9,0
5,4,5
(b) Six pourings is the minimum, achieved by the path (0, 9, 5) → (9, 0, 5) → (10, 0, 4) → (1, 9, 4) → (1, 8, 5) → (6, 8, 0) → (6, 3, 5). (c) Another solution with six pourings is (0, 9, 5) → (9, 0, 5) → (9, 5, 0) → (4, 5, 5) → (4, 9, 1) → (10, 3, 1) → (6, 3, 5). 23. (a) The BFS tree is 480
930
534
570
183
174
444
084 804
840 903
(b) Yes, this can be done using four pourings, achieved by the path (0, 8, 4) → (4, 8, 0) → (9, 3, 0) → (5, 3, 4) → (5, 7, 0). Another solution is (0, 8, 4) → (8, 0, 4) → (9, 0, 3) → (1, 8, 3) → (1, 7, 4). (c) The BFS tree in part (a) cannot be extended further. So, there is no way to obtain six pints in either of the larger jugs. 24. (a) The BFS tree is 802 082
280
820
622
640
901
181
172
262
460
442
910
712
730
(b) Four pourings is the minimum, achieved by the path (0, 8, 2) → (2, 8, 0) → (2, 6, 2) → (4, 6, 0) → (4, 4, 2).
15
K25544_SM_Cover.indd 19
11/17/14 7:45 PM
25. (a) The BFS tree is 802 082
280
820
622
640
901
181
172
262
460
442
910
712
730
370
352
532
550
(b) Six pourings is the minimum, achieved by the path (0, 8, 2) → (2, 8, 0) → (9, 1, 0) → (7, 1, 2) → (7, 3, 0) → (5, 3, 2) → (5, 5, 0). Other Graph Search Problems 26. (a) Yes, it is possible to do this. The associated graph contains the solution path (0, 0) → (7, 4) → (3, 0) → (3, 4) → (0, 1) → (7, 1) → (6, 0). 04
40
44 60
1 00
74
4
30
71 73
3 34
70
01
03
(b) Turn over both timers. Let the second one run out and flip it over, let the first timer run out and flip it over, and let the second timer run out. We will now have 6 minutes left on the first timer. It takes a total of 4 + 3 + 1 = 8 minutes to get to state (6, 0), and then 6 more minutes elapse for a total of 14 minutes. 27. (a) Yes, it is possible to do this. The associated graph contains the solution path (0, 0) → (7, 4) → (3, 0) → (3, 4) → (0, 1) → (7, 1) → (6, 0) → (6, 4) → (2, 0) → (5, 0). 14
10 04
00
74
40
4
44 1
30
60
71 64
70
34
4
20
50
73
3 01
24 03
16
K25544_SM_Cover.indd 20
11/17/14 7:45 PM
(b) Turn over both timers. Let the second one run out and flip it over, let the first timer run out and flip it over, let the second timer run out and flip it over, let the second timer run out, and flip over the first timer. We will now have 5 minutes left on the first timer. It takes a total of 4 + 3 + 1 + 4 = 12 minutes to get to state (5, 0), and then 5 more minutes elapse for a total of 17 minutes. 28. (a) Yes it is possible to do this. The associated graph contains the solution path (0, 0) → (15, 7) → (8, 0) → (8, 7) → (1, 0) → (1, 7) → (0, 6) → (15, 6) → (9, 0). 6
0,7
7 15,7
9,0
0,1
15,1
7,0 0,6
1 0,0
15,6
7,7
8,0
7
8,7
15,0
1,7
1,0
14,0
14,7
(b) Turn over both timers. Let the second one run out and flip it over, let the second timer run out and flip it over, let the first timer run out and flip it over, and let the second timer run out. We will now have 9 minutes left on the first timer. 29. (a) As seen in the graph of valid moves, the fewest number of moves to get from A = (5, 1) to B = (4, 2) is six. 52
54 B 33
31 51
12
43
21
A 24
42
14
34
53
13
(b) Using the fewest moves, there are 3 ways to get from (5, 1) to (3, 3) and 2 ways to get from (3, 3) to (4, 2), giving 3 × 2 = 6 ways to get from (5, 1) to (4, 2) in 6 moves. The possible paths are (5, 1) → (4, 3) → (3, 1) → (5, 2) (5, 1) → (4, 3) → (3, 1) → (5, 2) (5, 1) → (4, 3) → (3, 1) → (1, 2) (5, 1) → (4, 3) → (3, 1) → (1, 2) (5, 1) → (4, 3) → (2, 4) → (1, 2) (5, 1) → (4, 3) → (2, 4) → (1, 2)
→ (3, 3) → (5, 4) → (3, 3) → (2, 1) → (3, 3) → (5, 4) → (3, 3) → (2, 1) → (3, 3) → (5, 4) → (3, 3) → (2, 1)
→ (4, 2), → (4, 2), → (4, 2), → (4, 2), → (4, 2), → (4, 2).
17
K25544_SM_Cover.indd 21
11/17/14 7:45 PM
30. The graph of valid moves, starting at A = (1, 5), is shown next: 52 45 C
12 23
31
24
A 15
32 B
43 34
51
55
(a) Five is the minimum number of moves needed to reach B = (3, 2). One solution path is A = (1, 5) → (3, 4) → (5, 5) → (4, 3) → (5, 1) → (3, 2) = B. (b) Five is the minimum number of moves needed to reach C = (4, 5). One solution path is A = (1, 5) → (2, 3) → (3, 1) → (1, 2) → (2, 4) → (4, 5) = C. (c) Yes, squares (1, 4), (2, 1), (2, 5), (4, 1), (5, 4) cannot be reached from A.
18
K25544_SM_Cover.indd 22
11/17/14 7:45 PM
Chapter 2
Greedy Algorithms and Dynamic Programming Knapsack Problems and Investment Decisions 1. (a) The Greedy Algorithm selects in turn items A, D, C with weight 26 and total value 66. (b) It is possible to do better. For example, items A, B, D, F have weight 27 and give the larger value 67. 2. (a) The Greedy Algorithm selects in turn items A, B, E with weight 25 and total value 46. (b) It is possible to do better. For example, items A, C, D have weight 25 and give the larger value 47. 3. (a) The Greedy Algorithm selects in turn investment options E and C, using $50,000 and giving a total return of $8300. (b) The table of all selections using $50,000 is shown below: A($10,000)
B($10,000)
C($20,000)
D($20,000)
E($30,000)
Total Return $8400 $7600 $8300 $8200 $8500
(c) Selecting investments A, B, E gives the maximum return $8500. 4. (a) The Greedy Algorithm selects in turn projects E and D, requiring an investment of $35,000 and producing a total benefit of $55,000. (b) The table of all selections using $35,000 is shown next: 19
K25544_SM_Cover.indd 23
11/17/14 7:45 PM
A($5000)
B($10,000)
C($10,000)
D($15,000)
E($20,000)
Total Benefit $58,000 $60,000 $57,000 $55,000
The optimal selection is A, C, E which gives the maximum benefit of $60,000. 5. (a) The Greedy Algorithm selects selects in turn improvements A, B, E, with a cost of $24,500 and a total benefit of $34,000. (b) Notice that two improvements yield a benefit of at most $29,000 and that any four improvements exceed the $25,000 budget. So, we only need to consider options using three improvements, listed in the table below: A($12,000)
B($9000)
C($7600)
D($6800)
E($3500)
Total Benefit $34,000 $32,500 $31,000 $34,500 $29,500 $28,000 $26,500
The optimal choice is to select improvements B, C, D yielding a total benefit of $34,500. 6. (a) The horizontal edge from (A, 5) to (B, 5) means we do not choose investment A; the diagonal edge from (B, 5) to (C, 3) means we select investment B; the diagonal edge from (C, 3) to (D, 0) means we select investment C. This entirely uses up the given $50,000 budget, so investments D and E are not selected. The value of this path is $0 + $3400 + $5400 + $0 + $0 = $8800. (b) The selection of A, C, D corresponds to the path (A, 5) → (B, 4) → (C, 4) → (D, 1) → (E, 0) → (F, 0). This path has value $2300 + $0 + $5400 + $900 + $0 = $8600. 7. Moving horizontally from (C, 4) means we do not choose investment C and we have $40,000 left to invest in (possibly) D and E. But D and E together only use up $10,000 + $20,000 = $30,000. So there is no way to fully invest the $50,000. Greedy Algorithms and Change-Making Problems 8. Using only two coins, it is not possible to make change for 22 cents: with two coins, we can only make change for 32, 25, 21, 18, 17, 14, 10, 6, and 2 cents. 20
K25544_SM_Cover.indd 24
11/17/14 7:45 PM
So at least three coins are needed. Since the greedy solution 22 = 16 + 5 + 1 uses just three coins, it is optimal. 9. If we do not use the 16-cent coin, then the largest amount of change that can be made with three coins is 9 + 9 + 9 = 27. Thus, we need to use at least one 16-cent coin. However, this leaves 42 − 16 = 26 cents. It is not possible to make change for 26 cents using only two coins as we can only make change for 32, 25, 21, 18, 17, 14, 10, 6, and 2 cents. This means that we must use at least three coins to make change for 26 cents, and hence at least four coins to make change for 42 cents. Since the Greedy Algorithm uses four coins, it must be optimal. 10. (a) The greedy solution selects one 25-cent coin, one 5-cent coin, and one 1-cent coin: 31 = 25 + 5 + 1. (b) No, there is no solution using only two coins. 11. (a) The greedy solution selects one 25-cent coin, one 5-cent coin, and two 1-cent coins: 32 = 25 + 5 + 1 + 1. (b) Yes, the solution 32 = 12 + 10 + 10 uses just three coins: one 12-cent coin and two 10-cent coins. 12. (a) The greedy solution selects one 25-cent coin, one 5-cent coin, and four 1-cent coins: 34 = 25 + 5 + 1 + 1 + 1 + 1. (b) Yes, the solution 34 = 12 + 12 + 10 uses just three coins: two 12-cent coins and one 10-cent coin. 13. (a) The greedy solution selects two 25-cent coins, one 12-cent coin, and one 5-cent coin: 67 = 25 + 25 + 12 + 5. (b) No, there is no solution using only three coins. 14. (a) The greedy solution selects two 12-cent coins, one 4-cent coin, and three 1-cent coins: 31 = 12 + 12 + 4 + 1 + 1 + 1. (b) Yes, the solution 31 = 10 + 10 + 10 + 1 uses just four coins: three 10-cent coins and one 1-cent coin. 15. (a) The greedy solution selects two 17-cent coins, one 7-cent coin, and one 1-cent coin: 42 = 17 + 17 + 7 + 1 (b) The greedy solution 42 = 17 + 17 + 7 + 1 is optimal, and also the solution 42 = 17 + 12 + 12 + 1 is optimal. Dynamic Programming and Thai 21 16. Given the table below, we iteratively calculate the entries for n = 8, . . . , 12. 1 W
2 W
3 W
4 L
5 W
6 W
7 W
8
9
10
11
12
21
K25544_SM_Cover.indd 25
11/17/14 7:45 PM
(n = 8) Taking 1, 2, 3 flags leaves us in states 7 (W ), 6 (W ), 5 (W ) all winning; so 8 is a losing state. (n = 9) Taking 1, 2, 3 flags leaves us in states 8 (L), 7 (W ), 6 (W ); since 8 is a losing state, 9 is a winning state (by selecting 1 flag). (n = 10) Taking 1, 2, 3 flags leaves us in states 9 (W ), 8 (L), 7 (W ); since 8 is a losing state, 10 is a winning state (by selecting 2 flags). (n = 11) Taking 1, 2, 3 flags leaves us in states 10 (W ), 9 (W ), 8 (L); since 8 is a losing state, 11 is a winning state (by selecting 3 flags). (n = 12) Taking 1, 2, 3 flags leaves us in states 11 (W ), 10 (W ), 9 (W ) all winning; so 12 is a losing state. 17. (a) The completed table is given below: 1 W
2 L
3 W
4 W
5 W
6 W
7 L
8 W
9 L
10 W
11 W
12 W
13 W
14 L
15 W
16 L
17 W
18 W
19 W
20 W
21 L
20 W
21 L
20 L
21 W
(b) Since state 21 is a losing state it is better to go second, as any move of your opponent will leave you in a winning state (20, 18, or 17). 18. (a) The completed table is given below: 1 W
2 W
3 L
4 W
5 W
6 L
7 W
8 W
9 L
10 W
11 W
12 L
13 W
14 W
15 L
16 W
17 W
18 L
19 W
(b) Since state 21 is a losing state it is better to go second, as any move of your opponent will leave you in a winning state (20, 19, or 17). 19. (a) The completed table is given below: 1 W
2 L
3 W
4 W
5 L
6 W
7 L
8 W
9 W
10 L
11 W
12 L
13 W
14 W
15 L
16 W
17 L
18 W
19 W
(b) Since state 21 is a winning state it is better to go first, as you can place the opponent in the losing state 20 by selecting one flag. 20. (a) The completed table is given below: 1 W
2 L
3 W
4 W
5 W
6 W
7 W
8 L
9 W
10 L
11 W
12 W
13 W
14 W
15 W
16 L
17 W
18 L
19 W
20 W
21 W
19 W
20 W
21 L
19 W
20 W
21 W
(b) Since state 21 is a winning state it is better to go first, as you can place the opponent in the losing state 16 by selecting five flags. 21. (a) The completed table is given below: 1 W
2 W
3 L
4 W
5 W
6 W
7 L
8 W
9 W
10 L
11 W
12 W
13 W
14 L
15 W
16 W
17 L
18 W
(b) Since state 21 is a losing state it is better to go second, as any move of your opponent will leave you in a winning state (20, 19, or 15). 22. (a) The completed table is given below: 1 W
2 L
3 W
4 L
5 W
6 W
7 W
8 W
9 W
10 W
11 L
12 W
13 L
14 W
15 L
16 W
17 W
18 W
22
K25544_SM_Cover.indd 26
11/17/14 7:45 PM
(b) Since state 21 is a winning state it is better to go first, as you can place the opponent in the losing state 15 by selecting six flags. Dynamic Programming and Change-Making Problems 23. (a) It is not possible to make change for 29 cents with just two coins, using denominations 12, 10, 5, or 1. With these denominations the largest amount of change that can be made with two coins is 12 + 12 = 24 cents. (b) It is not possible to make change for 31 cents with just three coins, using denominations 10, 5 or 1. With these denominations the largest amount of change that can be made with three coins is 10 + 10 + 10 = 30 cents. 24. (a) The greedy solution selects two 15-cent coins and four 1-cent coins, for a total of six coins. (b) The initial vertex (34, 15) is assigned the optimal value 3, obtained from subproblem (22, 12) by using a 12-cent coin. Since subproblem (22, 12) is optimally solved as 22 = 12 + 10, the original problem only needs three coins: 34 = 12 + 12 + 10. 19,15 15 12
5
22,12 2
3
34,15
10
24,10 6 1
33,1 33
25. (a) The greedy solution selects one 12-cent coin and four 1-cent coins, for a total of five coins. (b) The initial vertex (16, 12) is assigned the optimal value 3, obtained from subproblem (6, 5) by using a 10-cent coin. Since subproblem (6, 5) is optimally solved as 6 = 5 + 1, the original problem only needs three coins: 16 = 10 + 5 + 1. 4,1 12 10
4
6,5
2
11,5
3
15,1
15
3
16,12
5 1
23
K25544_SM_Cover.indd 27
11/17/14 7:45 PM
26. Note that a third stage is needed for subproblem (20, 12), where the greedy solution is not optimal. The initial vertex (32, 25) is assigned the optimal value 3, so only three coins are needed. The indicated path corresponds to the optimal solution 32 = 12 + 10 + 10. 4
3
25
12
2
10
20,12
12
32,25
10
10,10 1
5 1
4
3
8,5
7,5
15,5 3
22,10
5
19,1 19
7
27,5
1
31
31,1
27. The initial vertex (29, 15) is assigned the optimal value 5, so only five coins are needed. There are bolded edges extending to (14, 10) and to (19, 10), both having optimal value 4. The indicated paths correspond to the two optimal solutions 29 = 15 + 6 + 6 + 1 + 1 and 29 = 10 + 6 + 6 + 6 + 1. 4
4,1 4
14,10
10 6
3
8,6
1
13
13,1
15
4
9,6
5
29,15
10
4
19,10
10 6
3
13,6
6 1 8 1
18,1
18
23,6 28
28,1
28. The initial vertex (32, 19) is assigned the optimal value 4, so only four coins are needed. There are bolded edges extending to (13, 10) and to (22, 10), both having optimal value 3. Notice that (13, 10), (22, 10), and (12, 10) need to be expanded to another stage since the greedy solutions for these three vertices are not optimal. The indicated paths correspond to the two optimal solutions 32 = 19 + 6 + 6 + 1 and 32 = 10 + 10 + 6 + 6.
24
K25544_SM_Cover.indd 28
11/17/14 7:45 PM
3
3,1 3
13,10
10
2
6
7,6 12
1
2
12,1
19
2,1 10
2
12,10
4
32,19
10
3
22,10
6
1
6,6
10 6
6
16,6
1
11
11,1
6 21
1 6 1
21,1
26,6 31
31,1
25
K25544_SM_Cover.indd 29
11/17/14 7:45 PM
Chapter 3
Shortest Paths, DNA Sequences, and GPS Systems DNA Alignments and Paths 1. The alignment table is G
A
G
C
T
G
T
A C G T
2. The alignment table is G
C
A
C
G
T
G
A
A T G G
3. The alignment table is C
G
A
T
G
A
C
G C G G A
26
K25544_SM_Cover.indd 30
11/17/14 7:45 PM
4. The alignment table is A
G
T
C
G
C
A
G C T T A
5.
Main: GAGCTG−T Sub: AC−−GT The penalty score is 3 + 1 + 1 + 1 = 6.
6.
Main: CG−ATGAC Sub: GAT−G−C The penalty score is 1 + 3 + 1 + 1 = 6.
7.
Main: CGA−TGA−C Sub: G−AT−G−C The penalty score is 3 + 1 + 1 + 1 + 1 + 1 = 8.
Admissible Paths in an Alignment Table 8. (a) There is one such path. (b) There are 1 + 7 = 8 such paths. (c) There are 1 + 7 + 25 = 33 such paths. (d) There are 1 + 7 + 25 + 63 = 96 such paths. (e) The total number of paths is 1 + 8 + 33 + 96 + 225 = 363. 9. The table below shows the number of paths from the upper left corner: 1 1 1
1 3 5
1 5 13
1 7 25
1 9 41
1 11 61
This gives a total of 1 + 5 + 13 + 25 + 41 + 61 = 146 admissible paths. Optimal Paths in an Alignment Table 10. The optimal path costs are shown in the following table:
27
K25544_SM_Cover.indd 31
11/17/14 7:45 PM
T
G
T
A
C
T
G
G
3
0
1
2
3
3
0
A
4
1
2
1
2
3
1
T
5
2
1
2
3
2
2
C
6
3
2
3
2
3
3
11. The optimal path costs are shown in the following table: A
T
G
A
T
A
C
A
0
1
2
0
1
0
1
G
1
2
1
1
2
1
2
T
2
1
2
2
1
2
3
C
3
2
3
3
2
3
2
12. The optimal path costs are shown in the following table: C
G
A
G
C
A
T
G
3
0
1
0
1
2
3
C
4
1
2
1
0
1
2
T
5
2
3
2
1
2
1
G
6
3
4
3
2
3
2
A
7
4
3
4
3
2
3
13. The optimal path is traced in the following table: C
A
T
G
G
A
3
0
1
2
3
C 3
G
4
1
2
1
2
3
C
5
2
3
2
3
2
A
6
3
4
3
4
3
The corresponding alignment is Main: CATG−−GC Sub: A−GCA 14. (a) The smallest penalty is 1. (b) The optimal path is traced in the following table: A
G
C
T
A
A
0
1
2
3
0
G 1
G
1
0
1
2
1
0
T
2
1
2
1
2
1
A
3
2
3
2
1
2
28
K25544_SM_Cover.indd 32
11/17/14 7:45 PM
The corresponding alignment is Main: AGCTAG Sub: AG−TA 15. (a) The smallest penalty is 1. (b) Tracing back gives the following optimal paths: C
G
A
T
G
A
C
G
3
0
1
2
0
1
2
A
4
1
0
1
1
0
1
T
5
2
1
0
1
1
2
G
6
3
2
1
0
1
2
C
7
4
3
2
1
2
1
The corresponding alignments are Main: CGATG−AC Sub: GATGC Main: CGATGAC Sub: GATG−C 16. The smallest penalty is 2. Tracing back gives the following optimal paths: T
G
T
A
C
T
G
G
3
0
1
2
3
3
0
A
4
1
2
1
2
3
1
T
5
2
1
2
3
2
2
C
6
3
2
3
2
3
3
The corresponding alignments are Main: TG−T−ACTG Sub: GATC Main: TGTA−CTG Sub: G−ATC Main: TG−TACTG Sub: GAT−C
29
K25544_SM_Cover.indd 33
11/17/14 7:45 PM
17. The smallest penalty is 2. Tracing back gives the following optimal paths: A
T
G
A
T
A
C
A
0
1
2
0
1
0
1
G
1
2
1
1
2
1
2
T
2
1
2
2
1
2
3
C
3
2
3
3
2
3
2
The corresponding alignments are Main: A−T−GATAC Sub: AGTC Main: ATGA−T−AC Sub: AGTC Main: ATGA−TAC Sub: A GT−C Main: ATGATA−−C Sub: AG TC 18. The smallest penalty is 2. Tracing back gives the following optimal path: C
G
A
G
C
A
T
G
3
0
1
0
1
2
3
C
4
1
2
1
0
1
2
T
5
2
3
2
1
2
1
G
6
3
4
3
2
3
2
A
7
4
3
4
3
2
3
The corresponding alignment is Main: CGAGC−−AT Sub: GCTGA Shortest Paths and Dijkstra’s Algorithm 19. There are 18 shortest paths: 30
K25544_SM_Cover.indd 34
11/17/14 7:45 PM
1 → 2 → 4 → 3 → 5 → 7, cost 1 → 2 → 4 → 3 → 5 → 6 → 7, 1 → 2 → 4 → 3 → 6 → 7, cost 1 → 2 → 4 → 6 → 7, cost 33; 1 → 2 → 5 → 6 → 7, cost 34; 1 → 2 → 5 → 7, cost 35; 1 → 3 → 2 → 4 → 6 → 7, cost 1 → 3 → 2 → 5 → 6 → 7, cost 1 → 3 → 2 → 5 → 7, cost 34; 1 → 3 → 5 → 6 → 7, cost 35; 1 → 3 → 5 → 7, cost 36; 1 → 3 → 6 → 7, cost 34; 1 → 4 → 3 → 2 → 5 → 6 → 7, 1 → 4 → 3 → 2 → 5 → 7, cost 1 → 4 → 3 → 5 → 6 → 7, cost 1 → 4 → 3 → 5 → 7, cost 49; 1 → 4 → 3 → 6 → 7, cost 47; 1 → 4 → 6 → 7, cost 33.
49; cost 48; 47;
32; 33;
cost 46; 47; 48;
The shortest path is 1 → 3 → 2 → 4 → 6 → 7 with cost 32. 20. (a) The application of Dijkstra’s Algorithm is shown below: 3
3
2 3
4 6
2
0
1
6
13 12
3
1
6
1
8
8
3 8
2
7
5
Vertices
Routing Edge
Distance
1 2 5 4 3 6
(1,2) (2,5) (2,4) (5,3) (4,6)
0 3 5 6 7 12
5
(b) The shortest path is 1 → 2 → 4 → 6 with cost 12. 21. (a) The application of Dijkstra’s Algorithm is shown below: 4
5
2
4
9 8
4 7
7
0
1
1
2
6
2
6
15 14
5
3 6
2
5 11 9
Vertices
Routing Edge
Distance
1 2 3 4 5 6
(1,2) (1,3) (3,4) (4,5) (5,6)
0 4 6 8 9 14
(b) The shortest path is 1 → 3 → 4 → 5 → 6 with cost 14.
31
K25544_SM_Cover.indd 35
11/17/14 7:45 PM
22. (a) The application of Dijkstra’s Algorithm is shown below: 10
8
9
7
1
2
3
6
10 0
1
3
4
13 12 6 11
4
3 2
5
4
9
5
1
5
Vertices
Routing Edge
Distance
1 4 3 2 5 6
(1,4) (4,3) (3,2) (3,5) (5,6)
0 5 7 8 10 11
14 10
(b) The shortest path is 1 → 4 → 3 → 5 → 6 with cost 11. 23. (a) The application of Dijkstra’s Algorithm is shown below: 11
1
2
4
7
11 0
1
4
2
28 26 6 25
17
3 12
8
3
9
8
Vertices
Routing Edge
Distance
1 3 2 5 4 6
(1,3) (1,2) (2,5) (5,4) (4,6)
0 8 11 15 18 25
18
20
11
5 17 15
(b) The shortest path is 1 → 2 → 5 → 4 → 6 with cost 25. 24. (a) The application of Dijkstra’s Algorithm is shown below: 9
8
7
5 2
2
9
3
8
2 0
1
13 6 12
1
5
2
3
3
4 3
7
5
Vertices
Routing Edge
Distance
1 4 3 2 5 6
(1,4) (4,3) (3,2) (2,5) (5,6)
0 3 5 7 9 12
10 9
(b) The shortest path is 1 → 4 → 3 → 2 → 5 → 6 with cost 12.
32
K25544_SM_Cover.indd 36
11/17/14 7:45 PM
25. (a) The application of Dijkstra’s Algorithm is shown below: 12
13
20 6
2 13 0
4
7
1
8
3
8
5 12
14 32 7 29
5
16 9
21
4
7
6
3
21 19
Vertices
Routing Edge
Distance
1 3 2 5 4 6 7
(1,3) (3,2) (2,5) (2,4) (4,6) (6,7)
0 8 12 18 19 22 29
18
24 23 22
(b) The shortest path is 1 → 3 → 2 → 5 with cost 18. (c) The shortest path is 1 → 3 → 2 → 4 → 6 → 7 with cost 29. 26. (a) The application of Dijkstra’s Algorithm is shown below: 15
14
24 8
2 15 0
3
1
7
7
3
7
22
5 17
12 3
7
34 32
19 2
18
4 18 17
8 7
6 26 24
Vertices
Routing Edge
Distance
1 3 2 4 5 6 7
(1,3) (3,2) (2,4) (2,5) (4,6) (6,7)
0 7 14 17 22 24 32
(b) The shortest path is 1 → 3 → 2 → 4 with cost 17. (c) The shortest path is 1 → 3 → 2 → 5 with cost 22. (d) The shortest path is 1 → 3 → 2 → 4 → 6 → 7 with cost 32. Other Optimal Path Problems 27. We process the vertices in the order i = 1, 2, . . . , 9; at each step, the label on vertex i is added to each edge (i, j) leaving that vertex, possibly providing a new larger label for vertex j. This produces the routing edges shown next, together with the optimal vertex labels. Vertex 9 has the optimal value 620, corresponding to the maximum profit obtained from the longest path 1 → 2 → 5 → 7 → 9. This means selecting bids 3, 5, and 7.
33
K25544_SM_Cover.indd 37
11/17/14 7:45 PM
280
240 150
1
0
0
0
2 0
0
3 150
4
0
240
0
5 300
470
0
6
7
470
0
8
170 300
130
9
610 620
330
150
180
28. Apply the modified Dijkstra Algorithm, starting at vertex 1. This produces the routing edges shown below, along with the optimal vertex labels. Vertex 7 has the optimal value 0.288, corresponding to the most reliable path 1 → 2 → 3 → 6 → 7. 0.8 0.8 1
1
5
0.72
0.9
0.4 0.2592
0.9
3
0.8
0.648
0.56
0.7
2
7 0.288
0.8
0.9 0.8
0.75
4
0.7
0.75
0.5
6 0.525
0.576
29. Apply the modified Dijkstra Algorithm, starting at vertex 1. This produces the routing edges shown below, along with the optimal vertex labels. Vertex 6 has the strongest association value 0.576, corresponding to the path 1 → 4 → 5 → 6. 0.576 0.48 0.4 0.9
0.576 0.504
2
0.4 1
6
0.8 0.7
1
3
0.6
0.9
0.72
0.9
0.8
4
5
0.8
0.8
0.64
30. Create a network with vertices corresponding to hours and edges corresponding to shifts. Also, zero-cost edges are added to allow for overlap of shifts, giving the following network: 38 18
9
0
10
12
18 0
11
0
12
0
1
0
2
0
3
0
4
0
5
9
5 22
20
30
34
K25544_SM_Cover.indd 38
11/17/14 7:45 PM
Starting from vertex 9, apply Dijkstra’s Algorithm to produce the optimal values shown below: 38 18
9 0
0
10
0
11
0
23
12
0
30
1
0
18
18
12
18 41
2
0
3 41
5 22
0
52
4
0
5
53
9 20
30
The shortest path from 9 to 5 is given by 9 → 11 → 10 → 12 → 3 → 5 with cost 53. This corresponds to selecting shifts [9, 11], [10, 12], [12, 3], and [3, 5] for an overall cost of 53 hours. This indicates hiring applicants 2, 3, 4, and 8. Notice that the shifts [9, 11] and [10, 12] overlap for one hour in this optimal solution.
35
K25544_SM_Cover.indd 39
11/17/14 7:45 PM
Chapter 4
Routing Problems and Optimal Circuits Eulerian Circuits and Eulerian Paths 1. Yes, for example ABCDEBDF CGF EA. 2. No, vertex F has degree 5. 3. Yes, for example ABCDHM LHBGLKF GKJEF BEA. 4. Yes, for example ABEGF EDCBDF CAD. 5. Yes, for example EBDEGDCADF CGF . 6. No, there are four vertices A, C, E, G with odd degree. 7. The graph can be labeled as follows: C A D G
H
E B
F
An Eulerian path is AGHF GEHCBF EDCAB. Notice that the Eulerian path ends at vertex B, which has odd degree. 8. (a) This graph does not have an Eulerian circuit since A and G have odd degree. However, it does have an Eulerian path: ABEGF DACBDCF EDG. (b) This graph has an Eulerian circuit: ACBDF CDEF GEBA.
36
K25544_SM_Cover.indd 40
11/17/14 7:45 PM
(c) This graph does not have an Eulerian circuit or an Eulerian path since A, D, E, F have odd degree. 9. (a) This graph does not have an Eulerian circuit since B and G have odd degree. However, it does have an Eulerian path: BCEGCABDF EBF G. (b) This graph does not have an Eulerian circuit or an Eulerian path since A, C, D, H have odd degree. (c) This graph does have an Eulerian circuit: ABDHGF DAF CEGCA. Optimal Routing Problems 10. (a) No, vertices A and G have odd degree. (b) Add edges AD and DG, as seen in the augmented graph below. Then we can construct an Eulerian circuit that minimizes the number of repeated streets: ABEDCBDF EGDADGF CA. B
A
D
C
E
G
F
11. (a) No, vertices A, B, D, G have odd degree. (b) Add edges AG, BC, and CD, as seen in the augmented graph below. Then we can construct an Eulerian circuit that minimizes the number of repeated streets: ABCF BCEHF EDCDHGAF GA. B
C
F A
E
G
D
H
12. (a) No, vertices B, D, F, H have odd degree. (b) Add edges BD, EF , and EH, as seen in the following augmented graph. Then we can construct an Eulerian circuit that minimizes the number of repeated streets: ABDBECF EF IEHDEHGDA.
37
K25544_SM_Cover.indd 41
11/17/14 7:45 PM
A
B
C
E
D
G
F
I
H
13. (a) No, vertices A, E, I, M have odd degree. (b) Add edges AB, BE, IL, and LM , as seen in the augmented graph below. Then we can construct an Eulerian circuit that minimizes the number of repeated streets: ADIHDCABF GKLILHGCBEF JKM LM JEBA. A
E
B
C
F
G
J
K
D H
I
L
M
14. Vertices A, C, D, F have odd degree. The possible pairings are - AC(7), DF (3): total = 10 ← minimum-time pairing - AD(6), CF (5): total = 11 - AF (8), CD(7): total = 15 15. Vertices C, E, G, H have odd degree. The possible pairings are - CE(4), GH(4): total = 8 ← minimum-time pairing - CG(6), EH(3): total = 9 - CH(5), EG(5): total = 10 16. Vertices A, C, D, F have odd degree. The best pairing AC(7), DF (3) with added weight 10 is achieved by adding the edges AB, BC, and DF in the augmented graph below. A minimum-time route is ABF EBAF CBCDF DEA. 5
A
B
11 4
2
9
3 4
E 2
5
F 3
C 7
D
38
K25544_SM_Cover.indd 42
11/17/14 7:45 PM
17. Vertices C, E, G, H have odd degree. The best pairing is then CE(4), GH(4) with added weight 8, which is achieved by adding the edges BC, AB, AE, GJ, and HJ to the augmented graph below. A minimum-time route is AEDAEJDGJHF GJHBF CABCBA. A
2
1 2
3 1
B
1
2
5
F
3
D
C 2
G
5
E 3
2
3
4
H
J
1
18. (a) Vertices B and C have odd degree. A best pairing uses the edges BD, AD, and AC giving the (smallest) additional time 27. (b) Adding these edges produces a minimum-time route ACDBAEBDACEDA. A 21 16
B
7
9
5
13
E
C
8 11
18
D
19. (a) Vertices A, C, E, F have odd degree. The possible pairings are - AE(6), CF (7): total = 13 - AC(5), EF (7): total = 12 ← minimum-time pairing - AF (5), EC(9): total = 14 (b) The best pairing AC(5), EF (7) is achieved by adding the edges AB, BC, DE, and DF in the augmented graph below. A minimum-time route is AEF DEDF ABCF BDCBA. A 6
E
2
5 8
5
F
B 2
4
3
D
7 5
3
C
20. (a) Vertices A, B, C, E have odd degree. The possible pairings are - AB(8), CE(13): total = 21 ← minimum-time pairing - AC(9), BE(14): total = 23 - AE(12), BC(11): total = 23 39
K25544_SM_Cover.indd 43
11/17/14 7:45 PM
(b) The best pairing AB(8), CE(13) is achieved by adding the edges AF , BF , CD, and DE in the augmented graph below. A minimum-time route is ABCF AEGDEDCDF BF A.
40
K25544_SM_Cover.indd 44
11/17/14 7:45 PM
A 15
3
E 5
B 5 12
F 6
G
11
3
6
D
2
7
C
21. (a) In the diagram below, vertices B, D, F, G, I, K have odd degree. The best pairing is BK(3), DG(1), F I(1) giving an additional 5 time units. B
A
C
E
D G
F I
H
J
L K
(b) Adding edges BE, EH, HK, DG, and F I gives the augmented graph below. An optimal routing is ABCF IF EBEDGHILKHEHKJGDA. B
A
C
E
D G
F I
H
J
L K
Applications 22. (a) The graph representation is shown below: A
G
H
D
K
B
C
O
E
F
(b) Only vertices B and G have odd degree, meaning that an Eulerian path exists. One such path, starting at vertex B (and ending at vertex G), is BCBAGBKOKF EKGHDEHG.
41
K25544_SM_Cover.indd 45
11/17/14 7:45 PM
23. (a) The graph representation is shown below: 5
0
6
4 1
3
2
(b) Only vertices 2 and 6 have odd degree, meaning that an Eulerian path exists. One such path is 650360412432. This corresponds to lining up the eleven dominos as 65, 50, 03, 36, 60, 04, 41, 12, 24, 43, 32. 24. (a) The graph representation is shown below: 3 0 2 4
1
5 6
(b) Only vertices 2 and 5 have odd degree, meaning that an Eulerian path exists. One such path is 234214503165. This corresponds to lining up the eleven dominos as 23, 34, 42, 21, 14, 45, 50, 03, 31, 16, 65. 25. (a) Three Eulerian paths are CA → AG → GT → TT → TC → CA → AT → TG → GT → TA → AT → TC, CA → AG → GT → TA → AT → TG → GT → TT → TC → CA → AT → TC, CA → AT → TC → CA → AG → GT → TA → AT → TG → GT → TT → TC. (b) These paths correspond to target DNA sequences CAGTTCATGTATC, CAGTATGTTCATC, and CATCAGTATGTTC. 26. (a) The directed graph is shown below: GC T
C C
AC
T
G
CT
TG
AG A
C
A
GA
G
AT
G
T
CA
42
K25544_SM_Cover.indd 46
11/17/14 7:45 PM
(b) Three Eulerian paths are CA → AT → TG → GA → AC → CT → TG → GC → CA → AG → GC → CT, CA → AT → TG → GC → CA → AG → GC → CT → TG → GA → AC → CT, CA → AG → GC → CA → AT → TG → GC → CT → TG → GA → AC → CT. These paths correspond to target DNA sequences CATGACTGCAGCT, CATGCAGCTGACT, and CAGCATGCTGACT. 27. (a) The directed graph is shown below: GC T
C
AT
G
TG
G
C
CT T
A
TC
AC
T
G
C
CG
GG G
GA A
(b) Three Eulerian paths are AT → TC → CG → GG → GA → AC → CT → TG → GA → AT → TG → GC → CT, AT → TG → GC → CT → TG → GA → AT → TC → CG → GG → GA → AC → CT, AT → TC → CG → GG → GA → AT → TG → GA → AC → CT → TG → GC → CT. These paths correspond to target DNA sequences ATCGGACTGATGCT, ATGCTGATCGGACT, and ATCGGATGACTGCT.
43
K25544_SM_Cover.indd 47
11/17/14 7:45 PM
28. (a) The directed graph is shown next: TCC A
C C
AAT
ATC
CCA T
T
C
CAA
CAT
A
ATA
G
TAG
T
A
GCA
A
AGC
C
A
TGC
C
ATG
(b) Three Eulerian paths are ATG → TGC → GCA → CAT → ATC → TCC → CCA → CAT → ATA → TAG → AGC → GCA → CAA → AAT → ATC, ATG → TGC → GCA → CAT → ATA → TAG → AGC → GCA → CAA → AAT → ATC → TCC → CCA → CAT → ATC, ATG → TGC → GCA → CAA → AAT → ATC → TCC → CCA → CAT → ATA → TAG → AGC → GCA → CAT → ATC. These correspond to target DNA sequences ATGCATCCATAGCAATC, ATGCATAGCAATCCATC, and ATGCAATCCATAGCATC.
44
K25544_SM_Cover.indd 48
11/17/14 7:45 PM
Chapter 5
Traveling Salesmen and Optimal Orderings Hamiltonian Circuits 1. (a) No. Since vertices B, C, and E have degree two, any Hamiltonian circuit must use the edges AB, BG, CG, CD, DE, and EF . These edges form a path between A and F that visits all the vertices; however, there is no edge in the graph joining A and F . (b) Yes, for example ABGCHDF EA. (c) No. Since vertices A, C, and E have degree two, any Hamiltonian circuit must use the edges AB, AF , BC, CD, DE, and EF . However, then there is no way to include G in the tour without repeating a vertex. 2. (a) Yes, for example ABEDCGF A. (b) No. Since A, D, and G have degree two, any Hamiltonian circuit must use the edges AB, AE, CD, DE, CG, and F G. These edges form a path between B and F that visits all the vertices; however, there is no edge in the graph joining B and F . (c) No. Since A, C, and D have degree two, any Hamiltonian circuit must use the edges AB, AE, BC, CG, BD, DF . However, vertex B is then forced to use three incident edges, and this is not possible in a circuit. 3. The Hamiltonian circuit ABHGF ON M LKRST P QIJCDEA is displayed in the following diagram:
45
K25544_SM_Cover.indd 49
11/17/14 7:45 PM
A F O
G B
H
E
S
Q
I
N
T
P
M
R
J
L
K
C
D
4. The Hamiltonian circuit AEN OF GHIJKRQP T SM LDCBA is displayed in the diagram below: A F O
G B
H
P Q
I J
N
T
E
S M
R K
L
C
D
5. The associated graph is shown below. The Hamiltonian circuit ABDEJKGLHCF A provides a suitable patrol for the watchman. G
K
J
D
E
B
F
A
L
H
C
6. For the first stack of cubes use the edges BG, GB, RR, Y Y involving Cubes 1, 2, 3, 4. For the second stack of cubes, use the set of edges (disjoint from the first set) BY , Y R, RG, GB that form a circuit involving Cubes 1, 4, 2, 3. Then we place these two stacks together (sorted by cube number) to form a solution. Cube 1 2 3 4
First Stack B-G G-B R-R Y -Y
Second Stack B-Y R-G G-B Y -R
7. The directed graph for the puzzle is shown next:
46
K25544_SM_Cover.indd 50
11/17/14 7:45 PM
4
R
2
3 1
1 3
4
G
Y
2 3
2
4 1
B
For the first stack of cubes, use the edges GR, RY , Y B, BG that form a circuit involving Cubes 1, 3, 4, 2. For the second stack of cubes, use the edges (disjoint from the first set) RG, GY , Y B, BR that form a circuit involving Cubes 2, 4, 1, 3. Then we place these two stacks together (sorted by cube number) to form a solution. Cube 1 2 3 4
First Stack G-R B-G R-Y Y -B
Second Stack Y -B R-G B-R G-Y
8. The graph representation is shown below. We then seek a Hamiltonian circuit in the graph, such as 03512460. This corresponds to lining up seven dominos as 03, 35, 51, 12, 24, 46, and 60. 0 3
6
4
2
5
1
9. The graph representation is shown below. Observe that this graph does not have a Hamiltonian circuit. This can be seen by noting that vertices 3, 5, and 6 have degree two, so that edges 16, 64, 43, 32, 25, and 50 must be used. These edges form a path visiting all vertices, but there is no edge 01 present to complete a Hamiltonian circuit. So, the required arrangement is impossible. 1 6 0
4 5
3 2
47
K25544_SM_Cover.indd 51
11/17/14 7:45 PM
10. The graph representation is shown below. We then seek a Hamiltonian circuit in the graph, such as 05412630. This corresponds to lining up seven dominos as 05, 54, 41, 12, 26, 63, and 30. 0 5 6
4 3
1 2
11. The undirected Hamiltonian circuits in the graph shown below are ABCDEA, ABCEDA, ABDCEA, ABDECA, ABECDA, ABEDCA, ACBDEA, ACBEDA, ACDBEA, ACEBDA, ADBCEA, and ADCBEA. There are 12 such circuits since (5 − 1)! 4! 24 = = = 12. 2 2 2 A
E
B
D
C
12. The Hamiltonian circuits are ABCDEA ABCEDA ABECDA ABEDCA ACBEDA ADCBEA
with with with with with with
cost cost cost cost cost cost
47 + 41 + 21 + 35 + 38 = 182, 47 + 41 + 33 + 35 + 32 = 188, 47 + 40 + 33 + 21 + 32 = 173, 47 + 40 + 35 + 21 + 28 = 171, ← minimum total cost 28 + 41 + 40 + 35 + 32 = 176, 32 + 21 + 41 + 40 + 38 = 172.
13. The Hamiltonian circuits are ABCEDA ABDECA ACBDEA ACBEDA
with with with with
cost cost cost cost
18 + 19 + 13 + 15 + 21 = 86, 18 + 19 + 15 + 13 + 20 = 85, ← minimum total cost 20 + 19 + 19 + 15 + 17 = 90, 20 + 19 + 18 + 15 + 21 = 93, 48
K25544_SM_Cover.indd 52
11/17/14 7:45 PM
ACEBDA with cost 20 + 13 + 18 + 19 + 21 = 91, ADBCEA with cost 21 + 19 + 19 + 13 + 17 = 89. TSP Heuristics 14. Starting at vertex A, the tour is ACDEBA and its cost is 28 + 21 + 35 + 40 + 47 = 171: A 47
38 32 E
28 B
40 33
41
35
D
C 21
Starting at vertex C, the tour is CDAEBC and its cost is 21 + 32 + 38 + 40 + 41 = 172: A 47
38 32 E
28 B
40 33
41
35
D
C 21
Starting at vertex A gives a better tour than starting at vertex C. The Nearest Neighbor solution starting at A is, in fact, optimal. 15. Starting at vertex A, the tour is AECBDA and its cost is 17 + 13 + 19 + 19 + 21 = 89: A 17
18 21
E
20 B
18 19
13 15
19
D
C
Starting at vertex C, the tour is CEDBAC and its cost is 13 + 15 + 19 + 18 + 20 = 85: 49
K25544_SM_Cover.indd 53
11/17/14 7:45 PM
A 17
18 21
E
20 B
18 19
13 15
19
D
C
Starting at vertex C gives a better tour than starting at vertex A. The Nearest Neighbor solution starting at C is, in fact, optimal. 16. Starting at vertex A, the tour is ACEDBA and its cost is 14 + 11 + 25 + 30 + 17 = 97: A 16
17 18
E
14 B
26 11
30
25
22
D
C 13
Starting at vertex E, the tour is ECDABE and its cost is 11 + 13 + 18 + 17 + 26 = 85: A 16
17 18
E
14 B
26 11
30
25
22
D
C 13
Starting at vertex E gives a better tour than starting at vertex A. 17. Starting at vertex A, the tour is AEF CBDA and its cost is 4 + 5 + 6 + 11 + 13 + 12 = 51:
50
K25544_SM_Cover.indd 54
11/17/14 7:45 PM
A 8
9 14
4
B
7
F
12 11
11 6
7
5
C 13
17
E
12
15
D
Starting at vertex D, the tour is DF EABCD and its cost is 11 + 5 + 4 + 9 + 11 + 12 = 52: A 8
9 14
4
B
7
F
12 11
11 6
7
5
C 13
17
E
12
15
D
Starting at vertex A gives a better tour than starting at vertex D. 18. Starting at vertex C, the tour is CF BADEC and its cost is 6 + 10 + 11 + 8 + 13 + 17 = 65: A 17 10
11 12
9
F
B
8 15
14
E
17
16
10 6 C 18 23
13
D
Starting at vertex F , the tour is F CBADEF and its cost is 6 + 10 + 11 + 8 + 13 + 16 = 64: A 17
11 12
9
B
10
F
8 15
14
E
17
16
10 6 C 18 23
13
D
Starting at vertex F gives a better tour than starting at vertex C. 19. The cheapest edge leaving S = {B} leads to vertex D which gives the circuit BDB with cost 78. Then looking at all edges leaving S = {B, D}, the cheapest 51
K25544_SM_Cover.indd 55
11/17/14 7:45 PM
edge is DC so vertex C is added to S, giving the circuit BCDB with cost 101. The cheapest edge leaving S = {B, C, D} is CA so vertex A is added to S. Now vertex A needs to be inserted in the current circuit BCDB with the minimum additional cost. insert A between B and C: cost increase is 47 + 28 − 41 = 34 insert A between C and D: cost increase is 28 + 32 − 21 = 39 insert A between B and D: cost increase is 47 + 32 − 39 = 40 So A is added between B and C, giving the circuit BACDB with cost 135. Finally vertex E is added to S = {A, B, C, D} and needs to be inserted in the current circuit BACDB with the minimum additional cost. insert insert insert insert
E E E E
between between between between
B and A: cost increase is 40 + 38 − 47 = 31 A and C: cost increase is 38 + 33 − 28 = 43 C and D: cost increase is 33 + 35 − 21 = 47 D and B: cost increase is 35 + 40 − 39 = 36
So vertex E is inserted between B and A, producing the tour BEACDB with overall cost 166. 20. The cheapest edge leaving S = {C} leads to vertex E which gives the circuit CEC with cost 22. The cheapest edge leaving S = {C, E} is CD so vertex D is added to S, giving the circuit CDEC with cost 49. The cheapest edge leaving S = {C, D, E} is CA so vertex A is added to S. Now vertex A needs to be inserted in the current circuit CDEC with the minimum additional cost. insert A between C and D: cost increase is 14 + 18 − 13 = 19 insert A between D and E: cost increase is 18 + 16 − 25 = 9 insert A between E and C: cost increase is 16 + 14 − 11 = 19 So A is added between D and E, giving the circuit CDAEC with cost 58. Finally vertex B is added to S = {A, C, D, E} and needs to be inserted in the current circuit CDAEC with the minimum additional cost. insert insert insert insert
B B B B
between between between between
C and D: cost increase is 22 + 30 − 13 = 39 D and A: cost increase is 30 + 17 − 18 = 29 A and E: cost increase is 17 + 26 − 16 = 27 E and C: cost increase is 26 + 22 − 11 = 37
So vertex B is inserted between A and E, producing the tour CDABEC with overall cost 85. 21. The cheapest edge leaving S = {A} leads to vertex E which gives the circuit AEA with cost 34. The cheapest edge leaving S = {A, E} is EC so vertex C is added to S, giving the circuit ACEA with cost 48. The cheapest edge leaving S = {A, C, E} is ED so vertex D is added to S. Now vertex D needs to be inserted in the current circuit ACEA with the minimum additional cost.
52
K25544_SM_Cover.indd 56
11/17/14 7:45 PM
insert D between A and C: cost increase is 21 + 18 − 18 = 21 insert D between C and E: cost increase is 18 + 15 − 13 = 20 insert D between E and A: cost increase is 15 + 21 − 17 = 19 So D is added between E and A, giving the circuit ACEDA with cost 67. Finally vertex B is added to S = {A, C, D, E} and needs to be inserted in the current circuit ACEDA with the minimum additional cost. insert B between A and C: cost increase is 18 + 19 − 18 = 19 insert B between C and E: cost increase is 19 + 18 − 13 = 24 insert B between E and D: cost increase is 18 + 19 − 15 = 22 insert B between D and A: cost increase is 19 + 18 − 21 = 16 So vertex B is inserted between D and A, producing the tour ACEDBA with overall cost 83. Ordering Problems 22. (a) The graph of valid knight moves on this chessboard is shown below: 4
6
10
8
12
2
11
1
5
7
9
3
(b) A Hamiltonian circuit in the graph is 1 → 6 → 8 → 2 → 10 → 4 → 12 → 7 → 5 → 11 → 3 → 9 → 1. This translates into visiting in turn squares A, B, C, . . . , L, A on the chessboard: K H
A F C J
D I L G
B E
23. Label the squares of the chessboard as follows: 1 4 7
2 5 8
3 6 9
The graph of valid knight moves on this chessboard is shown next: 53
K25544_SM_Cover.indd 57
11/17/14 7:45 PM
6 7
1
8
5
2
9
3 4
As vertex 5 is isolated there can be no Hamiltonian path, and hence no such open Knight’s tour. However, there is a Knight’s tour that visits all squares except the center square 5: 1 → 6 → 7 → 2 → 9 → 4 → 3 → 8 → 1. 24. (a) We determine sites(a) = {1, 2, 3}, sites(b) = {1, 5}, sites(c) = {2, 4, 6}, sites(d) = {3, 4, 5, 6}, sites(e) = {2, 3, 5, 6}. This produces the graph shown below: e 1
2 2
3
1
a
b 1
1 c
1 d
2
(b) A largest weight Hamiltonian path is c → d → e → a → b of weight 8. (c) Since d is older than a, a probable chronology from oldest to most recent artifacts is c, d, e, a, b. 25. (a) We find sites(a) = {4, 5, 6}, sites(b) = {1, 2, 5, 7}, sites(c) = {1, 3, 4, 7}, sites(d) = {1, 2}, sites(e) = {2, 3, 4, 5, 6}. This produces the graph shown below: 1
a 1
2
c 1
3 2
b 2 2
d 1 e
(b) A largest weight Hamiltonian path is a → e → c → b → d of weight 9. (c) Since e is older than b, a probable chronology from oldest to most recent artifacts is a, e, c, b, d. 54
K25544_SM_Cover.indd 58
11/17/14 7:45 PM
26. (a) Suppose the vertices are A, B, C. Then there are 3 paths: ABC, ACB, BAC. (b) Suppose the vertices are A, B, C, D. Then there are 12 paths: ABCD, ABDC, ACBD, ACDB, ADBC, ADCB, BACD, BADC, BCAD, BDAC, CABD, CBAD. (c) The number of paths in (a) is 3!2 = 62 = 3; the number of paths in (b) is 4! 24 n! 2 = 2 = 12. In general, the number of paths of length n − 1 is 2 . 27. (a) The transformed graph H is shown below: 0
0 A -11
s
0 0
-10
-12
B -7 C
-9 -8
D
(b) Starting from vertex A in H, the Nearest Neighbor tour is ADBCsA of weight −28. This translates into the Hamiltonian path ADBC of weight 28 in G. (c) Starting from vertex B in H, the Nearest Neighbor tour is BADCsB of weight −30, giving path BADC of weight 30 in G. Starting from vertex C in H, the Nearest Neighbor tour is CADBsC of weight −32, giving path CADB of weight 32 in G. Starting from vertex D in H, the Nearest Neighbor tour is DACBsD of weight −30, giving path DACB of weight 30 in G. (d) The best solution found occurs when starting from vertex C: the Hamiltonian path CADB of weight 32. (e) The twelve Hamiltonian paths and their weights are ABCD (25), ABDC (27), ACBD (27), ACDB (28), ADBC (28), ADCB (27), BACD (29), BADC (30), BCAD (30), BDAC (32), CABD (30), CBAD (29). So, a largest weight path is BDAC with the maximum weight 32. This happens to be the same solution found by the NNA, starting at vertex C.
55
K25544_SM_Cover.indd 59
11/17/14 7:45 PM
28. (a) The transformed graph H is shown below: 0
-5
0
A -6 -7
B
D
-4
-3 C -1
s
0
-5
-1 -3 E
0
-3 -2
F
0
0
(b) Starting from vertex A in H, the Nearest Neighbor tour is ACDF EBsA of weight −19. This translates into the Hamiltonian path ACDF EB of weight 19 in G. (c) Starting from vertex B in H, the Nearest Neighbor tour is BACDF EsB of weight −23, giving path BACDF E of weight 23 in G. Starting from vertex C in H, the Nearest Neighbor tour is CADF EBsC of weight −21, giving path CADF EB of weight 21 in G. Starting from vertex F in H, the Nearest Neighbor tour is F DACBEsF of weight −22, giving path F DACBE of weight 22 in G. (d) Starting at vertex B gives a Hamiltonian path with the largest weight (23) among the options considered.
56
K25544_SM_Cover.indd 60
11/17/14 7:45 PM
Chapter 6
Vertex Colorings and Edge Matchings Maps, Graphs, and the Chromatic Number 1. (a) The graph representation has six vertices representing the six states and territories; edges indicate a common border. B
C
A
E F
D
(b) A vertex coloring with three colors is shown below. The chromatic number of the graph is 3; the graph cannot be colored with fewer colors since it contains a K3 subgraph (on vertices A, B, and D). 2
1 B
1
C
A
E
2
F
D 3
1
(c) The labeling indicates that A, C, and F (all labeled 1) could be colored red; B and E (both labeled 2) could be colored green; and D (labeled 3) could be colored yellow. In this coloring, no neighboring states or territories would have the same color. 2. (a) The graph representation has eight vertices representing the eight southern provinces; edges indicate a common border.
57
K25544_SM_Cover.indd 61
11/17/14 7:45 PM
B
A
C
E
F
G
H
D
(b) A vertex coloring with three colors is shown below. The chromatic number of the graph is 3; the graph cannot be colored with fewer colors since it contains a K3 subgraph (on vertices A, B, and C). 2 B 1
A
C
D
1
F 2
1 E
3
3
G
H
1
(c) The labeling indicates that A, D, E, and H (all labeled 1) could be colored red; B and F (both labeled 2) could be colored green; finally, C and G (both labeled 3) could be colored yellow. In this coloring, no neighboring provinces would have the same color. 3. (a) The graph representation has nine vertices representing the nine countries; edges indicate a common boundary. P
G
C
V
W
A
H
L
I
(b) A vertex coloring with four colors is shown next. The chromatic number of the graph is 4, as shown by a forcing argument. Suppose that only three colors are available. Start with V , H, A labeled 1, 2, 3, respectively; then L must be labeled 1, I must be labeled 2, W must be labeled 1, and G must be labeled 2; since C is then adjacent to vertices with colors 1, 2, 3, a fourth color must be needed. This means that the graph cannot be colored with fewer than four colors, so the given coloring is optimal.
58
K25544_SM_Cover.indd 62
11/17/14 7:45 PM
3 P 4
2
1
1
G
C
V
W
3 A
H
2
L
I 2
1
(c) The coloring indicates that L, V , and W (all labeled 1) could be colored red; G, H, and I (all labeled 2) could be colored green; A and P (both labeled 3) could be colored yellow; and C could be colored blue. In this coloring, no neighboring countries would have the same color. 4. (a) The graph representation of the diagram has eight vertices corresponding to the eight regions of the diagram; edges indicate adjacent regions. A
D
B C
F
E
G
H
(b) A vertex coloring with four colors is shown below. The chromatic number of the graph is 4, as shown by a forcing argument. Suppose that only three colors are available. Start with C, D, F labeled 1, 2, 3, respectively; then H must be labeled 2, G must be labeled 3, E must be labeled 2, and B must be labeled 3; since A is then adjacent to vertices with colors 1, 2, 3, a fourth color must be needed. This means that the graph cannot be colored with fewer than four colors, so the given coloring is optimal. 4 A 3
D
B
2
1 C 2
F
E
G
3
H
3
2
(c) The coloring indicates that C (labeled 1) could be colored red; D, E, and H (all labeled 2) could be colored green; B, F , and G (labeled 3) could be colored yellow; and A could be colored blue. In this coloring, no adjacent regions would have the same color.
59
K25544_SM_Cover.indd 63
11/17/14 7:45 PM
5. The vertex coloring below uses three colors. The chromatic number of the graph is 3; the graph cannot be colored with fewer colors since it contains a K3 subgraph (on vertices A, B, and C). 3
2 B
1
C
A
D F
1
E
2
3
6. The vertex coloring below uses four colors. The chromatic number of the graph is 4; the graph cannot be colored with fewer colors since it contains a K4 subgraph (on vertices D, E, F , and G). 1 A 3
1
4
2 B
C
D
E
F
G
3
2
7. If the graph has n vertices and n is even, then the chromatic number is 2; we can alternately assign colors 1 and 2 around the circuit. If n is odd, then the chromatic number is 3; in this case, we can alternately assign colors 1 and 2 around the circuit until reaching the last vertex, which must then receive color 3. 8. (a) The chromatic number of the wheel graph on six vertices is 4, shown by a forcing argument. Suppose that only three colors are available. Start with A, B, F labeled 1, 2, 3, respectively; then C must be labeled 1 and D must be labeled 2; since E is then adjacent to vertices with colors 1, 2, 3, a fourth color must be needed. This means that the graph cannot be colored with fewer than four colors, so the coloring shown below with four colors is optimal. 1 A 4
E
B
3
2
F
D
C
2
1
(b) The chromatic number of the wheel graph on seven vertices is 3, achieved by alternating colors 1 and 2 on the outside circuit, leaving the third color 60
K25544_SM_Cover.indd 64
11/17/14 7:45 PM
for the center vertex. The chromatic number is 3 since the graph contains a K3 subgraph (on vertices A, B, and G). 1 A 2
B
F
2
3 G 1
C
E
1
D 2
(c) The above results generalize for wheel graphs on n vertices. If n is odd, then the chromatic number is 3; we can alternately assign colors 1 and 2 around the circuit and then use color 3 for the center vertex. If n is even, then the chromatic number is 4; in this case, we can alternately assign colors 1 and 2 around the circuit until reaching the last vertex of the circuit, which must receive color 3. We then assign color 4 to the center vertex. 9. Suppose that only three colors are available. Start with A, B, and F labeled 1, 2, 3, respectively; then C must be labeled 1, and D must be labeled 2; since G is then adjacent to vertices with colors 1, 2, 3, a fourth color must be needed. This means that the graph cannot be colored with fewer than four colors, so the chromatic number is 4. Greedy Coloring Algorithm 10. Using the Greedy Coloring Algorithm and processing the vertices in alphabetical order, we obtain the following coloring with four colors: 2
1
3
A
C
D
F
G
E
4
B
1
2
1
This is not an optimal coloring; the graph can be colored with only three colors: 2
1
3
1
A
C
D
F
G
E
1
B
3
2
61
K25544_SM_Cover.indd 65
11/17/14 7:45 PM
11. Using the Greedy Coloring Algorithm and processing the vertices in alphabetical order, we obtain the following coloring with four colors: 1 A
2 B
1
D
E
F
G
H 2
J
C 4
3
1
3
1
This coloring is optimal as the graph contains a K4 subgraph (on vertices A, B, D, and E) and so requires at least four colors. 12. Using the Greedy Coloring Algorithm and processing the vertices in alphabetical order, we obtain the following coloring with four colors: 1 A 4
2 B
G
3
C
F
E
3
D
2
1
We can show that there can be no coloring using just three colors by a forcing argument. Suppose that only three colors are available. Start with A, B, C labeled 1, 2, 3, respectively; then D must be labeled 1, E must be labeled 2, and F must be labeled 3; since G is then adjacent to vertices with colors 1, 2, 3, a fourth color must be needed. This means that the graph cannot be colored with fewer than four colors, so the given coloring is optimal. 13. (a) Using the Greedy Coloring Algorithm and processing the vertices in alphabetical order, we obtain the following coloring with four colors. However, it is not optimal. 1 A 4
3
2 F
B
E
C D
1
2
(b) If instead the Greedy Coloring Algorithm is applied to vertices in the order D, C, E, F , B, A, we obtain the optimal coloring shown next, using three colors. Notice that the graph contains a K3 subgraph (on vertices A, B, and F ) and so requires at least three colors. 62
K25544_SM_Cover.indd 66
11/17/14 7:45 PM
2 A 1
3
3 F
B
E
C D
2
1
14. (a) Using the Greedy Coloring Algorithm and processing the vertices in alphabetical order, we obtain the following coloring with five colors. However, it is not optimal. 1 A 2
1
B
3 D
C
F
G
2
4
5
E
(b) If instead the Greedy Coloring Algorithm is applied to vertices in the order A, B, D, G, E, C, F , we obtain the optimal coloring below with four colors. Notice that the graph contains a K4 subgraph (on vertices D, E, F , and G) and so requires at least four colors. 1 A 2
4
B
1 D
C
F
G
3
4
2
E
Applications of Coloring 15. (a) The frequency interference graph is shown below: A F
B
E
C
D
63
K25544_SM_Cover.indd 67
11/17/14 7:45 PM
(b) The chromatic number of the graph is 4, which is achieved by the coloring shown below. Notice that the graph contains a K4 subgraph (on vertices A, B, E, and F ) and so requires at least four colors. This coloring translates into the assignment of towers to the four frequencies in the following way: frequency 1: A, C; frequency 2: B, D; frequency 3: F ; frequency 4: E. 1 A 3
4
F
B
E
C
2
2
1
D
16. (a) The frequency interference graph is shown below: C
B
A
G
D
F
H
E
(b) A forcing argument shows that the chromatic number of the graph is 4, which is achieved by the coloring shown below. This coloring translates into the assignment of towers to the four frequencies in the following way: frequency 1: E, G; frequency 2: A, C, H; frequency 3: D, F ; frequency 4: B. 4
2 C
B 1 G
2 A
3
3 D
F
H
2
E 1
64
K25544_SM_Cover.indd 68
11/17/14 7:45 PM
17. (a) The frequency interference graph is shown below: C D G E H
B
A F
(b) The chromatic number of the graph is 4, which is achieved by the coloring shown below. Notice that the graph contains a K4 subgraph (on vertices C, D, G, and H) and so requires at least four colors. This coloring translates into the assignment of towers to the four frequencies in the following way: frequency 1: E, G; frequency 2: A, C; frequency 3: D, F ; frequency 4: B, H. 2 C
3 1 G
D
E 4
1
H 4
B
A 3
2
F
18. (a) Suppose that only three colors are available. Start with A, B, C labeled 1, 2, 3, respectively; then D must be labeled 2, and E must be labeled 3; since F is then adjacent to vertices with colors 1, 2, 3, a fourth color must be needed. This means that the graph cannot be colored with fewer than four colors, so the chromatic number is 4. (b) A different coloring using four colors is shown below. This coloring translates into the assignment of courses to the four days in the following manner: day 1: A; day 2: B, E; day 3: C, F ; day 4: D. 2 B
3 C
1 A
D 4 F 3
E 2
65
K25544_SM_Cover.indd 69
11/17/14 7:45 PM
19. (a) The course interference graph is shown below: B A
D C
E
G
F
(b) The chromatic number of the graph is 4, which is achieved by the coloring shown below. Notice that the graph contains a K4 subgraph (on vertices C, E, F , and G) and so requires at least four colors. This coloring translates into the assignment of courses to the four days in the following manner: day 1: D, E; day 2: A, C; day 3: B, G; day 4: F . 3 B 2
A
2
D
1
C 1
E
G
3
F
4
20. (a) The conflict graph is shown below: B
A D
C
J
E
F
K
G
H
(b) Using the Greedy Coloring Algorithm and processing the vertices in alphabetical order, we obtain the following coloring with four colors:
66
K25544_SM_Cover.indd 70
11/17/14 7:45 PM
2 B 1 A 4
1
2
D
C 4
E
F
1
3
J K 1
G
H 3
(c) This coloring is optimal because the graph contains a K4 subgraph (on vertices A, B, C, and D). (d) This coloring translates into the assignment of fish to the four tanks in the following manner: tank 1: A, E, G, K; tank 2: B, F ; tank 3: C, H; tank 4: D, J. 21. (a) The conflict graph is shown below: B A
C F
D E
G
(b) The following gives a coloring with four colors. A forcing argument shows that the chromatic number of the graph is 4, so this coloring is optimal. This coloring translates into the assignment of chemicals to the four locations in the following manner: location 1: A, E; location 2: D, G; location 3: C, F ; location 4: B. 4 B 1
A
C
3 F 2
3
D 2 E
G
1
22. Vertices F , O, E are assigned the colors 1, 2, 3, respectively. This forces T to be assigned color 1, C to be assigned color 3, and I to be assigned color 2. Continuing in this fashion produces the coloring shown next, in which six vertices receive color 1 (A, B, D, F , G, T ), six vertices receive color 2 (I, J, L, O, W , Y ), and six vertices receive color 3 (C, E, P , R, S, X).
67
K25544_SM_Cover.indd 71
11/17/14 7:45 PM
3 X
1 F
1 B 3 2
E
O
I
2
3 C
1 T
1
L 2
G
D
1
3 R
W
2
2 3 P
J
A 1 Y
3 S
2
Matchings 23. The matching shown below with three edges is a maximum matching. It is also a perfect matching because it includes all vertices. A B
C D F
E
24. The matching shown below with three edges is a maximum matching. It is not a perfect matching because vertex C is not included. A B
C D F
E G
68
K25544_SM_Cover.indd 72
11/17/14 7:45 PM
25. The matching shown below with five edges is a perfect matching, as every vertex is included in the matching. B
C A
J H
E G
D
I
F
26. The bipartite graph is shown below. A maximum matching consists of the four edges (A, H), (B, G), (C, F ), and (D, E). Since the vertex cover A, B, C, D has four vertices, there can be at most four edges in any maximum matching. So, this matching is a maximum matching of the four pilots to the four copilots: A with H, B with G, C with F , and D with E. A
E
B
F
C
G
D
H
27. The bipartite graph is shown below. A maximum matching consists of the four edges (A, M ), (B, F ), (C, P ), and (D, G). Since the vertex cover A, B, C, D has four vertices, there can be at most four edges in any maximum matching. So, this matching is a maximum matching and provides an assignment of the four instructors to four different courses: A teaches Math, B teaches French, C teaches Physics, and D teaches German. A
F
B
G
C
M
D
P
69
K25544_SM_Cover.indd 73
11/17/14 7:45 PM
28. (a) The bipartite graph of compatibilities is shown below: A
a
B
b
C
c
D
d
E
e
(b) A maximum matching consists of the four edges (A, b), (B, c), (C, d), and (D, e). Since the vertex cover B, b, d, e has four vertices, there can be at most four edges in any maximum matching. So, this matching is a maximum matching of size four. (c) Since a maximum matching has size four, it is not possible to assign all the five antibiotics to five different volunteers. We can however provide an assignment of four antibiotics to four different volunteers: A receives antibiotic b, B receives antibiotic c, C receives antibiotic d, and D receives antibiotic e.
70
K25544_SM_Cover.indd 74
11/17/14 7:45 PM
Chapter 7
Inductive and Deductive Arguments Inductive Arguments and Counterexamples 1. This is a weak inductive argument based on insufficient evidence. If you had pulled out 30 cans of Diet Pepsi, the argument would be stronger. 2. This is a weak inductive argument because there is no evidence directly supporting the contention that elephants can fly. All elephants observed have not flown. The fact that the conclusion has not been disproven does nothing at all to support the conclusion being true. 3. This is a strong inductive argument, even though it is possible that a giant asteroid could obliterate the moon. 4. This is a weak inductive argument. The winning numbers in a lottery game are randomly chosen for each game. The probability of any ticket containing the winning numbers is the same as the probability of any other ticket containing those winning numbers. Past success or failure does not have any bearing on the current odds of winning. 5. This is a strong inductive argument only if the evidence is something you care about. For example, if you become quickly overheated in the sun and prefer to walk the beach on a cloudy day, then this would be a weak inductive argument. 6. This is a strong inductive argument, since the sample is representative of the population with respect to properties that are relevant to the issue. 7. This inductive argument is strong, but more evidence is needed. Did the neighbors see anything? Are there any fingerprints in the house, other than those of the family? Could someone in the family have made it look like a burglary in order to collect insurance money? 71
K25544_SM_Cover.indd 75
11/17/14 7:45 PM
Inductive Puzzles 8. Yes, the argument is strong because a fairly simple pattern fits all the data. We would predict the next two numbers to be 37 = 62 + 1 and 50 = 72 + 1. 9. (a) 4 can be written as 4, 3+1, 2+2, 2+1+1, 1+3, 1+2+1, 1+1+2, 1+1+1+1, giving 8 = 23 compositions. (b) 5 can be written as 5, 4+1, 3+2, 3+1+1, 2+3, 2+2+1, 2+1+2, 2+1+1+1, 1+4, 1+3+1, 1+2+2, 1+2+1+1, 1+1+3, 1+1+2+1, 1+1+1+2, 1+1+1+1+1, giving 16 = 24 compositions. (c) The integer n has 2n−1 compositions. 10. (a) 3 can be written as 3+0+0, 2+1+0, 2+0+1, 1+2+0, 1+1+1, 1+0+2, 0+3+0, 0+2+1, 0+1+2, 0+0+3, giving 10 = (4 × 5)/2 tripartite compositions. (b) 4 can be written as 4+0+0, 3+1+0, 3+0+1, 2+2+0, 2+1+1, 2+0+2, 1+3+0, 1+2+1, 1+1+2, 1+0+3, 0+4+0, 0+3+1, 0+2+2, 0+1+3, 0+0+4, giving 15 = (5 × 6)/2 tripartite compositions. (c) The number of tripartite compositions for n = 1, 2, 3, 4 follows the pattern 3, 6, 10, 15 where the differences between successive values are 3, 4, 5. So we predict the next value to be 15 + 6 = 21. A general formula is (n + 1)(n + 2)/2. 11. It is highly probable that the native is a knight (telling the truth) because the probability he would say the same wrong name that Abercrombie was thinking of is low. 12. A knight (a truth-teller) would not say “I am a knave and there is no gold on this island” because such a statement is true only if both of its component statements are true, meaning that this native is a knave (a liar), a contradiction. Therefore the native must be a knave, whose statements are always false. Since the first part of this compound claim “I am a knave and there is no gold on this island” is true, the second part “there is no gold on this island” must then be false. Abercrombie can validly conclude there must be gold on the island. Deductive Arguments and Venn Diagrams 13. The argument is invalid. Let A be the set of people who live in the Bayou, and let B be the set of people who are familiar with hurricanes. So A is a subset of B, as shown in the following Venn diagram. Let x represent Marisa. Notice that x needs to be placed inside B; however, x can be placed either inside set A or outside. For example, Marisa could live on the Florida coast.
72
K25544_SM_Cover.indd 76
11/17/14 7:45 PM
B A x x
14. The argument is valid. Let A be the set of people who like James Patterson fiction and let B be the set of people who like Lee Child fiction. So A is a subset of B, as shown in the Venn diagram below. Let x represent Omar. Notice that x needs to be placed inside A, and so x is necessarily inside B. That is, Omar (x) necessarily likes Lee Child fiction.
B A x
15. Let A be the set of students who receive an A on the calculus exam and let B be the set of students who pass the calculus course. Jones (x) did not receive an A, so that x needs to be placed outside the set A. However, x could be placed inside or outside of B, so the argument is invalid. A counterexample would be the situation in which Jones gets the grade of C on the exam, and yet passes the calculus course. In other words, there is a scenario in which the premises are true and the conclusion is false.
B A x x
Deductive Puzzles 16. To explain the deductive logic and order of the inferences, we label the 4 blocks and the 16 cells in the 4 × 4 grid as follows: 73
K25544_SM_Cover.indd 77
11/17/14 7:45 PM
A1 A3 C1 C3
A2 A4 C2 C4
B1 B3 D1 D3
B2 B4 D2 D4
Cell A2 must contain 3, since 2 and 4 occur already in its row and 1 occurs already in its block. That means A4 must contain 2 and B2 must contain 1. Cell B3 must contain 3, since 2 and 4 occur already in its column and 1 occurs already in its block. That means B4 must contain 4. We can then assign 1 to D1 and 2 to D4, as these are the only options available. Cell C2 must contain 4, since 1 and 3 occur already in its row and 2 occurs already in its column. That means C4 must contain 1. Finally, C1 is assigned 2 and C3 is assigned 3, as these are the only options available. The completed Sudoku is shown below: 4 1 2 3
3 2 4 1
2 3 1 4
1 4 3 2
17. The clues show that the third floor is visited right after the basement. Also, the fourth floor is visited some time after the second floor, which is visited some time after the first floor, which is visited some time after the basement. The only schedule consistent with these clues is: basement, third floor, first floor, second floor, fourth floor. So, Miguel’s mail delivery schedule is 8:00 basement, 8:20 third floor, 8:40 first floor, 9:00 second floor, and 9:20 fourth floor. Fallacies 18. False dichotomy 19. Red herring. To distract from the argument, he inserts a new criterion for winning: that the answer with the most letters wins. 20. Personal attack 21. Circular reasoning 22. False dichotomy 23. Slippery slope 24. False analogy 74
K25544_SM_Cover.indd 78
11/17/14 7:45 PM
25. Straw man 26. Causation/correlation 27. Hasty generalization 28. Causation/correlation 29. Red herring 30. False analogy 31. Circular reasoning 32. (1) false dichotomy, (2) popularity, (3) false analogy, (4) slippery slope, (5) personal attack, (6) popularity.
75
K25544_SM_Cover.indd 79
11/17/14 7:45 PM
Chapter 8
Deductive Arguments and Truth-Tables Symbolization 1. p = “The candidate has wealthy supporters” q = “The candidate campaigns hard” r = “The candidate will be elected” (p ∧ q) → r 2. p = “It requires skill to climb the mountain” q = “It requires courage to climb the mountain” p∨q 3. p q r s
= = = =
“Smith “Smith “Smith “Smith
is sick” needs a doctor” is in an accident” needs a lawyer”
(p → q) ∧ (r → s) 4. p = “Canada is in the Eastern Hemisphere” q = “The U.S. is in the Eastern Hemisphere” ∼p ∧ ∼q 5. p = “Emily Dickinson was a poet” q = “Walt Whitman was a poet” p∧q 6. p = “You are able to run a distance of over 5 kilometers” q = “You are physically fit” p→q 76
K25544_SM_Cover.indd 80
11/17/14 7:45 PM
7. p = “You can take math to satisfy the quantitative reasoning requirement” q = “You can take statistics to satisfy the quantitative reasoning requirement” p∨q 8. p = “Everyone here is an Independent” q = “Everyone here is a Republican” (p ∨ q) ∧ ∼(p ∧ q) 9. p = “Louis can drive” q = “Rosa can drive” ∼p ∧ ∼q 10. p = “We make improvements in health information technology” q = “We achieve low-cost, high-quality health care” q→p 11. p = “You are the president” q = “You are the provost” (p → ∼q) ∧ (q → ∼p) 12. p = “You will eat Thai food for dinner” q = “You will eat Mexican food for dinner” ∼(p ∨ q) Truth-Values of Compound Statements 13. p = “The Pope is Catholic” q = “Mars is a planet” r = “The sun revolves around Mars” p → (q ∧ r) T → (T ∧ F) T→F F 14. p = “Clinton is a Republican” q = “Bush is a Democrat” ∼p ∧ ∼q ∼F ∧ ∼F T∧T T 15. p = “Red is a primary color” q = “Blue is a primary color” r = “Orange is a primary color” 77
K25544_SM_Cover.indd 81
11/17/14 7:45 PM
(p ∧ q) → ∼r (T ∧ T) → ∼F T→T T 16. p = “Chicago is in Illinois” q = “Chicago is in Indiana” r = “Chicago is in Iowa” (p ∨ q) → ∼r (T ∨ F) → ∼F T→T T 17. p = “Pears are vegetables” q = “Carrots are vegetables” r = “Apples are fruits” (p ∧ q) ∨ r (F ∧ T) ∨ T F∨T T Truth-Tables for Compound Statements 18. The solution is shown below: p T T F F
q T F T F
p∧q T F F F
∼q F T F T
(p ∧ q) → ∼q F T T T
19. The solution is shown below: p T T F F
q T F T F
p→q T F T T
∼(p → q) F T F F
∼(p → q) ∧ p F T F F
20. The solution is shown below: p T T F F
q T F T F
∼p F F T T
∼p ∧ q F F T F
∼p → q T T T F
(∼p ∧ q) ∨ (∼p → q) T T T F
78
K25544_SM_Cover.indd 82
11/17/14 7:45 PM
21. The solution is shown below: p T T T T F F F F
q T T F F T T F F
r T F T F T F T F
p∨q T T T T T T F F
∼r F T F T F T F T
∼r ∧ p F T F T F F F F
(p ∨ q) → (∼r ∧ p) F T F T F F T T
22. The solution is shown below: p T T T T F F F F
q T T F F T T F F
r T F T F T F T F
∼p F F F F T T T T
∼q F F T T F F T T
∼r F T F T F T F T
∼p ∨ ∼q F F T T T T T T
∼r → q T T T F T T T F
(∼p ∨ ∼q) ∧ (∼r → q) F F T F T T T F
Symbolization of Arguments 23. p = “The contract is legal” q = “The contract was drawn up using appropriate terminology” r = “Smith signed it in front of witnesses” P1: (q ∧ r) → p P2: r ∧ q C: p 24. p = “Robbery was the motive for the crime” q = “Revenge was the motive for the crime” r = “The victim has his wallet in his pocket” P1: p ∨ q P2: r → ∼p P3: ∼r C: ∼q 25. p = “Epidemic X can be prevented” q = “We provide an adequate number of inoculations” r = “We have to quarantine infected persons”
79
K25544_SM_Cover.indd 83
11/17/14 7:45 PM
P1: q → p P2: q → ∼r P3: r C: ∼p 26. p = “San Diego is south of Los Angeles” q = “San Diego is south of San Francisco” P1: ∼p → ∼q P2: q C: p 27. p = “You are interested in volcanoes” q = “You visited Mt. Vesuvius” r = “You visited Mt. Etna” s = “You visited Mauna Loa” t = “You visited Kilauea” P1: p → q P2: q → r P3: r → (s ∧ t) P4: ∼t C: ∼p Validity and Invalidity of Arguments 28. p = “Congress is willing to implement reform” q = “The tax code will be simplified” P1: p → q P2: ∼p C: ∼q C p T T F F
q T F T F
P1 p→q T F T T
P2 ∼p F F T T
P1 ∧ P2 (p → q) ∧ ∼p F F T T
C ∼q F T F T
(P1 ∧ P2) → C → T T F T
The argument is invalid since the third row of the truth-table evaluates to F. 29. p = “Inflation is under control” q = “The stock market will crash” P1: ∼p → q P2: ∼p C: q
80
K25544_SM_Cover.indd 84
11/17/14 7:45 PM
p T T F F
C q T F T F
P2 ∼p F F T T
P1 ∼p → q T T T F
P1 ∧ P2 (∼p → q) ∧ ∼p F F T F
(P1 ∧ P2) → C → T T T T
The final column of the truth-table contains all true values, so the argument is valid. 30. p = “K-12 education improves in the U.S.” q = “Standards for student performance at each level are implemented” r = “Parents become more involved” P1: p → (q ∧ r) P2: ∼q C: ∼p
p T T T T F F F F
q T T F F T T F F
r T F T F T F T F
q∧r T F F F T F F F
P1 p → (q ∧ r) T F F F T T T T
P2 ∼q F F T T F F T T
P1 ∧ P2 (p → (q ∧ r)) ∧ ∼q F F F F F F T T
C ∼p F F F F T T T T
(P1 ∧ P2) → C → T T T T T T T T
The final column of the truth-table contains all true values, so the argument is valid. 31. p = “Unemployment is high” q = “Kids join gangs” r = “Prisons are overcrowded” P1: p → q P2: q → r P3: p C: r
81
K25544_SM_Cover.indd 85
11/17/14 7:45 PM
P3 p T T T T F F F F
q T T F F T T F F
C r T F T F T F T F
P1 p→q T T F F T T T T
P2 q→r T F T T T F T T
P1 ∧ P2 ∧ P3 (p → q) ∧ (q → r) ∧ p T F F F F F F F
(P1 ∧ P2 ∧ P3) → C → T T T T T T T T
The final column of the truth-table contains all true values, so the argument is valid.
82
K25544_SM_Cover.indd 86
11/17/14 7:45 PM
Chapter 9
Deductive Arguments and Derivations Assigning Truth-Values to Prove Invalidity 1. We start by making C false by setting p = T and r = F. Since P1 is to be true and p = T, we get q = T. Then we verify that P2 is true: F → T is true. So, we have an assignment p = T, q = T, r = F that makes all premises true, yet the conclusion is false. The argument is shown to be invalid. 2. We start by making C false by setting p = T and t = F. Since P3 is to be true, we get s = F. Then s ∧ t = F and so to make P2 true, we need r = F. Since P1 is to be true where p = T and r = F, we have q = T. So, the assignment p = T, q = T, r = F, s = F, t = F makes all premises true, yet the conclusion is false. The argument is shown to be invalid. 3. We start by making C false by setting p = F and s = F. Since P2 is to be true and s = F, we get r = F. Since P3 is to be true and r = F, we get q = T. So, the assignment p = F, q = T, r = F, s = F makes all premises true, yet the conclusion is false. The argument is shown to be invalid. Derivations and Valid Arguments 4. A solution is given below: 1. 2. 3. 4. 5. 6.
p ∨ (q ∧ r) p→r ∼r ∼p q∧r ∴q
Given Given Given 2, 3, MT 1, 4, DS 5, SMP
83
K25544_SM_Cover.indd 87
11/17/14 7:45 PM
5. A solution is given below: 1. 2. 3. 4. 5. 6. 7. 8.
(p ∨ q) → (r ∧ s) (s ∨ t) → u p p∨q r∧s s s∨t ∴u
Given Given Given 3, ADD 1, 4, MP 5, SMP 6, ADD 2, 7, MP
6. A solution is given below: 1. 2. 3. 4. 5. 6. 7.
p→r ∼p → q q→s ∼r ∼p q ∴s
Given Given Given Given 1, 4, MT 2, 5, MP 3, 6, MP
7. A solution is given below: 1. 2. 3. 4. 5. 6. 7. 8. 9.
p → (q ∧ r) (q ∨ u) → t s∨p ∼s p q∧r q q∨u ∴t
Given Given Given Given 3, 4, DS 1, 5, MP 6, SMP 7, ADD 2, 8, MP
8. A solution is given below: 1. (p → ∼q) ∧ (r → s) 2. (∼q → t) ∧ (s → ∼m) 3. (∼t → ∼n) ∧ (∼m → u) 4. p ∧ r 5. r 6. r → s 7. s 8. s → ∼m 9. ∼m 10. ∼m → u 11. u 12. ∴ ∼n ∨ u
Given Given Given Given 4, SMP 1, SMP 5, 6, MP 2, SMP 7, 8, MP 3, SMP 9, 10, MP 11, ADD
84
K25544_SM_Cover.indd 88
11/17/14 7:45 PM
Derivations and Derivation Graphs 9. (a) p = “We visit Norway” q = “We stay in Stockholm” r = “We stay in Oslo” P1. p → ∼q P2. ∼q → r P3. ∼r C. ∼p (b) A solution is given below: 1. p → ∼q Given 2. ∼q → r Given 3. ∼r Given 4. ∼∼q 2, 3, MT 5. ∴ ∼p 1, 4, MT (c) The associated derivation graph is p
~q
~q
r
~r
MT
~ ~q
MT
~p
10. (a) p q r s
= “Portugal boycotts the alliance” = “Brazil joins the alliance” = “Argentina boycotts the alliance” = “Chile boycotts the alliance” P1. ∼q → (p ∧ r) P2. q → ∼s P3. s C. p (b) A solution is given below: 1. ∼q → (p ∧ r) Given 2. q → ∼s Given 3. s Given 4. ∼∼s 3, DN 5. ∼q 2, 4, MT 6. p ∧ r 1, 5, MP 7. ∴ p 6, SMP 85
K25544_SM_Cover.indd 89
11/17/14 7:45 PM
(c) The associated derivation graph is ~q
q
(p r)
~s
s DN
~ ~s
MT
~q
MP
p r SMP
p
11. (a) m = “Maria goes to the party” c = “Caitlin goes to the party” t = “Tamika goes to the party” r = “Rhonda goes to the party” P1. m → ∼c P2. t → ∼r P3. m ∨ t P4. r C. ∼c (b) A solution is given below: 1. m → ∼c Given 2. t → ∼r Given 3. m ∨ t Given 4. r Given 5. ∼∼r 4, DN 6. ∼t 2, 5, MT 7. m 3, 6, DS 8. ∴ ∼c 1, 7, MP
86
K25544_SM_Cover.indd 90
11/17/14 7:45 PM
(c) The associated derivation graph is t
r
~r
m t
m
~c
DN
~ ~r
MT
~t
DS
m
MP
~c
Indirect Proofs and Valid Arguments 12. A solution is given below: 1. 2. 3. 4. 5. 6.
p→q p∨q ∼q p ∼p ∴q
Given Given Assume (IP) 2, 3, DS 1, 3, MT 3, 4, 5, IP
13. A solution is given below: 1. 2. 3. 4. 5. 6. 7.
∼p ∧ ∼s r→q ∼p → r ∼r ∼∼p ∼p ∴r
Given Given Given Assume (IP) 3, 4, MT 1, SMP 4, 5, 6, IP
87
K25544_SM_Cover.indd 91
11/17/14 7:45 PM
14. A solution is given below: 1. 2. 3. 4. 5. 6. 7. 8. 9.
p→r ∼p → q q→s ∼r ∼s ∼q ∼p q ∴r
Given Given Given Given Assume (IP) 3, 5, MT 1, 4, MT 2, 7, MP 5, 6, 8, IP
15. A solution is given below: 1. 2. 3. 4. 5. 6. 7. 8. 9.
(s ∨ p) → ∼q r→q ∼q → r ∼∼(s ∨ p) (s ∨ p) ∼q r ∼r ∴ ∼(s ∨ p)
Given Given Given Assume (IP) 4, DN 1, 5, MP 3, 6, MP 2, 6, MT 4, 7, 8, IP
16. (a) A solution is 1. p → ∼q 2. ∼q → r 3. ∼r 4. ∼∼p 5. p 6. ∼q 7. r 8. ∴ ∼p
given below: Given Given Given Assume (IP) 4, DN 1, 5, MP 2, 6, MP 3, 4, 7, IP
88
K25544_SM_Cover.indd 92
11/17/14 7:45 PM
(b) The associated derivation graph is ~ ~p
p
~q
~q
r
~r
DN
p
MP
~q
MP
r IP
~p
Indirect Proofs and Derivation Graphs 17. (a) p = “Steve has his parking permit” q = “Steve’s car is out of gas” r = “Steve’s car starts” P1. ∼p ∨ q P2. p ∨ ∼r P3. ∼q ∨ ∼r C. ∼r (b) A solution is given below: 1. ∼p ∨ q Given 2. p ∨ ∼r Given 3. ∼q ∨ ∼r Given 4. ∼∼r Assume (IP) 5. ∼q 3, 4, DS 6. ∼p 1, 5, DS 7. p 2, 4, DS 8. ∴ ∼r 4, 6, 7, IP
89
K25544_SM_Cover.indd 93
11/17/14 7:45 PM
(c) The associated derivation graph is p
~r
~ ~r
~q
~r
~p
q
DS
DS
p
~q
DS
~p
IP
~r
18. (a) p = “Melissa visits her aunt” q = “Melissa will go to traffic court” r = “Melissa has dinner with Lauren” P1. ∼p → q P2. p → ∼r P3. ∼p ∨ r C. q (b) A solution is 1. ∼p → q 2. p → ∼r 3. ∼p ∨ r 4. ∼q 5. ∼∼p 6. p 7. ∼r 8. ∼p 9. ∴ q
given below: Given Given Given Assume (IP) 1, 4, MT 5, DN 2, 6, MP 3, 7, DS 4, 6, 8, IP
90
K25544_SM_Cover.indd 94
11/17/14 7:45 PM
(c) The associated derivation graph is ~q
~p
p
q
~r
~p
r
MT
~~p DN
p MP
~r
DS
~p
IP
q
19. (a) p = “I go to Chicago” q = “I go to Cleveland” r = “I go to Minneapolis” s = “I go to Madison” t = “I go to Ann Arbor” P1. (p ∨ q) → (p → ∼r) P2. (∼s ∨ t) → (p ∧ r) C. s (b) A solution is given below: 1. (p ∨ q) → (p → ∼r) 2. (∼s ∨ t) → (p ∧ r) 3. ∼s 4. ∼s ∨ t 5. p ∧ r 6. p 7. p ∨ q 8. p → ∼r 9. ∼r 10. r 11. s
Given Given Assume (IP) 3, ADD 2, 4, MP 5, SMP 6, ADD 1, 7, MP 6, 8, MP 5, SMP 3, 9, 10, IP
91
K25544_SM_Cover.indd 95
11/17/14 7:45 PM
(c) The associated derivation graph is ~s
(~s
t)
(p
r)
(p
q)
(p
~ r)
ADD
~s
t
MP
p
r
SMP ADD
p
p
q
SMP
MP
p
~r
MP
r
~r IP
s
Counterexamples to Conjectures 20. Let x = 1 and y = −1. Then 12 = (−1)2 yet 1 �= −1. 21. Let x = 1 and y = 1. Then (1 + 1)2 = 4 and 4xy = 4(1)(1) = 4, but 4 > 4 is false. 22. If x = 0.5, then (0.5)3 = 0.125 and (0.5)2 = 0.25, but 0.125 > 0.25 is false. 23. Let n = 6. Then n2 = 36 is evenly divisible by 4, but n = 6 is not evenly divisible by 4. 24. Let n = 6. Then (2 × 3 × 5 × 7 × 11 × 13) + 1 = 30,031 = 59 × 509, showing that (2 × 3 × 5 × 7 × 11 × 13) + 1 is not prime. Mathematical Induction 25. Initial Step: Verify the claim for the initial case (namely n = 8). When n = 8, we can make 8 cents by using one 3-cent coin and one 5-cent coin: 8 = 3(1) + 5(1). Thus, P(8) is true. Inductive Hypothesis: We assume P(n) holds for some n = k ≥ 8 (k is an integer). Inductive Step: We need to consider how to extend the truth of P(k) so that the claim continues to hold for the next larger value n = k + 1. We reason that if the change for k cents uses a 5-cent coin, we can replace it with two 3-cent 92
K25544_SM_Cover.indd 96
11/17/14 7:45 PM
coins to form k + 1 cents. Otherwise, the change for k cents uses only 3-cent coins; since k ≥ 8 we must have at least three 3-cent coins. We can replace these three 3-cent coins with two 5-cent coins and thereby make change for k + 1 cents. So, in either case we can make change for k + 1 cents using only 3-cent coins and 5-cent coins, based on assuming it is possible to make change for k cents. Conclusion: P(n) holds for all n ≥ 8. 26. Initial Step: When n = 1 the tree has just one vertex, and so has no edges. Since n − 1 = 1 − 1 = 0, P(1) holds. Inductive Hypothesis: We assume that P(n) holds for n = k ≥ 1 (k is an integer). Inductive Step: We want to extend the truth of P(k) so that the claim continues to hold for the next larger value n = k + 1. Suppose that Tk+1 is a tree on k + 1 vertices. We then need to show that Tk+1 has (k + 1) − 1 = k edges. To do this, notice that Tk+1 can be obtained by adding a new vertex k + 1 to a tree Tk on k vertices and joining it to one of the existing vertices of Tk . Thus, Tk+1 has one more edge than Tk . By the inductive hypothesis Tk has k − 1 edges, so Tk+1 must have (k − 1) + 1 = k edges. This establishes the truth of P(k + 1). Conclusion: P(n) holds for all n ≥ 1. 27. Initial Step: When n = 6 the inequality states that 62 − 5(6) − 1 = 5 > 0, which is true. So, P(6) holds. Inductive Hypothesis: We assume that P(n) holds for n = k ≥ 6 (k is an integer). That is, k2 − 5k − 1 > 0. Inductive Step: We want to verify that the inequality holds for n = k + 1. To do so, we express A = (k + 1)2 − 5(k + 1) − 1 = k 2 + 2k + 1 − 5k − 5 − 1 = (k2 − 5k − 1) + (2k − 4). By the inductive hypothesis, k 2 − 5k − 1 > 0. Since k ≥ 6, we also have 2k − 4 ≥ 2(6) − 4 = 8 > 0. Then A is the sum of two positive integers, giving A > 0. This establishes that P(k + 1) holds. Conclusion: P(n) holds for all n ≥ 6. By the way, when n = 5 the inequality fails since 52 − 5(5) − 1 = −1 < 0. 28. Initial Step: When n = 1 the formula gives a1 = 1 + 1 = 2, which is correct. So, the formula an = n + 1 holds for n = 1. Inductive Hypothesis: We assume that the formula holds for n = k ≥ 1 (k is an integer). That is, ak = k + 1. Inductive Step: We need to show that the formula holds for n = k + 1 ≥ 2. To do so, we apply the definition, using the fact that ak = k +1: ak+1 = 2ak −k = 2(k + 1) − k = 2k + 2 − k = k + 2 = (k + 1) + 1. This verifies that the formula holds for n = k + 1. Conclusion: The formula holds for all n ≥ 1. 93
K25544_SM_Cover.indd 97
11/17/14 7:45 PM
29. Initial Step: When n = 1 the formula gives b1 = (1 − 1)2 + 3 = 3, which is correct. So, the formula bn = (n − 1)2 + 3 holds for n = 1. Inductive Hypothesis: We assume that the formula holds for n = k ≥ 1 (k is an integer). That is, bk = (k − 1)2 + 3. Inductive Step: We need to show that the formula holds for n = k + 1 ≥ 2. To do so, we apply the definition, using the fact that bk = (k − 1)2 + 3: bk+1 = bk + 2k − 1 = (k − 1)2 + 3 + 2k − 1 = k 2 − 2k + 1 + 3 + 2k − 1 = k 2 + 3 = ((k + 1) − 1)2 + 3. This verifies that the formula holds for n = k + 1. Conclusion: The formula holds for all n ≥ 1. 30. Initial Step: When n = 1 the tree has one level and so consists of a single vertex. For n = 1 the formula gives 21 − 1 = 1 vertex, which is correct. So, the formula 2n − 1 holds for n = 1. Inductive Hypothesis: We assume that the formula holds for n = k ≥ 1 (k is an integer). That is, any full, complete binary tree on k levels has 2k − 1 vertices. Inductive Step: We need to show that the formula holds for n = k + 1 ≥ 2 levels. In this case, the root (top) vertex is connected to two full, complete binary trees, each having k levels. By the inductive hypothesis, each of these trees contains 2k − 1 vertices. Altogether, we have 2(2k − 1) vertices plus the root vertex for a total of 2(2k − 1) + 1 = (2k+1 − 2) + 1 = 2k+1 − 1 vertices. This verifies that the formula holds for n = k + 1. Conclusion: The formula holds for all n ≥ 1. Strong Induction 31. Initial Step: We establish the claim for two base cases: n = 4 and n = 5. Namely, 4 = 2(2) + 5(0) and 5 = 2(0) + 5(1). So, P(4) and P(5) hold. Inductive Hypothesis: We assume that P(4), P(5), . . . , P(k) all hold for some k ≥ 5, and then want to establish that P(k + 1) holds. Inductive Step: We need to consider how to extend the truth of P(4), P(5), . . . , P(k) so that the claim continues to hold for the next larger value n = k +1. To make change for k + 1 cents we first use a 2-cent coin, leaving k + 1 − 2 = k − 1 cents. However, by the inductive hypothesis and the fact that k ≥ 5, we can make change for this smaller remaining amount since k − 1 ≥ 4. Together with the first 2-cent coin, we now have made change for the given k + 1 cents. So, P(k + 1) is true. Conclusion: P(n) holds for all n ≥ 4. 32. Initial Step: We establish the claim for four base cases: n = 12, n = 13, n = 14, n = 15. Namely, 12 = 4(3) + 5(0); 13 = 4(2) + 5(1); 14 = 4(1) + 5(2); 15 = 4(0) + 5(3). So, P(12), P(13), P(14), and P(15) hold. 94
K25544_SM_Cover.indd 98
11/17/14 7:45 PM
Inductive Hypothesis: We assume that P(12), P(13), . . . , P(k) all hold for some k ≥ 15, and then want to establish that P(k + 1) holds. Inductive Step: We need to consider how to extend the truth of P(12), P(13), . . . , P(k) so that the claim continues to hold for the next larger value n = k+1. To make change for k+1 cents we first use a 4-cent coin, leaving k+1−4 = k−3 cents. However, by the inductive hypothesis and the fact that k ≥ 15, we can make change for this smaller remaining amount since k − 3 ≥ 12. Together with the first 4-cent coin, we have now made change for the given k + 1 cents. So, P(k + 1) is true. Conclusion: P(n) holds for n ≥ 12. 33. Initial Step: We establish the claim for three base cases: n = 8, n = 9, n = 10. Namely, 8 = 3(0)+8(1)+10(0); 9 = 3(3)+8(0)+10(0); 10 = 3(0)+8(0)+10(1). So, P(8), P(9), P(10) hold. Inductive Hypothesis: We assume that P(8), P(9), . . . , P(k) all hold for some k ≥ 10, and then want to establish that P(k + 1) holds. Inductive Step: We need to consider how to extend the truth of P(8), P(9), . . . , P(k) so that the claim continues to hold for the next larger value n = k +1. To make change for k + 1 cents we first use a 3-cent coin, leaving k + 1 − 3 = k − 2 cents. However, by the inductive hypothesis and the fact that k ≥ 10, we can make change for this smaller remaining amount since k − 2 ≥ 8. Together with the first 3-cent coin, we now have made change for the given k + 1 cents. So, P(k + 1) is true. Conclusion: P(n) holds for all n ≥ 8. 34. Initial Step: We establish the claim for the base case n = 1. Namely, 1 = 20 . So, P(1) holds. Inductive Hypothesis: We assume that P(1), P(2), . . . , P(k) all hold for some k ≥ 1, and then want to establish that P(k + 1) holds. Inductive Step: We need to consider how to extend the truth of P(1), P(2), . . . , P(k) so that the claim continues to hold for the next larger value n = k + 1. Consider the two cases. (1) Suppose that k + 1 is even. Then k + 1 = 2t, for some integer t ≤ k. By the inductive hypothesis, t can be expressed as a sum of distinct powers of two: t = 2a + 2b + · · · + 2x . Then k + 1 = 2t = 2(2a + 2b + · · · + 2x ) = 2a+1 + 2b+1 + · · · + 2x+1 , a sum of distinct powers of two. (2) Suppose that k + 1 is odd. Then k is even so that k = 2t, for some integer t ≤ k. By the inductive hypothesis, t can be expressed as a sum of distinct powers of two: t = 2a + 2b + · · · + 2x . Then k + 1 = 2t + 1 = 2(2a + 2b + · · · + 2x ) + 20 = 20 + 2a+1 + 2b+1 + · · · + 2x+1 , a sum of distinct powers of two. So, in either case, we see that P(k + 1) holds. Conclusion: P(n) holds for all n ≥ 1.
95
K25544_SM_Cover.indd 99
11/17/14 7:45 PM
Chapter 10
Deductive Logic and Equivalence Internet Searches 1. (a) p ∧ ∼q; ∼(∼p ∨ q) (b) The truth-table is given below: p T T F F
q T F T F
p ∧ ∼q F T F F
∼p ∨ q T F T T
∼(∼p ∨ q) F T F F
Since columns 3 and 5 agree, the expressions are equivalent. 2. (a) p ∧ ∼q; ∼(p ∨ q) (b) The truth-table is given below: p T T F F
q T F T F
p ∧ ∼q F T F F
p∨q T T T F
∼(p ∨ q) F F F T
Since columns 3 and 5 do not agree, the expressions are not equivalent. 3. (a) Let A = (p ∧ ∼r) ∨ (q ∧ r), B = (p ∨ (q ∧ r)) ∧ (q ∨ ∼r). (b) The truth-table is given next:
96
K25544_SM_Cover.indd 100
11/17/14 7:45 PM
p T T T T F F F F
q T T F F T T F F
r T F T F T F T F
p ∧ ∼r F T F T F F F F
q∧r T F F F T F F F
A T T F T T F F F
p ∨ (q ∧ r) T T T T T F F F
q ∨ ∼r T T F T T T F T
B T T F T T F F F
Since columns 6 and 9 agree, the expressions are equivalent. Equivalences 4. In the truth-table below, columns 1 and 4 agree: p T T F F
q T F T F
p∨q T T T F
(p ∨ q) ∧ p T T F F
5. In the truth-table below, columns 5 and 7 agree: p T T F F
q T F T F
∼p F F T T
∼q F T F T
p ∨ ∼q T T F T
∼p ∧ q F F T F
∼(∼p ∧ q) T T F T
6. In the truth-table below, columns 6 and 7 agree: p T T F F
q T F T F
∼p F F T T
∼q F T F T
∼q → p T T T F
∼p → (∼q → p) T T T F
p∨q T T T F
7. In the truth-table below, columns 7 and 8 agree: p T T T T F F F F
q T T F F T T F F
r T F T F T F T F
p∨q T T T T T T F F
p∨r T T T T T F T F
q∧r T F F F T F F F
(p ∨ q) ∧ (p ∨ r) T T T T T F F F
p ∨ (q ∧ r) T T T T T F F F
97
K25544_SM_Cover.indd 101
11/17/14 7:45 PM
8. Set A = (p ∨ q) ∧ (r ∨ ∼p), B = (p ∧ r) ∨ (q ∧ (r ∨ ∼p)). In the truth-table below, columns 8 and 9 agree: p T T T T F F F F
q T T F F T T F F
r T F T F T F T F
p∨q T T T T T T F F
r ∨ ∼p T F T F T T T T
p∧r T F T F F F F F
q ∧ (r ∨ ∼p) T F F F T T F F
A T F T F T T F F
B T F T F T T F F
9. The truth-table is given below: p T T F F
q T F T F
p∧q T F F F
p ∧ ∼q F T F F
(p ∧ q) ∨ (p ∧ ∼q) T T F F
The expression (p ∧ q) ∨ (p ∧ ∼q) is seen to be equivalent to p. 10. The truth-table is given below: p T T T T F F F F
q T T F F T T F F
r T F T F T F T F
q∨r T T T F T T T F
p→q T T F F T T T T
p→r T F T F T T T T
p → (q ∨ r) T T T F T T T T
(p → q) ∨ (p → r) T T T F T T T T
Since columns 7 and 8 agree, the two expressions are equivalent. 11. The truth-table is given below: p T T T T F F F F
q T T F F T T F F
r T F T F T F T F
q∧r T F F F T F F F
p→q T T F F T T T T
p→r T F T F T T T T
p → (q ∧ r) T F F F T T T T
(p → q) ∧ (p → r) T F F F T T T T
98
K25544_SM_Cover.indd 102
11/17/14 7:45 PM
Since columns 7 and 8 agree, the two expressions are equivalent. 12. The truth-table is given below: p T T T T F F F F
q T T F F T T F F
r T F T F T F T F
q→r T F T T T F T T
p∧q T T F F F F F F
p → (q → r) T F T T T T T T
(p ∧ q) → r T F T T T T T T
Since columns 6 and 7 agree, the two expressions are equivalent. 13. The truth-table is given below: p T T T T F F F F
q T T F F T T F F
r T F T F T F T F
q→r T F T T T F T T
p→q T T F F T T T T
p → (q → r) T F T T T T T T
(p → q) → r T F T T T F T F
Since columns 6 and 7 do not agree, the two expressions are not equivalent. Conditional Statements 14. Contrapositive: “If Rita is not exempt from the the final, then she did not get an A on the midterm.” Inverse: “If Rita does not get an A on the midterm, then she is not exempt from the final.” Converse: “If Rita is exempt from the final, then she got an A on the midterm.” 15. Contrapositive: “If Smith does not resign from the council, then he was not elected mayor.” Inverse: “If Smith isn’t elected mayor, then he will not resign from the council.” Converse: “If Smith resigns from the council, then he was elected mayor.” 16. Contrapositive: “If the hike did not take place, then it snowed.” Inverse: “If it does snow, then the hike will not take place.” Converse: “If the hike takes place, then it didn’t snow.” 99
K25544_SM_Cover.indd 103
11/17/14 7:45 PM
17. Contrapositive: “If Brandon graduates, then he passed the English course.” Inverse: “If Brandon passes the English course, then he will graduate.” Converse: “If Brandon does not graduate, then he did not pass the English course.” Venn Diagrams and Truth-Tables 18. (a) James: p → w, Seymour: ∼w → ∼p, Felix: ∼p → ∼w (b) Seymour agrees with James:
W
P
P
W
James, Seymour
Felix
(c) The truth-table is given below: p T T F F
w T F T F
James p→w T F T T
∼p F F T T
∼w F T F T
Seymour ∼w → ∼p T F T T
Felix ∼p → ∼w T T F T
Seymour (column 6) agrees with James (column 3). 19. (a) Monica: ∼w → ∼p, Dana: w → p, Katelyn: p → w (b) Katelyn agrees with Monica:
W
P
P
W
Monica, Katelyn
Dana
100
K25544_SM_Cover.indd 104
11/17/14 7:45 PM
(c) The truth-table is given below: p T T F F
w T F T F
∼w F T F T
∼p F F T T
Monica ∼w → ∼p T F T T
Dana w→p T T F T
Katelyn p→w T F T T
Katelyn (column 7) agrees with Monica (column 5). Rules of Replacement 20. Below we show steps in the simplification of the logical expression: ∼(∼p ∨ q) ∨ ∼(p ∨ q) ⇔ (p ∧ ∼q) ∨ (∼p ∧ ∼q)
(DM, DN)
⇔ (p ∨ ∼p) ∧ ∼q
(DIST)
⇔ T ∧ ∼q ⇔ ∼q 21. Below we show steps in the simplification of the logical expression: ∼(p ∧ ∼q) ∧ (p ∨ ∼q) ⇔ (∼p ∨ q) ∧ (p ∨ ∼q)
(DM, DN)
⇔ ((∼p ∨ q) ∧ p) ∨ ((∼p ∨ q) ∧ ∼q)
(DIST)
⇔ (∼p ∧ p) ∨ (q ∧ p)) ∨ ((∼p ∧ ∼q) ∨ (q ∧ ∼q)) (DIST) ⇔ (F ∨ (q ∧ p)) ∨ ((∼p ∧ ∼q) ∨ F) ⇔ (q ∧ p) ∨ (∼p ∧ ∼q) ⇔ (p ∧ q) ∨ (∼p ∧ ∼q)
(COM)
22. Below we show steps in the simplification of the logical expression: ∼(∼p ∧ q) ∧ (p ∨ ∼r) ⇔ (p ∨ ∼q) ∧ (p ∨ ∼r) ⇔ p ∨ (∼q ∧ ∼r) ⇔ p ∨ ∼(q ∨ r)
(DM, DN) (DIST) (DM)
Logical Expressions from Circuits 23. ∼(∼p ∧ q) ∨ q; ∼(∼1 ∧ 0) ∨ 0 = ∼0 ∨ 0 = 1 24. (∼(∼p ∨ q) ∧ q) ∨ p; (∼(∼0 ∨ 1) ∧ 1) ∨ 0 = (∼(1 ∨ 1) ∧ 1) ∨ 0 = (0 ∧ 1) ∨ 0 = 0 ∨ 0 = 0 101
K25544_SM_Cover.indd 105
11/17/14 7:45 PM
25. (∼(p ∨ q) ∧ q) ∨ ∼(q ∧ r); (∼(0 ∨ 1) ∧ 1) ∨ ∼(1 ∧ 1) = (∼1 ∧ 1) ∨ ∼1 = (0 ∧ 1) ∨ 0 = 0 ∨ 0 = 0 26. ∼((∼p ∨ q) ∧ (q ∨ ∼r)); ∼((∼1 ∨ 0) ∧ (0 ∨ ∼0)) = ∼((0 ∨ 0) ∧ (0 ∨ 1)) = ∼(0 ∧ 1) = ∼0 = 1 Circuits from Logical Expressions 27. The circuit is given by p q
28. The circuit is given by p q
29. The circuit is given by p q
30. The circuit is given by p q
r
102
K25544_SM_Cover.indd 106
11/17/14 7:45 PM
31. The circuit is given by p q
r
32. The circuit is given by p q
r
Circuit Design and Simplification 33. The truth-table is given below: A B C E
x 1 1 1 0
y 1 1 0 1
z 1 0 1 1
y∨z 1 1 1 1
x ∧ (y ∨ z) 1 1 1 0
y∧z 1 0 0 1
(x ∧ (y ∨ z)) ∨ (y ∧ z) 1 1 1 1
All other combinations give an output of 0. 34. The truth-table is given below:
A B C D E F G
w 1 1 0 1 0 0 0
x 1 0 1 0 1 0 0
y 1 1 1 1 0 1 0
z 0 1 1 0 1 1 1
w∧y 1 1 0 1 0 0 0
∼z ∨ ∼x 1 1 0 1 0 1 1
∼w ∧ z 0 0 1 0 1 1 1
(w ∧ y ∧ (∼z ∨ ∼x)) ∨ (∼w ∧ z) 1 1 1 1 1 1 1
All other combinations give an output of 0.
103
K25544_SM_Cover.indd 107
11/17/14 7:45 PM
35. (a) The truth table is given below. It produces the expression xy + x¯ y+x ¯y. A B C
x 1 1 0 0
y 1 0 1 0
output 1 1 1 0
term xy x¯ y x ¯y
(b) The circuit below uses 7 gates:
x
y
(c) The associated graph is shown below. The simplified expression is x + y and a corresponding circuit uses just 1 gate. x xy
xy 2
A
y
B
1
C
xy
36. (a) The truth table is given below. The associated logical expression is w¯ ¯ xy¯z + w¯ ¯ xy z¯ + w¯ ¯ xyz + w¯ xy¯z + w¯ xyz + wx¯ y z and the corresponding circuit would use 30 + 5 = 35 gates. A B C D E F
w 0 0 0 1 1 1
x 0 0 0 0 0 1
y 0 1 1 0 1 0
z 1 0 1 1 1 1
output 1 1 1 1 1 1
term w¯ ¯ xy¯z w¯ ¯ xy z¯ w¯ ¯ xyz w¯ xy¯z w¯ xyz wx¯ yz
# of gates 6 6 5 5 4 4
(b) The associated graph is shown next. The simplified expression is x ¯z + w¯ ¯ xy + w¯ yz = x ¯(z + wy) ¯ + w¯ y z and a corresponding circuit uses 9 gates.
104
K25544_SM_Cover.indd 108
11/17/14 7:45 PM
wxyz B
wxy
4
wxyz C 3
wxyz
1
A
wxyz E
xz
F
wyz
3 1
D
wxyz 2
wxyz
37. (a) The truth table is given below. The associated logical expression is wxyz + wxy z¯ + wx¯ y z + w¯ xyz + wxyz ¯ and the corresponding circuit would use 19 + 4 = 23 gates. w 1 1 1 1 0
A B C D E
x 1 1 1 0 1
y 1 1 0 1 1
z 1 0 1 1 1
output 1 1 1 1 1
term wxyz wxy z¯ wx¯ yz w¯ xyz wxyz ¯
# of gates 3 4 4 4 4
(b) The associated graph is shown below. The simplified expression is wxy + wxz + wyz + xyz = wx(y + z) + (w + x)yz and a corresponding circuit uses 7 gates. wxy
xyz wxyz B
wxyz
4
1
A 3
wxyz E
2
C
D
wxyz
wxyz
wxz
wyz
105
K25544_SM_Cover.indd 109
11/17/14 7:45 PM
38. (a) The truth table is given below. The associated logical expression is wx¯ y z + w¯ ¯ xy¯z + wxyz ¯ + w¯ xy¯z + w¯ ¯ xyz + wx¯ ¯ y z. w 1 0 0 1 0 0
A B C D E F
x 1 0 1 0 0 1
y 0 0 1 0 1 0
z 1 1 1 1 1 1
output 1 1 1 1 1 1
term wx¯ yz w¯ ¯ xy¯z wxyz ¯ w¯ xy¯z w¯ ¯ xyz wx¯ ¯ yz
# of gates 4 6 4 5 5 5
(b) The corresponding circuit uses 29 + 5 = 34 gates. (c) The associated graph is shown below. The simplified expression is y¯z + wz ¯ = (¯ y + w)z ¯ and a corresponding circuit uses 4 gates.
wxyz D
1
wxyz B
3
2
2
A
wxyz
1
wxyz E 2
F
wxyz
yz
3
C
wxyz wz
106
K25544_SM_Cover.indd 110
11/17/14 7:45 PM
Chapter 11
Modeling Using Deductive Logic City Planning 1. (a) The proximity graph is shown below: B
D
A
C
(b) Efficient placements are AD, B, and C. 2. (a) The proximity graph is shown below: B
D
A
C
(b) Efficient placements are AD, BD, and C. 3. The expression can be simplified as follows: (a ∨ b) ∧ (a ∨ c) ∧ (a ∨ c ∨ d) = (a ∨ b) ∧ (a ∨ c) = a ∨ (b ∧ c)
(ABS) (DIST)
107
K25544_SM_Cover.indd 111
11/17/14 7:45 PM
4. The expression can be simplified as follows: (a ∨ c ∨ d) ∧ (a ∨ d) ∧ (a ∨ b ∨ c) = (a ∨ d) ∧ (a ∨ d ∨ c) ∧ (a ∨ b ∨ c) (COM) = (a ∨ d) ∧ (a ∨ b ∨ c)
(ABS)
= a ∨ (d ∧ (b ∨ c)) = a ∨ (b ∧ d) ∨ (c ∧ d)
(DIST) (DIST, COM)
5. The expression can be simplified as follows: (a ∨ c) ∧ (b ∨ d) ∧ (a ∨ c ∨ d) ∧ (b ∨ c ∨ d) = (a ∨ c) ∧ (a ∨ c ∨ d) ∧ (b ∨ d) ∧ (b ∨ d ∨ c) = (a ∨ c) ∧ (b ∨ d)
(ABS)
= ((a ∨ c) ∧ b) ∨ ((a ∨ c) ∧ d) = (a ∧ b) ∨ (b ∧ c) ∨ (a ∧ d) ∨ (c ∧ d)
(COM) (DIST)
(DIST, COM)
This gives AB, BC, AD, and CD as efficient placements. 6. The expression can be simplified as follows: (a ∨ b ∨ c) ∧ (a ∨ b ∨ d) ∧ (a ∨ c ∨ d) ∧ (b ∨ c ∨ d) = ((a ∨ b) ∨ (c ∧ d)) ∧ ((a ∧ b) ∨ (c ∨ d))
(DIST)
= ((a ∨ b) ∧ (a ∧ b)) ∨ ((c ∧ d) ∧ (a ∧ b)) ∨ ((a ∨ b) ∧ (c ∨ d)) ∨ ((c ∧ d) ∧ (c ∨ d))
(DIST)
= (a ∧ (a ∨ b) ∧ b) ∨ ((c ∧ d) ∧ (a ∧ b)) ∨ ((a ∨ b) ∧ (c ∨ d)) ∨ (c ∧ d ∧ c) ∨ (c ∧ d ∧ d) (COM, DIST) = (a ∧ b) ∨ ((c ∧ d) ∧ (a ∧ b)) ∨ (a ∧ c) ∨ (b ∧ c) ∨ (a ∧ d) ∨ (b ∧ d) ∨ (c ∧ d) ∨ (c ∧ d)
(ABS, DIST)
= (a ∧ b) ∨ (c ∧ d) ∨ (a ∧ c) ∨ (b ∧ c) ∨ (a ∧ d) ∨ (b ∧ d)
(ABS)
This gives AB, CD, AC, BC, AD, and BD as efficient placements.
108
K25544_SM_Cover.indd 112
11/17/14 7:45 PM
7. The expression can be simplified as follows: (a ∨ c) ∧ (b ∨ c ∨ e) ∧ (a ∨ b ∨ c ∨ d) ∧ (c ∨ d ∨ e) ∧ (b ∨ d ∨ e) = (a ∨ c) ∧ (b ∨ e ∨ c) ∧ (c ∨ d ∨ e) ∧ (b ∨ e ∨ d)
(ABS, COM)
= (a ∨ c) ∧ ((b ∨ e) ∨ (c ∧ d)) ∧ (c ∨ d ∨ e)
(DIST)
= (c ∨ (a ∧ (d ∨ e))) ∧ ((b ∨ e) ∨ (c ∧ d))
(DIST, COM)
= (c ∧ (b ∨ e)) ∨ (c ∧ (c ∧ d)) ∨ ((a ∧ (d ∨ e)) ∧ (b ∨ e)) ∨ ((a ∧ (d ∨ e)) ∧ (c ∧ d))
(DIST)
= (c ∧ b) ∨ (c ∧ e) ∨ (c ∧ d) ∨ (a ∧ (d ∨ e) ∧ b) ∨ (a ∧ (d ∨ e) ∧ e) (DIST, ABS) = (c ∧ b) ∨ (c ∧ e) ∨ (c ∧ d) ∨ (((a ∧ d) ∨ (a ∧ e)) ∧ b) ∨ (a ∧ e) (DIST, ABS) = (c ∧ b) ∨ (c ∧ e) ∨ (c ∧ d) ∨ (a ∧ d ∧ b) ∨ (a ∧ e ∧ b) ∨ (a ∧ e) (DIST) = (b ∧ c) ∨ (c ∧ e) ∨ (c ∧ d) ∨ (a ∧ b ∧ d) ∨ (a ∧ e)
(ABS, COM)
This gives BC, CE, CD, ABD, and AE as efficient placements. Biological Models 8. (0, 1, 0, 1, 0) → (0, 0, 1, 0, 0) → (1, 0, 1, 0, 0) → (1, 1, 1, 0, 1) → (1, 1, 1, 1, 1) → (1, 1, 1, 1, 1) → · · · (1, 1, 0, 0, 0) → (0, 1, 0, 0, 1) → (0, 0, 0, 1, 0) → (0, 0, 0, 1, 0) → · · · The first case converges to the same equilibrium as Example 11.5; the second case converges to a different equilibrium. 9. (a) (1, 0, 0) → (0, 1, 1) → (1, 1, 1) → (1, 0, 1) → (1, 0, 1) → · · · (b) (0, 0, 0) → (0, 1, 0) → (1, 1, 0) → (1, 1, 1) → (1, 0, 1) → (1, 0, 1) → · · · (c) The state transition graph is shown below: 0,0,0
0,1,0
1,1,0
0,0,1
0,1,1
1,1,1
1,0,1
1,0,0
Every initial state leads to the equilibrium state (1, 0, 1). 10. (a) (0, 1, 0, 1, 0) → (1, 0, 0, 1, 1) → (1, 1, 1, 1, 1) → (1, 1, 1, 1, 1) → · · ·
(1, 1, 1, 1, 0)
→
(1, 1, 0, 1, 1)
→
(b) (0, 0, 0, 1, 0) → (1, 0, 0, 0, 0) → (1, 0, 0, 0, 0) → · · · Here the system converges to a different equilibrium. 109
K25544_SM_Cover.indd 113
11/17/14 7:45 PM
(c) (0, 1, 0, 1, 1) → (1, 0, 1, 1, 1) → (0, 1, 1, 1, 1) → (1, 0, 1, 1, 1) → (0, 1, 1, 1, 1) → (1, 0, 1, 1, 1) → · · · No equilibrium is reached; the system alternates between the states (1, 0, 1, 1, 1) and (0, 1, 1, 1, 1). Games and Nash Equilibria 11. SP places FP in state 21; FP should remove one bead from the pile with two beads, placing SP in (losing) state 11; SP then removes one bead, leaving state 1; FP then removes the last bead and wins. 12. Consider Figure 11.2, where the initial state is now considered to be 211. Since state 211 is labeled W , it is a winning state for FP, who can place SP in the losing state 11 by taking both beads from the pile with two beads. Then SP must take one bead from a pile with one bead, leaving state 1; now FP wins by taking the single remaining bead. 13.(a,b) The directed graph and its labeling are given below: W 2111
2111
1111
211
111
111
21
11
11
2
1
L
W
L
1
1111
111
W 211 W
W
11
111
21
11
2
1
W 1
W
L
W
L
L
(a)
(b)
(c) State 2111 is a winning state for FP, who is guaranteed a win.
110
K25544_SM_Cover.indd 114
11/17/14 7:45 PM
14. (a) The directed graph is given below: 222 22
221
2
111
211
21
22
1
11
21
11
2
1
2
1
(b) Labeling of the directed graph is given below: W 222 W
L 22 W
W 2
L
221 W 211
21
W 111
W 1
L 11
L
L 11
W 2
W 1
L 22
21 W
1
2
W
L W
L
L
(c) The best first move for FP is to remove two beads, leaving (losing) state 22 for SP. (d) State 222 is winning for FP. 15. The payoff matrix (in thousands of dollars profit per week) is A high low high (9, 9) (5, 14) B low (14, 5) (7, 7) 111
K25544_SM_Cover.indd 115
11/17/14 7:45 PM
Rationality leads both players to set low prices, leading to (7, 7). However, they would both be better off at (9, 9). 16. The payoff matrix is
China
reduce not
U.S. reduce not (10, 10) (−5, 15) (15, −5) (0, 0)
Rationality leads both players to not reduce emissions, leading to (0, 0). However, they would both be better off at (10, 10). 17. There is a Nash equilibrium at (R1, C2). 18. There are Nash equilibria at (R1, C2) and (R2, C1). 19. There are Nash equilibria at (R1, C1) and (R2, C3). 20. There are Nash equilibria at (R1, C3) and (R2, C2). 21. There are no Nash equilibria. 22. There is a Nash equilibrium at (AA, AA). Saddlepoints in Zero-Sum Games 23. The maximin strategy is R1, with maximin value 5. The minimax strategy is C2, with minimax value 5. There is a saddlepoint at (R1, C2). The value of the game is 5. 24. The maximin strategy is R3, with maximin value 1. The minimax strategy is C1, with minimax value 1. There is a saddlepoint at (R3, C1). The value of the game is 1. 25. The maximin strategy is R1, with maximin value −1. The minimax strategy is C2, with minimax value −1. There is a saddlepoint at (R1, C2). The value of the game is −1. 26. Both R1 and R2 are maximin strategies, with maximin value −2. The minimax strategy is C1, with minimax value 1. There is no saddlepoint: the maximin value is −2, while the minimax value is 1. 27. Both R2 and R4 are maximin strategies, with maximin value 1. Both C2 and C5 are minimax strategies, with minimax value 1. There are saddlepoints at (R2, C2), (R2, C5), (R4, C2), (R4, C5). The value of the game is 1.
112
K25544_SM_Cover.indd 116
11/17/14 7:45 PM
Mixed Strategies for Zero-Sum Games 28. (a) The maximin strategy is R1 and the minimax strategy is C2. There is no saddlepoint: the maximin value is −1, while the minimax value is 1. (b) RP: 3
(3) + 47 (−2) 73 4 7 (−1) + 7 (1)
=
5
(−1) = (1) =
=
1 7 1 7
CP: 2 72 7
(3) +
(−2) +
7
5 7
1 7 1 7
(c) The value of the game is + 17 . This is not a fair game; it is in favor of RP by 17 . 29. (a) The maximin strategy is R2 and the minimax strategy is C2. There is no saddlepoint: the maximin value is −3, while the minimax value is 2. (b) RP: 5
8 (4) + 13 (−3) 13 8 5 13 (−4) + 13 (2)
4 = − 13
6
4 = − 13
4 = − 13
CP: 7 (4) + 13 (−4) 13 7 6 13 (−3) + 13 (2)
4 = − 13
4 (c) The value of the game is − 13 . This is not a fair game; it is in favor of 4 CP by 13 .
30. (a) The maximin strategy is R2 and the minimax strategy is C1. There is no saddlepoint: the maximin value is −10, while the minimax value is 14. (b) RP: 5 12 5 12
(14) +
7
(−21) +
12
(−10) = 0 (15) = 0
7 12
CP: 3
(14) + 25 (−21) 53 2 5 (−10) + 5 (15)
=0 =0
(c) The value of the game is 0. The game is fair; it is not in favor of either player. 113
K25544_SM_Cover.indd 117
11/17/14 7:45 PM
31. (a) The maximin strategy is CB and the minimax strategy is CB. There is no saddlepoint: the maximin value is .265, while the minimax value is .285. (b) Batter: 1
(.340) 51 5 (.260)
+
1
+
+
4
(.265) = .280
3
(.260) = .280
54 5
(.285) = .280
Pitcher: (.340) 41 4 (.265)
+
43 4
(.285) = .280
(c) The value of the game is .280; this is the batting average that can be achieved by optimal play—anticipating a fastball 15 of the time and a curveball 45 of the time. 32. (a) The maximin strategy is FB and the minimax strategy is CB. There is no saddlepoint: the maximin value is .270, while the minimax value is .370. (b) Batter: 2
(.450) +
1
+
52 5
(.270) +
3
(.250) = .330
2
(.270) = .330
53 5
(.370) = .330
Pitcher: (.450) 31 3 (.250)
+
32 3
(.370) = .330
(c) The value of the game is .330; this is the batting average that can be achieved by optimal play—anticipating a fastball 25 of the time and a curveball 35 of the time.
114
K25544_SM_Cover.indd 118
11/17/14 7:45 PM
Chapter 12
Probability and Counting Decision Trees 1. (a) The decision tree is shown below: HH
HHH HHT
H
HTH HT
s
HTT THH
TH THT T
TTH TT
TTT
(b) Pr[two heads] = Pr[HHT, HT H, T HH] =
3 8
(c) Pr[at least two tails] = Pr[HT T, T HT, T T H, T T T ] =
4 8
=
1 2
2. (a) The decision tree is shown below: BB
BBB BBG
B
BGB BG
s
BGG GBB
GB GBG G
GGB GG
GGG
115
K25544_SM_Cover.indd 119
11/17/14 7:45 PM
(b) Pr[one girl] = Pr[BBG, BGB, GBB] =
3 8
(c) Pr[at least one girl] = Pr[BBG, BGB, BGG, GBB, GBG, GGB, GGG] = 7 8
3. (a) In the decision tree below, let A denote the card allowing an advance of 3 squares, let B be the card for advancing 2 squares, and let C be the card for advancing 1 square: advance
A
AA
6
AB
5
AC
4
BA
5
BB
4
BC
3
CA
4
CB
3
CC
2
B
s
C
(b) Pr[advance 4] = Pr[AC, BB, CA] = (c) Pr[advance 5] = Pr[AB, BA] =
3 9
=
1 3
2 9
4. (a) The decision tree below shows the possible outcomes as well as their probabilities: 0.6
HHH
0.216
0.4
HHT
0.144
0.6
HTH
0.144
HT
0.4
HTT
0.096
TH
0.6
THH
0.144
0.4
THT
0.096
0.6
TTH
0.096
0.4
TTT
0.064
HH 0.6 H 0.4
0.6
s 0.4
0.6 T 0.4 TT
(b) Pr[two tails] = Pr[HT T, T HT, T T H] = 3(0.096) = 0.288 (c) Pr[at least two heads] = Pr[HHT, HT H, T HH, HHH] = 3(0.144) + 0.216 = 0.648
116
K25544_SM_Cover.indd 120
11/17/14 7:45 PM
5. (a) The decision tree below shows the possible outcomes as well as their probabilities: 0.7
HHH
0.343
0.3
HHT
0.147
0.7
HTH
0.147
HT
0.3
HTT
0.063
TH
0.7
THH
0.147
0.3
THT
0.063
0.7
TTH
0.063
0.3
TTT
0.027
HH 0.7 H 0.3
0.7
s 0.3
0.7 T 0.3 TT
(b) Pr[two heads] = Pr[HHT, HT H, T HH] = 3(0.147) = 0.441 (c) Pr[at least two tails] = Pr[HT T, T HT, T T H, T T T ] = 3(0.063)+0.027 = 0.216 6. (a) The decision tree below displays the edge probabilities and the possible outcomes: PP
2/7 4/7
P
PO
1/7
PW
2/7
s
4/7
O
OP
2/7 4/7
OO
1/7
OW
1/7 WP
2/7 4/7
W
WO
1/7
(b) Pr[OW ] + Pr[W O] =
4 1 7
7
+
WW
1 4 7
7
=
4 49
+
4 49
=
8 49
7. (a) The relevant portion of the decision tree is shown below, where Y indicates success and N indicates otherwise: NN
3/4
NNN
1/4
NNY
3/4 N 3/4
s
1/4 NY
1/4 Y
117
K25544_SM_Cover.indd 121
11/17/14 7:45 PM
(b) Pr[draw within three tries] = Pr[Y, N Y, N N Y ] = 3 3 name 37 1 = 4 4 4 64
1 4
+
3 1 4
4
+
Multiplication and Addition Rules 8. Pr[$100 then $50] + Pr[$50 then $100] and $50] = Pr[$100 = 23 13 + 13 23 = 49 9. (a) 36 outcomes
(b) {(1, 4), (2, 3), (3, 2), (4, 1)} (c) Pr[sum = 5] =
4 36
1 9
=
10. (a) 36 outcomes (b) {(1, 6), (2, 5), (3, 4), (4, 3), (5, 2), (6, 1)} (c) Pr[sum = 7] =
6 36
1 6
=
11. (a) 36 outcomes (b) {(1, 3), (2, 4), (3, 1), (3, 5), (4, 2), (4, 6), (5, 3), (6, 4)} (c) Pr[differ by 2] =
8 36
=
2 9
12. (a) 36 outcomes (b) {(1, 2), (2, 1), (2, 3), (3, 2), (3, 4), (4, 3), (4, 5), (5, 4), (5, 6), (6, 5)} (c) Pr[differ by 1] =
10 36
=
5 18
Complement Rule 13. Pr[no repeated digits] =
10×9×8×7×6 10×10×10×10×10
= 0.3024
Pr[some repeated digits] = 1 − 0.3024 = 0.6976 625 14. Pr[no 1 in four rolls] = 56 56 56 56 = 1296 Pr[at least one 1 in four rolls] = 1 −
15. Pr[8 rolled in one turn] =
625 1296
=
671 1296
= 0.518
5 36
Pr[8 not rolled in one turn] = 31 36 (complement rule) 31 20 Pr[no 8 in first 20 turns] = 36 ≈ 0.050 (multiplication rule)
4 16. (a) Pr[roll 5] = 36 5 Pr[roll 6] = Pr[roll 8] = 36 4 5 5 Pr[resource] = 36 + 36 + 36 =
14 36
7 18 (addition rule) 7 11 18 = 18 (complement rule) 11 10 ≈ 0.00726 (multiplication 18
=
(b) Pr[no resource on next roll] = 1 − Pr[no resource on next 10 rolls] =
rule)
118
K25544_SM_Cover.indd 122
11/17/14 7:45 PM
17. Pr[no rain in three days] = (1 − 0.5)(1 − 0.6)(1 − 0.7) = 0.06 (complement and multiplication rules) Pr[rain on at least one of three days] = 1 − Pr[no rain in three days] = 0.94 18. Pr[no single-bit error] = 0.99; Pr[no error in 50 bits] = (0.99)50 Pr[at least one error in 50 bits] = 1 − (0.99)50 = 0.395 Multistage Rule 19. 5 × 8 × 3 = 120 20. (a) 25 × 25 × 10 × 9 × 8 × 7 = 3,150,000 (b) Not enough PINs 21. 26 × 25 × 24 × 10 × 9 × 8 = 11,232,000 22. 10 × 9 × 9 × 9 × 9 × 9 × 9 = 5,314,410 23. 10 × 9 × 8 × 7 × 6 = 30,240 Testing Our Intuition 24. (a) {11111, 22222, . . . , 66666}; Pr[all same] = (b)
6×5×4×3×2 6×6×6×6×6
6 6×6×6×6×6
= 0.0926
25. (a) {111111, 222222, . . . , 666666}; Pr[all same] = (b)
= 0.000772
6×5×4×3×2×1 6×6×6×6×6×6
6 6×6×6×6×6×6
= 0.000129
= 0.0154
12 26. (a) Pr[no one’s birthday] = 364 = 0.9676 365 Pr[someone has a birthday] = 1 − 0.9676 = 0.0324 365×364×···×354 (b) Pr[all different] = 365×365×···×365 = 0.833 Pr[some have same birthday] = 1 − 0.833 = 0.167 22 27. (a) Pr[no one’s birthday] = 364 = 0.9414 365 Pr[someone has a birthday] = 1 − 0.9414 = 0.0586 365×364×···×344 (b) Pr[all different] = 365×365×···×365 = 0.524 Pr[some have same birthday] = 1 − 0.524 = 0.476
28. (a) Pr[at least one match] = 1 − Pr[no match in four] = 1 − 9×8×7×6 = 9×9×9×9 1 − 0.461 = 0.539 9×8×7×6×5×4 (b) Pr[at least one match] = 1−Pr[no match in six] = 1− 9×9×9×9×9×9 = 1 − 0.114 = 0.886
119
K25544_SM_Cover.indd 123
11/17/14 7:45 PM
Chapter 13
Counting and Unordered Outcomes Combinations Formula 1. C(15, 3) = 455 2. C(10, 6) = 210 3. C(28, 3) = 3276 4. C(11, 4) = 330 5. C(12, 3) = 220 6. C(11, 3) × C(9, 3) = 165 × 84 = 13,860 7. C(6, 3) × C(5, 2) = 20 × 10 = 200 8. C(20, 4) × C(14, 2) = 4845 × 91 = 440,895 9. C(9, 2) × C(11, 2) × C(14, 2) = 36 × 55 × 91 = 180,180 10. C(8, 3) × C(7, 3) = 56 × 35 = 1960 11. C(4, 2) × C(8, 3) = 6 × 56 = 336 12. (a) C(21, 6) = 54,264 (b) C(9, 6) = 84 (c) C(9, 3) × C(12, 3) = 84 × 220 = 18,480 Lottery Probabilities 13.
C(6, 4) × C(34, 2) 15 × 561 = = 0.00219 C(40, 6) 3,838,380 120
K25544_SM_Cover.indd 124
11/17/14 7:45 PM
1 1 = = 0.00000199 C(38, 5) 501,942 C(5, 4) × C(33, 1) 5 × 33 (b) = = 0.000329 C(38, 5) 501,942 C(5, 3) × C(33, 2) 10 × 528 (c) = = 0.0105 C(38, 5) 501,942
14. (a)
15.
1 1 1 1 1 × = × = C(59, 5) C(35, 1) 5,006,386 35 175,223,510
16.
1 34 1 × ≈ C(59, 5) 35 5,153,633
17.
C(54, 5) 1 3,162,510 1 × = ≈ C(59, 5) 35 5,006,386 × 35 55.41
18.
C(5, 4) × C(54, 1) 34 9180 1 × = ≈ C(59, 5) 35 5,006,386 × 35 19,087.5
19. C(35, 6) = 1,623,160 ≈ 1,600,000; select 6 numbers from the 35. 20. C(29, 7) = 1,560,780 ≈ 1,500,000; select 7 numbers from the 29. Poker Probabilities 21.
4 4 1 = = = 0.00000154, about once every 649,740 ≈ C(52, 5) 2,598,960 649,740 650,000 hands.
22.
10 × C(4, 1) 10 × 4 = = 0.0000154 C(52, 5) 2,598,960
23.
(10 × 45 ) − 40 10,240 − 40 = = 0.00392 C(52, 5) 2,598,960
24.
C(36, 5) 376,992 = = 0.145 C(52, 5) 2,598,960
25.
C(16, 5) 4368 = = 0.00168 C(52, 5) 2,598,960
26. 1 − Pr[no number cards] = 1 − Pr[all face cards] = 1 − 0.00168 = 0.99832 27.
C(4, 1) × C(13, 4) × 39 4 × 715 × 39 = = 0.0429 C(52, 5) 2,598,960
28.
C(13, 2) × C(4, 2) × C(4, 2) × C(44, 1) 78 × 6 × 6 × 44 = = 0.0475 C(52, 5) 2,598,960
121
K25544_SM_Cover.indd 125
11/17/14 7:45 PM
29.
30.
31.
C(13, 1) × C(4, 3) × C(12, 2) × C(4, 1) × C(4, 1) 13 × 4 × 66 × 4 × 4 = C(52, 5) 2,598,960 = 0.0211 C(13, 1) × C(4, 2) × C(12, 3) × C(4, 1) × C(4, 1) × C(4, 1) 13 × 6 × 220 × 4 × 4 × 4 = C(52, 5) 2,598,960 = 0.423 C(13, 2) × C(4, 3) × C(4, 3) 78 × 4 × 4 = = 0.0000613 C(52, 6) 20,358,520
122
K25544_SM_Cover.indd 126
11/17/14 7:45 PM
Chapter 14
Independence and Conditional Probabilities Independent and Disjoint Events 1. (a) S = {11, 12, 13, . . . , 64, 65, 66} (b) E = {11, 13, 15, 22, 24, 26, 31, 33, 35, 42, 44, 46, 51, 53, 55, 62, 64, 66} 1 Pr[E] = 18 36 = 2 (c) F = {51, 52, 53, 54, 55, 56} 6 Pr[F ] = 36 = 16 (d) E and F = {51, 53, 55} 3 1 Pr[EF ] = 36 = 12 1 Pr[EF ] = 12 = 12 × 16 = Pr[E] Pr[F ]; E and F are independent. 2. (a) S = {HHH, HHT, HT H, HT T, T HH, T HT, T T H, T T T } (b) E = {HT H, HT T, T HH, T HT, T T H, T T T } F = {HHH, HHT, HT H, T HH} G = {HHH, HT H, T HT, T T T } (c) Pr[E] =
6 8
= 34 ; Pr[F ] =
4 8
= 12 ; Pr[G] =
4 8
=
1 2
(d) E and F = {HT H, T HH}, Pr[EF ] = 82 = 14 E and G = {HT H, T HT, T T T }, Pr[EG] = 83 F and G = {HHH, HT H}, Pr[F G] = 82 = 14 (e) Pr[EF ] = Pr[EG] = Pr[F G] =
1 4 3 8 1 4
�= = =
3 4 3 4 1 2
× × ×
1 2 1 2 1 2
= Pr[E] × Pr[F ]; E and F are not independent. = Pr[E] × Pr[G]; E and G are independent. = Pr[F ] × Pr[G]; F and G are independent.
3. (a) E and F = {(2H, 7C), (3H, 7C), . . . , (KH, 7S), (AH, 7S)} (52 choices) 1 1 52 Pr[EF ] = 52×52 = 52 ; Pr[E] = 14 ; Pr[F ] = 13 123
K25544_SM_Cover.indd 127
11/17/14 7:45 PM
(b) Pr[EF ] =
1 52
=
1 4
1 13
×
= Pr[E] × Pr[F ]; E and F are independent.
4. (a) E = {36, 45, 46, 54, 55, 56, 63, 64, 65, 66}; Pr[E] = (b) F = {11, 22, 33, 44, 55, 66}; Pr[F ] = (c) E and F = {55, 66}; Pr[EF ] = E and F are not independent.
2 36
=
6 1 36 = 6 1 5 18 �= 18
×
1 6
10 36
=
5 18
= Pr[E] × Pr[F ];
5. (a) E = {13, 14, 15, 22, 23, 24, 31, 32, 33, 41, 42, 51}; Pr[E] = (b) F = {11, 22, 33, 44, 55, 66}; Pr[F ] = (c) E and F = {22, 33}; Pr[EF ] = E and F are independent.
2 36
=
6 1 36 = 6 1 1 1 18 = 3 × 6
12 36
=
1 3
= Pr[E] × Pr[F ];
6. (a) E = {13, 22, 31}; F = {14, 23, 32, 41} (b) E or F = {13, 14, 22, 23, 31, 32, 41} (c) Pr[E or F ] =
7 36
=
3 36
+
4 36
= Pr[E] + Pr[F ]; E and F are disjoint.
7. (a) E = {16, 25, 34, 43, 52, 61}; F = {13, 24, 31, 35, 42, 46, 53, 64} (b) E or F = {13, 16, 24, 25, 31, 34, 35, 42, 43, 46, 52, 53, 61, 64} (c) Pr[E or F ] =
14 36
=
6 36
+
8 36
= Pr[E] + Pr[F ]; E and F are disjoint.
8. (a) E = {15, 24, 33, 42, 51}; F = {13, 24, 31, 35, 42, 46, 53, 64} (b) E or F = {13, 15, 24, 31, 33, 35, 42, 46, 51, 53, 64} (c) Pr[E or F ] =
11 36
�=
5 36
+
8 36 ;
E and F are not disjoint.
9. (a) E = {HT H, HT T, T HH, T HT }; F = {HHH, HT H, T HT, T T T } (b) E or F = {HHH, HT H, HT T, T HH, T HT, T T T } (c) Pr[E or F ] =
6 8
�=
4 8
+
4 8
= Pr[E] + Pr[F ]; E and F are not disjoint.
10. (a) E = {QH, QD} F = {JH, JD, QH, QD, KH, KD, AH, AD} (b) E or F = {JH, JD, QH, QD, KH, KD, AH, AD} (c) Pr[E or F ] =
8 36
�=
2 36
+
8 36 ;
E and F are not disjoint.
11. (a) E or F = {2H, 3H, . . . , 7H, . . . , AH, 7C, 7D, 7S} (b) Pr[E or F ] =
16 36
�=
13 36
+
4 36
= Pr[E] + Pr[F ]; E and F are not disjoint.
12. Pr[win both] = 0.7 × 0.9 = 0.63 13. Pr[walk] = 0.3; Pr[rain] = 0.4 (a) Pr[walk and rain] = 0.05 �= 0.3 × 0.4 = Pr[walk] × Pr[rain]; not independent (b) Pr[walk and rain] = 0 �= 0.3 × 0.4 = Pr[walk] × Pr[rain]; not independent (c) Pr[walk and rain] = 0.12 = 0.3 × 0.4 = Pr[walk] × Pr[rain]; independent 124
K25544_SM_Cover.indd 128
11/17/14 7:45 PM
14. (a) Pr[guilty verdict] = Pr[all jurors vote a guilty verdict] = 0.6×0.6×0.6× 0.6 × 0.6 = (0.6)5 = 0.07776 (b) Pr[not-guilty verdict] = 1 − 0.07776 = 0.92224 15. (a) S = {YYYYY, YYYYN, . . . , NNNNN} (votes of the five members) (b) Pr[≥ 3 yes votes] = Pr[3 yes votes] + Pr[4 yes votes] + Pr[5 yes votes] = C(5, 3)(.8)3 (.2)2 + C(5, 4)(.8)4 (.2)1 + C(5, 5)(.8)5 = 10(.8)3 (.2)2 + 5(.8)4 (.2)1 + 1(.8)5 = 0.2048 + 0.4096 + 0.3277 = 0.9421 16. (a) B wins in the following circumstances: B beats A, C beats D, B beats C: .2 × .55 × .6 = 0.066 B beats A, D beats C, B beats D: .2 × .45 × .7 = 0.063 ⇒ Pr[B wins] = 0.066 + 0.063 = 0.129 (b) C wins in the following circumstances: C beats D, A beats B, C beats A: .55 × .8 × .3 = 0.132 C beats D, B beats A, C beats B: .55 × .2 × .4 = 0.044 ⇒ Pr[C wins] = 0.132 + 0.044 = 0.176 (c) D wins in the following circumstances: D beats C, A beats B, D beats A: .45 × .8 × .35 = 0.126 D beats C, B beats A, D beats B: .45 × .2 × .3 = 0.027 ⇒ Pr[D wins] = 0.126 + 0.027 = 0.153 Conditional Probabilities 17. (a) The decision tree below shows the four possible outcomes: 5/7
WW
W 3/4
2/7
1/4
6/7
WM
s MW
M 1/7
(b) Pr[W W ] = (c) Pr[M M ] =
3 4 1 4
× ×
5 7 1 7
= =
MM
15 28 1 28
125
K25544_SM_Cover.indd 129
11/17/14 7:45 PM
18. (a) In the following decision tree, the first stage corresponds to FDA approval (A) or not (N ), and the second stage corresponds to the stock doubling (D) or not (N ). The four outcome probabilities are also computed. 0.95
AD
0.76
0.8
0.05
AN
0.04
0.2
0.10
ND
0.02
0.90
NN
0.18
A
s
N
(b) Pr[AN ] = (.8)(.05) = 0.04 (c) Pr[N D] = (.2)(.1) = 0.02 19. (a) The decision tree below shows the nine possible outcomes: OO
6/15
O
5/15
OP
4/15
OG
7/16
s
5/16
P
PO
7/15 4/15
PP
4/15
PG
7/15
GO
4/16 5/15
GP
G 3/15
(b) Pr[OO] + Pr[P P ] + Pr[GG] = (c) 1 −
37 120
=
83 120
7 16
GG
×
6 15
+
5 16
×
4 15
+
4 16
×
3 15
=
37 120
20. (a) The following decision tree shows the six possible outcomes; the first stage indicates the change in the interest rate and the second stage indicates the change in the value of the portfolio:
126
K25544_SM_Cover.indd 130
11/17/14 7:45 PM
0.2
++
+ 0.8 0.1 0.6
0
0.7
s
0.4
+ 0+
0
0.2
+
0.9
0.1
(b) Pr[increase in value] = Pr[+ +] + Pr[0 +] + Pr[− +] = (.1)(.2) + (.7)(.6) + (.2)(.9) = 0.62 21. The decision tree below shows the eight possible outcomes: 2/7
HHH
5/7
HHD
3/7
HDH
HD
4/7
HDD
DH
3/7
DHH
4/7
DHD
4/7
DDH
3/7
DDD
HH 3/8 H 5/8
4/9
s 5/9
1/2 D 1/2 DD
(a) Pr[HHH] = (b) Pr[DDD] =
4 3 2 9 × 8 × 7 = 5 1 3 9 × 2 × 7 =
1 21 5 42
(c) Pr[HDD] + Pr[DHD] + Pr[DDH] = + 59 × 12 × 47 = 10 21
4
9
×
22. Pr[N N N ] = Pr[N ] × Pr[N |N ] × Pr[N |N N ] = 23. Pr[F F ] = Pr[F ] × Pr[F |F ] =
16 52
×
15 51
5 8
×
4 7
+
5 9
×
1 2
×
4 7
36 52
×
35 51
×
34 50
= 0.323
13 52
×
12 51
×
11 50
= 0.0129
= 0.0905
24. Pr[HHH] = Pr[H] × Pr[H|H] × Pr[H|HH] =
25. (a) Suppose there are 3 defective (D) and 47 good (G) items. Pr[GGGGG] = Pr[G] × Pr[G|G] × Pr[G|GG] × Pr[G|GGG] × Pr[G|GGGG] 47 45 44 43 = 50 × 46 49 × 48 × 47 × 46 = 0.724
127
K25544_SM_Cover.indd 131
11/17/14 7:45 PM
(b) Suppose there are 10 defective (D) and 40 good (G) items. Pr[GGGGG] = Pr[G] × Pr[G|G] × Pr[G|GG] × Pr[G|GGG] × Pr[G|GGGG] 40 38 37 36 = 50 × 39 49 × 48 × 47 × 46 = 0.311 26. The relevant portion of the decision tree is shown below, where S and F stand for success and failure, respectively: S 0.4
s
0.8
FS
0.2
FF
0.6 F
Pr[pass] = Pr[S] + Pr[F S] = 0.4 + (0.6 × 0.8) = 0.88 27. The relevant portion of the decision tree is shown below, where S and F stand for success and failure, respectively: S 0.6
FS
s
0.65 0.4 F
0.7
FFS
0.3
FFF
0.35 FF
Pr[pass] = Pr[S] + Pr[F S] + Pr[F F S] = 0.6 + (0.4)(0.65) + (0.4)(0.35)(0.7) = 0.958 28. The relevant portion of the decision tree is shown below, where S and F stand for success and failure, respectively: S 1/7
FS
s
1/6 6/7 F
1/5
FFS
4/5
FFF
5/6 FF
Pr[succeeds] = Pr[S] + Pr[F S] + Pr[F F S] =
1 7
+
6 7
×
1 6
+
6 7
×
5 6
×
1 5
=
3 7
128
K25544_SM_Cover.indd 132
11/17/14 7:45 PM
29. (a) The following decision tree shows the four outcomes; the first stage indicates who services the car and the second stage indicates the type of repair job: TG
3/4 T 2/3
1/4
1/3
4/5
TP
s RG
R 1/5
(b) Pr[G] = Pr[T G] + Pr[RG] =
2 3
×
RP
3 4
+
1 3
×
4 5
=
1 2
+
4 15
=
23 30
= 0.767
30. (a) The decision tree below shows the six outcomes and their probabilities; the first stage indicates the type of weather and the second stage indicates the type of beverage sold: 0.15
S 0.7
0.25 0.60
s
SH
0.105
SW
0.175
SL
0.420
RH
0.150
RW
0.090
RL
0.060
0.5
0.3
0.3
R 0.2
(b) Pr[H] = Pr[SH] + Pr[RH] = 0.105 + 0.150 = 0.255 (c) Pr[W ] = Pr[SW ] + Pr[RW ] = 0.175 + 0.090 = 0.265 31. (a) The following decision tree shows the six outcomes and their probabilities; the first stage indicates the type of weather and the second stage indicates whether or not Norman sails his boat:
129
K25544_SM_Cover.indd 133
11/17/14 7:45 PM
0.6
RS
0.18
RN
0.12
WS
0.14
WN
0.06
CS
0.40
CN
0.10
R 0.4 0.3
s
W
0.2
0.7
0.3 0.5 0.8 C 0.2
(b) Pr[W S] = 0.14 (c) Pr[S] = Pr[RS] + Pr[W S] + Pr[CS] = 0.18 + 0.14 + 0.40 = 0.72 Pr[W S] 0.14 (d) Pr[W |S] = = = 0.194 Pr[S] 0.72
130
K25544_SM_Cover.indd 134
11/17/14 7:45 PM
Chapter 15
Bayes’ Law and Applications of Conditional Probabilities Bayes’ Law and Decision Trees 1. (a) The decision tree is shown below: 1
B
BR
1/3
NR
1/12
NO
7/12
1/3
s 1/8
2/3 N
7/8
Pr[BR] = Pr[R]
1 3
4 1 = 5 + 12 We revise our estimate that the given coin is biased from
(b) Pr[B|R] =
1 3
1 3
to 45 .
2. (a) The decision tree is shown next:
131
K25544_SM_Cover.indd 135
11/17/14 7:45 PM
0.85
SF
S 0.15
0.6
s
0.6
W
0.3
0.4 0.1 0.3
SC
0.09
WF
WC
0.12
RF
R 0.7
(b) Pr[W |C] =
RC
0.07
Pr[W C] 0.12 = = 0.429 Pr[C] 0.09 + 0.12 + 0.07
3. The decision tree is shown below: 0.7
S 0.35
0.2 0.1
s 0.3
0.65
0.5
N 0.2
SA
0.245
SB
0.070
SC
0.035
NA
0.195
NB
0.325
NC
0.130
Pr[SA] 0.245 = = 0.557 Pr[A] 0.245 + 0.195 Pr[N C] 0.13 (b) Pr[N |C] = = = 0.788 Pr[C] 0.035 + 0.13 (a) Pr[S|A] =
4. In the following decision tree, X denotes purchasing an LCD TV and Y denotes purchasing an LED TV:
132
K25544_SM_Cover.indd 136
11/17/14 7:45 PM
AX
0.09
0.7
AY
0.21
0.4
BX
0.20
0.6
BY
0.30
0.8
CX
0.16
0.2
CY
0.04
0.3 A
0.3
s
B
0.5
0.2 C
Pr[BX] 0.20 = = 0.444 Pr[X] 0.09 + 0.20 + 0.16 Pr[CY ] 0.04 (b) Pr[C|Y ] = = = 0.073 Pr[Y ] 0.21 + 0.30 + 0.04 (a) Pr[B|X] =
5. The decision tree is shown below: SP
0.140
SF
0.210
CP
0.045
0.7
CF
0.105
0.55
DP
0.275
0.45
DF
0.225
0.4 S 0.6 0.35
s
0.15 C
0.3
0.50 D
Pr[DP ] 0.275 = = 0.598 Pr[P ] 0.140 + 0.045 + 0.275 Pr[SF ] 0.210 (b) Pr[S|F ] = = = 0.389 Pr[F ] 0.210 + 0.105 + 0.225 (a) Pr[D|P ] =
6. In the following decision tree, T indicates infection with tularemia and H indicates healthy. The laboratory test provides either a positive (P ) or negative (N ) result.
133
K25544_SM_Cover.indd 137
11/17/14 7:45 PM
0.98
TP
0.02
TN
0.01
HP
0.99
HN
0.00294
T 0.003
s 0.997
0.00997
H
Pr[T |P ] =
0.00294 Pr[T P ] = = 0.228 Pr[P ] 0.00294 + 0.00997
7. In the following decision tree, C indicates a cancerous tumor and H indicates healthy. The mammogram test provides either a positive (P ) or negative (N ) result. 0.8
CP
0.2
CN
0.1
HP
0.9
HN
0.0032
C 0.004
s 0.996
0.0996
H
Pr[C|P ] =
Pr[CP ] 0.0032 = = 0.031 Pr[P ] 0.0032 + 0.0996
8. Let V = Vietnamese, C = Cambodian, V ′ = reported Vietnamese, and C ′ = reported Cambodian. Then we are given Pr[V ′ |V ] = Pr[C ′ |C] = 0.85, Pr[C ′ |V ] = Pr[V ′ |C] = 0.15. The associated decision tree is shown below: 0.85
VV
0.68
0.8
0.15
VC
0.12
0.2
0.15
CV
0.03
0.85
CC
0.17
V
s
C
134
K25544_SM_Cover.indd 138
11/17/14 7:45 PM
Pr[C|C ′ ] =
Pr[CC ′ ] 0.17 = = 0.586 Pr[C ′ ] 0.12 + 0.17
9. (a) The associated decision tree is shown below: 4/9
OO
4/18
1/2
5/9
OG
5/18
1/2
5/9
GO
5/18
4/9
GG
4/18
O
s
G
(b) Pr[2nd orange|1st orange] =
Pr[OO] = Pr[OO] + Pr[OG]
(c) Pr[other is orange|one is orange] = =
4 18
+
4 18 5 18
+
=
5 18
4 14
=
4 18 4 18
+
5 18
=
4 9
Pr[OO] Pr[OO] + Pr[OG] + Pr[GO]
2 7
10. (a) Suppose you select envelope A. Let A, B, C, D indicate the location of the $100 bill, and let B ′ , C ′ , D ′ indicate the removal of envelopes B, C, D by the host. The associated decision tree is shown below: AB C
1/3
A 1/4
s
1/4
1/3
1/12
AB D
1/3
AC D
B 1
BC D
1/4
C 1
CB D
1/4
D 1
DB C
1/4
Suppose the host removes B and C after you have selected A, leaving envelope D on the table. (b) Pr[D|B ′ C ′ ] =
Pr[DB ′ C ′ ] = Pr[B ′ C ′ ]
(c) Pr[A|B ′ C ′ ] =
Pr[AB ′ C ′ ] = Pr[B ′ C ′ ]
1 4 1 12
+
1 4
1 12 1 12
+
1 4
= =
3 4 1 4
135
K25544_SM_Cover.indd 139
11/17/14 7:45 PM
Since Pr[D|B ′ C ′ ] > Pr[A|B ′ C ′ ], it is best to switch. Bayes’ Law and Data Tables
11.
Positive Test Negative Test
Infected 96 4 100
Pr[Infected|Positive] =
12.
Positive Negative
Disorder 96 4 100
13.
96/3000 212/3000
96 194
Osteoporosis 228 12 240
14.
Lying 285 15 300
15. (a)
228 404
285 447
Cancer 63 42 105
16. (a)
< $1000 770 30 800
17.
Defective 25 100 125
Not 1805 570 2375
Pr[Defective|Passes] =
25 1830
404 1596 2000
447 2553 3000 = 0.638 No Cancer 252 1143 1395 1143 1395
> $1000 180 20 200
(b) Pr[On Time| < $1000] = Pass Not
194 4806 5000
= 0.564
(b) Pr[Non-Smoker|No Cancer] = On Time Late
= 0.453
Not Present 176 1584 1760
Truthful 162 2538 2700
Pr[Lying|Tests Positive] = Smoker Non-Smoker
96 212
212 2788 3000
= 0.495
Pr[Osteoporosis|Positive] = Positive Negative
=
Not Present 98 4802 4900
Pr[Disorder|Positive] = Positive Negative
Not Infected 116 2784 2900
770 800
315 1185 1500
= 0.819 950 50 1000
= 0.963
1830 670 2500 = 0.014 136
K25544_SM_Cover.indd 140
11/17/14 7:45 PM
18.
Accident None
Poor 2100 1400 3500
Pr[Poor|Accident] =
Good 2200 3300 5500 2100 4500
Excellent 200 800 1000
4500 5500 10,000
= 0.467
19. (a) Pr[Accident] = (0.272)(0.16) + (0.198)(0.09) + · · · + (0.083)(0.04) = 0.09563 Pr[< 25 and Accident] (0.16)(0.272) (b) Pr[< 25|Accident] = = = 0.455 Pr[Accident] 0.09563 Conditional Probabilities and Their Inverses 20. Let F = fatal car accident and O = older vehicle. The first claim states that Pr[O|F ] is large. The implied conclusion is that Pr[F |O] is also high. By the Ratio Rule, Pr[F |O] Pr[F ] small = = = small. Pr[O|F ] Pr[O] large There is no conclusive evidence that Pr[F |O] = Pr[O|F ] × small is likewise large. 21. Let A = former athlete and O = over 75 years old. The first statement is that Pr[O|A] is large. The implied conclusion is that Pr[A|O] is also large. By the Ratio Rule, Pr[A|O] Pr[A] small = = = small. Pr[O|A] Pr[O] large There is no conclusive evidence that Pr[A|O] is also large. 22. Let M = minor and S = received speeding ticket. The headline says that Pr[M |S] is high. The recommendation is based on Pr[S|M ]. By the Ratio Rule, Pr[S|M ] Pr[S] small = = = small, Pr[M |S] Pr[M ] large so Pr[S|M ] need not be large. The conclusion is invalid. 23. Let H = contracted Hepatitis B and T = received a blood transfusion. The study found that Pr[T |H] = 0.10 but the concern as a receiver of a transfusion is Pr[H|T ]. By the Ratio Rule, Pr[H|T ] Pr[H] small = = = small, Pr[T |H] Pr[T ] large so Pr[H|T ] is likely much less than 0.10.
137
K25544_SM_Cover.indd 141
11/17/14 7:45 PM
24. Pr[M |I] is stated as being relatively large, where M = mobster and I = Italian. The executive’s response deals with Pr[I|M ]. The following Venn diagram represents this situation:
M
I
Here the sizes of the ovals indicate the relative sizes of the populations. The diagram shows that Pr[M |I] is high but Pr[I|M ] is not. 25. Let D represent people dying after eating, and let S represent people experiencing salmonella food poisoning. The following Venn diagram displays a possible scenario involving these sets:
D
S
Here the sizes of the ovals indicate the relative sizes of the populations. Pr[D|S] is large but Pr[S|D] is not, as the shaded area is not a large proportion of the oval denoted D. 26. We complete the row and column totals in the table: Positive Test Negative Test
Used Drugs 118 4 122
No Drugs Used 50 130 180
168 134 302
118 122 = 0.967 118 168 = 0.702
Pr[Postitive Test|Drugs Used] = Pr[Drugs Used|Positive Test] =
Pr[CO] Pr[C] × Pr[O|C] (0.000002)(0.94) = = Pr[O] Pr[O] 0.5 = 0.00000376
27. (a) Pr[C|O] =
Pr[C] �= Pr[C|O] so C and O are not independent. (b) Yes, since Pr[C|O] > Pr[C]. Pr[CO ′ ] Pr[C] × Pr[O ′ |C] Pr[C] × (1 − Pr[O|C]) (c) Pr[C|O′ ] = = = ′ Pr[O ] Pr[O ′ ] 1 − Pr[O] (0.000002)(1 − 0.94) = 0.00000024 1 − 0.5 Pr[C] �= Pr[C|O ′ ] so C and O ′ are not independent. =
138
K25544_SM_Cover.indd 142
11/17/14 7:45 PM
(d) Yes, since Pr[C|O] > Pr[C|O ′ ]. Probability and the Law 1 5 1 28. Assuming the independence of loci, Pr[match at five loci] = 10 = 100,000 , so in a population of 900,000 we would expect 9 matches on all five loci. Innocent 8 899,991 899,999
Match No Match
29.
Pr[M |I] =
8 899,991
Pr[I|M ] =
8 9
9 899,991 900,000
= 0.0000089
= 0.889 ← this is the more pertinent probability
Positive Test Negative Test Pr[P |D] =
Guilty 1 0 1
2375 2500
Gene Disorder 2375 125 2500
No Gene Disorder 7125 40,375 47,500
= 0.95 is high, but Pr[D|P ] =
2375 9500
9500 40,500 50,000
= 0.25 is not high.
139
K25544_SM_Cover.indd 143
11/17/14 7:45 PM
Chapter 16
Expected Values and Decision Making Probability Models
1.
Event Probability
# of Heads 0 1 2 3 1 8
3 8
3 8
1 8
2. Pr[HH] = (.6)(.6) = .36 Pr[HT ] = (.6)(.4) = .24 Pr[T H] = (.4)(.6) = .24 Pr[T T ] = (.4)(.4) = .16
Event Probability
# of Heads 0 1 2 .16 .48 .36
3. Pr[HHH] = (.6)3 = .216 Pr[T HH] = Pr[HT H] = Pr[HHT ] = (.6)2 (.4) = .144 Pr[T T H] = Pr[T HT ] = Pr[HT T ] = (.6)(.4)2 = .096 Pr[T T T ] = (.4)3 = .064
Event Probability
0 .064
# of Heads 1 2 .288 .432
3 .216
4. The following table shows the sum of face values obtained in the two rolls:
140
K25544_SM_Cover.indd 144
11/17/14 7:45 PM
first
1 2 3 4
1 2 3 4 5
Event Probability
second 2 3 3 4 4 5 5 6 6 7
4 5 6 7 8
2
3
4
1 16
2 16
3 16
sum 5 6 4 16
3 16
7
8
2 16
1 16
5. The table below shows the difference between the face values obtained in the two rolls: second 1 2 3 4 1 0 1 2 3 2 1 0 1 2 first 3 2 1 0 1 4 3 2 1 0
Event Probability
0
difference 1 2 3
4 16
6 16
4 16
2 16
6. Pr[M M M ] = (.512)3 = .134 Pr[F M M ] = Pr[M F M ] = Pr[M M F ] = (.512)2 (.488) = .128 Pr[F F M ] = Pr[F M F ] = Pr[M F F ] = (.512)(.488)2 = .122 Pr[F F F ] = (.488)3 = .116
Event Probability
0 .116
# of Males 1 2 .366 .384
3 .134
7. The decision tree is shown below: 5/9
DD
5/15
6/10
4/9
DR
4/15
4/10
6/9
RD
4/15
3/9
RR
2/15
D
s
R
141
K25544_SM_Cover.indd 145
11/17/14 7:45 PM
Event Probability
# of Republicans 0 1 2 5 15
8 15
2 15
8. The decision tree is shown below: OO
20/56
OP
15/56
PO
15/56
PP
6/56
3/15
AA
1/20
4/16
12/15
AN
4/20
12/16
4/15
NA
4/20
11/15
NN
11/20
$1000 .30
$1500 .25
4/7 O 5/8
3/7
3/8
5/7
s
P 2/7
Event Probability
# Orange 0 1 2 3 28
15 28
10 28
9. The decision tree is shown below: A
s
N
Event Probability
# of Aces 0 1 2 11 20
8 20
1 20
Expected Value 10.
Value Probability
$500 .10
$600 .17
$2000 .18
Expected Value = (.10)($500) + (.17)($600) + (.30)($1000) + (.25)($1500) + (.18)($2000) = $1187
11.
# Total Points Probability
T-F 25 50 0.70
M-C 10 30 0.65
S-A 5 20 0.80 142
K25544_SM_Cover.indd 146
11/17/14 7:45 PM
Expected Score = (.70)50 + (.65)30 + (.80)20 = 70.5 12.
Claim Probability
$0 .9
$5000 .06
$7500 .025
$10,000 .015
Expected Payout = (.9)($0) + (.06)($5000) + (.025)($7500) + (.015)($10,000) = $637.50 Net Profit = $800 − $637.50 = $162.50 13. Expected Payout = (0.1)($5000) + (0.9)($0) = $500 Premium = $500 + (0.3)($500) = $650 1 14. Expected Payout = 38 ($35) + 37 38 ($0) = $0.921 Since you pay $1 for the bet, your expected net return is $0.921−$1 = −$0.079, a loss of 7.9 cents per play on average.
15. Expected Payout = 38 ($1) + 38 ($4) + 18 ($9) = $3, which balances exactly the $3 bet. Expected gain/loss is $0. 1 2 1 16. Pr[2, 3, 12] = Pr[2] + Pr[3] + Pr[12] = 36 + 36 + 36 = 19 1 8 Expected Payout = 9 ($8) + 9 ($0) = $0.89 Expected return is $0.89 − $1 = −$0.11, a loss of 11 cents per play on average.
17. (a) Expected Payout = 0.005($25)+0.01($10)+0.05($5)+0.935($0) = $0.475 Expected Profit = $1 − $0.475 = $0.525 per play (b) Notice that Pr[loses on one play] = 0.935. So, Pr[wins more than $4] = Pr[wins at least once] = 1 − Pr[loses all 4 times] = 1 − (0.935)4 = 0.236 18. Expected payoff = (0.0514277)($4) + (0.0114794)($40) + (0.0016111)($280) + (0.0001354)($1800) + (0.0000061)($8000) + (0.0000001)($50,000) = $1.4135, so we would expect to lose approximately $2 − $1.41 = $0.59 each play. 19. 4 boxes: Pr[no match] =
9×8×7×6 9×9×9×9
= 0.4609
Pr[at least one match] = 1 − 0.4609 = 0.5391 5 boxes: Pr[no match] =
9×8×7×6×5 9×9×9×9×9
= 0.2561
Pr[at least one match] = 1 − 0.2561 = 0.7439 6 boxes: Pr[no match] =
9×8×7×6×5×4 9×9×9×9×9×9
= 0.1138
Pr[at least one match] = 1 − 0.1138 = 0.8862 7 boxes: Pr[no match] =
9×8×7×6×5×4×3 9×9×9×9×9×9×9
= 0.0379
Pr[at least one match] = 1 − 0.0379 = 0.9621
143
K25544_SM_Cover.indd 147
11/17/14 7:45 PM
20. We tabulate below the expected gain/loss from purchasing various numbers of drinks: # Match Expected Purchase Net Drinks Probability Payout Cost Gain/Loss 1 0 $0 $1 −$1 2 1 − 5×4 = 0.2 $1 $2 −$1 5×5 5×4×3 3 1 − 5×5×5 = 0.52 $2.6 $3 −$0.4 4 1 − 5×4×3×2 = 0.808 $4.04 $4 +$0.04 5×5×5×5 5
1−
5×4×3×2×1 5×5×5×5×5
= 0.962
$4.81
$5
−$0.19
So, it is optimal to purchase four drinks. 21. m1 = 1 + 12 m2 + 12 m5 m2 = 1 + 12 m3 + 12 m4 m3 = 1 + 12 m1 + 12 m6 m4 = 1 + 12 m3 + 12 m4 m5 = 1 + 12 m1 + 12 m6 m6 = 0 m7 = 1 + 12 m2 + 12 m5 m8 = 1 + 12 m7 + 12 m8 ⇒ m1 = m2 = m4 = m7 = 6, m3 = m5 = 4, m6 = 0, m8 = 8 Expected number of steps to state 6: 3 + 18 (6 + 6 + 6 + 6 + 4 + 4 + 0 + 8) = 8 22. (a) The diagram of the four states is 1 HT
2
4
HH
TT
TH
3
(b) m1 = 0 m2 = 1 + 12 m1 + 12 m2 m3 = 1 + 12 m1 + 12 m2 m4 = 1 + 12 m3 + 12 m4 ⇒ m1 = 0, m2 = m3 = 2, m4 = 4 (c) Expected number of steps to HT (state 1): 2 + 14 (0 + 2 + 2 + 4) = 4 144
K25544_SM_Cover.indd 148
11/17/14 7:45 PM
Zero-Sum Games 23. (a) The maximin value −3 differs from the minimax value 2, so there is no saddlepoint. 1 2 1 8 −3 −3∗ 2 −7 2 −7 ∗ 8 2 (b) We compute expected values if Player B plays strategy 1 and strategy 2: 1 2 1 8 −3 q 2 −7 2 1−q EV1 = 8q − 7(1 − q) = 15q − 7, EV2 = −3q + 2(1 − q) = 2 − 5q. These expected values are plotted below: 8.0
EV1
4.0
EV 0.0
EV2
4.0
8.0 0.2
0.4
0.6
0.8
1.0
q
The minimum value for each q defines the broken line curve. We choose q to achieve the highest value on this curve: namely, when EV1 = EV2 : 9 15q − 7 = 2 − 5q, so 20q = 9 ⇒ q = 20 9 11 The optimal strategy for Player A is given by 20 , 20 . 9 (c) The value of the game is 2 − 5q = 2 − 5( 20 ) = − 14 . The game is not fair; 1 it is biased in favor of Player B by 4 .
24. (a) The maximin value −5 differs from the minimax value 7, so there is no saddlepoint. 1 2 1 −12 10 −12 2 7 −5 −5∗ ∗ 7 10 145
K25544_SM_Cover.indd 149
11/17/14 7:45 PM
(b) We compute expected values if Player B plays strategy 1 and strategy 2: 1 2 1 −12 10 q 2 7 −5 1 − q EV1 = −12q + 7(1 − q) = 7 − 19q, EV2 = 10q − 5(1 − q) = 15q − 5. These expected values are plotted below: 12.0
EV2
8.0
4.0
EV 0.0
4.0
EV1 8.0
12.0 0.2
0.4
0.6
0.8
1.0
q
The minimum value for each q defines the broken line curve. We choose q to achieve the highest value on this curve: namely, when EV1 = EV2 : 12 7 − 19q = 15q − 5, so 34q = 12 ⇒ q = 34 = 6 11 The optimal strategy for Player A is given by 17 , 17 .
6 (c) The value of the game is 15q − 5 = 15( 17 )−5 = 5 it is biased in favor of Player A by 17 .
5 17 .
6 17
The game is not fair;
25. (a) The maximin value −1 differs from the minimax value 2, so there is no saddlepoint. 1 2 3 1 −3 −1 4 −3 2 4 2 −1 −1∗ 4 2∗ 4 (b) We compute expected values if Player B plays strategy 1, 2, and 3: 1 2 3 1 −3 −1 4 q 2 4 2 −1 1 − q EV1 = −3q + 4(1 − q) = 4 − 7q, EV2 = −q + 2(1 − q) = 2 − 3q, EV3 = 4q − (1 − q) = 5q − 1.
146
K25544_SM_Cover.indd 150
11/17/14 7:45 PM
These expected values are plotted below: 4.0
EV3
2.0
EV 0.0
EV2
2.0
EV1 4.0 0.2
0.4
0.6
0.8
1.0
q
The minimum value for each q defines the broken line curve. We choose q to achieve the highest value on this curve: namely, when EV2 = EV3 : 2 − 3q = 5q − 1, so 8q = 3 ⇒ q = 83 The optimal strategy for Player A is given by 38 , 58 .
(c) The value of the game is 2 − 3q = 2 − 3( 83 ) = 78 . The game is not fair; it is biased in favor of Player A by 78 . 26. The maximin value −6 differs from the minimax value 5, so there is no saddlepoint.
(a)
1 2
1 9 −15 9
2 5 −6 5∗
3 −6 10 10
−6∗ −15
(b) We compute expected values if Player B plays strategy 1, 2, and 3: 1 2 3 1 9 5 −6 q 2 −15 −6 10 1 − q EV1 = 9q − 15(1 − q) = 24q − 15, EV2 = 5q − 6(1 − q) = 11q − 6, EV3 = −6q + 10(1 − q) = 10 − 16q.
147
K25544_SM_Cover.indd 151
11/17/14 7:45 PM
These expected values are plotted below: 10.0
EV1
5.0
EV2 EV
0.0
5.0
EV3 10.0
15.0 0.2
0.4
0.6
0.8
1.0
q
The minimum value for each q defines the broken line curve. We choose q to achieve the highest value on this curve: namely, when EV1 = EV3 : 24q − 15 = 10 − 16q, so 40q = 25 ⇒ q = The optimal strategy for Player A is given by 58 , 38 .
25 40
=
5 8
(c) The value of the game is 10 − 16q = 10 − 16( 58 ) = 0. This game is fair. 27. (a) The maximin value −4 differs from the minimax value 1, so there is no saddlepoint. 1 2 1 −5 8 −5 2 −4 3 −4∗ 3 1 −5 −5 1∗ 8 (b) We compute expected values if Player A plays strategy 1, 2, and 3: 1 2 1 −5 8 2 −4 3 3 1 −5 p 1−p EV1 = −5p + 8(1 − p) = 8 − 13p, EV2 = −4p + 3(1 − p) = 3 − 7p, EV3 = p − 5(1 − p) = 6p − 5.
148
K25544_SM_Cover.indd 152
11/17/14 7:45 PM
These expected values are plotted below:
8.0
4.0
EV3
EV 0.0
EV2 4.0
EV1
8.0 0.2
0.4
0.6
0.8
1.0
p
The maximum value for each p defines the broken line curve. We choose p to achieve the lowest value on this curve: namely, when EV1 = EV3 : 13 8 − 13p = 6p − 5, so 19p = 13 ⇒ p = 19 6 The optimal strategy for Player B is given by 13 19 , 19 .
17 (c) The value of the game is 8 − 13p = 8 − 13( 13 19 ) = − 19 . The game is not fair; it is biased in favor of Player B by
17 19 .
Simpson’s Paradox
28.
Dave Andy
1989 .235 .237
1990 .282 .284
Combined .278 .261
(a) Andy has the higher average each year. (b) Dave has the higher average for the combined years. (c) The ranking of the two players changes when the data are combined, compared to when analyzed separately. First Game 29.
A B
16 5 123 30
= 3.2 = 4.1
Second Game 83 17 104 21
= 4.88 = 4.95
Combined 99 22 = 4.50 227 51 = 4.45
(a) Player B has the higher average in each game. (b) Player A has the higher average for both games combined. (c) The ranking of the two players changes when the data are combined, compared to when analyzed separately. 149
K25544_SM_Cover.indd 153
11/17/14 7:45 PM
30.
JFK Charlotte National Atlanta Chicago Overall
% On Time Alpha Beta 89.6 85.3 95.3 90.1 91.3 86.5 82.5 72.1 85.5 77.5 86.6 87.4
(a) Alpha Airlines has a better on-time percentage at each airport. (b) Overall, Alpha Airlines has 3234 on-time flights and 501 delayed flights (86.6% overall); Beta Airlines has 5444 on-time flights and 786 delayed flights (87.4% overall). Beta Airlines has a better on-time percentage taking into account all five airports. (c) Alpha Airline’s percentage is heavily weighted towards Chicago’s percentage (85.5% for 2118 flights), whereas Beta Airlines’ percentage is heavily weighted towards Charlotte’s percentage (90.1% for 4250 flights). 31. (a) Female In-State:
42 200
= 0.21,
Out-of-State:
76 100
= 0.76
(b) Male: In-State:
30 200
= 0.15,
Out-of-State:
208 320
= 0.65
118 300
(c) Overall (female): = 0.393; Overall (male): 238 520 = 0.458 Paradox : For both in-state and out-of-state, the female acceptance rate is higher than that for males. However, males have an overall higher acceptance rate. Explanation: The overall average for females is weighted more towards instate (with a lower acceptance rate), while for males the overall average is weighted more towards out-of-state (with a higher acceptance rate).
150
K25544_SM_Cover.indd 154
11/17/14 7:45 PM
Chapter 17
Voting Methods Preference Tables Voter Profiles 1. (a)
First Second Third Fourth
4 A C D B
3 B D C A
3 D C A B
2 B A C D
2 C D A B
(b) There are 14 voters, so a majority is 8. No majority winner. (c) B is the Plurality winner, with 5 first-place votes. Voter Profiles 2. (a)
First Second Third Fourth
4 C D A B
3 A C D B
3 C B A D
2 B A C D
1 D A B C
(b) There are 13 voters, so a majority is 7. C is the Majority winner. (c) C is also the Plurality winner, with 7 first-place votes. Voter Profiles 3.
First Second Third
4 C A B
3 A C B
3 C B A
2 B A C
1 A B C
Plurality and Plurality Run-Off 4. (a) The Plurality winner is A, with 25 votes. 151
K25544_SM_Cover.indd 155
11/17/14 7:45 PM
(b) A and B meet in a run-off; B wins, 30 votes to 26. 5. (a) The favorite by Plurality is S, with 13 votes. (b) S and U meet in a run-off; U wins, 21 votes to 20. 6. (a) The favorite by Plurality is R, with 44 votes. (b) R and H meet in a run-off; H wins, 50 votes to 48. 7. (a) B is the Plurality winner, with 3 votes. (b) A and B meet in a run-off; A wins, 4 votes to 3. IRV (Instant Run-Off ) 8. D has the fewest first-place votes (2) and is eliminated. Then A is eliminated with 3 first-place votes. In the B vs. C contest, B wins with 7 votes, a majority. 9. B has the fewest first-place votes (5) and is eliminated. Then A is eliminated with 7 first-place votes. In the C vs. D contest, C wins with 16 votes, a majority. 10. (a) B has the fewest first-place votes (9) and is eliminated. In the A vs. C contest, C wins with 20 votes, a majority. (b) A has the fewest first-place votes (8) and is eliminated. In the B vs. C contest, B wins with 17 votes, a majority. (c) The original winner C gets extra support, yet now loses. 11. D has the most last-place votes (7) and is eliminated. Then C has the most last-place votes (7) and is eliminated. In the A vs. B contest, A wins with 8 votes, a majority. 12. A has the most last-place votes (12) and is eliminated. Then C has the most last-place votes (13) and is eliminated. In the B vs. D contest, D wins with 17 votes, a majority. Sequential Run-Off 13. (a) A vs. D: A wins, 19 - 10 A vs. C: A wins, 23 - 6 A vs. B: B wins, 17 - 12 (b) B vs. C: B wins, 17 - 12 B vs. D: D wins, 18 - 11 D vs. A: A wins, 19 - 10 14. (a) A vs. B: B wins, 13 - 8 B vs. C: C wins, 15 - 6 C vs. D: C wins, 12 - 9 152
K25544_SM_Cover.indd 156
11/17/14 7:45 PM
(b) A vs. C: A wins, 11 - 10 A vs. D: A wins, 11 - 10 A vs. B: B wins, 13 - 8 (c) With agenda [D, B, C, A] D vs. B: B wins, 11 - 10 B vs. C: C wins, 15 - 6 C vs. A: A wins, 11 - 10 (d) D loses to everyone else, so D cannot win with any agenda. 15. (a) A vs. C: C wins, 13 - 4 C vs. B: B wins, 10 - 7 B vs. D: D wins, 9 - 8 (b) D vs. C: C wins, 14 - 3 C vs. B: B wins, 10 - 7 B vs. A: B wins, 12 - 5 Pairwise Comparison 16. E E P E
vs. P: E wins, 29 - 21 vs. R: E wins, 30 - 20 vs. R: R wins, 26 - 24 wins 2, R wins 1, P wins 0 ⇒ E is the pairwise winner.
17. A vs. B: A wins, 25 - 18 A vs. C: C wins, 30 - 13 A vs. D: A wins, 23 - 20 B vs. C: B wins, 23 - 20 B vs. D: B wins, 31 - 12 C vs. D: D wins, 25 - 18 A wins 2, B wins 2, C wins 1, D wins 1 ⇒ no pairwise winner. 18. A vs. A vs. A vs. Since
B: A wins, 21 - 15 C: A wins, 30 - 6 D: A wins, 22 - 14 A wins all contests, A is the pairwise winner.
19. N vs. S: N wins, 135 - 65 N vs. W: W wins, 115 - 85 N vs. E: E wins, 155 - 45 S vs. W: W wins, 135 - 65 S vs. E: E wins, 135 - 65 W vs. E: W wins, 115 - 85 N wins 1, S wins 0, W wins 3, E wins 2 ⇒ W is the pairwise winner.
153
K25544_SM_Cover.indd 157
11/17/14 7:45 PM
Borda Count 20. M: (8 × 2) + (15 × 1) = 31 N: (14 × 2) + (8 × 1) = 36 O: (10 × 2) + (9 × 1) = 29 ⇒ N is the Borda Count winner. 21. A: (4 × 3) + (5 × 2) + (2 × 1) = 24 B: (2 × 3) + (4 × 2) + (9 × 1) = 23 C: (5 × 3) + (4 × 2) + (4 × 1) = 27 D: (4 × 3) + (2 × 2) = 16 ⇒ C is the Borda Count winner. 22. A: (11 × 3) + (13 × 2) = 59 B: (7 × 3) + (14 × 2) + (13 × 1) = 62 C: (12 × 3) + (7 × 2) = 50 D: (4 × 3) + (21 × 1) = 33 ⇒ B is the Borda Count winner. Approval Voting 23. A: 22 + 19 = 41 B: 18 + 15 + 9 = 42 C: 22 + 15 = 37 D: 19 + 15 + 9 = 43 ⇒ D is the winner by Approval Voting. 24. A: 5 + 4 = 9 B: 6 + 2 = 8 C: 6 + 4 + 1 = 11 D: 5 + 4 + 1 = 10 E: 5 + 2 + 1 = 8 ⇒ C is the winner by Approval Voting. Combined Methods 25. (a) The Plurality winner is L (15 first-place votes). (b) G and L meet in a run-off: G wins, 26 - 25 ⇒ G is the Plurality Run-Off winner. (c) G vs. L: 26 - 25; G vs. P: 32 - 19; G vs. V: 14 - 37 ⇒ V is the winner. L vs. P: 39 - 12; L vs. V: 29 - 22; L vs. G: 25 - 26 ⇒ G is the winner. L vs. G: 25 - 26; G vs. V: 14 - 37; V vs. P: 25 - 26 ⇒ P is the winner. G vs. V: 14 - 37; V vs. L: 22 - 29; L vs. P: 39 - 12 ⇒ L is the winner.
154
K25544_SM_Cover.indd 158
11/17/14 7:46 PM
(d) G: (14 × 3) + (30 × 1) = 72 L: (15 × 3) + (24 × 2) = 93 P: (12 × 3) + (21 × 1) = 57 V: (10 × 3) + (27 × 2) = 84 ⇒ L is the Borda Count winner. (e) G beats L and P; L beats P and V; P beats V; V beats G. Both G and L have 2 points; no Pairwise Comparison winner. 26. (a) The Plurality winner is A, with 5 first-place votes. (b) A vs. B: 7 - 8 ⇒ B is the Plurality Run-Off winner. (c) Eliminate D (with 1 first-place vote); eliminate E (2 first-place votes). Now A has 5, B has 4, C has 6; eliminate B. A vs. C: 5 - 10, C is the IRV winner. (d) A: (5 × 4) + (6 × 1) = 26 B: (4 × 4) + (5 × 3) + (4 × 1) = 35 C: (3 × 4) + (1 × 3) + (6 × 2) + (5 × 1) = 32 D: (1 × 4) + (6 × 3) + (8 × 2) = 38 E: (2 × 4) + (3 × 3) + (1 × 2) = 19 ⇒ D is the Borda Count winner. (e) B beats everyone else, so B is the Pairwise Comparison winner. 27. (a) The Plurality winner is A, with 8 first-place votes. (b) A vs. D: 8 - 13 D is the Plurality Run-Off winner. (c) C vs. A: 9 - 12 A vs. D: 8 - 13 D vs. B: 9 - 12 B vs. E: 10 - 11 ⇒ E is the Sequential Run-Off winner. (d) A: (8 × 4) + (2 × 2) + (11 × 1) = 47 B: (12 × 3) + (2 × 1) = 38 C: (2 × 4) + (7 × 3) + (8 × 2) = 45 D: (7 × 4) + (2 × 3) + (4 × 2) + (8 × 1) = 50 E: (4 × 4) + (7 × 2) = 30 ⇒ D is the Borda Count winner. (e) A beats B and C; B beats C and D; C beats E; D beats A, C, and E; E beats A and B. ⇒ D is the Pairwise Comparison winner. 28. (a) A vs. C: 8 - 13 C is the Plurality Run-Off winner. (b) A beats B and D; B beats D; C beats A, B, and D; D beats no one. ⇒ C is the Pairwise Comparison winner. 155
K25544_SM_Cover.indd 159
11/17/14 7:46 PM
(c) A: (8 × 3) + (3 × 2) = 30 B: (4 × 3) + (3 × 2) + (14 × 1) = 32 C: (9 × 3) + (5 × 2) + (4 × 1) = 41 D: (10 × 2) + (3 × 1) = 23 ⇒ C is the Borda Count winner also. 29. (a) The Plurality winner is H, with 20 first-place votes. (b) H vs. S: 20 - 25 S is the Plurality Run-Off winner. (c) Eliminate G with 5 first-place votes; eliminate F with 8 first-place votes. In H vs. S contest, S wins with 25 votes. (d) H: (20 × 3) = 60 S: (12 × 3) + (5 × 2) + (18 × 1) = 64 F: (8 × 3) + (20 × 2) + (17 × 1) = 81 G: (5 × 3) + (20 × 2) + (10 × 1) = 65 ⇒ F is the Borda Count winner. (e) F beats everyone and so is the Pairwise Comparison winner.
156
K25544_SM_Cover.indd 160
11/17/14 7:46 PM
Chapter 18
Fairness Criteria and Arrow’s Impossibility Theorem Elections with Two Candidates 1. (a) A gets 9 first-place votes, B only gets 7; so A is the winner. Also, A has the majority of first-place votes. (b) Suppose A gets extra support (from some of the 7 voters ranking A second). Then A gets more than 9 first-place votes and still wins. (c) If the loser B drops out, then A gets 15 first-place votes and wins. (d) So long as A has more first-place votes than B, the above reasoning still holds. Violating the Fairness Criteria 2. (a) A: 8, B: 12, C: 9 A is eliminated; B: 12, C: 17 ⇒ C wins. (b) A: 8, B: 7, C: 14 B is eliminated; A: 15, C: 14 ⇒ A wins. (c) The original winner C gains additional support (and no other preferences change), yet now loses. 3. (a) A: 12, B: 13, C: 7, D: 4 (majority is 19) D is eliminated; A: 12, B: 13, C: 11 C is eliminated; A: 19, B: 17 ⇒ A wins.
157
K25544_SM_Cover.indd 161
11/17/14 7:46 PM
(b) A: 15, B: 10, C: 7, D: 4 (majority is 19) D is eliminated; A: 15, B: 10, C: 11 B is eliminated; A: 15, C: 21 ⇒ C wins (c) The original winner A gains additional support (and no other preferences change), yet now loses. 4. (a) D beats C (6 - 3); B beats D (7 - 2); A beats B (5 - 4) ⇒ A is the winner with agenda [D, C, B, A] (b) All nine voters prefer C to A, yet A wins. 5. (a) A gets 7 of the 21 first-place votes and is the Plurality winner. (b) C drops out; A gets 7, B gets 11, D gets 3 first-place votes, so B wins. (c) Irrelevancy is violated since the losing candidate C drops out and this changes the result of the election. 6. (a) A: 3, B: 4, C: 6 A is eliminated; B: 7, C: 6 ⇒ B wins (b) C drops out; A: 9, B: 4 ⇒ A wins (c) Losing candidate C drops out and this changes the result of the election. 7. (a) A: 4, B: 2, C: 3, D: 1 D is eliminated; A: 4, B: 2, C: 4 B is eliminated; A: 6, C: 4 ⇒ A wins (b) A: 4, B: 5, D: 1 D is eliminated; A: 4, B: 6 ⇒ B wins (c) Losing candidate C drops out and this changes the result of the election. 8. (a) A beats B (2 - 1), C beats A (2 - 1), D beats C (2 - 1) ⇒ D is the winner with agenda [A, B, C, D]. (b) A beats B (2 - 1), A beats D (2 - 1) ⇒ A is the winner with agenda [A, B, D]. (c) Losing candidate C drops out and this changes the result of the election.
9. (a)
A B C
B A (50/18)
C A (50/18) – (34/34)
D D (38/30) B (48/20) C (48/20)
A wins 2 while B, C, D each win 1 ⇒ A is the Pairwise Comparison winner. 158
K25544_SM_Cover.indd 162
11/17/14 7:46 PM
(b) D beats A (38 - 30). (c) Losing candidates B and C drop out and this changes the election result. 10. (a) A: (6 × 3) + (4 × 2) + (5 × 1) = 31 B: (4 × 3) + (5 × 2) + (6 × 1) = 28 C: (4 × 1) = 4 D: (5 × 3) + (6 × 2) = 27 ⇒ A is the Borda Count winner. (b) A: (6 × 2) + (9 × 1) = 21 B: (9 × 2) + (6 × 1) = 24 C: 0 ⇒ B is the Borda Count winner. (c) Losing candidate D drops out and this changes the result of the election. 11. (a) A: (8 × 3) = 24 B: (7 × 3) + (8 × 2) = 37 C: (3 × 2) + (9 × 1) = 15 D: (4 × 2) + (6 × 1) = 14 ⇒ B is the Borda Count winner. (b) B wins by the Borda Count method, but A receives a majority (8) of the 15 first-place votes. 12. (a) A: 10, B: 9, C: 13, D: 14 ⇒ D is the Plurality winner. (b) A beats B (24 - 22), A beats C (24 - 22), A beats D (24 - 22) ⇒ A wins in contests with all other candidates. (c) A beats all other candidates in one-on-one matchups, but the Plurality winner is D. 13. (a) A: 2, B: 2, C: 1 C is eliminated; A: 3, B: 2 ⇒ A is the Plurality Run-Off winner. (b) C beats A (3 - 2), C beats B (3 - 2) ⇒ C wins in contests with all other candidates. (c) C beats all other candidates in one-on-one matchups, but the Plurality Run-Off winner is A. 14. (a) A: 30, B: 23, C: 7, D: 10 C is eliminated; A: 30, B: 23, D: 17 D is eliminated; A: 47, B: 23 ⇒ A is the IRV winner. (b) D beats A (40 - 30), D beats B (47 - 23), D beats C (63 - 7) ⇒ D wins in contests with all other candidates. (c) D is the winner of all one-on-one contests, yet is not elected by IRV.
159
K25544_SM_Cover.indd 163
11/17/14 7:46 PM
15. (a) A: (10 × 3) + (14 × 2) + (14 × 1) = 72 B: (9 × 3) + (13 × 2) + (10 × 1) = 63 C: (13 × 3) + (19 × 2) + (14 × 1) = 91 D: (14 × 3) + (8 × 1) = 50 ⇒ C is the Borda Count winner. (b) A beats B (24 - 22), A beats C (24 - 22), A beats D (24 - 22) ⇒ A wins in contests with all other candidates. (c) A beats all other candidates in one-on-one matchups, but the Borda Count winner is C. Satisfying the Fairness Criteria 16. If A has the majority of first-place votes, then A also has a plurality of firstplace votes and so will win using the Plurality method. 17. If A has the majority of first-place votes, then A wins immediately without any run-off needed. 18. If A has the majority of first-place votes, then A beats any other candidate in a one-to-one contest and so will be the Pairwise Comparison winner. 19. If everyone prefers A to B, then A appears higher on each voter’s profile. So A will have more first-place votes than B (if B has any first-place votes at all). So B cannot win by the Plurality method. 20. Suppose A wins all one-on-one contests. No matter where A is in the agenda order, A will win all succeeding contests and be declared the winner. So the Condorcet criterion is satisfied. 21. Suppose A wins all one-on-one contests with the n − 1 other candidates. Then A gets n − 1 points and no other candidate can get more than n − 2 points. So A is declared the Pairwise Comparison winner and the Condorcet criterion holds.
22. (a)
A B C D
B B (12 - 9)
C A (17 - 4) C (11 - 10)
D A (13 - 8) D (17 - 4) C (11 - 10)
E A (13 - 8) B (12 - 9) E (17 - 4) D (12 - 9)
A wins 3, B wins 2, C wins 2, D wins 2, and E wins 1 ⇒ A is the Pairwise Comparison winner.
(b)
A B C D
B A (17 - 4)
C A (17 - 4) C (11 - 10)
D A (13 - 8) D (17 - 4) C (11 - 10)
E A (21 - 0) B (12 - 9) E (17 - 4) D (12 - 9)
160
K25544_SM_Cover.indd 164
11/17/14 7:46 PM
A wins 4, B wins 1, C wins 2, D wins 2, and E wins 1 ⇒ A is still the Pairwise Comparison winner. A’s points increase while the other candidates’ points either decrease or stay the same. (c) More generally, by moving A’s ranking in some column, A’s points cannot decrease and the points of the other candidates cannot increase. So A remains the Pairwise Comparison winner. 23. (a) A: (8 × 3) + (9 × 2) = 42 B: (6 × 3) + (8 × 2) + (5 × 1) = 39 C: (5 × 3) + (10 × 1) = 25 D: (2 × 2) + (4 × 1) = 8 ⇒ A is the Borda Count winner (b) A: (8 × 3) + (11 × 2) = 46 (increased) B: (6 × 3) + (8 × 2) + (5 × 1) = 39 (remained the same) C: (5 × 3) + (8 × 1) = 23 (decreased) D: (6 × 1) = 6 (decreased) ⇒ A is still the Borda Count winner. (c) More generally, A’s count increases and the counts for the other candidates stay the same or decrease. So A remains the winner by the Borda Count method. Strategic Voting 24. (a) A: 3, B: 4, C: 2 C is eliminated; A: 5, B: 4 ⇒ A is the Plurality Run-Off winner. (b) A: 3, B: 1, C: 5 B is eliminated; A: 4, C: 5 ⇒ C is now the Plurality Run-Off winner. (c) Voters in the second profile achieve a better result by voting insincerely; their second choice (C) wins rather than their third choice (A). 25. (a) A: A: A: ⇒
11, B: 7, C: 8, D: 2, so D is eliminated. 11, B: 7, C: 10, so B is eliminated. 11, C: 17 C is the IRV winner.
(b) A: 0, B: 18, C: 8, D: 2, so A is eliminated. B: 18, C: 8, D: 2, so D is eliminated. B: 18, C: 10 ⇒ B is the IRV winner. (c) Voters in the first profile achieve a better result by voting insincerely; their second choice (B) wins rather than their fourth choice (C).
161
K25544_SM_Cover.indd 165
11/17/14 7:46 PM
26. (a) A beats B (3 - 2); C beats A (3 - 2) ⇒ C is the Sequential Run-Off winner. (b) B beats A (4 - 1); B beats C (4 - 1) ⇒ B is the Sequential Run-Off winner. (c) Voters in the first profile achieve a better result by voting insincerely; their second choice (B) wins rather than their third choice (C).
162
K25544_SM_Cover.indd 166
11/17/14 7:46 PM
Chapter 19
Weighted Voting Systems and Voting Power Weighted Voting Systems 1. Assign D (weight 4) and F (weight 1). q = 10 ensures that w({D, D, F, F}) ≥ q. Also, w({D, F, F, F, F}) = 8 < q and w({D, D, F}) = 9 < q, not enough votes. 2. Let P denote the president and O another officer. (a) Assign P (weight 2) and O (weight 1). q = 4 ensures that w({P, O, O}) ≥ q. Also, w({P, O}) = 3 < q and w({O, O, O}) = 3 < q, not enough votes. (b) Assign P (weight 4) and O (weight 1). q = 4 ensures that w({P}) ≥ q. Also, w({O, O, O}) = 3 < q, not enough votes. 3. (a) All five permanent members P (weight 6), all 10 regular R (weight 1). The coalition {5 P, 4 R} is able to pass a measure, and it has weight w({5 P, 4 R}) = (5 × 6) + (4 × 1) = 34. However, w({4 P, 10 R}) = (4 × 6) + (10 × 1) = 34, and so the coalition {4 P, 10 R} can also pass a measure, contrary to the rules. (b) All five permanent members P (weight 7), all 10 regular R (weight 1). Let q = 39. The coalition {5 P, 4 R} is able to pass a measure since it has weight w({5 P, 4 R}) = (5 × 7) + (4 × 1) = 39 ≥ q. Notice that the coalition {4 P, 10 R} has weight w({4 P, 10 R}) = (4 × 7) + (10 × 1) = 38 < q, and so is a losing coalition.
163
K25544_SM_Cover.indd 167
11/17/14 7:46 PM
4. Assign C (weight 2) and M (weight 1). Then q = 5 ensures that w({C, 3 M}) = 2 + 3 = 5 ≥ q and that w({5 M}) = 5 ≥ q. 5. Assign F (weight 5) and S (weight 1). Setting q = 17 will ensure that w({3 F, 2 S}) = (3 × 5) + (2 × 1) = 17 ≥ q. We can also see that the coalition {2 F, 6 S} has weight w({2 F, 6 S}) = (2 × 5) + (6 × 1) = 16 < q, and so is a losing coalition. 6. A (weight 21), B (weight 15), C (weight 10), q = 31 A T T T T F F F F
B T T F F T T F F
C T F T F T F T F
Weight 46 36 31 21 25 15 10 0
Type W W W L L L L L
Critical A A, B A, C
7. CEO (weight 9), CFO (weight 7), COO (weight 3), q = 10 CEO T T T T F F F F
CFO T T F F T T F F
COO T F T F T F T F
Weight 19 16 12 9 10 7 3 0
Type W W W L W L L L
Critical — CEO, CFO CEO, COO CFO, COO
164
K25544_SM_Cover.indd 168
11/17/14 7:46 PM
8. A (weight 29), B (weight 22), C (weight 12), D (weight 8), q = 49 A T T T T T T T T F F F F F F F F
B T T T T F F F F T T T T F F F F
C T T F F T T F F T T F F T T F F
D T F T F T F T F T F T F T F T F
Weight 71 63 59 51 49 41 37 29 42 34 30 22 20 12 8 0
Type W W W W W L L L L L L L L L L L
Critical A A, B A, B A, B A, C, D
9. GG (weight 15), RB (weight 10), GA (weight 18), EL (weight 26), q = 42 GG T T T T T T T T F F F F F F F F
RB T T T T F F F F T T T T F F F F
GA T T F F T T F F T T F F T T F F
EL T F T F T F T F T F T F T F T F
Weight 69 43 51 25 59 33 41 15 54 28 36 10 44 18 26 0
Type W W W L W L L L W L L L W L L L
Critical — GG, RB, GA GG, RB, EL GA, EL
GA, EL
GA, EL
165
K25544_SM_Cover.indd 169
11/17/14 7:46 PM
10. GG (weight 15), RB (weight 10), GA (weight 18), EL (weight 26), q = 40 GG T T T T T T T T F F F F F F F F
RB T T T T F F F F T T T T F F F F
GA T T F F T T F F T T F F T T F F
EL T F T F T F T F T F T F T F T F
Weight 69 43 51 25 59 33 41 15 54 28 36 10 44 18 26 0
Type W W W L W L W L W L L L W L L L
Critical — GG, RB, GA GG, EL EL GG, EL GA, EL
GA, EL
Banzhaf Power Index 11. A: 35 , B: 15 , C:
1 5
12. CEO: 13 , CFO: 13 , COO: 13. A: 12 , B:
3 10 ,
C:
1 10 ,
D:
1 3
1 10
14. GG: 16 , RB: 16 , GA: 13 , EL: 15. GG: 14 , RB:
1 12 ,
GA: 14 , EL:
1 3 5 12
16. A: 21, B: 15, C: 10, q = 31 Losing Coalition A BC B C —
Weight 21 25 15 10 0
Critical B, C A A A —
The BPI are A: 35 , B: 15 , C:
1 5
166
K25544_SM_Cover.indd 170
11/17/14 7:46 PM
17. A: 29, B: 22, C: 12, D: 8, q = 49 Losing Coalition AC AD A BCD BC BD B CD C D —
Weight 41 37 29 42 34 30 22 20 12 8 0
The BPI are A: 12 , B:
Critical B, D B, C B A A A A A — — — 3 10 ,
C:
1 10 ,
D:
1 10
18. A: 10, B: 7, C: 4, q = 11
(a)
Winning Coalition ABC AB AC BC
Weight 21 17 14 11
(b)
Winning Coalition ABC AB AC BC
Critical — A, B A, C B, C
(c) The BPI are A: 13 , B: 13 , C:
1 3
(d) A: 10, B: 7, C: 4, q = 12 Winning Coalition ABC AB AC
Weight 21 17 14
Critical A A, B A, C
The BPI are A: 35 , B: 15 , C:
1 5
167
K25544_SM_Cover.indd 171
11/17/14 7:46 PM
19. (a) A: 11, B: 7, C: 5, D: 3, q = 14 Winning Coalition Weight ABCD 26 ABC 23 ABD 21 (b) ACD 19 AB 18 AC 16 AD 14 BCD 15
(c)
Winning Coalition ABCD ABC ABD ACD AB AC AD BCD
Critical — A A A A, B A, C A, D B, C, D
(d) The BPI are A:
6 12
= 12 , B:
2 12
= 16 , C:
2 12
= 16 , D:
= .3684; C, D, E:
1 19
= .0526
2 12
=
1 6
20. A: 6, B: 4, C: 1, D: 1, E: 1, q = 9 (a) A:
9 19
= .4737; B:
7 19
(b) A: 5, B: 5, C: 1, D: 1, E: 1, q = 9 The BPI are A, B:
8 16
=
1 2
= .5; C, D, E: 0
(c) By giving up votes, A actually increases his power. 21. P (weight 2), M, M, M, M, M (weight 1), q = 5
(a)
Winning Coalition PMMM PMMMM PMMMMM MMMMM
Weight 5 6 7 5
P Critical C(5, 3) = 10 C(5, 4) = 5
15
A Critical C(4, 2) = 6
C(4, 4) = 1 7
(b) P is critical in 15 coalitions. (c) A is critical in 7 coalitions. (d) Number of critical voters: 15 + (7 × 5) = 50. The BPI are P:
15 50 ,
A:
7 50 .
(e) The chair’s power is 15 7 times that of an ordinary member, slightly more than the 21 ratio of allocated votes. 168
K25544_SM_Cover.indd 172
11/17/14 7:46 PM
22. P (weight 5), M, M, M (weight 3), q = 8
(a)
(1) (2) (3) (4)
Winning Coalition PM PMM PMMM MMM
Weight 8 11 14 9
Number of Winning Coalitions C(3, 1) = 3 C(3, 2) = 3 C(3, 3) = 1 C(3, 3) = 1
(b) P is critical in situations (1) and (2) ⇒ 3 + 3 = 6 coalitions. (c) A is critical in situations (1) and (4) ⇒ 1 + 1 = 2 coalitions. (d) Number of critical voters: 6 + (3 × 2) = 12. The BPI are P: 2 M: 12 = 16 .
6 12
= 12 ,
(e) The chair has three times the power of any regular member. 23. P (weight 5), M, M, M (weight 3), q = 6
(a)
(1) (2) (3) (4) (5)
Winning Coalition PM PMM PMMM MM MMM
Weight 8 11 14 6 9
Number of Winning Coalitions C(3, 1) = 3 C(3, 2) = 3 C(3, 3) = 1 C(3, 2) = 3 C(3, 3) = 1
(b) P is critical in situation (1) ⇒ 3 coalitions. (c) A is critical in situations (1) and (4) ⇒ 1 + 2 = 3 coalitions. (d) Number of critical voters: 3 + (3 × 3) = 12. The BPI are P: 41 , M: 14 . (e) Here the chair has the same power as any regular member. Critical Voters and Decision Trees 24. R: 6, C: 5, O: 4, H: 2, S: 1, q = 10 5
6
H
H 2
4
2
H 1
1
4
1
2
L
L
2 L
1
1
1
L
L
1
H 1
C has weight 5. Eliminate all coalitions X with weight < 5 or weight ≥ 10. This leaves the following 7 winning coalitions: 169
K25544_SM_Cover.indd 173
11/17/14 7:46 PM
5,6 (CR), 5,6,2 (CRH), 5,6,1 (CRS), 5,6,2,1 (CRHS), 5,4,2 (COH), 5,4,1 (COS), 5,4,2,1 (COHS). 25. R: 6, C: 5, O: 4, H: 2, S: 1, q = 10 4
6
H
H 2
5
2
H 1
1
5
1
L
L
2
2 L
1
1
1
L
L
1
H 1
O has weight 4. Eliminate all coalitions X with weight < 6 or weight ≥ 10. This leaves the following 7 winning coalitions: 4,6 (OR), 4,6,2 (ORH), 4,6,1 (ORS), 4,6,2,1 (ORHS), 4,5,2 (OCH), 4,5,1 (OCS), 4,5,2,1 (OCHS). 26. A: 5, B: 7, C: 8, D: 9, E: 11, q = 20 (a) The decision tree relative to E is shown below: 11
9
8 H
H
7
H
8
7
5
5
5 H
7 H
L
L
7 L
5
5 L
5
5
5
(b) Eliminate all coalitions X with weight < 9 or weight ≥ 20. 170
K25544_SM_Cover.indd 174
11/17/14 7:46 PM
(c) E is critical to 7 coalitions: Coalition ABE ACE BCE DE ADE BDE CDE
Weight 23 24 26 20 25 27 28
27. A: 5, B: 7, C: 8, D: 9, E: 11, q = 20 (a) The decision tree relative to C is shown below: 8
L
H
H
H
7
9 H
11
9
7
5
5
5 H
7 H
L
7 L
5
5 L
5
5
5
(b) Eliminate all coalitions X with weight < 12 or weight ≥ 20. (c) C is critical to 5 coalitions: Coalition ABC ACD BCD ACE BCE
Weight 20 22 24 24 26
171
K25544_SM_Cover.indd 175
11/17/14 7:46 PM
Chapter 20
Apportionment Apportionment Concepts 1. (a) total population = 1125; ideal size =
1125 12
= 93.75
(b) The ideal size is the average number of people represented by each seat. (c) A:
505 93.75
380 93.75
= 5.387; B:
= 4.053; C:
240 93.75
= 2.560
(d) The group quota is the number of (decimal) seats for each town, if fractions are allowed. Lower Upper A 5 6 (e) B 4 5 C 2 3 2. (a) total number of homes sold = 58; ideal size = (b) A:
19 7.25
= 2.621; B:
17 7.25
= 2.345; C:
12 7.25
58 8
= 7.25
= 1.655; D:
10 7.25
= 1.379
(c) The group quota is the number of (decimal) tickets each agent is entitled to, if fractions are allowed.
(d)
A B C D
Lower 2 2 1 1
Upper 3 3 2 2
3. (a) total ridership = 3630; the ideal size 3630 13 = 279.23 represents the average number of passengers (ridership) associated with each new bus. 980 279.23 = 650 Purple: 279.23
(b) Red:
3.510; Blue:
705 279.23
= 2.328; Green:
= 2.525; Orange:
610 279.23
685 279.23
= 2.453;
= 2.185
(c) The group quota is the number of (decimal) new buses each route is entitled to, if fractions are allowed. 172
K25544_SM_Cover.indd 176
11/17/14 7:46 PM
(d)
Lower 3 2 2 2 2
Red Blue Orange Purple Green
Upper 4 3 3 3 3
Hamilton Apportionment
4.
5.
6.
Quota Lower Final
Quota Lower Final
Quota Lower Final
A
B
C
Total
5.387 5 5 L
4.053 4 4 L
2.560 2 3 U
11 12
A
B
C
D
Total
2.621 2 3 U
2.345 2 2 L
1.655 1 2 U
1.379 1 1 L
6 8
Red
Blue
Orange
Purple
Green
Total
3.510 3 4 U
2.525 2 3 U
2.453 2 2 L
2.328 2 2 L
2.185 2 2 L
11 13
7.(a,b) total number of students = 2560; ideal size =
2560 20
= 128
Agriculture
Business
Education
Humanities
Sciences
Total
540 4.219 4 4
690 5.391 5 5
325 2.539 2 3
272 2.125 2 2
733 5.727 5 6
18 20
Students Quota Lower Final
Jefferson Apportionment
8.
9.
d = 82 Final
d = 114 Final
A
B
C
505 6.159 6
380 4.634 4
240 2.927 2
Agriculture
Business
Education
Humanities
Sciences
540 4.737 4
690 6.053 6
325 2.851 2
272 2.386 2
733 6.430 6
173
K25544_SM_Cover.indd 177
11/17/14 7:46 PM
10.
d = 8.1 Final Adams
A
B
C
D
E
234 28.889 28 29
989 122.099 122 119
300 37.037 37 37
97 11.975 11 12
144 17.778 17 18
The allocations differ for A, B, D, and E.
11.
d = 65 Final Webster
A
B
C
D
E
235 3.615 3 3
142 2.185 2 2
985 15.154 15 15
305 4.692 4 4
100 1.538 1 1
The allocations are the same.
12.
d = 17.3 Final H-H
A
B
C
259 14.971 14 14
87 5.029 5 5
84 4.855 4 4
The allocations are the same. 13. (a) The ideal size is 1190/28 = 42.5. A B d = 42.5 Rounded Down
(b)
C
D
Total
445 10.471 10
290 6.824 6
260 6.118 6
195 4.588 4
1190
A
B
C
D
Total
445 11.125 11
290 7.250 7
260 6.500 6
195 4.875 4
1190
d = 40 Final
26
28
Adams Apportionment
14.
15.
A
B
C
D
d = 9.6 Final
19 1.979 2
17 1.771 2
12 1.250 2
10 1.042 2
A
B
C
D
E
d = 340 Final
980 2.882 3
705 2.074 3
685 2.015 3
650 1.912 2
610 1.794 2
174
K25544_SM_Cover.indd 178
11/17/14 7:46 PM
16.
d = 73 Final Jefferson
A
B
C
D
E
923 12.644 13 15
293 4.014 5 4
243 3.329 4 3
130 1.781 2 2
73 1.000 1 1
The allocations differ for A, B, and C.
17.
d = 19.4 Final Webster
A
B
C
235 12.113 13 14
78 4.021 5 4
77 3.969 4 4
The allocations differ for A and B.
18.
d = 20 Final H-H
A
B
C
259 12.95 13 14
87 4.35 5 5
84 4.20 5 4
The allocations differ for A and C. 19. (a) The ideal size is 109/15 = 7.27. A B C d = 7.27 Rounded Up
(b)
d = 8.4 Final
D
Total
20 2.751 3
34 4.677 5
42 5.777 6
13 1.788 2
109
A
B
C
D
Total
20 2.381 3
34 4.048 5
42 5.000 5
13 1.548 2
109
16
15
Webster Apportionment
20.
21.
d = 95.1 AM Final
d = 43 AM Final
A
B
C
505 5.310 5.5 5
380 3.996 3.5 4
240 2.524 2.5 3
A
B
C
D
445 10.349 10.5 10
290 6.744 6.5 7
260 6.047 6.5 6
195 4.535 4.5 5 175
K25544_SM_Cover.indd 179
11/17/14 7:46 PM
22.
d = 8.215 AM Final Adams
A
B
C
D
E
234 28.484 28.5 28 29
989 120.390 120.5 120 119
300 36.519 36.5 37 37
97 11.808 11.5 12 12
144 17.529 17.5 18 18
The allocations differ for A and B.
23.
d = 18.7 AM Final H-H
A
B
C
259 13.850 13.5 14 14
87 4.652 4.5 5 5
84 4.492 4.5 4 4
The allocations are the same. 24. The ideal size is 102/10 = 10.2. This is also the final divisor.
d = 10.2 AM Final
A
B
C
D
Total
57 5.588 5.5 6
19 1.863 1.5 2
15 1.471 1.5 1
11 1.078 1.5 1
102
10
Huntington-Hill Apportionment
25.
26.
d = 7.63 GM Final
d = 17.43 GM Final Webster
A
B
C
D
20 2.621 2.449 3
34 4.456 4.472 4
42 5.505 5.477 6
13 1.704 1.414 2
A
B
C
235 13.483 13.491 13 14
78 4.475 4.472 5 4
77 4.418 4.472 4 4
The allocations differ for A and B.
27.
d = 69 GM Final Webster
A
B
C
D
E
235 3.406 3.464 3 3
142 2.058 2.449 2 2
985 14.275 14.491 14 15
305 4.420 4.472 4 4
100 1.449 1.414 2 1
176
K25544_SM_Cover.indd 180
11/17/14 7:46 PM
The allocations differ for C and E.
28.
d = 10.6 GM Final Webster
A
B
C
D
57 5.377 5.477 5 6
19 1.792 1.414 2 2
15 1.415 1.414 2 1
11 1.038 1.414 1 1
The allocations differ for A and C. 29. The ideal size is 123/10 = 12.3. The final divisor is d = 12.0.
d = 12.3 GM d = 12.0 Final
A
B
C
D
Total
40 3.252 3.464 3
38 3.089 3.464 3
28 2.276 2.449 2
17 1.382 1.414 1
123
3.333 3
3.167 3
2.333 2
1.417 2
9 10
Comparison of Methods 30. The total population is 240,000 and the ideal size is 240,000/100 = 2400. A
B
C
D
d = 2400 Lower Hamilton
21,120 8.800 8 9
152,580 63.575 63 64
54,150 22.563 22 22
12,150 5.063 5 5
d = 2350 Jefferson
8.987 8
64.928 64
23.043 23
5.170 5
d = 2450 Adams
8.620 9
62.278 63
22.102 23
4.959 5
d = 2405 AM Webster
8.782 8.5 9
63.443 63.5 63
22.516 22.5 23
5.052 5.5 5
d = 2405 GM H-H
8.782 8.485 9
63.443 63.498 63
22.516 22.494 23
5.052 5.477 5
177
K25544_SM_Cover.indd 181
11/17/14 7:46 PM
31. The total number of students is 952 and the ideal size is 952/25 = 38.08. A
B
C
D
d = 38.08 Lower Hamilton
297 7.799 7 8
259 6.801 6 7
217 5.699 5 5
179 4.701 4 5
d = 36 Jefferson
8.250 8
7.194 7
6.028 6
4.972 4
d = 43 Adams
6.907 7
6.023 7
5.047 6
4.163 5
d = 39.5 AM Webster
7.519 7.5 8
6.557 6.5 7
5.494 5.5 5
4.532 4.5 5
d = 39.65 GM H-H
7.491 7.483 8
6.532 6.481 7
5.473 5.477 5
4.515 4.472 5
32. The total number of students is 57 and the ideal size is 57/9 = 6.33. A
B
C
d = 6.1 AM Webster
40 6.557 6.5 7
9 1.475 1.5 1
8 1.311 1.5 1
d = 6.33 GM H-H
6.319 6.481 6
1.422 1.414 2
1.264 1.414 1
Paradoxes and the Hamilton Apportionment 33. (a) The total population is 9970 and the ideal size is 9970/100 = 99.7. A B C d = 99.7 Hamilton
6314 63.330 63
2525 25.326 25
1131 11.344 12
(b) The total population is 9970 and the ideal size is 9970/101 = 98.71. A B C d = 98.71 Hamilton
6314 63.965 64
2525 25.580 26
1131 11.458 11
(c) The number of seats increased, but C lost a seat.
178
K25544_SM_Cover.indd 182
11/17/14 7:46 PM
34. (a) The total number of employees is 900 and the ideal size is 900/30 = 30. A B C d = 30 Hamilton
161 5.367 6
250 8.333 8
489 16.300 16
(b) The total number of employees is 900 and the ideal size is 900/31 = 29.03. A B C d = 29.03 Hamilton
161 5.546 5
250 8.612 9
489 16.845 17
(c) The number of laptops increased, but A lost a laptop. 35. (a) The total population is 10,240 and the ideal size is 10,240/16 = 640. A B C d = 640 Hamilton
6820 10.656 11
2370 3.703 4
1050 1.641 1
(b) The total population is 10,340 and the ideal size is 10,340/16 = 646.25. A B C d = 646.25 Hamilton
6840 10.584 10
2453 3.796 4
1047 1.620 2
(c) State A increased in size, but lost a seat to State C, which decreased in size. Divisor Methods and Preserving Quota 36. The total population is 1764 and the ideal size is 1764/215 = 8.205. A
B
C
D
E
d = 8.1 Jefferson
234 28.889 28
989 122.099 122
300 37.037 37
97 11.975 11
144 17.778 17
d = 8.205 Lower Upper
28.519 28 29
120.536 120 121
36.563 36 37
11.822 11 12
17.550 17 18
Quota is not preserved since the lower and upper quotas for B are, respectively, 120 and 121, but B is allocated 122 iPads.
179
K25544_SM_Cover.indd 183
11/17/14 7:46 PM
37. The total population is 4000 and the ideal size is 4000/100 = 40. A
B
C
D
d = 41 Adams
3477 84.805 85
173 4.220 5
216 5.268 6
134 3.268 4
d = 40 Lower Upper
86.925 86 87
4.325 4 5
5.400 5 6
3.350 3 4
Quota is not preserved since the lower and upper quotas for A are, respectively, 86 and 87, but A is allocated 85 laptops. 38. The total population is 12,350 and the ideal size is 12,350/25 = 494. A
B
C
D
E
d = 475 AM Webster
6900 14.526 14.5 15
2100 4.421 4.5 4
1650 3.474 3.5 3
1000 2.105 2.5 2
700 1.474 1.5 1
d = 494 Lower Upper
13.968 13 14
4.251 4 5
3.340 3 4
2.024 2 3
1.417 1 2
Quota is not preserved since the lower and upper quotas for A are, respectively, 13 and 14, but A is allocated 15 seats. 39. The total population is 4000 and the ideal size is 4000/100 = 40. A
B
C
D
d = 39.5 GM H-H
3477 88.025 88.499 88
173 4.380 4.472 4
216 5.468 5.477 5
134 3.392 3.464 3
d = 40 Lower Upper
86.925 86 87
4.325 4 5
5.400 5 6
3.350 3 4
Quota is not preserved since the lower and upper quotas for A are, respectively, 86 and 87, but A is allocated 88 laptops.
180
K25544_SM_Cover.indd 184
11/17/14 7:46 PM
Chapter 21
Assessing Apportionment Methods Hamilton Method and the New States Paradox 1. (a) The total population is 18,600 and the ideal size is Province A B Total Population Quota Lower
13,400 11.527 11
5200 4.473 4
18,600
12
4
16
Final (b) Since
3800 1162.5
18,600 16
= 1162.5.
15
= 3.27, we add 3 more seats. Now the ideal size is
1178.95. Province Population Quota Lower
A
B
C
Total
13,400 11.366 11
5200 4.411 4
3800 3.223 3
22,400
11
5
3
19
Final
22,400 19
=
18
(c) The new states paradox occurs since A loses one seat (B gains one). 2. (a) The total sales are 10,000 and the ideal size is Store A B Total Sales Quota Lower
1044 10.44 10
8956 89.56 89
10,000
Final
10
90
100
(b) Since
820 100
10,000 100
= 100.
99
= 8.2, we add 8 more tickets. Now the ideal size is
10,820 108
=
100.185. 181
K25544_SM_Cover.indd 185
11/17/14 7:46 PM
Store
A
B
C
Total
Sales Quota Lower
1044 10.421 10
8956 89.395 89
820 8.185 8
10,820
Final
11
89
8
108
107
(c) The new states paradox occurs since B loses one ticket (A gains one). 3. (a) The total number of patrons is 7495 and the ideal size is Branch A B C Total Patrons Quota Lower
1080 14.410 14
6233 83.162 83
182 2.428 2
7495
14
83
3
100
Final (b) Since 8005 107
510 74.95
7495 100
= 74.95.
99
= 6.80, we add 7 more workstations. Now the ideal size is
= 74.81.
Branch
A
B
C
D
Total
Patrons Quota Lower
1080 14.437 14
6233 83.318 83
182 2.433 2
510 6.817 6
8005
15
83
2
7
107
Final
105
(c) The new states paradox occurs since C loses one workstation (A gains one). 4. (a) The total number of employees is 1960 and the ideal size is Office A B C Total Employees Quota Lower Final (b) Since 2485 13
525 196
990 5.051 5
680 3.469 3
290 1.480 1
1960
5
3
2
10
1960 10
= 196.
9
= 2.68, we add 3 more staff members. Now the ideal size is
= 191.15.
Office Employees Quota Lower Final
A
B
C
D
Total
990 5.179 5
680 3.557 3
290 1.517 1
525 2.747 2
2485
5
4
1
3
13
11
(c) The new states paradox occurs since C loses one staff member (B gains one).
182
K25544_SM_Cover.indd 186
11/17/14 7:46 PM
Webster and Huntington-Hill Apportionments 5. (a) Webster apportionment A B 20 34 d = 7.62 2.625 4.462 AM 2.5 4.5 Final 3 4 (b) H-H apportionment A B
C
D
42 5.512 5.5 6
13 1.706 1.5 2
C
D
20 34 42 13 d = 7.65 2.614 4.444 5.490 1.699 GM 2.449 4.472 5.477 1.414 Final 3 4 6 2 (c) They give the same apportionment. 6. (a) Webster apportionment A B 97 35 d = 10.1 9.604 3.465 AM 9.5 3.5 Final 10 3 (b) H-H apportionment A B
C
D
15 1.485 1.5 1
9 0.891 0.5 1
C
D
97 35 15 9 d = 10.4 9.327 3.365 1.442 0.865 GM 9.487 3.464 1.414 0 Final 9 3 2 1 (c) H-H gives an extra computer to the smaller class C, at the expense of the larger class A. 7. (a) Webster apportionment A B 16 19 d = 10.8 1.481 1.759 AM 1.5 1.5 Final 1 2 (b) H-H apportionment A B d = 11.2 GM Final
16 1.429 1.414 2
19 1.696 1.414 2
C
D
23 2.130 2.5 2
50 4.630 4.5 5
C
D
23 2.054 2.449 2
50 4.464 4.472 4
183
K25544_SM_Cover.indd 187
11/17/14 7:46 PM
(c) H-H gives an extra video camera to A (with a smaller case load) at the expense of D (with a larger case load). Absolute Difference in Representative Share 8. (a) A: (b) B:
7 100 = 0.07 3 40 = 0.075
(c) C: absolute difference = 0.005 9. (a) A: (b) A:
20 1198 19 1198
= 0.01669, B: = 0.01586, B:
6 399 7 399
= 0.01504, absolute difference = 0.00165 = 0.01754, absolute difference = 0.00168
(c) Webster has the smaller absolute difference in RS. 10. (a) A: (b) A:
2 75 3 75
= 0.02667, B: = 0.04, B:
4 136
5 136
= 0.03676, absolute difference = 0.0101
= 0.02941, absolute difference = 0.0106
(c) Webster has the smaller absolute difference in RS. 11. (a) A and C receive different allocations: 10 and 1, vs. 9 and 2. (b) A: (c) A:
10 97 9 97
= 0.1031, B: = 0.0928, B:
1 15 2 15
= 0.0667, absolute difference = 0.0364 = 0.1333, absolute difference = 0.0405
(d) Webster has the smaller absolute difference in RS. 12. (a) A and D receive different allocations: 1 and 5, vs. 2 and 4. (b) A: (c) A:
1 16 2 16
5 50 = 0.10, absolute difference = 0.0375 4 50 = 0.08, absolute difference = 0.045
= 0.0625, D: = 0.125, D:
(d) Webster has the smaller absolute difference in RS. 13. (a) Webster apportionment: A B d = 20.87 AM Final
228 10.925 10.5 11
157 7.523 7.5 8
73 3.498 3.5 3
B
C
157 7.476 7.483 7
73 3.476 3.464 4
H-H apportionment: A d = 21 GM Final
228 10.857 10.488 11
C
They differ in the B and C allocations. (b) B:
8 157
= 0.05096, C:
3 73
= 0.04110, absolute difference = 0.00986 184
K25544_SM_Cover.indd 188
11/17/14 7:46 PM
(c) B:
7 157
4 73
= 0.04459, C:
= 0.05479, absolute difference = 0.0102
(d) Webster has the smaller absolute difference in RS. Absolute Difference in District Size 14. (a) A: (b) B:
100 7 = 14.286 40 3 = 13.333
(c) absolute difference = 0.953 15. (a) A: (b) A:
1198 20 1198 19
399 6 = 66.5, absolute difference B: 399 7 = 57, absolute difference:
= 59.9, B:
= 6.6
= 63.05,
6.05
(c) H-H has the smaller absolute difference in DS. 16. (a) A: (b) A:
75 2 75 3
136 5 = 27.2, absolute difference: 10.3 136 4 = 34, absolute difference = 9.0
= 37.5, D: = 25, D:
(c) H-H has the smaller absolute difference in DS. 17. (a) A and C receive different allocations: 10 and 1, vs. 9 and 2. (b) A: (c) A:
97 10 97 9
= 9.7, C:
15 1
= 15, absolute difference = 5.3
= 10.778, C:
15 2
= 7.5, absolute difference = 3.278
(d) H-H has the smaller absolute difference in DS. 18. (a) A and D receive different allocations: 1 and 5, vs. 2 and 4. (b) A: (c) A:
16 1 16 2
50 5 = 10, absolute difference = 6 50 4 = 12.5, absolute difference = 4.5
= 16, D: = 8, D:
(d) H-H has the smaller absolute difference in DS. 19. (a) B and C receive different allocations: 8 and 3, vs. 7 and 4. (b) B: (c) B:
157 8 157 7
= 19.625, C: = 22.429, C:
73 3 73 4
= 24.333, absolute difference = 4.708 = 18.25, absolute difference = 4.179
(d) H-H has the smaller absolute difference in DS. Relative Differences in Representative Share and District Size 20. (a) A:
7 100
= 0.07, B:
3 40
= 0.075, relative difference in RS =
0.075−0.07 0.07
→ 7.14%. (b) A: =
100 40 7 = 14.2857, B: 3 = 13.3333, 14.2857−13.3333 → 7.14%. 13.3333
relative difference in DS
(c) The same percentage is found.
185
K25544_SM_Cover.indd 189
11/17/14 7:46 PM
21. (a) Webster: 6 A: 900 = 0.006667, B:
1 234
= 0.004274, relative difference in RS is 56.0%.
H-H: 5 A: 900 = 0.005556, B:
2 234
= 0.008547, relative difference in RS is 53.8%.
(b) Webster: A: 900 6 = 150, B:
234 1
= 234, relative difference in DS is 56.0%.
H-H: A: 900 5 = 180, B:
234 2
= 117, relative difference in DS is 53.8%.
(c) The same percentage (RS or DS) is found for each method. (d) H-H gives the lower percentage. 22. (a) Webster: 6 A: 1000 = 0.006, B:
4 817
= 0.004896, relative difference in RS is 22.5%.
H-H: 5 A: 1000 = 0.005, B:
5 817
= 0.006120, relative difference in RS is 22.4%.
(b) Webster: A: 1000 6 = 166.667, B: H-H: A: 1000 5 = 200, B:
817 5
817 4
= 204.25, relative difference in DS is 22.5%.
= 163.4, relative difference in DS is 22.4%.
(c) The same percentage (RS or DS) is found for each method. (d) H-H gives the lower percentage. 23. (a) A and C receive different allocations: 10 and 1, vs. 9 and 2. Webster: 10 1 A: 97 = 0.1031, C: 15 = 0.06667, relative difference in RS is 54.6%. H-H: 9 A: 97 = 0.09278, C: (b) Webster: A: 97 10 = 9.7, C:
15 1
2 15
= 0.1333, relative difference in RS is 43.7%.
= 15, relative difference in DS is 54.6%.
H-H: A: 97 9 = 10.778, C:
15 2
= 7.5, relative difference in DS is 43.7%.
(c) The same percentage (RS or DS) is found for each method. (d) H-H gives the lower percentage. 24. (a) A and D receive different allocations: 1 and 5, vs. 2 and 4. Webster: 1 5 A: 16 = 0.0625, D: 50 = 0.1, relative difference in RS is 60%. H-H: 2 A: 16 = 0.125, D:
4 50
= 0.08, relative difference in RS is 56.25%.
186
K25544_SM_Cover.indd 190
11/17/14 7:46 PM
(b) Webster: A: 16 1 = 16, D: H-H: A: 16 2 = 8, D:
50 5
50 4
= 10, relative difference in DS is 60%.
= 12.5, relative difference in DS is 56.25%.
(c) The same percentage (RS or DS) is found for each method. (d) H-H gives the lower percentage. 25. (a) B and C receive different allocations: 8 and 3, vs. 7 and 4. Webster: 3 8 B: 157 = 0.05096, C: 73 = 0.04110, relative difference in RS is 24.0%. H-H: 7 B: 157 = 0.04459, C:
4 73
= 0.05479, relative difference in RS is 22.9%.
(b) Webster: B: 157 8 = 19.625, C:
73 3
= 24.333, relative difference in DS is 24.0%.
H-H: B: 157 7 = 22.429, C:
73 4
= 18.25, relative difference in DS is 22.9%.
(c) The same percentage (RS or DS) is found for each method. (d) H-H gives the lower percentage. 26. Let a be the representative share of A, and let b be the representative share of B; suppose a > b. Then the relative difference in representative share is a−b a = − 1. b b Now the district size of A is a1 and the district size of B is 1b , where The relative difference in district size is then 1 b
− 1 a
1 a
=
1 b 1 a
−1=
1 b
> a1 .
a − 1, b
the same as the relative difference in representative share. Redistricting 4,012,012 = 668, 669 6 678,048−650,923 = 0.0406 → 668,669
27. Average district population = Population deviation =
4.06%
28. (a) A: 402, B: 517, C: 486, D: 443 Average district population = 402+517+486+443 = 462 4 Population deviation =
517−402 462
= 0.249 → 24.9%
187
K25544_SM_Cover.indd 191
11/17/14 7:46 PM
(b) A better partitioning into four districts is shown below: A
C
120
115
133 162
78
89
128
94
112
93
107
85
159
122
121 130
B
D
A: {120, 115, 133, 89} has total population 457 B: {162, 128, 94, 85} has total population 469 C: {78, 112, 159, 122} has total population 471 D: {93, 107, 121, 130} has total population 451 The average district population is still 462. Population deviation = 471−451 = 0.043 → 4.3%. 462 29. (a) A: 228, B: 277, C: 223, D: 212 Average district population = 228+277+223+212 = 235 4 Population deviation = 277−212 = 0.277 → 27.7%. 235 (b) A better partitioning into four districts is shown below: A
C
43
81
50
68
65
39
67
92
56
58
57
75
67
42
32
48
B
D
A: {43, 81, 50, 67} has total population 241 B: {68, 92, 75} has total population 235 C: {65, 56, 67, 42} has total population 230 D: {39, 58, 57, 32, 48} has total population 234 The average district population is still 235. Population deviation = 241−230 = 0.047 → 4.7%. 235
188
K25544_SM_Cover.indd 192
11/17/14 7:46 PM
Chapter 22
Modular Arithmetic and Cryptography Modular Remainders 1. (a) 4 is the remainder because the largest multiple of 6 that is less than or equal to 10 is 6 and 10 − 6 = 4. (b) 3 is the remainder because the largest multiple of 6 that is less than or equal to 3 is 0 and 3 − 0 = 3. (c) 5 is the remainder because the largest multiple of 6 that is less than or equal to −13 is −18, and −13 − (−18) = 5. 2. (a) 8 is the remainder because the largest multiple of 9 that is less than or equal to 35 is 27 and 35 − 27 = 8. (b) 6 is the remainder because the largest multiple of 9 that is less than or equal to 6 is 0 and 6 − 0 = 6. (c) 7 is the remainder because the largest multiple of 9 that is less than or equal to −2 is −9 and −2 − (−9) = 7. 3. (a) 25 is the remainder because the largest multiple of 26 that is less than or equal to 51 is 26 and 51 − 26 = 25. (b) 1 is the remainder because the largest multiple of 26 that is less than or equal to −51 is −52 and −51 − (−52) = 1. (c) 0 is the remainder because the largest multiple of 26 that is less than or equal to 52 is 52 and 52 − 52 = 0. 4. (1 + 365) (mod 7) = 366 (mod 7) = 2 or Tuesday. 5. (3 + 3 + 6 + 5 + 2) (mod 7) = 19 (mod 7) = 5 or Friday.
189
K25544_SM_Cover.indd 193
11/17/14 7:46 PM
6. (6 + 250) (mod 12) = 256 (mod 12) = 4 or May. Since 256 divided by 12 is 21 with the remainder 4, we add 21 years to 2012 which gives us the year 2033. So, the bond matures in May 2033. 7. It will take five rounds. Since K corresponds to position 1 and L corresponds to position 2, we are solving the linear congruence 1 + 3x ≡ 2 (mod 7), which has the solution x ≡ 5 (mod 7). Linear Congruences 8. True, since 10 and 25 both have the remainder of 0 when divided by 5. 9. True, since 6 and 26 both have the remainder of 6 when divided by 10. 10. False, since 14 (mod 6) = 2 and 21 (mod 6) = 3. Equivalently, 14 − 21 = −7 is not a multiple of 6. 11. True, since −10 (mod 3) = 2 and 14 (mod 3) = 2. Equivalently, −10 − 14 = −24 is a multiple of 3. 12. False, since 11 (mod 6) = 5 and −5 (mod 6) = 1. Equivalently, 11−(−5) = 16 is not a multiple of 6. Modular Inverses and Linear Congruences 13. x = 4 because 4 × 7 (mod 9) = 28 (mod 9) = 1. 14. x = 7 because 7 × 8 (mod 11) = 56 (mod 11) = 1. 15. x = 15 because 15 × 8 (mod 17) = 120 (mod 17) = 1. 16. We use the fact that 5 is the inverse of 3, modulo 7. 1. 3x ≡ 2 (mod 7)
Given
2. 5(3x) ≡ 5(2) (mod 7)
1, Multiplying both sides by 5
3. 15x ≡ 10 (mod 7)
2, Simplification
4. 1x ≡ 3 (mod 7)
3, Since 15 ≡ 1 (mod 7), 10 ≡ 3 (mod 7)
5. x ≡ 3 (mod 7)
4, Simplification
17. We use the fact that 9 is the inverse of 9, modulo 10. 1. 9x ≡ 2 (mod 10)
Given
2. 9(9x) ≡ 9(2) (mod 10) 1, Multiplying both sides by 9 3. 81x ≡ 18 (mod 10)
2, Simplification
4. 1x ≡ 8 (mod 10)
3, Since 81 ≡ 1 (mod 10), 18 ≡ 8 (mod 10)
5. x ≡ 8 (mod 10)
4, Simplification 190
K25544_SM_Cover.indd 194
11/17/14 7:46 PM
18. Let x denote the number of 4-cent stamps used and let y be the number of 7-cent stamps used. We are then led to solving the equation 4x + 7y = 47. In order to make this easier to solve, let’s instead solve the congruence 4x + 7y ≡ 47 (mod 4). (a) We can simplify 4x + 7y ≡ 47 (mod 4) as follows. Since 4 (mod 4) = 0, 7 (mod 4) = 3, and 47 (mod 4) = 3, we obtain 0 + 3y ≡ 3 (mod 4) or 3y ≡ 3 (mod 4). To solve for y, we use the fact that 3 is the modular inverse of 3, modulo 4. 1. 3y ≡ 3 (mod 4)
Given
2. 3(3y) ≡ 3(3) (mod 4)
1, Multiplying both sides by 3
3. 9y ≡ 9 (mod 4)
2, Simplification
4. 1y ≡ 1 (mod 4)
3, Since 9 ≡ 1 (mod 4)
5. y ≡ 1 (mod 4)
4, Simplification
Now y ≡ 1 (mod 4) means that 1 is the remainder when y is divided by 4. Equivalently, y = 1 + 4k, where k is some integer. (b) We can now solve for x: 1. 4x + 7y = 47
Given
2. 4x + 7(1 + 4k) = 47
1, Substituting y = 1 + 4k
3. 4x + 7 + 28k = 47
2, Simplification
4. 4x + 28k = 40
3, Subtracting 7 from both sides
5. x + 7k = 10
4, Dividing both sides by 4
6. x = 10 − 7k
5, Subtracting 7k from both sides
(c) All integer solutions of our original equation 4x + 7y = 47 can now be expressed as x = 10 − 7k and y = 1 + 4k, where the parameter k ranges over all (positive, negative, zero) integers. In our stamp scenario, the only meaningful solutions for x and y are nonnegative. For k = 0: x = 10, y = 1; for k = 1, x = 3, y = 5. (No other values of k ensure that x and y are nonnegative.) So the postmaster can dispense ten 4-cent stamps and one 7-cent stamp, or can dispense three 4-cent stamps and five 7-cent stamps. 19. (a) Since 13 (mod 13) = 0, 17 (mod 13) = 4, and 453 (mod 13) = 11, the congruence 13x + 17y ≡ 453 (mod 13) simplifies to the following, which we can then solve: 1. 4y ≡ 11 (mod 13)
Given
2. 10(4y) ≡ 10(11) (mod 13) 1, Multiplying both sides by 10 3. 40y ≡ 110 (mod 13)
2, Simplification
4. 1y ≡ 6 (mod 13)
3, Since 40 ≡ 1 (mod 13), 110 ≡ 6 (mod 13)
5. y ≡ 6 (mod 13)
4, Simplification 191
K25544_SM_Cover.indd 195
11/17/14 7:46 PM
All possible solutions y can then be expressed as y = 6 + 13k, where k is some integer. (b) We can now solve for x: 1. 13x + 17y = 453
Given
2. 13x + 17(6 + 13k) = 453
1, Substituting y = 6 + 13k
3. 13x + 102 + 221k = 453
2, Simplification
4. 13x + 221k = 351
3, Subtracting 102 from both sides
5. x + 17k = 27
4, Dividing both sides by 13
6. x = 27 − 17k
5, Subtracting 17k from both sides
(c) All integer solutions of our original equation 13x + 17y = 453 can now be expressed as x = 27 − 17k and y = 6 + 13k, where the parameter k ranges over all (positive, negative, zero) integers. There are only two values of k that produce nonnegative values for x and y. Namely, k = 0: x = 27, y = 6; k = 1: x = 10, y = 19. The solution with the fewest stamps uses ten 13-cent stamps and nineteen 17-cent stamps, for a total of 29 stamps. 20. (a) Since 11 (mod 11) = 0, 13 (mod 11) = 2, and 553 (mod 11) = 3, the congruence 11x + 13y ≡ 553 (mod 11) simplifies to the following, which we can then solve: 1. 2y ≡ 3 (mod 11)
Given
2. 6(2y) ≡ 6(3) (mod 11) 1, Multiplying both sides by 6 3. 12y ≡ 18 (mod 11)
2, Simplification
4. 1y ≡ 7 (mod 11)
4, Since 12 ≡ 1 (mod 11), 18 ≡ 7 (mod 11)
5. y ≡ 7 (mod 11)
5, Simplification
All possible solutions y can then be expressed as y = 7 + 11k, where k is some integer. (b) We can now solve for x: 1. 11x + 13y = 553
Given
2. 11x + 13(7 + 11k) = 553
1, Substituting y = 7 + 11k
3. 11x + 91 + 143k = 553
2, Simplification
4. 11x + 143k = 462
3, Subtracting 91 from both sides
5. x + 13k = 42
4, Dividing both sides by 11
6. x = 42 − 13k
5, Subtracting 13k from both sides
(c) All integer solutions of our original equation 11x + 13y = 553 can now be expressed as x = 42 − 13k and y = 7 + 11k, where the parameter k ranges over all (positive, negative, zero) integers. There are only four 192
K25544_SM_Cover.indd 196
11/17/14 7:46 PM
values of k that produce nonnegative values for x and y. Namely, k = 0: x = 42, y = 7; k = 1: x = 29, y = 18; k = 2: x = 16, y = 29; k = 3: x = 3, y = 40. The solution with the fewest stamps uses three 11-cent and forty 13-cent stamps, for a total of 43 stamps. Caesar Cipher 21. We carry out the encryption as follows: S 18 6 G
E 4 18 S
A 0 14 O
G 6 20 U
U 20 8 I
L 11 25 Z
L 11 25 Z
Plaintext letter Alphabetic position Add a shift of 14 Ciphertext letter
22. We carry out the encryption as follows: P 15 9 J
E 4 24 Y
L 11 5 F
I 8 2 C
C 2 22 W
A 0 20 U
N 13 7 H
Plaintext letter Alphabetic position Add a shift of 20 Ciphertext letter
23. We carry out the decryption as follows: N 13 7 H
A 0 20 U
S 18 12 M
H 7 1 B
R 17 11 L
K 10 4 E
Ciphertext letter Alphabetic position Subtract a shift of 6 Plaintext letter
24. We carry out the decryption as follows: R 17 14 O
U 20 17 R
L 11 8 I
J 9 6 G
L 11 8 I
Q 16 13 N
D 3 0 A
O 14 11 L
Ciphertext letter Alphabetic position Subtract a shift of 3 Plaintext letter
25. We carry out the decryption as follows: J 9 0 A
A 0 17 R
A 0 17 R
R 17 8 I
E 4 21 V
N 13 4 E
Ciphertext letter Alphabetic position Subtract a shift of 9 Plaintext letter
193
K25544_SM_Cover.indd 197
11/17/14 7:46 PM
26. We keep trying possible shift lengths until we find the likely plaintext COW. Shift of 1 F R Z 5 17 25 4 16 24 E Q Y
Shift of 2 F R Z 5 17 25 3 15 23 D P X
Shift of 3 F R Z 5 17 25 2 14 22 C O W
27. We keep trying possible shift lengths until we find the likely plaintext FIRE.
J 9 8 I
Shift M 12 11 L
of 1 V 21 20 U
I 8 7 H
Shift M 12 10 K
J 9 7 H
of 2 V 21 19 T
I 8 6 G
J 9 6 G
Shift M 12 9 J
of 3 V 21 18 S
I 8 5 F
J 9 5 F
Shift M 12 8 I
of 4 V 21 17 R
I 8 4 E
Frequency Analysis 28. Since X is the most frequent letter in the ciphertext, and since E is the most frequent letter in Table 22.13, we would try X → E, but there is no two-letter English word beginning with E. So we try the next most frequent letter in Table 22.13 which is A. If X → A, we can have possible two-letter English words, so we try the corresponding shift of 23 (to the left). F 5 8 I
X 23 0 A
J 9 12 M
I 8 11 L
X 23 0 A
Q 16 19 T
B 1 4 E
Ciphertext letter Alphabetic position Subtract a shift of 23 Plaintext letter
This results in the meaningful plaintext “I am late.” 29. Since there are two Qs and two Ms in the ciphertext, we would assign the most frequent letter E in Table 22.13 to either Q or M. It must be Q, because there is no single-letter word E in the English language. When Q → E, we have a shift of 12 (to the left). U 20 8 I
Z 25 13 N
Q 16 4 E
Q 16 4 E
P 15 3 D
M 12 0 A
O 14 2 C
M 12 0 A
D 3 17 R
Ciphertext letter Alphabetic position Subtract a shift of 12 Plaintext letter
This results in the meaningful plaintext “I need a car.” 30. The most frequent letters in the ciphertext are G(5), C(3), J(2), N(2), V(2), Y(2). We first try the substitutions G → E, C → A and make subsequent guesses consistent with English word patterns. 194
K25544_SM_Cover.indd 198
11/17/14 7:46 PM
Original Cryptogram Substitute G→ E Substitute C→ A Substitute V→ T Substitute J→ H, T→ R Substitute N→ L, K→ I Substitute Y → W, D → B, P → N
JG YKNN DG CV VJG PGY CTGC JE YKNN DE CV VJE PEY CTEC JE YKNN DE AV VJE PEY ATEA JE YKNN DE AT TJE PEY ATEA HE YKNN DE AT THE PEY AREA HE YILL DE AT THE PEY AREA HE WILL BE AT THE NEW AREA
31. The most frequent letters in the ciphertext are D(3), O(2), Q(2), V(2). Since D is the most frequent letter in the ciphertext, and since there is no two-letter English word beginning with E, we begin with the substitution D → A. We make subsequent guesses consistent with English word patterns. Original Cryptogram Substitute D→ A Substitute Q→ N Substitute V → S, L→ I, Substitute W → T Substitute P → M, O → L
DQ DQW LV VPDOO AQ AQW LV VPAOO AN ANW LV VPAOO AN ANW IS SPAOO AN ANT IS SPAOO AN ANT IS SMALL
Vigen` ere Cipher 32. We carry out the encryption as follows: 16 Q W 22 12 M
20 U A 0 20 U
0 A V 21 21 V
13 N E 4 17 R
19 T W 22 15 P
20 U A 0 20 U
12 M V 21 7 H
Alphabetic position (plaintext) Plaintext Keyword Alphabetic position (keyword) Add shift lengths to plaintext Ciphertext
33. We carry out the encryption as follows: 15 P Z 25 14 O
7 H E 4 11 L
14 O R 17 5 F
19 T O 14 7 H
14 O Z 25 13 N
13 N E 4 17 R
Alphabetic position (plaintext) Plaintext Keyword Alphabetic position (keyword) Add shift lengths to plaintext Ciphertext
195
K25544_SM_Cover.indd 199
11/17/14 7:46 PM
34. We carry out the encryption as follows: 15 P L 11 0 A
0 A A 0 0 A
17 R S 18 9 J
19 T E 4 23 X
8 I R 17 25 Z
2 C L 11 13 N
11 L A 0 11 L
4 E S 18 22 W
Alphabetic position (plaintext) Plaintext Keyword Alphabetic position (keyword) Add shift lengths to plaintext Ciphertext
35. We carry out the decryption as follows: 7 H D 3 4 E
16 Q I 8 8 I
15 P C 2 13 N
22 W E 4 18 S
22 W D 3 19 T
12 M I 8 4 E
10 K C 2 8 I
17 R E 4 13 N
Alphabetic position (ciphertext) Ciphertext Keyword Alphabetic position (keyword) Subtract shift lengths from ciphertext Plaintext
36. We carry out the decryption as follows: 25 Z S 18 7 H
13 N T 19 20 U
1 B A 0 1 B
20 U T 19 1 B
19 T I 8 11 L
6 G C 2 4 E
Alphabetic position (ciphertext) Ciphertext Keyword Alphabetic position (keyword) Subtract shift lengths from ciphertext Plaintext
37. We carry out the decryption as follows: 0 A L 11 15 P
11 L A 0 11 L
22 W W 22 0 A
24 Y L 11 13 N
2 C A 0 2 C
6 G W 22 10 K
Alphabetic position (ciphertext) Ciphertext Keyword Alphabetic position (keyword) Subtract shift lengths from ciphertext Plaintext
196
K25544_SM_Cover.indd 200
11/17/14 7:46 PM
38. Trying AB produces IQ VQ . . . , which is not meaningful. Trying AC produces IP VP . . . , which is not meaningful. Trying CD does produce meaningful text: 8 I C 2 6 G
17 R D 3 14 O
21 V C 2 19 T
17 R D 3 14 O
21 V C 2 19 T
10 K D 3 7 H
6 G C 2 4 E
10 K D 3 7 H
16 Q C 2 14 O
23 X D 3 20 U
20 U C 2 18 S
7 H D 3 4 E
Alphabetic position (ciphertext) Ciphertext Keyword Alphabetic position (keyword) Subtract shift lengths from ciphertext Plaintext
The ciphertext is then decrypted as the message “Go to the house.”
197
K25544_SM_Cover.indd 201
11/17/14 7:46 PM
Chapter 23
Binary Representation and Symmetric Cryptosystems Decimal, Hexadecimal, and Binary Number Systems 1. (a) Converting to binary, the largest power of 2 that does not exceed 5 is 22 = 4. Subtracting this produces 5 − 4 = 1 = 20 . This gives 5 = 22 + 20 and so the binary representation is 101. Converting to hexadecimal, the largest power of 16 that does not exceed 5 is 160 = 1. This gives 5 = 5×160 and so the hexadecimal representation is 5. (b) Converting to binary, the largest power of 2 that does not exceed 22 is 24 = 16. Subtracting this produces 22 − 16 = 6. The largest power of 2 that does not exceed 6 is 22 = 4 and subtracting this produces 6 − 4 = 2 = 21 . This gives 22 = 24 + 22 + 21 and so the binary representation is 10110. Converting to hexadecimal, the largest power of 16 that does not exceed 22 is 161 = 16. Dividing 22 by 16 gives a quotient of 1 and a remainder of 6. The remainder can now be expressed as 6 = 6×160 . So the hexadecimal representation of 22 is 16. (c) Converting to binary, the largest power of 2 that does not exceed 139 is 27 = 128. Subtracting this produces 139 − 128 = 11. The largest power of 2 that does not exceed 11 is 23 = 8 and subtracting this produces 11−8 = 3. Continuing we obtain 3 = 21 + 20 . This gives 139 = 27 + 23 + 21 + 20 and so the binary representation is 10001011. Converting to hexadecimal, the largest power of 16 that does not exceed 139 is 161 = 16. Dividing 139 by 16 gives a quotient of 8 and a remainder of 11. The remainder can now be expressed as 11 = 11 × 160 . Then 139 = (8 × 161 ) + (11 × 160 ) and so the hexadecimal representation of 139 is 8B. 198
K25544_SM_Cover.indd 202
11/17/14 7:46 PM
2. (a) Converting to binary, the largest power of 2 that does not exceed 313 is 28 = 256. Subtracting this produces 313 − 256 = 57. The largest power of 2 that does not exceed 57 is 32 = 25 and subtracting this produces 57 − 32 = 25. Continuing we obtain 25 = 24 + 23 + 20 . This gives 313 = 28 + 25 + 24 + 23 + 20 and so the binary representation is 100111001. Converting to hexadecimal, the largest power of 16 that does not exceed 313 is 162 = 256. Dividing 313 by 256 gives a quotient of 1 and a remainder of 57. The largest power of 16 that does not exceed 57 is 161 = 16. Dividing 57 by 16 gives a quotient of 3 and a remainder of 9. The remainder can now be expressed as 9 = 9 × 160 . Then 313 = (1 × 162 ) + (3 × 161 ) + (9 × 160 ) and so the hexadecimal representation of 313 is 139. (b) Converting to binary, the largest power of 2 that does not exceed 579 is 29 = 512. Subtracting this produces 579 − 512 = 67. The largest power of 2 that does not exceed 67 is 64 = 26 and subtracting this produces 67 − 64 = 3. Continuing we obtain 3 = 21 + 20 . This gives 579 = 29 + 26 + 21 + 20 and so the binary representation is 1001000011. Converting to hexadecimal, the largest power of 16 that does not exceed 579 is 162 = 256. Dividing 579 by 256 gives a quotient of 2 and a remainder of 67. The largest power of 16 that does not exceed 67 is 161 = 16. Dividing 67 by 16 gives a quotient of 4 and a remainder of 3. The remainder can now be expressed as 3 = 3 × 160 . Then 579 = (2 × 162 ) + (4 × 161 ) + (3 × 160 ) and so the hexadecimal representation of 579 is 243. (c) Converting to binary, the largest power of 2 that does not exceed 1000 is 29 = 512. Subtracting this produces 1000 − 512 = 488. The largest power of 2 that does not exceed 488 is 256 = 28 and subtracting this produces 488 − 256 = 232. Continuing we obtain 232 = 27 + 26 + 25 + 23 . This gives 1000 = 29 + 28 + 27 + 26 + 25 + 23 and so the binary representation is 1111101000. Converting to hexadecimal, the largest power of 16 that does not exceed 1000 is 162 = 256. Dividing 1000 by 256 gives a quotient of 3 and a remainder of 232. The largest power of 16 that does not exceed 232 is 161 = 16. Dividing 232 by 16 gives a quotient of 14 and a remainder of 8. The remainder can now be expressed as 8 = 8 × 160 . Then 1000 = (3 × 162 ) + (14 × 161 ) + (8 × 160 ) and so the hexadecimal representation of 1000 is 3E8. 3. (a) (1 × 23 ) + (1 × 22 ) = 8 + 4 = 12. (b) (1 × 25 ) + (1 × 23 ) + (1 × 21 ) = 32 + 8 + 2 = 42. (c) (1×27 )+(1×26 )+(1×24 )+(1×21 )+(1×20 ) = 128+64+16+2+1 = 211.
199
K25544_SM_Cover.indd 203
11/17/14 7:46 PM
4. (a) (11 × 161 ) + (3 × 160 ) = (11 × 16) + (3 × 1) = 179. (b) (2 × 162 ) + (10 × 161 ) + (7 × 160 ) = (2 × 256) + (10 × 16) + (7 × 1) = 679. (c) (13×162 )+(4×161 )+(12×160 ) = (13×256)+(4×16)+(12×1) = 3404. 5. (a) P → 80 and M → 77. (b) 80 = (5 × 16) so 80 → 50. 77 = (4 × 16) + (13 × 1) so 77 → 4D. (c) 50 → 01010000 and 4D → 01001101. Pseudo-Random Numbers 6. (a) 00110-110-110 . . .; this only generates the four sequences 001, 011, 110, and 101. (b) 101-101-101 . . .; this only generates the three sequences 101, 011, and 110. 7. 001101011110001-001101011110001 . . .; this generates all 15 nonzero sequences, that is, all 4-bit sequences except 0000. 8. 00111001-0111001-0111001 . . .; this generates only the eight sequences 0011, 0111, 1110, 1100, 1001, 0010, 0101, and 1011. 9. 0010110-0010110 . . .; this generates only seven of the 15 nonzero 4-bit sequences: 0010, 0101, 1011, 0110, 1100, 1000, and 0001. Vernam Cipher 10.(a,b) Using Table 23.4, R is assigned 82, U is assigned 85, and N is assigned 78. These decimal numbers are (respectively) converted into 01010010, 01010101, and 01001110. (c) Combining these three 8-bit strings produces the following plaintext message of length 24: 010100100101010101001110. Plaintext Random Key Ciphertext
010100100101010101001110 100001010111000101101001 110101110010010000100111
11.(a,b) Using Table 23.4, K is assigned 75, G is assigned 71, and B is assigned 66. These decimal numbers are (respectively) converted into 01001011, 01000111, and 01000010. (c) Combining these three 8-bit strings produces the following plaintext message of length 24: 010010110100011101000010. Plaintext Random Key Ciphertext
010010110100011101000010 000001000011000101001001 010011110111011000001011 200
K25544_SM_Cover.indd 204
11/17/14 7:46 PM
12. (a) XORing of the ciphertext with the key produces Ciphertext Random Key Plaintext
110100100010101000110000 100000010110000101101001 010100110100101101011001
(b) The binary number 01010011 is converted to the decimal number (1 × 64) + (1 × 16) + (1 × 2) + (1 × 1) = 83, which then corresponds to the plaintext letter S. Similarly, 01001011 is converted to the decimal number (1 × 64) + (1 × 8) + (1 × 2) + (1 × 1) = 75, giving the plaintext letter K, and 01011001 is converted to the decimal number (1 × 64) + (1 × 16) + (1 × 8) + (1 × 1) = 89, giving the ciphertext letter Y. The plaintext SKY is obtained. 13. (a) XORing of the ciphertext with the key produces Ciphertext Random Key Plaintext
010001110111000000001100 000001010011000101001011 010000100100000101000111
(b) The binary number 01000010 is converted to the decimal number (1 × 64) + (1 × 2) = 66, which then corresponds to the plaintext letter B. Similarly, 01000001 is converted to the decimal number (1×64)+(1×1) = 65, giving the plaintext letter A, and 01000111 is converted to the decimal number (1 × 64) + (1 × 4) + (1 × 2) + (1 × 1) = 71, giving the ciphertext letter G. The plaintext BAG is obtained. 14. (a) To convert 79 into binary, we subtract the largest power of 2, giving 79 − 26 = 79 − 64 = 15; from 15 we subtract the largest power of 2, giving 15 − 23 = 15 − 8 = 7; and so on. The result is the expression 79 = 64 + 8 + 4 + 2 + 1 = 26 + 23 + 22 + 21 + 20 , providing the binary representation 01001111. Likewise, we find 139 = 128 + 8 + 2 + 1 = 27 + 23 + 21 + 20 , giving the binary representation 10001011. Finally, 26 = 16 + 8 + 2 = 24 + 23 + 21 , giving the binary representation 00011010. (b) The three binary RGB numbers are combined into the 24-bit string 010011111000101100011010. Suppose that we use the randomly generated 24-bit key 111100100100000011100000. The 24-bit plaintext and the 24-bit key are combined in the table below using the XOR operation: Plaintext Random Key Ciphertext
010011111000101100011010 111100100100000011100000 101111011100101111111010
(c) The ciphertext 10111101 11001011 11111010 is then translated into three decimal numbers: 10111101 → 27 +25 +24 +23 +22 +20 = 128+32+16+ 8+4+1 = 189, 11001011 → 27 +26 +23 +21 +20 = 128+64+8+2+1 = 203, and 11111010 → 27 + 26 + 25 + 24 + 23 + 21 = 128 + 64 + 32 + 16 + 8 + 2 = 201
K25544_SM_Cover.indd 205
11/17/14 7:46 PM
250. As a result, the encrypted pixel has color (189, 203, 250), which corresponds to a shade of light blue. AES Transformations 15. (a) Using Table 23.4 we identify the decimal equivalent for each letter: S → 83, Y→ 89, N→ 78, and C→ 67. Then these decimal numbers are converted to the hexadecimal numbers 53, 59, 4E, and 43 (respectively) resulting in the array shown below: S Y
N C
53 59
→
4E 43
(b) The initial plaintext array is XORed with the initial key. This is done by converting each hexadecimal number to binary and then carrying out the XOR operation bit by bit. For example, hexadecimal 53 is 01010011 in binary and hexadecimal 42 is 01000010 in binary; taking the exclusive-or of these two binary numbers results in 00010001 = 11 in hexadecimal. The result of applying the XOR operation to the initial plaintext array is shown below: 53 59
4E 43
⊕
42 43
5A 48
=
11 1A
14 0B
(c) Next we apply to the current array the substitutions defined by the given table, which shows how to transform the first and second digits of each hexadecimal pair. The results are shown in the array below: 82 A2
FA 2B
(d) The first row of the current array remains the same, while the second row is shifted (circularly) to the left by one place. The result is shown below: 82 A2
FA 2B
→
82 2B
FA A2
16. (a) As seen below, the last column is shifted up, and then the substitutions are applied: 4A 59
→
59 → 4A
CB D6
202
K25544_SM_Cover.indd 206
11/17/14 7:46 PM
(b) The new column is XORed with the column of predefined numbers and then with the first column of the initial key. For example, to process the first element of the new column, we first convert the hexadecimal entries to binary as follows: CB → 11001011; C4 → 11000100; 43 → 01000011. Taking the XOR of these three binary numbers bit by bit produces 01001100 or 4C. The second element of the new column is transformed in a similar way, producing CB D6
⊕
C4 25
⊕
43 5B
=
4C A8
(c) XORing this new first column with the second column of the initial key gives us our new second column. 4C A8
4A 59
⊕
=
06 F1
The key array for use in the next round is shown below: 4C A8
06 F1
Hill Cipher and Matrix Multiplication 17. 18.
19.
20.
21.
�
�� � � � � � � � 2 15 × 2 + 0 × 5 30 4 = = ≡ mod 26. 5 12 × 2 + 3 × 5 39 13 � �� � � � � � � � 6 8 1 6×1+8×5 46 20 = = ≡ mod 26. 12 4 5 12 × 1 + 4 × 5 32 6 4 20 11 1 4 + 100 + 33 137 7 6 3 10 5 = 6 + 15 + 30 = 51 ≡ 25 mod 26. 2 25 7 3 2 + 125 + 21 148 18 � �� � � � 6 5 2 1 6×2+5×3 6×1+5×4 MK = = 15 16 3 4 15 × 2 + 16 × 3 15 × 1 + 16 × 4 � � � � 27 26 1 0 mod 26. = = 78 79 0 1 � �� � � � 4 19 19 7 4 × 19 + 19 × 7 4 × 7 + 19 × 4 MK = = 19 19 7 4 19 × 19 + 19 × 7 19 × 7 + 19 × 4 � � � � 209 104 1 0 ≡ mod 26. = 494 209 0 1 15 0 12 3
� � 4 22. (a) The column matrix is based on the position numbers of E and S: . 18 203
K25544_SM_Cover.indd 207
11/17/14 7:46 PM
(b) Multiply the key matrix times the plaintext column: 3 2 4 3 × 4 + 2 × 18 48 22 = = ≡ mod 26. 5 7 18 5 × 4 + 7 × 18 146 16 (c) The ciphertext is WQ. 6 23. (a) The column matrix is based on the position numbers of G and C: . 2 (b) Multiply the key matrix times the plaintext column: 6 5 6 6×6+5×2 46 20 = = ≡ mod 26. 15 16 2 15 × 6 + 16 × 2 122 18 (c) The plaintext is US. 24. (a) Using Table 23.12 we replace G and O by 6 and 14, givingthe 2×1 6 1 column . Similarly, B and A result in the 2 × 1 column , while 14 0 2 C and K result in the 2 × 1 column . 10 38 12 4 × 6 + 1 × 14 4 1 6 mod 26. ≡ = = (b) 5 × 6 + 3 × 14 72 20 5 3 14 4 4 1 4×1+1×0 4 1 mod 26. = ≡ = 5 5 0 5×1+3×0 5 3 4 1 2 4 × 2 + 1 × 10 18 18 = = ≡ mod 26. 5 3 10 5 × 2 + 3 × 10 40 14 (c) Again using Table 23.12, the ciphertext numbers 12, 20, 4, 5, 18, 14 are converted to the ciphertext letters MUEFSO. 12 25. (a) MI becomes 12, 8 or the column . To encrypt this plaintext we 8 3 25 12 multiply together the key matrix and this column: = 24 17 8 3 × 12 + 25 × 8 236 2 = ≡ mod 26. 24 × 12 + 17 × 8 424 8 2 CH becomes 2, 7 giving the column . We then encrypt by forming 7 3 25 2 3 × 2 + 25 × 7 181 25 = = ≡ mod 26. 24 17 7 24 × 2 + 17 × 7 167 11 8 IG becomes 8, 6 giving the column . We then encrypt by forming 6 3 25 8 3 × 8 + 25 × 6 174 18 = = ≡ mod 26. 24 17 6 24 × 8 + 17 × 6 294 8
204
K25544_SM_Cover.indd 208
11/17/14 7:46 PM
0 AN becomes 0, 13 giving the column . We then encrypt by forming 13 3 25 0 3 × 0 + 25 × 13 325 13 = = ≡ mod 26. 24 17 13 24 × 0 + 17 × 13 221 13 The ciphertext message is then CIZLSINN. (b) Now we can decrypt the ciphertext using the inverse matrix: 3 17 2 3 × 2 + 17 × 8 142 12 = = ≡ mod 26. 8 25 8 8 × 2 + 25 × 8 216 8 3 17 25 3 × 25 + 17 × 11 262 2 = = ≡ mod 26. 8 25 11 8 × 25 + 25 × 11 475 7 3 17 18 3 × 18 + 17 × 8 190 8 = = ≡ mod 26. 8 25 8 8 × 18 + 25 × 8 344 6 3 17 13 3 × 13 + 17 × 13 260 0 = = ≡ mod 26. 8 25 13 8 × 13 + 25 × 13 429 13 The corresponding plaintext message is MICHIGAN. 3 17 3 25 3 × 3 + 17 × 24 3 × 25 + 17 × 17 (c) M K = = 8 25 24 17 8 × 3 + 25 × 24 8 × 25 + 25 × 17 417 364 1 0 mod 26. ≡ = 624 625 0 1 Diffie-Hellman Key Exchange 26. b∗ = ab (mod n) = 518 (mod 47) = 56 × 56 × 56 (mod 47) ≡ 21 × 21 × 21 (mod 47) = 2. 27. s∗ = as (mod n) = 522 (mod 47) = 57 × 57 × 58 (mod 47) ≡ 11 × 11 × 8 (mod 47) = 28. 28. k = (s∗ )b (mod n) = 2818 (mod 47) = 286 × 286 × 286 (mod 47) ≡ 9 × 9 × 9 (mod 47) = 24. So B calculates the shared private key as 24. 29. k = (b∗ )s (mod n) = 222 (mod 47) = 27 × 27 × 28 (mod 47) ≡ 34 × 34 × 21 (mod 47) = 24. So S also calculates the shared private key as 24. 30. b∗ = ab (mod n) = 56 (mod 23) = 15,625 (mod 23) = 8. 31. s∗ = as (mod n) = 515 (mod 23) = 55 × 55 × 55 (mod 23) ≡ 20 × 20 × 20 (mod 23) = 19. 32. k = (s∗ )b (mod n) = 196 (mod 23) = 192 × 192 × 192 (mod 23) ≡ 16 × 16 × 16 (mod 23) = 2. So B calculates the shared private key as 2. 33. k = (b∗ )s (mod n) = 815 (mod 23) = 85 × 85 × 85 (mod 23) ≡ 16 × 16 × 16 (mod 23) = 2. So S also calculates the shared private key as 2.
205
K25544_SM_Cover.indd 209
11/17/14 7:46 PM
Chapter 24
Prime Numbers and Public-Key Cryptosystems Modular Inverses 1. (a) We keep trying multiples of 7 until we find a remainder of 1 (mod 15): 1 × 7 = 7 (mod 15); 2 × 7 = 14 (mod 15); 3 × 7 = 21 ≡ 6 (mod 15); 4 × 7 = 28 ≡ 13 (mod 15); 5 × 7 = 35 ≡ 5 (mod 15); 6 × 7 = 42 ≡ 12 (mod 15); 7 × 7 = 49 ≡ 4 (mod 15); 8 × 7 = 56 ≡ 11 (mod 15); 9 × 7 = 63 ≡ 3 (mod 15); 10 × 7 = 70 ≡ 10 (mod 15); 11 × 7 = 77 ≡ 2 (mod 15); 12 × 7 = 84 ≡ 9 (mod 15); 13 × 7 = 91 ≡ 1 (mod 15). This means that 13 is the inverse of 7 modulo 15. Since 7 × 13 = 13 × 7 ≡ 1 (mod 15), 7 is the inverse of 13 modulo 15. Notice that both 13 and 7 are relatively prime to 15; neither is divisible by 3 or 5. (b) We keep trying multiples of 11 until we find a remainder of 1 (mod 15): 1 × 11 = 11 (mod 15); 2 × 11 = 22 ≡ 7 (mod 15); 3 × 11 = 33 ≡ 3 (mod 15); 4 × 11 = 44 ≡ 14 (mod 15); 5 × 11 = 55 ≡ 10 (mod 15); 6 × 11 = 66 ≡ 6 (mod 15); 7 × 11 = 77 ≡ 2 (mod 15); 8 × 11 = 88 ≡ 13 (mod 15); 9 × 11 = 99 ≡ 9 (mod 15); 10 × 11 = 110 ≡ 5 (mod 15); 11 × 11 = 121 ≡ 1 (mod 15). This means that 11 is its own inverse modulo 15. (c) Trying multiples of 10 produces 1 × 10 = 10 (mod 15); 2 × 10 = 20 ≡ 5 (mod 15); 3 × 10 = 30 ≡ 0 (mod 15); 4 × 10 = 40 ≡ 10 (mod 15); 5 × 10 = 50 ≡ 5 (mod 15); 6 × 10 = 60 ≡ 0 (mod 15); 7 × 10 = 70 ≡ 10 (mod 15); 8×10 = 80 ≡ 5 (mod 15); 9×10 = 90 ≡ 0 (mod 15); 10×10 = 100 ≡ 10 (mod 15); 11 × 10 = 110 ≡ 5 (mod 15); 12 × 10 = 120 ≡ 0 (mod 15); 13 × 10 = 130 ≡ 10 (mod 15); 14 × 10 = 140 ≡ 5 (mod 15). This means that 10 does not have an inverse modulo 15. Notice that 10 is not relatively prime to 15, as they both share the divisor 5. (d) The numbers that have inverses modulo 15 are exactly those relatively prime to 15: 1, 2, 4, 7, 8, 11, 13, 14. 206
K25544_SM_Cover.indd 210
11/17/14 7:46 PM
2. (a) We keep trying multiples of 7 until we find a remainder of 1 (mod 14): 1 × 7 = 7 (mod 14); 2 × 7 = 14 ≡ 0 (mod 14); 3 × 7 = 21 ≡ 7 (mod 14); 4 × 7 = 28 ≡ 0 (mod 14); 5 × 7 = 35 ≡ 7 (mod 14); 6 × 7 = 42 ≡ 0 (mod 14); 7 × 7 = 49 ≡ 7 (mod 14); 8 × 7 = 56 ≡ 0 (mod 14); 9 × 7 = 63 ≡ 7 (mod 14); 10 × 7 = 70 ≡ 0 (mod 14); 11 × 7 = 77 ≡ 7 (mod 14); 12 × 7 = 84 ≡ 0 (mod 14); 13 × 7 = 91 ≡ 7 (mod 14). This means that 7 does not have an inverse modulo 14. Notice that 7 is not relatively prime to 14, as they both share the divisor 7. (b) We keep trying multiples of 11 until we find a remainder of 1 (mod 14): 1 × 11 = 11 (mod 14); 2 × 11 = 22 ≡ 8 (mod 14); 3 × 11 = 33 ≡ 5 (mod 14); 4 × 11 = 44 ≡ 2 (mod 14); 5 × 11 = 55 ≡ 13 (mod 14); 6 × 11 = 66 ≡ 10 (mod 14); 7 × 11 = 77 ≡ 7 (mod 14); 8 × 11 = 88 ≡ 4 (mod 14); 9 × 11 = 99 ≡ 1 (mod 14). This means that 9 is the inverse of 11 (mod 14). (c) Trying multiples of 10 produces 1 × 10 = 10 (mod 14); 2 × 10 = 20 ≡ 6 (mod 14); 3×10 = 30 ≡ 2 (mod 14); 4×10 = 40 ≡ 12 (mod 14); 5×10 = 50 ≡ 8 (mod 14); 6 × 10 = 60 ≡ 4 (mod 14); 7 × 10 = 70 ≡ 0 (mod 14); 8× 10 = 80 ≡ 10 (mod 14); 9× 10 = 90 ≡ 6 (mod 14); 10× 10 = 100 ≡ 2 (mod 14); 11 × 10 = 110 ≡ 12 (mod 14); 12 × 10 = 120 ≡ 8 (mod 14); 13 × 10 = 130 ≡ 4 (mod 14). This means that 10 does not have an inverse modulo 14. Notice that 10 is not relatively prime to 14, as they both share the divisor 2. (d) The numbers that have inverses modulo 14 are exactly those relatively prime to 14: 1, 3, 5, 9, 11, 13. Discrete Logarithms 3. (a) Taking successive powers of 3, modulo 5 produces: 30 (mod 5) = 1; 31 (mod 5) = 3; 32 (mod 5) = 4; 33 (mod 5) = 27 (mod 5) = 2; 34 (mod 5) = 81 (mod 5) = 1. So the remainder 2 is uniquely produced using the exponent 3, meaning that log3 2 (mod 5) = 3. Notice that the successive remainders 1, 3, 4, 2 produced are all the nonzero remainders, modulo 5. (b) Taking successive powers of 4, modulo 5 produces: 40 (mod 5) = 1; 41 (mod 5) = 4; 42 (mod 5) = 16 (mod 5) = 1; 43 (mod 5) = 64 (mod 5) = 4; 44 (mod 5) = 256 (mod 5) = 1. As a result, log4 2 (mod 5) does not exist: there is no exponent e so that 4e (mod 5) = 2. 4. (a) Taking successive powers of 2, modulo 11 produces: 20 (mod 11) = 1; 21 (mod 11) = 2; 22 (mod 11) = 4; 23 (mod 11) = 8; 24 (mod 11) = 16 (mod 11) = 5; 25 (mod 11) = 32 (mod 11) = 10; 26 (mod 11) = 64 (mod 11) = 9; 27 (mod 11) = 128 (mod 11) = 7; 28 (mod 11) = 256 (mod 11) = 3; 29 (mod 11) = 512 (mod 11) = 6; 210 (mod 11) = 1024 (mod 11) = 1. The remainder 6 is uniquely produced using the exponent 207
K25544_SM_Cover.indd 211
11/17/14 7:46 PM
9, so log2 6 (mod 11) = 9. Notice that all the nonzero remainders modulo 11 are produced. (b) Taking successive powers of 3, modulo 11 produces: 30 (mod 11) = 1; 31 (mod 11) = 3; 32 (mod 11) = 9; 33 (mod 11) = 27 (mod 11) = 5; 34 (mod 11) = 81 (mod 11) = 4; 35 (mod 11) = 243 (mod 11) = 1; 36 (mod 11) = 729 (mod 11) = 3; 37 (mod 11) = 2187 (mod 11) = 9; 38 (mod 11) = 6561 (mod 11) = 5; 39 (mod 11) = 19,683 (mod 11) = 4; 310 (mod 11) = 59,049 (mod 11) = 1. So, the remainder 6 is not produced using the exponent 3. As a result, log3 6 (mod 11) does not exist: there is no exponent e so that 3e (mod 11) = 6. Notice that the only remainders produced are 1, 3, 4, 5, 9. Generators Modulo p 5. (a) Since all powers of 1 equal 1, b = 1 is not a generator. Calculations are shown below of the successive powers bk for b = 2, 3, 4. As a result, we see that 2 and 3 are the only generators modulo 5. b=2 b=3 b=4
k=1 21 (mod 5) = 2 31 (mod 5) = 3 41 (mod 5) = 4
k=2 22 (mod 5) = 4 32 (mod 5) = 4 42 (mod 5) = 1
k=3 23 (mod 5) = 3 33 (mod 5) = 2 43 (mod 5) = 4
k=4 24 (mod 5) = 1 34 (mod 5) = 1 44 (mod 5) = 1
(b) Determine which numbers in the range 1, 2, 3 are relatively prime to 5 − 1 = 4. Only 1 and 3 are relatively prime to 4, so there are two such numbers. This agrees with the number of generators b found in part (a). 6. (a) Taking successive powers of 6, modulo 11 produces: 60 (mod 11) = 1; 61 (mod 11) = 6; 62 (mod 11) = 36 (mod 11) = 3; 63 (mod 11) = 216 (mod 11) = 7; 64 (mod 11) = 1296 (mod 11) = 9; 65 (mod 11) = 7776 (mod 11) = 10; 66 (mod 11) = 46,656 (mod 11) = 5; 67 (mod 11) = 279,936 (mod 11) = 8; 68 (mod 11) = 1,679,616 (mod 11) = 4; 69 (mod 11) = 10,077,696 (mod 11) = 2; 610 (mod 11) = 60,466,176 (mod 11) = 1. All nonzero remainders modulo 11 are produced, so 6 is a generator modulo 11. (b) Determine which numbers in the range 1, 2, . . . , 9 are relatively prime to 11 − 1 = 10. Namely, 1, 3, 7, and 9 are relatively prime to 10, so there are four generators modulo 11. Prime Division and Prime Factorization 7. The square root of 5670 is approximately 75 so we only need to consider primes less than 75. The smallest prime that divides 5670 is p1 = 2, giving the quotient 5670 2 = 2835. We continue to divide each quotient by the smallest prime that divides it evenly: 208
K25544_SM_Cover.indd 212
11/17/14 7:46 PM
p2 = 3 gives the quotient p3 = 3 gives the quotient p4 = 3 gives the quotient p5 = 3 gives the quotient p6 = 5 gives the quotient
2835 3 = 945; 945 3 = 315; 315 3 = 105; 105 3 = 35; 35 5 = 7.
We stop here because 7 is prime. The prime factorization of 5670 is 2 × 3 × 3 × 3 × 3 × 5 × 7 = 2 × 34 × 5 × 7. 8. The square root of 52,745 is approximately 230 so we only need to consider primes less than 230. The smallest prime that divides 52,745 turns out to be p1 = 5, giving the quotient 52,745 = 10,549. We continue to divide each 5 quotient by the smallest prime that divides it evenly: 10,549 7 1507 quotient 11
p2 = 7 gives the quotient
= 1507;
p3 = 11 gives the
= 137.
We stop here because 137 is prime. The prime factorization of 52,745 is 5 × 7 × 11 × 137. Exponentials and Logarithms Modulo p 9. (a) Because 225 is itself very large, we express it as the product (210 )2 × 25 (mod 13) ≡ 102 × 6 (mod 13) = 600 (mod 13) = 2. (b) The brute-force solution is to try all possible exponents 0, 1, . . . , 12: 20 (mod 13) = 1; 21 (mod 13) = 2; 22 (mod 13) = 4; 23 (mod 13) = 8; 24 (mod 13) = 16 (mod 13) = 3; 25 (mod 13) = 32 (mod 13) = 6; 26 (mod 13) = 64 (mod 13) = 12; 27 (mod 13) = 128 (mod 13) = 11. So, we discover that log2 11 (mod 13) = 7. 10. (a) Because 542 is itself very large, we express it as the product (510 )4 × 52 (mod 23) ≡ 94 × 2 (mod 23) = 6561 × 2 (mod 23) = 13,122 (mod 23) = 12. (b) The brute-force solution is to try all possible exponents 0, 1, . . . , 22: 50 (mod 23) = 1; 51 (mod 23) = 5; 52 (mod 23) = 25 (mod 23) = 2; 53 (mod 23) = 52 × 5 (mod 23) ≡ 2 × 5 (mod 23) = 10; 54 (mod 23) = 52 × 52 (mod 23) ≡ 2 × 2 (mod 23) = 4; 55 (mod 23) = 53 × 52 (mod 23) ≡ 10 × 2 (mod 23) = 20; 56 (mod 23) = 54 × 52 (mod 23) ≡ 4 × 2 (mod 23) = 8. So, we discover that log5 8 (mod 23) = 6. 11. The last two digits will be 2727 (mod 100) = (275 )5 ×272 (mod 100) ≡ 75 ×729 (mod 100) ≡ 75 × 29 (mod 100) ≡ 7 × 29 (mod 100) = 3 (mod 100) = 3. Consequently, the last two digits are 03. 12. The last two digits will be 1926 (mod 100) = (194 )5 ×196 (mod 100) ≡ 215 ×81 (mod 100) ≡ 1 × 81 (mod 100) = 81. Consequently, the last two digits are 81. 209
K25544_SM_Cover.indd 213
11/17/14 7:46 PM
RSA Encryption 13. (a) The public modulus is n = 5 × 17 = 85. (b) The public key e = 13 is relatively prime to (p − 1)(q − 1) = 4 × 16 = 64 because the only common factor of 13 and 64 is 1. (c) The ciphertext C is calculated using C = P e (mod n) = 913 (mod 85) = (95 )2 × 93 (mod 85) ≡ 592 × 49 (mod 85) = 59. 14. (a) The public modulus is n = 7 × 11 = 77. (b) The public key e = 13 is relatively prime to (p − 1)(q − 1) = 6 × 10 = 60 because the only common factor of 13 and 60 is 1. (c) The ciphertext C is calculated using C = P e (mod n) = 513 (mod 77) = 56 × 57 (mod 77) ≡ 71 × 47 (mod 77) = 26. 15. (a) The public modulus is n = 61 × 53 = 3233. (b) The public key e = 17 is relatively prime to (p−1)(q−1) = 60×52 = 3120 because the only common factor of 17 and 3120 is 1. (c) The ciphertext C is calculated as P e (mod n) = 12317 (mod 3233) = (1234 )2 × (1234 )2 × 123 (mod 3233) ≡ (3173)2 × (3173)2 × 123 (mod 3233) ≡ 367 × 367 × 123 (mod 3233) = 16,566,747 (mod 3233) = 855. RSA Decryption 16. (a) The public modulus is n = 5 × 7 = 35. (b) The public key e = 5 is relatively prime to (p − 1)(q − 1) = 4 × 6 = 24 because the only common factor of 5 and 24 is 1. (c) To verify that d = 29 is the inverse of e = 5 modulo (p − 1)(q − 1), we calculate de (mod (p−1)(q−1)) = 29×5 (mod 24) = 145 (mod 24) = 1. (d) The plaintext P is calculated using C d (mod n) = 1829 (mod 35) = (187 )4 × 18 (mod 35) ≡ 324 × 18 (mod 35) ≡ 11 × 18 (mod 35) = 198 (mod 35) = 23. The plaintext is P = 23. 17. (a) The public modulus is n = 3 × 17 = 51. (b) The public key e = 7 is relatively prime to (p − 1)(q − 1) = 2 × 16 = 32 because the only common factor of 7 and 32 is 1. (c) To verify that d = 23 is the inverse of e = 7 modulo (p − 1)(q − 1), we calculate de (mod (p−1)(q−1)) = 23×7 (mod 32) = 161 (mod 32) = 1. (d) The plaintext P is calculated using C d (mod n) = 2623 (mod 51) = (265 )4 ×263 (mod 51) ≡ 84 ×263 (mod 51) ≡ 16×263 (mod 51) ≡ 16×32 (mod 51) = 2. The plaintext is P = 2.
210
K25544_SM_Cover.indd 214
11/17/14 7:46 PM
18. (a) The public modulus is n = 47 × 59 = 2773. (b) The public key e = 157 is relatively prime to (p − 1)(q − 1) = 46 × 58 = 2668 because the only common factor of 157 and 2668 is 1. (c) To verify that d = 17 is the inverse of e = 157 modulo (p − 1)(q − 1), we calculate de (mod (p − 1)(q − 1)) = 17 × 157 (mod 2668) = 2669 (mod 2668) = 1. (d) The plaintext P is calculated using C d (mod n) = 18717 (mod 2773). Since 18717 is too large to calculate directly, we rewrite it as (1872 )8 ×187 (mod 2773) ≡ 16938 × 187 (mod 2773) = (16932 )4 × 187 (mod 2773) ≡ 17404 × 187 (mod 2773) = (17402 )2 × 187 (mod 2773) ≡ 22572 × 187 (mod 2773) ≡ 48 × 187 (mod 2773) = 657. The plaintext is P = 657. RSA Encryption and Decryption 19. (a) The public modulus is n = 17 × 11 = 187. (b) The public key e = 7 is relatively prime to (p − 1)(q − 1) = 16 × 10 = 160 because the only common factor of 7 and 160 is 1. (c) From Table 22.7, R → 17, U → 20, N → 13. Each block P of the plaintext is encrypted using P e (mod n) so that the plaintext message 17-20-13 is transformed as follows: 177 (mod 187) = 85, 207 (mod 187) = 147, and 137 (mod 187) = 106. The ciphertext 85-147-106 will be sent. (d) Each block C of the ciphertext 85-147-106 is decrypted using C d (mod n): 8523 (mod 187) = (855 )4 × 853 (mod 187) ≡ 1534 × 853 (mod 187) ≡ 34 × 17 (mod 187) = 17; 14723 (mod 187) = (1474 )5 × 1473 (mod 187) ≡ 1575 × 1473 (mod 187) = 1574 × 157 × 1473 (mod 187) ≡ 103 × 157 × 1473 (mod 187) ≡ 103 × 157 × 141 (mod 187) = 20; 10623 (mod 187) = (1064 )5 × 1063 (mod 187) ≡ 695 × 1063 (mod 187) ≡ 1 × 13 (mod 187) = 13. So the plaintext recovered is 17-20-13, which corresponds to the plaintext message RUN. (e) To verify that d = 23 is the inverse of e = 7 modulo (p − 1)(q − 1), we calculate de (mod (p−1)(q −1)) = 23×7 (mod 160) = 161 (mod 160) = 1. 20. (a) The public modulus is n = 23 × 41 = 943. (b) The public key e = 7 is relatively prime to (p − 1)(q − 1) = 22 × 40 = 880, because the only common factor of 7 and 880 is 1. (c) The plaintext message P = 35 is transformed using C = P e (mod n) = 357 (mod 943) = 354 × 353 (mod 943) ≡ 312 × 440 (mod 943) = 545. (d) The message C = 545 is decrypted using P = C d (mod n): 545503 (mod 943). Using the binary representation of 503, we obtain 545503 = 5451+2+4+16+32+64+128+256 , so it is useful to create the following table:
211
K25544_SM_Cover.indd 215
11/17/14 7:46 PM
5451 (mod 943) = 545 5454 (mod 943) = 400 54532 (mod 943) = 795 545128 (mod 943) = 18
5452 (mod 943) = 923 54516 (mod 943) = 857 54564 (mod 943) = 215 545256 (mod 943) = 324
Then 545503 (mod 943) ≡ (545×923×400)×(857×795×215)×(18×324) (mod 943) ≡ 432 × 877 × 174 (mod 943) = 35. (e) To see that d = 503 is the inverse of e = 7 modulo (p−1)(q −1), we calculate de (mod (p−1)(q −1)) = 503×7 (mod 880) = 3521 (mod 880) = 1. ElGamal Encryption 21. (a) C1 = g k (mod p) = 29 (mod 11) = 6 and C2 = P y k (mod p) = 5 × 39 (mod 11) = 9. The pair (6, 9) is sent to the receiver. (b) The equation used to define the public number y is y = g x (mod p). Using the known published numbers, this becomes the modular equation 3 = 2x (mod 11). In other words, we would need to find the discrete logarithm log2 3 (mod 11). 22. (a) C1 = g k (mod p) = 25 (mod 29) = 3 and C2 = P y k (mod p) = 26 × 75 (mod 29) = 10. The pair (3, 10) is sent to the receiver. (b) The equation used to define the public number y is y = g x (mod p). Using the known published numbers, this becomes the modular equation 7 = 2x (mod 29). In other words, we would need to find the discrete logarithm log2 7 (mod 29). ElGamal Decryption 23. (a) z = C1x (mod p) = 155 (mod 17) = 2. (b) To verify that 9 is the inverse (modulo 17) of z = 2, we compute the product 9 × 2 (mod 17) = 1. (c) To solve zP ≡ C2 (mod p), we compute z −1 C2 (mod p) = 9 × 9 (mod 17) = 13. The plaintext is P = 13. 24. (a) z = C1x (mod p) = 2623 (mod 107) = (265 )4 ×263 (mod 107) ≡ 964 ×263 (mod 107) ≡ 89 × 28 (mod 107) = 31. (b) To verify that 38 is the inverse (modulo 107) of z = 31, we compute the product 38 × 31 (mod 107) = 1. (c) To solve zP ≡ C2 (mod p), we compute z −1 C2 (mod p) = 38 × 12 (mod 107) = 28. The plaintext is P = 28.
212
K25544_SM_Cover.indd 216
11/17/14 7:46 PM
ElGamal Encryption and Decryption 25. (a) The receiver’s transformed key y is found using y = g x (mod p) = 23 (mod 13) = 8. (b) C1 = g k (mod p) = 25 (mod 13) = 6. C2 = P y k (mod p) = 7 × 85 (mod 13) = 4. The ciphertext pair (C1 , C2 ) = (6, 4) is sent to the receiver. (c) z = C1x (mod p) = 63 (mod 13) = 8; since 5 × 8 (mod 13) = 1, we have verified that z −1 = 5. (d) We multiply C2 by the modular inverse to obtain z −1 C2 (mod p) = 5 × 4 (mod 13) = 7, which is the original plaintext P . 26. (a) The receiver’s transformed key y is found using y = gx (mod p) = 437 (mod 167) = (410 )3 × 47 (mod 167) ≡ 1503 × 47 (mod 167) ≡ 97 × 18 (mod 167) = 76. (b) C1 = g k (mod p) = 471 (mod 167) = (410 )7 × 4 (mod 167) ≡ 1504 × 1503 ×4 (mod 167) ≡ 21×97×4 (mod 167) = 132. C2 = P y k (mod p) = 65 × 7671 (mod 167) = 65 × (765 )14 × 76 (mod 167) ≡ 65 × (1144 )3 × 1142 ×76 (mod 167) ≡ 65×653 ×1142 ×76 (mod 167) ≡ 65×77×137×76 (mod 167) = 44. The ciphertext pair (C1 , C2 ) = (132, 44) is sent to the receiver. (c) z = C1x (mod p) = 13237 (mod 167) = (1324 )9 × 132 (mod 167) ≡ (1304 )2 × 130 × 132 (mod 167) ≡ 872 × 130 × 132 (mod 167) ≡ 6 × 132 (mod 167) = 124; since 66 × 124 (mod 167) = 1, we have verified that z −1 = 66. (d) We multiply C2 by the modular inverse to obtain z −1 C2 (mod p) = 66 × 44 (mod 167) = 65, which is the original plaintext P . Elliptic Curve Cryptography 27. When x = 0 the equation y 2 ≡ x3 + x + 4 (mod 5) becomes y 2 ≡ 4 (mod 5), which has the solutions y = 2 and y = 3. When x = 1 the equation y 2 ≡ x3 + x + 4 (mod 5) becomes y 2 ≡ 1 (mod 5), which has the solutions y = 1 and y = 4. Similar calculations result in the eight solutions listed in the following table: x y
0 2
0 3
1 1
1 4
2 2
2 3
3 2
3 3
28. (a) Using the table, g = (1, 2), 2g = (1, 2) + (1, 2) = (3, 3), 3g = 2g + g = (3, 3) + (1, 2) = (0, 1), 4g = (0, 1) + (1, 2) = (0, 4), 5g = (0, 4) + (1, 2) = (3, 2), 6g = (3, 2) + (1, 2) = (1, 3), 7g = (1, 3) + (1, 2) = (0, 0). All points are generated as multiples of g. (b) y = xg = 4g = 2g + 2g = (3, 3) + (3, 3) = (0, 4). 213
K25544_SM_Cover.indd 217
11/17/14 7:46 PM
(c) C1 = kg = 3g = (0, 1) and C2 = P + ky = (3, 2) + 3(0, 4) = [(3, 2) + (0, 4)] + [(0, 4) + (0, 4)] = (3, 3) + (1, 2) = (0, 1). (d) Given these values for C1 and C2 , the receiver then needs to solve the equation xC1 +P = C2 or 4(0, 1)+P = (0, 1). We first calculate 4(0, 1) = [(0, 1) + (0, 1)] + [(0, 1) + (0, 1)] = (1, 3) + (1, 3) = (3, 2). We next need to solve (3, 2)+P = (0, 1). From the table, we find that (3, 3)+(3, 2) = (0, 0) so we add (3, 3) to both sides of the equation to get (3, 3) + (3, 2) + P = (3, 3) + (0, 1) (0, 0) + P = (3, 2) P = (3, 2). Notice that we are able to recover the original message P = (3, 2). RSA, Digital Signatures, and Hashing 29. (a) h(M ) = M1 + M2 + M3 + M4 (mod n) = (7865 + 3456 + 6211 + 5249) (mod 5011) = 22,781 (mod 5011) = 2737. (b) h(M ) = M1 + M2 + M3 + M4 (mod n) = (7685 + 3456 + 6211 + 5249) (mod 5011) = 22,601 (mod 5011) = 2557. Notice that the (inadvertent) error causes the hashed value to change. 30. (a) A encrypts P = 11 using B’s public information, obtaining the ciphertext C = P eB (mod nB ) = 115 (mod 35) = 16. (b) A signs the plaintext P = 11 using his private key, creating the signature S = P dA (mod nA ) = 1123 (mod 51) = (118 )2 ×117 (mod 51) ≡ 162 ×20 (mod 51) = 20. (c) Now B decrypts the ciphertext C = 16 to obtain the plaintext P = C dB (mod nB ) = 1629 (mod 35) = (165 )5 × 164 (mod 35) ≡ 115 × 164 (mod 35) ≡ 16 × 16 (mod 35) = 11. (d) B verifies the signature S by computing V = S eA (mod nA ) = 207 (mod 51) = 11. Since the decrypted signature V matches the plaintext P , the signature is verified. 31. (a) A encrypts P = 17 using B’s public information, obtaining the ciphertext C = P eB (mod nB ) = 173 (mod 33) = 29. (b) First, A computes the hashed plaintext H = h(P ) = P (mod n) = 17 (mod 7) = 3. Then H is signed using S = H dA (mod nA ) = 323 (mod 55) = (310 )2 × 33 (mod 55) ≡ 342 × 33 (mod 55) ≡ 1 × 27 (mod 55) = 27. (c) Now B decrypts the ciphertext C = 29 to obtain the plaintext P = C dB (mod nB ) = 297 (mod 33) = 293 × 294 (mod 33) ≡ 2 × 25 (mod 33) = 17. 214
K25544_SM_Cover.indd 218
11/17/14 7:46 PM
(d) First, B computes the hashed plaintext, given the value P = 17 just determined: H = h(P ) = P (mod n) = 17 (mod 7) = 3. Next, B verifies the hashed signature S by computing V = S eA (mod nA ) = 277 (mod 55) = 274 × 273 (mod 55) ≡ 31 × 48 (mod 55) = 3. Since the decrypted signature V matches the hashed plaintext H, the signature is verified.
215
K25544_SM_Cover.indd 219
11/17/14 7:46 PM
K25544
w w w. c r c p r e s s . c o m
K25544_SM_Cover.indd 220
11/17/14 7:46 PM