the cake division puzzle

26
The Cake Division Puzzle CSC2110 - Project

Upload: xavier-booker

Post on 01-Jan-2016

26 views

Category:

Documents


1 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The Cake Division Puzzle

The Cake Division Puzzle

CSC2110 - Project

Page 2: The Cake Division Puzzle

The Cake Division Puzzle

1. Introduction2. Proof of the general solution3. Variation of the puzzle

Page 3: The Cake Division 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?

Page 4: The Cake Division Puzzle

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.

Page 5: The Cake Division Puzzle

An Example

Divide each of the 7 cakes into 12 equal pieces.

7 x 12 = 84 pieces are needed to do the division.

That seems a lot. Can we use fewer pieces?

Each person takes 7 pieces.

Page 6: The Cake Division Puzzle

A Better Example

P1 P2 P3 P4

P5 P6 P7

P8

P10

P9

P8

P10 P11

P11

P9

P12

P12 P12

In this case, only 18 pieces are needed!

Can we do even better? Could we do it with 17 pieces? No

Page 7: The Cake Division Puzzle

Solution

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.

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?

Page 8: The Cake Division Puzzle

ProofClaim: 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

Page 9: The Cake Division Puzzle

ProofClaim: 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

Page 10: The Cake Division Puzzle

ProofClaim: 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.

Page 11: The Cake Division Puzzle

ProofClaim: 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.

e.g. when C = 4, P = 6, CP = 24

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, …

1. Imagine we split the big cake into CP pieces and we number them from 1 to CP.

12

3

12

618

24

12

618

24

4

12

24

816

20

Page 12: The Cake Division Puzzle

ProofClaim: 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.

e.g. when C = 4, P = 6, CP = 24

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”.

Notice that the cut at lcm(C, P) is repeated. (in the example, lcm(4, 6) = 12)

12

3

12

618

24

12

618

24

4

12

24

816

20

1212 12

Page 13: The Cake Division Puzzle

ProofClaim: 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.

e.g. when C = 4, P = 6, CP = 24

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),

A double-cut can be seen at multiples of lcm(C,P), 1<= lcm(C,P) < CP.

12

3

12

618

24

12

618

24

4

12

24

816

20

and the number of pieces is C + P - gcd(C,P).

Page 14: The Cake Division Puzzle

ProofClaim: 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.

Assume this is not the minimum, we have more than gcd(C, P)-1 double-cuts.

Now we prove that this is the minimum by contradiction.

(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

18

24

6 18 6

2

1014

22

Page 15: The Cake Division Puzzle

ProofClaim: 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.

Assume this is not the minimum, we have more than gcd(C, P)-1 double-cuts.

Now we prove that this is the minimum by contradiction.

(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.

1214

24

8

4

2

16

2020

8

Page 16: The Cake Division Puzzle

ProofClaim: 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.

Without loss of generality, we only have to consider (i).

Assumption: We have more than gcd(C,P) - 1 double-cuts.

This means there exist two double-cuts rC+a = yP, sC+a = zP such that

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)

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.

Page 17: The Cake Division Puzzle

ProofClaim: 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

Page 18: The Cake Division Puzzle

ProofClaim: 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

3

12

618

24

Page 19: The Cake Division Puzzle

ProofClaim: 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

3

12

618

24

12

24

6

12

24

18

Page 20: The Cake Division Puzzle

ProofClaim: 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.

e.g. when C = 2, P = 3, P+a = 4, CP(P+a) = 24

12

618

24

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.

8

24

16

6

12

24

18

816

At this point there are C + P+a – gcd(C,P+a) pieces.

Page 21: The Cake Division Puzzle

ProofClaim: 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.

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).

At this point there are C + P+a – gcd(C,P+a) pieces.

We know there are gcd(C,P)-1 + gcd(P,P+a)-1 double cuts.

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), ...

Page 22: The Cake Division Puzzle

ProofClaim: 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.

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)

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),

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.

Page 23: The Cake Division Puzzle

ProofClaim: 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)

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.

Page 24: The Cake Division Puzzle

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?

Page 25: The Cake Division Puzzle

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.

Page 26: The Cake Division Puzzle

- The End -