260 likes | 363 Views
The Cake Division Puzzle. CSC2110 - Project. The Cake Division Puzzle. 1. Introduction 2. Proof of the general solution 3. Variation of the puzzle. The Cake Division Puzzle.
E N D
The Cake Division Puzzle CSC2110 - Project
The Cake Division Puzzle 1. Introduction 2. Proof of the general solution 3. Variation of the puzzle
The Cake Division Puzzle You have 7 identical cakes that you are to divide equally among 12 people. You can accurately cut a cake into any number of pieces (not necessarily the same size). What is the minimum number of pieces needed to do the division? Can you find a general solution for any number of cakes and people?
An Example One way of doing the division is to cut each cake into 12 equal pieces and give each person 7 of the pieces.
An Example Divide each of the 7 cakes into 12 equal pieces. Each person takes 7 pieces. 7 x 12 = 84 pieces are needed to do the division. That seems a lot. Can we use fewer pieces?
A Better Example P8 P1 P9 P2 P10 P11 P4 P3 P10 P11 P12 P5 P6 P7 P8 P9 P12 P12 In this case, only 18 pieces are needed! Can we do even better? Could we do it with 17 pieces? No
Solution You have 7 identical cakes that you are to divide equally among 12 people. You can accurately cut a cake into any number of pieces (not necessarily the same size). What is the minimum number of pieces needed to do the division? Can you find a general solution for any number of cakes and people? Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P.
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. Instead of dividing C cakes among P people, we treat the cakes as one big cake. To have C cakes, cut it into C equal pieces. To divide the cakes among P people, cut it again into P equal pieces. e.g. when C = 3, P = 5
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. Notice that the total number of pieces you get equals to the number of cuts you make plus one. etc. Proof: Refer to Classwork 1 Long Questions - Q.14
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. Aim: Minimise the number of cuts ( => Minimise the number of pieces ) When we cut the cake into P equal pieces after cutting it into C equal pieces, a number of cuts are placed in the same places. Method: Maximise the number of cuts placed in the same places.
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. 1. Imagine we split the big cake into CP pieces and we number them from 1 to CP. 2. To divide into C pieces we make cuts at P, 2P, 3P, … 3. To divide into P pieces we make cuts at C, 2C, 3C, … e.g. when C = 4, P = 6, CP = 24 12 12 12 16 8 18 6 18 6 20 4 3 2 24 1 24 24
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. Notice that the cut at lcm(C, P) is repeated. (in the example, lcm(4, 6) = 12) This place is cut twice when cutting the cake into C pieces and cutting into P pieces. We call a cut like this a “double-cut”. e.g. when C = 4, P = 6, CP = 24 12 12 12 12 12 12 16 8 18 6 18 6 20 4 3 2 24 1 24 24
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. A double-cut can be seen at multiples of lcm(C,P), 1<= lcm(C,P) < CP. Since lcm(C,P) x gcd(C,P) = CP, there are gcd(C,P) - 1 double-cuts on the cake. Therefore, the total number of cuts is (C - 1) + (P - 1) - (gcd(C,P) - 1), and the number of pieces is C + P - gcd(C,P). e.g. when C = 4, P = 6, CP = 24 12 12 12 16 8 18 6 18 6 20 4 3 2 24 1 24 24
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. Now we prove that this is the minimum by contradiction. Assume this is not the minimum, we have more than gcd(C, P)-1 double-cuts. (i) We must have cut the cakes into P pieces at some a, C+a, … , (P-1)C+a, and we have “double-cuts” whenever some xC+a = yP, or 12 14 10 18 6 18 6 22 2 24
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. Now we prove that this is the minimum by contradiction. Assume this is not the minimum, we have more than gcd(C, P)-1 double-cuts. (i) We must have cut the cakes into P pieces at some a, C+a, … , (P-1)C+a, and we have “double-cuts” whenever some xC+a = yP, or (ii)We must have cut the cakes into C pieces at some a, P+a, … , (C-1)P+a, and we have “double-cuts” whenever some xP+a = yC. 12 14 8 16 8 20 4 20 2 24
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. Assumption: We have more than gcd(C,P) - 1 double-cuts. Without loss of generality, we only have to consider (i). From the assumption, there are at least gcd(C,P) double-cuts; thus the smallest difference between these cuts is at most CP/(gcd(C,P) +1) This means there exist two double-cuts rC+a = yP, sC+a = zP such that C(r-s) = P(y-z), and C(r-s) <= CP/(gcd(C,P) + 1) < CP/gcd(C,P) = lcm(C,P), but C(r-s) is clearly a multiple of C and P, which therefore contradicts the claim.
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. We also need to show that it is optimal to cut the cake into P pieces rather than some P+a where gcd(C,P+a) > gcd(C,P). Notice that after cutting a cake into P+a pieces, we may have to make cuts at some places in order to divide it among P people. e.g. when C = 2, P = 3, P+a = 4, gcd(C,P+a) = 2 > 1 = gcd(C,P) DC DC EC EC
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. This time imagine the big cake is split into CP(P+a) instead, and we number them from 1 to CP(P+a). e.g. when C = 2, P = 3, P+a = 4, CP(P+a) = 24 12 18 6 3 2 1 24
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. Similar to what we did before, to divide into C pieces and P+a pieces we make cuts at P(P+a), 2P(P+a), … and CP, 2CP, 3CP, … respectively. e.g. when C = 2, P = 3, P+a = 4, CP(P+a) = 24 12 12 12 18 6 18 6 3 2 1 24 24 24
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. At this point there are C + P+a – gcd(C,P+a) pieces. Now we cut whole cake into P pieces. We divide the cake into P pieces by making cuts at C(P+a), 2C(P+a), ... We know there are gcd(C,P)-1 + gcd(P,P+a)-1 double cuts. e.g. when C = 2, P = 3, P+a = 4, CP(P+a) = 24 12 12 16 8 16 8 18 6 18 6 24 24 24
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. At this point there are C + P+a – gcd(C,P+a) pieces. Now we cut whole cake into P pieces. We divide the cake into P pieces by making cuts at C(P+a), 2C(P+a), ... We know there are gcd(C,P)-1 + gcd(P,P+a)-1 double cuts. But this time we also have to consider double cuts of these double cuts, which appear at multiples of lcm(C,P,P+a). Therefore, we have gcd(C,P)-1 + gcd(P,P+a)-1 double cuts at multiples of lcm(C,P), lcm(P,P+a), and also gcd(C,P,P+a)-1 “triple-cuts” at multiples of lcm(C,P,P+a).
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. At this point there are C + P+a – gcd(C,P+a) pieces. In order to divide among P people, we have to add (P-1) - [(gcd(C,P)-1) + (gcd(P,P+1)-1) – (gcd(C,P,P+a)-1)] cuts to the whole cake. Hence the total number of cuts is (C-1) + (P-1) + (P+a-1) - (gcd(C,P+a)-1) - (gcd(C,P)-1) - (gcd(P,P+a)-1) + (gcd(C,P,P+a)-1), and thus the number of pieces is C + P + (P+a) - gcd(C,P+a) - gcd(C,P) - gcd(P,P+a) + gcd(C,P,P+a)
Proof Claim: With C cakes and P people, the minimum number of pieces required is C+P-D, where D is the greatest common divisor of C and P. Now we show that cutting the big cake into P pieces is optimal by showing C + P – gcd(C,P) <= C + P + (P+a) - gcd(C,P+a) - gcd(C,P) - gcd(P,P+a) + gcd(C,P,P+a) C + P – gcd(C,P) <= C + P + (P+a) - gcd(C,P+a) - gcd(C,P) - gcd(P,P+a) + gcd(C,P,P+a) Rearrange the terms, we have gcd(P+a,C) + gcd(P,P+a) <= P+a + gcd(P,P+a,C) When gcd(P+a,C) <= C and gcd(P,P+a) <= P, gcd(P+a,C) + gcd (P,P+a) <= P+a So the statement is true. Now the only possibility we have not covered is when gcd(P+a,C) = P+a, but when gcd(P+a,C) = P+a, gcd(P,P+a) = gcd(C,P,P+a) Therefore, the statement holds true as well and we are done.
Variation Suppose you owned a foundry that produced and sold gold bars. Suppose you had an order for 5 bars weighing 7 ounces each. That's 35 ounces. But, the workers got it wrong and by mistake produced 7 bars weighing 5 ounces each. That's still 35 ounces but the nomenclature is all wrong. We need to cut some of those seven 5 ounce bars up in some fashion, combine the pieces into 5 groups of 7 ounces each and re-melt those 5 groups into 5 seven ounce bars in order to properly fill this order. What is the minimum number of cuts required? Can you find a general solution?
Variation • The general solution is: N = B – D, where N is the minimum number of cuts, B is the number of gold bars needed and D is the gcd of the number of gold bars needed and the number of extra gold bars produced. • In the above case the number of gold bars needed is 5 and the number of extra gold bars produced is 7-5=2. gcd(5,2) is 1 so N = 5 - 1 = 4. • This puzzle becomes similar to the cake one after getting the number of extra gold bars produced, since the next thing you have to do is to divide the extra gold bars equally to the gold bars needed. However, this puzzle is asking for the minimum number of cuts instead of pieces, which is equal to the number of minimum pieces minus the number of extra gold bars, as n cuts on a gold bar produce n+1 pieces of small gold bars. Therefore, we have N = B + P - D - P, where P is equal to the number of extra gold bars produced. And we have N = B - D for the general solution.