Skip to main content
Home
plus.maths.org

Secondary menu

  • My list
  • About Plus
  • Sponsors
  • Subscribe
  • Contact Us
  • Log in
  • Main navigation

  • Home
  • Articles
  • Collections
  • Podcasts
  • Maths in a minute
  • Puzzles
  • Videos
  • Topics and tags
  • For

    • cat icon
      Curiosity
    • newspaper icon
      Media
    • graduation icon
      Education
    • briefcase icon
      Policy

    Popular topics and tags

    Shapes

    • Geometry
    • Vectors and matrices
    • Topology
    • Networks and graph theory
    • Fractals

    Numbers

    • Number theory
    • Arithmetic
    • Prime numbers
    • Fermat's last theorem
    • Cryptography

    Computing and information

    • Quantum computing
    • Complexity
    • Information theory
    • Artificial intelligence and machine learning
    • Algorithm

    Data and probability

    • Statistics
    • Probability and uncertainty
    • Randomness

    Abstract structures

    • Symmetry
    • Algebra and group theory
    • Vectors and matrices

    Physics

    • Fluid dynamics
    • Quantum physics
    • General relativity, gravity and black holes
    • Entropy and thermodynamics
    • String theory and quantum gravity

    Arts, humanities and sport

    • History and philosophy of mathematics
    • Art and Music
    • Language
    • Sport

    Logic, proof and strategy

    • Logic
    • Proof
    • Game theory

    Calculus and analysis

    • Differential equations
    • Calculus

    Towards applications

    • Mathematical modelling
    • Dynamical systems and Chaos

    Applications

    • Medicine and health
    • Epidemiology
    • Biology
    • Economics and finance
    • Engineering and architecture
    • Weather forecasting
    • Climate change

    Understanding of mathematics

    • Public understanding of mathematics
    • Education

    Get your maths quickly

    • Maths in a minute

    Main menu

  • Home
  • Articles
  • Collections
  • Podcasts
  • Maths in a minute
  • Puzzles
  • Videos
  • Topics and tags
  • Audiences

    • cat icon
      Curiosity
    • newspaper icon
      Media
    • graduation icon
      Education
    • briefcase icon
      Policy

    Secondary menu

  • My list
  • About Plus
  • Sponsors
  • Subscribe
  • Contact Us
  • Log in
  • Sharing cake: Solution

    12 February, 2020
    Cake

    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 $k$ people having $n_1, n_2, ...,n_k$ cakes respectively, who are then joined by another $m$ people who pay $n_1+n_2+n_3+...+n_k$ 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 $$n_1+n_2+n_3+...+n_k$$ cakes which are each divided into $k+m$ pieces, which means there are $$(n_1+n_2+n_3+...+n_k)(k+m)$$ pieces of cake in total. Each person eats $$(n_1+n_2+n_3+...+n_k)$$ pieces. The $ith$ person, call them $k_i$ brought along $n_i$ cakes, so they initially have $$(m+k)n_i$$ pieces. Since they eat $$n_1+n_2+n_3+...+n_k$$ pieces themselves they should be paid $$(m+k)n_i-(n_1+n_2+n_3+...+n_k)$$ coins. To double check, the total number coins received is \begin{eqnarray*}&(m+k)n_1-(n_1+n_2+n_3+...+n_k)\\ +&(m+k)n_2-(n_1+n_2+n_3+...+n_k)+...\\ +&(m+k)n_k-(n_1+n_2+n_3+...+n_k)\\ =&(m+k)(n_1+n_2+n_3+...+n_k)-k(n_1+n_2+n_3+...+n_k)\\ =&m(n_1+n_2+n_3+...+n_k), \end{eqnarray*} which equals the total number of coins that are being paid.

    • Log in or register to post comments

    Max

    28 August 2021

    Permalink
    Comment

    Correct me If I am wrong, the question specifically states that "each person eats one piece of each cake." This means that if A brings 3 cakes and B brings 5 cakes then person C eats one piece of each cake, so he must eat 3 pieces from A and 5 pieces from B. Hence if each piece costs 1 coin, 3 coins should go to A while 5 to B.

    For summarising the solution to this answer I got the general equation of (3n*(Σp-k))/Σp. the letter 'n' is the number of cakes present, 'Σp' is the total number of people eating cakes. The 'k' is the number of people who provide the cakes. The expression 'Σp-k' is the number of extra people. The equation provides a result for the sum of all coins that need to be paid back this will be 'Σc', to calculate the number of coins that need to be paid back per person the Σc needs to be divided by the number extra people this gives the result (Σc)/(Σp-k). Thus we can state that the number of coins that need to be paid back per person is given by equation (3n*(Σp-k))/((Σp*(Σp-k)) = Σc/Σp-k. This simplifies the left side equation to 3n/Σp.

    Thus the formulas I obtained are:
    - (3n*(Σp-k))/Σp = Σc : sum of coins needed to be paid back
    - (Σc)/(Σp-k) or 3n/Σp : number of coins that need to be given back per person

    I think that the problem with the question lies in the wording, the answer provided is correct is the people ate the 8 cakes between each other. I also would like to say that the answer provided would only be one of many possible answers, this is because it assumes that person A eats all her cakes and then gives the others away. However if they were the to randomly eat 8 slices each the number of combinations possible would be 24!/8! (each slice is on its own) where the combination in the answer would be just one of many.

    I am not sure if my maths is 100% correct, please do correct me if I have made any mistakes!

    • Log in or register to post comments

    Anonymous

    4 October 2023

    In reply to Answer to the question by Max

    Permalink
    Comment

    Hello. You are only focusing on how many pieces of cakes each person brought was being eaten by C, but remember that it is not only C who needs to pay A and B, A also needs to pay B bcz A ate more pieces of B's cakes than B ate A's.
    So basically: C pays A, C and A pays B.

    • Log in or register to post comments

    Firas Hussrin

    7 November 2021

    Permalink
    Comment

    A gave 6 pieces from his cake and took 5 pieces from B own + 3 from his own = so he got 8 pieces from all the cake so he pay for three cake 9 pieces

    B gave 10 pieces from here cake and took 3 pieces from A own + 5 from her cake = so she took same 8 pieces from all cake but she pay for five cake 15 pieces

    A PAY FOR 9 PIECES AND GOT 8 PIECES ----> 9-8 = 1
    one PIECE HE GAVE FROM THE HIS SHARE

    B PAY FOR 15 PIECS ABD GIT 8 PIECES -----> 15-8= 7
    Seven PIECES SHE GAVE FROM HER SHARE

    SO A will take only 1 for his one piece
    And B will take 7 for her pieces

    • Log in or register to post comments

    Rehan

    18 March 2023

    Permalink
    Comment

    Actually B claims that A should have 1 coin and B 7 coins because A has also eaten 5 pieces ( out of 15 pieces) of B . B has also eaten 3 pieces ( out of 9 pieces) of A. Thus A has to give coins to B for that extra 2 pieces ( 5-2) eaten. Thus from 3 coins of A , he has to give 2 .
    Thus at the end A would have 1 coin and B is left with 7 coins. ( If the pieces eaten from A and B are distributed equally first from A and then from B). It all depends on probability

    • Log in or register to post comments

    Swastik Sanyal

    17 April 2023

    In reply to Studying by Rehan

    Permalink
    Comment

    actually that's how i came up with the solution.

    • Log in or register to post comments
    University of Cambridge logo

    Plus is part of the family of activities in the Millennium Mathematics Project.
    Copyright © 1997 - 2025. University of Cambridge. All rights reserved.

    Terms