1
Problem Solving Skills (14021601-3 )
2
Part 2 Some mathematical principles and problem-solving techniques
3
and problem-solving techniques 2 Some mathematical principles and - - PDF document
Problem Solving Skills (14021601-3 ) Part 2 Some mathematical principles and problem-solving techniques 2 Some mathematical principles and problem-solving techniques Invariant Principle 3 1 Gauss When Karl Friedrich Gauss was still in
2
3
4
When Karl Friedrich Gauss was still in elementary school (around the age of nine), a lazy teacher used to give some “hard” problems to his pupils, so that they would be busy solving them while he read the morning paper! One day, the teacher asked the students to calculate the total of all integer numbers from 1 to 100; he was sure he would be able to read for the next half hour! To his great surprise, young Gauss was ready in a couple of minutes.
5
By grouping all the numbers from 1 to 100 into pairs: (1 and 100), (2 and 99), (3 and 98), and so on till (50 and 51) he noticed that the total for each pair is 101. This was the invariant. Given that there were only 50 pairs, a simple multiplication of 101 × 50 = 5,050 gave him the answer!
6
7
8
9
After one exchange, what amount is greater? Amount of water in the juice or amount of juice in the water?
10
11
12
13
Invariance principle is very helpful in solving problems where there is repetition in the statement of the problem. The invariance principle simply advises to look for things that do not change (i.e. invariants). For water & juice problem, the volumes in both glasses do not change…
14
15
16
17
18
Number of breaks Number of pieces 1 1 2 2 3 3 4 . . . . . . 62 63
19
20
21
22
knight can cut off 15, 17, 20, or 5 heads with one blow of his sword, however, in each of these cases a number of new heads will grow immediately: 24, 2, 14, or 17 heads, respectively. The dragon dies only if all his heads are cut off. Is it possible to kill the dragon?
24
25
Split the problem P into sub-problems P1 , P2 , …, Pk For each sub-problem P1 , P2 , …, Pk : If size (Pi) is small then solve Pi ,
26
27
28
29
30
Backtracking is a refinement of the brute force approach, which systematically searches for a solution to a problem among all available options. It does so by assuming that the solutions are represented by vectors (v1, ..., vk)
the vectors until the solutions are found.
31
Place 8 queens on the chessboard in such a way that none
any other
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
You have used backtracking in your last homework:
4 events. You’ll use backtracking in solving many problems to come…
54
There is a number n of items. Each item has some weight (w1, w2, …, wn). Each item has a value, often called profit (p1, p2, …, pn). The thief’s dilemma is to maximize the total value of the items while not making the total weight exceed W. How to find the best subset of items?
55
Items: 1 2 3 4 5 6 7 Weights: 12 10 9 13 8 11 10 Values: $25 $21 $18 $30 $16 $23 $22 The total weight W which can be carried away by a thief is 32. How to find the best subset of items?
56
There are many possible approaches for such knapsack problem:
57
$0 32
value capacity left
58
$0 32
value capacity left
$25 20
Item #1
59
$0 32
value capacity left
$25 20
Item #1 Item #2
$46 10
60
$0 32
value capacity left
$25 20
Item #1 Item #2
$46 10
Item #7
$68
61
$0 32 $25 20
Item #1 Item #2
$46 10
Item #7
$68
Item #4
$30 17
62
There are 100 pebbles on the table. There are
63
65
66
67
Two men meet on the street (they have not seen each other for many years): A: All three of my sons celebrate their birthday today. Can you tell me how old each one is? B: Yes, but you have to tell me something about them… A: The product of their ages is 36. B: I need more info… A: The sum of their ages is equal to the number of windows in the building next to us… B: I need more info… A: My oldest son has blue eyes. B: That is sufficient!
68
69
70
36 1 1 18 2 1 12 3 1 9 4 1 9 2 2 6 6 1 6 3 2 4 3 3
x y z
71
36 + 1 + 1 = 38 18 + 2 + 1 = 21 12 + 3 + 1 = 16 9 + 4 + 1 = 14 9 + 2 + 2 = 13 6 + 6 + 1 = 13 6 + 3 + 2 = 11 4 + 3 + 3 = 10
x y z
72
There are five houses, each of a different color and inhabited by men of different nationalities, with one unique pet, drink, and car. Some facts are given:
man owns a fox.
Who owns the zebra?
73
House 1 2 3 4 5 Color Drink Country Car Pet
74
There are:
water;
Norwegian, Spaniard, and Ukrainian;
and Volkswagen;
75
House 1 2 3 4 5 Color
blue yellow ivory red green
Drink
milk eggnog
water cocoa
Country
Englishman Ukrainian Norwegian Japanese Spaniard
Car
Mercedes Chevrolet Oldsmobile Ford V
Pet
zebra dog snails horse fox
76
man owns a fox.
77
House 1 2 3 4 5 Color
blue14
Drink
milk8
Country
Norwegian9
Car Pet
78
man owns a fox.
79
House 1 2 3 4 5 Color
yellow1,5 blue14
Drink
milk8
Country
Norwegian9
Car Pet
80
man owns a fox.
81
House 1 2 3 4 5 Color
yellow1,5 blue14
Drink
milk8
Country
Norwegian9
Car
Ford7
Pet
horse11
82
Now we can consider two cases for two possible sequences of colors for houses 3, 4, and 5:
Let’s consider the first possibility: ivory, green, red.
83
House 1 2 3 4 5 Color
yellow1,5 blue14 ivory green red
Drink
milk8
Country
Norwegian9
Car
Ford7
Pet
horse11
84
man owns a fox.
85
House 1 2 3 4 5 Color
yellow1,5 blue14 ivory green red
Drink
milk8
Country
Norwegian9 Englishman1
Car
Ford7
Pet
horse11
86
man owns a fox.
87
House 1 2 3 4 5 Color
yellow1,5 blue14 ivory green red
Drink
milk8 cocoa3
Country
Norwegian9 Englishman1
Car
Ford7
Pet
horse11
88
man owns a fox.
89
House 1 2 3 4 5 Color
yellow1,5 blue14 ivory green red
Drink
eggnog4 milk8 cocoa3
Country
Norwegian9 Ukrainian4 Englishman1
Car
Ford7
Pet
horse11
90
man owns a fox.
91
House 1 2 3 4 5 Color
yellow1,5 blue14 ivory green red
Drink
eggnog4 milk8 cocoa3
Country
Norwegian9 Ukrainian4 Englishman1
Car
Ford7 Mercedes12
Pet
horse11
92
man owns a fox.
93
94
House 1 2 3 4 5 Color
yellow1,5 blue14 red ivory green
Drink
milk8
Country
Norwegian9
Car
Ford7
Pet
horse11
95
96
House 1 2 3 4 5 Color
yellow1,5 blue14 red ivory green
Drink
water eggnog milk8
cocoa
Country
Norwegian9 Ukrainian Englishman Spaniard Japanese
Car
Ford7 Chevrolet Oldsmobile Mercedes V
Pet
fox horse11 snails dog zebra
97
98
99
100
7 6 2 4 5 5 8 2 6 9 3 8 8 9 5 1 2 6 3 3 1 9 9 3 6 4 5 9 8 4 2 9 6 7
101
7 6 2 4 5 5 8 2 6 9 3 8 8 9 5 1 2 6 3 3 1 9 9 3 6 4 5 9 8 4 4 2 9 6 7
102
everyone arrived, they greeted each other by a handshake. These were the rules: – no one shakes his/her own hand – no handshake between married couple – no pair does it twice – there are pairs which did not shake their hands
did they shake their hands, and all answers he got were different. How many hands did Mrs. Smith shake?
103
104
105
1 2 3 4 5 6 7 8
106
1 2 3 4 5 6 7 8
107
1 2 3 4 5 6 7 8
108
1 2 3 4 5 6 7 8
109
1 2 3 4 5 6 7 8
110
1 2 3 4 5 6 7 8
111
1 2 3 4 5 6 7 8
112
hairdresser where they experimented with different colors and haircuts. When they left the hairdresser, the lady with green hair said: – “Have you noticed that although our hair colors match our names, none of us has the same hair color as our name?”
– “Indeed, you are right! This is remarkable!”
What hair color did each lady have?
113
Rule #1: Do we understand the problem? Rule #2: Reject your intuition “It is impossible to tell!” Rule #3: Construct a model by listing all the variables, constraints, and objectives. The letters B, W, and G mark three colors: (B) brown, (W) white, and (G) green. If we knew nothing apart that three ladies selected some colors for their hair from this list, the model would be:
B or W or G
B or W or G
B or W or G
114
Initial model:
B or W or G
B or W or G
B or W or G As none of the ladies’ hair color matched their name (this is the first fact, hence the first constraint), the possible arrangements are:
W or G
B or G
B or W
115
Now we are ready for considering the other constraints. As the lady with green hair made a remark that was answered by a different lady, Mrs. Brown, so the immediate inference is that Mrs. Brown does not have green hair! And this is all we need to solve this puzzle, as:
W or G
B or G
B or W
116
Now:
W
B or G
B or W implies:
W
B or G
B which in turn implies:
W
G
B
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
1 2 3 5 10 20 25 50
136
137
138
139
140
141
142
143
it is necessary to test, whether all participants are logicians…
concern) that everyone will be able to guess the colour of his/her dot at some stage
Annual International Conference on Logic:
144
together with his sister; both had dots of different colour… At that time there were still some people left…
How many times did the bell ring?
145
146
148
149
Many problems fall into category of optimization
solution among many possible solutions. There is hardly a real-world problem without an optimization
particular destination in the shortest possible time? How should we schedule orders on a production line to minimize the production cost? How should we cut components from a piece of metal to minimize the waste? And so on…
150
151
Rule #2
152
Find the shortest possible travel distance for a salesman that must visit every city in his territory (exactly once) and then return home. The diagram below represents a seven-city version of this problem:
5 1 4 2 7 6 3
153
1 2 3 4 5 6 7 1 19 27 17 21 31 2 16 15 18 14 22 26 3 25 14 20 18 13 4 16 20 11 5 19 12 17 12 17 6 33 24 20 23 15 7 29 14 16
154
Different tours may have different costs (total distances). For example, if we follow the tour: 2 – 3 – 7 – 6 – 1 – 4 – 5 – 2 the quality measure (i.e. the total distance) of this tour is 15 + 13 + 16 + 33 + 17 + 11 + 12 = 117. If the salesman follows a different tour: 2 – 1 – 3 – 7 – 6 – 5 – 4 – 2 then the total distance would be 127… Which tour provides the shortest total distance?
155
156
y x 48 288 99 33 x = 18 y = 45
x + 6y ≤ 288 3x + y ≤ 99 maximize $20x + $30y
This diagram explains the principles of linear programming
157
From a piece of rectangular paper 20×30 centimeters, cut corners in such a way that after bending the sides
20 cm 30 cm
158
159
160
length = 3
161
length = 2.83
162
length = 3.14
163
length = 2.73 n points – so called Steiner’s problem… still unsolved…
164
Find a point F such that the total distance AF + BF + CF is minimum
F A C B
165
166
167
all solutions (search space)
168
quality measure all solutions (search space)
169
feasible solution infeasible solution quality measure Optimization task: Find the highest quality feasible solution…
170
feasible solution quality measure Optimization task: Find the highest quality feasible solution…
another quality measure infeasible solution
171
172
harm is done and the egg is not weaker).
experiment.
would break also if dropped from a higher floor.
floor, it would survive also if dropped from a lower floor.
173
174
175
176
177
If we drop the first egg from, say, the 18th floor, there are two possible outcomes:
every floor starting from floor 1. In the worst case, we drop the second egg 17 times to determine the egg-breaking floor....
remaining 18 floors; however, we have still two eggs for experimentation…
178
179
180
181
182
8 1 15 2 9 21 3 10 16 26 4 11 17 22 30 5 12 18 23 27 33 6 13 19 24 28 31 35 7 14 20 25 29 32 34 36
183
185
186
Let us consider the case of two bears – one white and
thinking about the answers before reading further. The questions are:
What is the probability that both bears are males? What is the probability that both bears are males if you
were told that one of them is male?
What is the probability that both bears are males if you
were told that the white one is male?
187
Rule #1: Be sure you understand the problem, and all the basic terms and expressions used to define it. There are two bears, but where did they come from? Were they selected from a large population of bears? If so, we should know the distribution of sexes and colors in this population… Since this information was not given in the problem, we have to assume that among all bears, the two sexes and two colors (black or white) are equally likely.
188
Rule #2: Do not rely on your intuition too much; solid calculations are far more reliable Rule #3: Solid calculations and reasoning are more meaningful when you build a model of the problem by defining its variables, constraints, and objectives.
189
What is the probability that both bears are males?
Let’s list all the possible outcomes, which are: (white, black) = (f f ), (f m), (m f ), and (m m) where m is male and f is female. Answer: 1/4
190
What is the probability that both bears are males if
you were told that one of them is male? We know that all possible outcomes are: (white, black) = (f f ), (f m), (m f ), and (m m) Answer: 1/3
191
What is the probability that both bears are males if
you were told that the white one is male? We know that all possible outcomes are: (white, black) = (f f ), (f m), (m f ), and (m m) Answer: 1/2
192
There are three cards in a bag:
You draw one card at random and examine one side of this card. You see an X.
193
Again: Rule #1, Rule #2, and Rule #3… Clue: Altogether, there are 6 symbols on these three cards: three Xs and three Os. Model: a, b, c X d, e, f O Card #1 Card #2 Card #3 a b c d e f
194
Model: a, b, c X d, e, f O Card #1 Card #2 Card #3 a b c d e f Now we can do some reasoning: “You draw one card at random and examine one side of this card. You see an X.” So you saw either a, b, or c… Answer: 2/3
195
A boy is often late for school. When approached by
his teacher, he explained that it is not his fault. Then he provided some details. His father takes him from home to the bus stop every morning. The bus is supposed to leave at 8:00 am, but this departure time is only approximate. The bus arrives at the stop anytime between 7:58 and 8:02 and immediately
bus stop at 8:00, however, due to variable traffic conditions they arrive anytime between 7:55 and 8:01. This is why the boy misses the bus so often.
Can you determine how often the boy is late for
school?
196
As we know, the two variables of the problem are:
x: arrival/departure time of the bus,
7:58 ≤ x ≤ 8:02.
y: arrival time of the boy,
7:55 ≤ y ≤ 8:01.
197
8:02 8:01 8:00 7:59 7:58 7:55 7:56 7:57 7:58 7:59 8:00 8:01 x y
6/35 ≈ 17% Possible arrivals: every minute…
198
8:02 8:01 8:00 7:59 7:58 7:55 7:56 7:57 7:58 7:59 8:00 8:01 y x
81/925 ≈ 18.5% Possible arrivals: every 10 sec…
199
8:02 8:01 8:00 7:59 7:58 7:55 7:56 7:57 7:58 7:59 8:00 8:01 x y
The line x = y divides the rectangle into two areas: area x < y (dark part) when the boy is late for the bus, and area x ≥ y (light part), when the boy is on time.
Exact answer: 18.75%
201
202
203
204
The assumption is that Shakespeare’s account of the circumstances of Julius Caesar death is accurate: Julius Caesar gasped: “You too, Brutus” at his last breath. Further, we assume that today – after more than 2,000 years from that event – all molecules present at that time are distributed uniformly in the atmosphere today. Then the question is: What are the chances that you have just inhaled a molecule which Julius Caesar exhaled in his dying breath?
205
206
207
208
209
210
211
in 1492 and his fellow Italian Enrico Fermi discovered the new world of atom in 1942.
Lincoln, while President Lincoln’s secretary was named Kennedy.
Reagan (former US President) has 6 letters (thus a connection with “666”).
212
213
214
215
216
217
218
219
220
221
= 0.4019
= 0.2961
6 5 6 5 6 5 6 5 6 5 6 1 1 6 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 1 6 1 2 12
222
k n
223
224
= 0.3349
1 – 0.3349 = 0.6651
6 5 6 5 6 5 6 5 6 5 6 5
225
226
= 0.1122
= 0.2692
6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 5 6 1 1 12
227
1 – 0.1122 – 0.2692 = 0.6186
228
229
230