# How to distribute cheese on my pancake?

I like to make pancakes with cheese. When I bake a pancake, I put some slices of cheese on it, like this:

Then I roll up the pancake from bottom to top before I eat it.

The thing is, I like my cheese to be as evenly distributed as possible. Because I roll up my pancake, the vertical position of each slice of cheese is not important, as long as it is completely on the pancake.

Let the pancake be a disc centered at $$(0, 0)$$ with radius $$1$$. We have $$N$$ rectangular slices of cheese, each of size $$w \times h$$. We can describe the amount of cheese at some point with a function $$c(x, y)$$. We must have $$c(x, y) = 0$$ for $$x^2 + y^2 > 1$$. $$c(x, y) = \begin{cases} 0 & \text{no cheese} \\ 1 & \text{1 slice of cheese} \\ \vdots \\ n & n \text{ slices of cheese} \\ \end{cases}$$

The cheese to pancake ratio at horizontal position $$-1 < x < 1$$ can be described using this formula: $$r(x) = \frac{\int_{-1}^1 c(x, y)\ \mathrm{d}y}{2\sqrt{1 - x^2}}$$

If the cheese would be perfectly distributed, we would have a constant $$r(x)$$: $$r(x) = R = \frac{\int_{-1}^1 \int_{-1}^1 c(x, y)\ \mathrm{d}x\ \mathrm{d}y}{\pi} = \frac{N \cdot w \cdot h}{\pi}$$

But this perfect distribution is not possible, because we may not fold or cut our slices.

We want to get as close as possible to such a perfect distribution. Let's take the following error function that describes how much $$r(x)$$ deviates from $$R$$. The integrand is multiplied with $$2\sqrt{1 - x^2}$$ so that the ratio is weighted by the amount of pancake at some $$x$$. $$e = \int_{-1}^1 2\sqrt{1 - x^2} \cdot (r(x)- R)^2 \ \mathrm{d}x$$

Alternatively, absolute error $$|r(x)- R|$$ can be used instead of quadratic $$(r(x)- R)^2$$ if that's easier.

Where do I need to put my slices of cheese to minimize $$e$$? For $$N=1$$, can we just lay it straight in the middle or should we rotate it a bit? What about $$N=2$$ or $$N=3$$?

• Crumble the cheese up and sprinkle it uniformly at random... Commented Jul 7 at 21:02
• 1. You eat the cheese raw or it melts on warm pancake? Commented Jul 7 at 21:19
• @AdamWrzesiński Very important question, I put the cheese on after I flip it, so it melts at bit.
– Paul
Commented Jul 7 at 21:21
• This Wikipedia plot summary may be relevant to your interests. Commented Jul 8 at 23:13
• More seriously: For reasonable $N$, we can reduce to one dimension, and try to match the circular profile of the pancake with combinations of trapezoidal functions $f_k$, with height $h\sec\theta_k$, upper base $w\cos\theta_k-h\sin\theta_k$, and lower base $w\cos\theta_k+h\sin\theta_k$ for tilt angle $\theta_k$ for the $k$th piece. It's not immediately obvious to me if there is an error metric that is convenient to use for this. Commented Jul 8 at 23:28

Perhaps it is not immediately obvious, but any arrangement of cheese that satisfies the following conditions:

1. Their long axes are parallel to each other
2. If the $$x$$-coordinates of two adjacent vertices of a strip are located at $$x_1 < x_2$$, and there is enough space to fit another strip, the second strip has two adjacent vertices at the same $$x$$-coordinates

then this results in a constant cheese amount across the entire interval except at the very ends of the first and last strip. For instance, in the diagram below, we have the same coverage except at the leftmost section of the circle cut by the first vertical line, and the rightmost section of the circle cut by the last vertical line:

Consequently, for given dimensions of a cheese strip, it is generally possible to choose a rotation angle $$\theta$$ such that you can arrange some number of strips in such a manner while ensuring that the leftmost and rightmost strips have a vertex on $$(-1,0)$$ and $$(1,0)$$, respectively. If you do not have enough strips for the diameter of the pancake, then nothing can be done; the "most even distribution" of cheese is to lay the strip so that the longest axis is parallel to the $$x$$-axis (which we might call rotation angle $$\theta = 0$$). At the other extreme, if the cheese strip is too large (trivially, any strip whose diagonal exceeds $$2$$ cannot fit in any orientation), then it is not possible to lay them without overlap while meeting the above criteria.

You can also lay the cheese in multiple rows, but this increases the size of the end regions where we don't have even coverage, since at most only one strip each may occupy the points $$(\pm 1,0)$$.

With this heuristic in mind, we can see that a general approach to reduce the error (although we have not formally proven it is minimized) in the case where the cheese is "reasonably shaped," is to arrange them in a parallel fashion at the same angle such there is only one "row" of strips. Shown below is an example of what I mean by $$N = 5$$ strips, although please forgive the inaccuracy of the diagram, since it was drawn freehand and not calculated.

• Nice answer. Not the answer to my exact question though, since I want the cheese/pancake ratio to be as uniform as possible, not the absolute amount of cheese. So, there should be more cheese in the middle.
– Paul
Commented Jul 8 at 8:44

# For $$N = 1$$, work in progress

It seems reasonable to assume that the slice is centered at $$(0, 0)$$. Let $$\alpha$$ be the angle of rotation, where $$\alpha = 0$$ means the slice lays horizontally. Let's say $$w > h$$.

We define: $$c(x) = \int_{-1}^1 c(x, y)\ \mathrm{d}y$$ If $$\displaystyle 0 \le \alpha \le \arctan \left( \frac{w}{h} \right)$$, which seems also reasonable, we have: \begin{align} d_1 &= \frac{w}{2} \cos (\alpha) - \frac{h}{2} \sin (\alpha) \\ d_2 &= \frac{w}{2} \cos (\alpha) + \frac{h}{2} \sin (\alpha) \end{align} $$c(x) = \begin{cases} \displaystyle \frac{h}{\cos{\alpha}} & |x| \le d_1 \\ \displaystyle \frac{h}{\cos{\alpha}} \cdot \frac{d_2 - |x|}{d_2 - d_1}& d_1 < |x| \le d_2 \\ 0 & d_2 < |x| \end{cases}$$ \begin{align} e =\ & 2 \int_{0}^{d_1} 2\sqrt{1-x^2} \left( \frac{h}{2\cos(\alpha)\sqrt{1-x^2}} - R \right)^2\ \mathrm{d}x\ + \\ & 2 \int_{d_1}^{d_2} 2\sqrt{1-x^2} \left( \frac{h}{2\cos(\alpha)\sqrt{1-x^2}}\cdot \frac{d_2 - x}{d_2 - d_1} - R \right)^2\ \mathrm{d}x \\ =\ & -\frac{1}{4 \sin(\alpha)^2 \cos(\alpha)^2} \left(h \sin (\alpha ) \left(5 \sqrt{1-{d_1}^2}-3 \sqrt{1-{d_2}^2}\right) +2 \arcsin({d_1}) (3 {d_1} h \sin (\alpha )+{d_1} w \cos (\alpha )+1)\right)\\ & +\frac{3w}{4 \sin(\alpha)^2 \cos(\alpha)} \left(\sqrt{1-{d_2}^2}-\sqrt{1-{d_1}^2}\right) \\ & + \frac{\left(2 {d_2}^2+1\right)\arcsin(d_2)}{2 \sin(\alpha)^2 \cos(\alpha)^2}\\ & -2 \left(\frac{w h}{\pi}\right)^2 \left(2\operatorname{arccot}\left(\frac{\sqrt{2 {d_1}+2}}{\sqrt{h \sin (\alpha )-w \cos (\alpha )+2}}\right)+\arcsin({d_1})-\arcsin({d_2})\right) \\ & +\frac{w^2 h^2}{\pi} \left( \frac{2 d_2}{\pi} \sqrt{1-{d_2}^2} - 1\right) \end{align}