Which piece do you want?

Two people on a long walk sit down for a well-deserved break. Person A has brought along 3 cakes to eat and person B has brought along 5.

As they are just about to tuck in, person C arrives and asks to share their meal. A and B agree. They cut each cake into three equal pieces and each person eats one piece of each cake.

After the meal person C pays 8 coins for the cake. Person A gives B 5 of these coins and keeps 3. But person B complains. She demands to be given 7 of the coins with only 1 remaining for A.

Who is right and why?

Can you generalise the solution for an initial people having cakes respectively, who are then joined by another people who pay coins each?

*We'd like to thank Syed Abbas, Associate Professor and Chairperson SBS, IIT Mandi, India, for sending in this puzzle. Reportedly, a version of it was put to Ali ibn Abi Talib in the seventh century AD. Another version also appears in Fibonacci's famous Liber Abaci. *

### Solution

It turns out that Person B is right. After sharing each cake into three pieces there are a total of 8x3=24 pieces. They are divided equally between the three people, which mean that every person eats 8 pieces. To start with person A has 3x3=9 pieces and person B has 3x5=15 pieces. Out of his 9 pieces person A eats 8, which means that he has given away 1. Out of her 15 pieces person B eats 8, which means that she has given away 7 pieces. Therefore, person B should receive 7 coins and person A only 1.

Now for the general version of the problem. There are a total of

cakes which are each divided into pieces, which means there are

pieces of cake in total. Each person eats

pieces.

The person, call them brought along cakes, so they initially have

pieces. Since they eat

pieces themselves they should be paid

coins.

To double check, the total number coins received is

which equals the total number of coins that are being paid.