# The Ice Cream Cake Process

You have a circular ice cream cake, with pink icing on top, and the brown chocolate interior showing when looked at from beneath.

Let $x$ be a fixed real number. Over and over, you cut a $x^\circ$ slice from the cake, turn it over, and insert it back in. (Since this is an ice cream cake, the cuts resolidify). The position of each slice is anticlockwise adjacent to the previous one. For example, when $x=130^\circ$, the first four steps would be:

Prove that all of the icing will end up back on top... even when $x$ is irrational!

Source: This is yet another one of Peter Winkler's gems, from Mathematical Mind Benders.

• I don't get the change from image 3 to 4. Shouldn't the remaining pink pie be rotated like this? – Engineer Toast Nov 16 '15 at 15:38
• @EngineerToast Imagine lifting the piece and flipping it over. The colors will be both flipped and also mirrored that way. Not just a flip of colors – Ivo Beckers Nov 16 '15 at 15:39
• @IvoBeckers Ah, see, I wasn't getting the action of taking out a piece and rotating about it's center. I can envision it all now. – Engineer Toast Nov 16 '15 at 15:47
• You mean the icing will end up back on top in a finite number of steps, right? – Jack M Nov 16 '15 at 18:25
• I have constructed a visualization tool for this puzzle, but it only works for integer values of x. Warning: the values [1, 7, 11, 13, 14, 16, 17, 19, 21, 22] appear to have a period longer than 500, and may consume a large amount of browser resources. – Kevin Nov 16 '15 at 20:26

## 2 Answers

Instead of the flipping mechanism rotating around the cake, let's take the frame of the flipper, where the flipper is fixed and always flips the same interval, followed by the cake being rotated. Whether the cake returns to all icing doesn't depend on the frame.

Let the cake have circumference $1$, and so that points correspond to values modulo $1$. Let's put $0$ above the cake and have the length-$x$ flipper be centered above the cake flipping the interval $R=[-x/2, x/2]$. So, we alternate negating points in range $R$ (and swapping their color) and increasing all points by $x$.

Let's look the orbit of a single point on the cake, treating the flips (when they happen) and the rotations as separate steps. We can look both forward and backward in time, since the steps are reversible.

At some point in the orbit, the point is in $R$ since the rotation angle equals the length of $R$. Say it flips from a value $-q$ to $q$. Iterating forward, it the rotates to $q+x, q+2x,\dots$ until it is again at some point $p$ in $R$. Iterating backwards, the same is true mirrored with $-q-x, -q-2x, \dots$ until it reaches a point $-p$ in $R$. But $p$ and $-p$ flip to each other, so the whole thing forms a cycle. Moreover, the point has changed color twice in that cycle, making the orbit a closed loop of events.

So, every point, after some number of steps, returns to its original position and color.

This number can be different for different points. It is twice the number $n$ of steps to rotate from $q$ to $p$. Looking at the extreme cases where $p$ and $q$ lie near the boundaries of $R$, the distance $nx$ rotated is in the range $(1-x,1+x)$, and so $n\in (x^{-1}-1,x^{-1}+1)$. Since $n$ is an integer, if we let $m=\lfloor x^{-1}\rfloor$, then $n$ is either $m$ or $m+1$.

Since points can have one of two cycle lengths, $2m$ and $2(m+1)$, it suffices to take a number of steps divisible by both of them, the smallest being their LCM, which is $2m(m+1)$, still with $m=\lfloor x^{-1}\rfloor$. After that number of steps, each point has done a whole number of cycles, and so returned to its original location and color of icing.

• Very clean, clear and nice solution. I especially like that you provide tight estimates on cycle lengths! It's also easy to see the estimate is optimal by plugging some cases into Kevin's visualization tool (like 7 or 11, for instance). – Fimpellizieri Nov 17 '15 at 6:06

To get the ice cream cake back to a position where either all the icing or all the chocolate faces top(chocolate top can be seen as a solution since you just need to repeat all steps to flip the cake again) we need to have the sum off all made slices be dividable by 360:

$$x \times n = 0 \bmod 360$$ where $n$ is the number of slices we flip.

The easiest way to get this would be to multiply $x$ by a natural number $y$ so that $x \times y$ is itself a natural number. After that you only need to multiply $y$ by 360 to be sure that your solution is dividable by 360.

For a rational number this is relatively easy.

Since every rational number $x$ can be written as a fraction $\frac{a}{b}$ we just need to multiply $x$ by its denominator $b$ to make sure that the solution is a natural number.

As for irrational numbers I do not think that it is possible, at least within the range of finite natural numbers.

To show that on a well known example we simply take the irrational number $\pi$.

As far as i know it is not possible that the term

$$\pi \times n \space|\space n\in {N}$$

can ever equal a natural number.

• This is only true when each cut only flips colors. But each cut flips colors and also mirrors the piece – Ivo Beckers Nov 16 '15 at 15:56
• Yeah saw that now as well. I'll still leave that answer for now. – The Dark Truth Nov 16 '15 at 15:57