Cutting my birthday cake

How to make the most slices from just a few cuts of cake

post

Belgin's marvellous birthday cake

Guess what? Today’s my birthday. I’ve invited my friends, I’ve got the cake, and I’ve blown out the candles. There’s only one thing left to do: cut the birthday cake. As I pick up the knife, ready to cut the cake for my hungry guests and me, a question suddenly pops into my head: what is the maximum number of pieces I can get by cutting my cake $c$ times?

Well, first things first, there’s loads of ways you could cut your cake. So our first ingredient for the answer to this question will be a handful of assumptions. In this blog post, I’m going to chop up a square cake with a normal knife. All cuts will be perfectly straight, and will go across the entire cake (so we won’t be starting from its centre). Also, the pieces you get after cutting the cake do not have to be the same size! And finally, we’ll pretend our cake is a two-dimensional object—a humble square.

Let’s suppose that $p_c$ is the maximum number of pieces you can obtain by cutting your cake in $c$ slices, and see what happens for different choices of $c$.

Start with the easiest case where $c=0$. In this case, you haven’t cut your cake yet, so of course you still have the whole cake. This is a single piece in its own right, therefore zero cuts give you one piece only ($p_0=1$).

Next, make a long, straight cut across your cake (this is $c=1$). I guarantee you will cut your cake into two, ie $p_1=2$.

Let's make one big cut down the middle

Let’s make one big cut down the middle

Now we’ll cut the cake a second time ($c=2$). Your best bet is to make sure the second cut passes through both pieces, so you end up with four pieces. In other words, $p_2=4$.

Now let's make a second cut

Now let’s make a second cut

Time for a third cut. It turns out you can obtain a maximum of seven pieces ($p_3=7$).

And a third cut...

And a third cut…

Now, if we make one more cut (ie $c=4$), how many slices can we make? The answer is in fact eleven. Don’t believe me? Have a look at the picture below and count up the bits for yourself

A fourth cut gives us 11 pieces... count them!

A fourth cut gives us 11 pieces… count them!

Let’s summarise what we know so far. As shown in the graph below, our sequence (starting from $c=0$) is $p_c=1,2,4,7,11,$ etc. This sequence does indeed have a formula, but before I reveal it, see if you can spot the pattern. Give up?

The number of pieces follows a familiar sequence...

The number of pieces follows a familiar sequence…

The best way to see the pattern is to take one away from each term in our sequence, we are left with $0,1,3,6,10,$ and so on. That’s right: these are the triangle numbers! Remember, since we started our sequence from $c=0$, we also have the zeroth triangular number, which is nothing but zero.

Recall that the $c$th term for the triangle numbers is $c(c+1)/2$, so we can write out a formula for the number of pieces we get from $c$ cuts. It’s…\[\frac{c(c+1)}{2}+1.\]This expression will work for any $c=0,1,2,3,…$. If we try the formula for, say, $c=8$, then the formula tells you that you can get at most 37 pieces. So, the next time you have 36 friends at your birthday party, see if you can make one piece each for you and all your friends in just eight cuts!

But why does the formula work? Perhaps the easiest way to begin tackling this question is by writing down the differences between two consecutive terms. We get the numbers 1,2,3,4,…. More generally, the difference from $(c-1)$ cuts to $c$ will be just $c$. Anything familiar about these differences? They match up perfectly with the triangle numbers, and you can obtain $p_c$ by adding up all the first $c$ differences and one. In other words,\[p_c=1+\sum_{i=1}^ c i=1+ \frac{c(c+1)}{2},\]which we expected anyway. So we have proved the general formula. But why do we get these differences? To find out, we are going to gather some intuition, so let’s take a step away from the sequence and back to the cake. Suppose you just did $(c-1)$ cuts. If you want to maximise the number of pieces after your next cut, the trick is to line up your knife so that it will pass through all $(c-1)$ cuts exactly once. By doing so, you will cut your way through $c$ pieces, splitting each bit into two smaller slices. Hence you will end up with $c$ new pieces.

Our formula is for a square cake. Actually, it also works if your cake is a circle. But will the formula work for any two-dimensional cake you could think of? The answer is no; it turns out that the formula is only useful for convex shapes. As a rule of thumb, if your cake is not convex, you can look forward to even more pieces of cake! For example, it is possible to get as many as six slices from a crescent-shaped cake in two cuts. Try it yourself! If you haven’t got a crescent-shaped cake, sketch a crescent on a piece of paper and draw straight lines on it instead.

That’s one puzzle to try out. How about a few more…?

  • What happens if the cuts don’t have to be straight? Do you still get the same formula for $c$ cuts, or will it be different?
  • Earlier I assumed that the individual pieces you get after cutting do not have to be the same size. It is quite easy to make the pieces the same size for one or two cuts, but can you do it for, say, three cuts?

But that’s enough talk for today. Now, where’s that cake?

Happy birthday to me...

Happy birthday to me…

Belgin is a data scientist having got her PhD in population genetics. When not working, you can usually find Belgin either playing the piano or playing Math Blaster. She is pictured here standing next to her copy of Zeeman’s catastrophe machine.

More from Chalkdust