This week’s Riddler Classic is geometry puzzle about randomly slicing a square sandwich.

I have made a square sandwich, and now it’s time to slice it. But rather than making a standard horizontal or diagonal cut, I instead pick two random points along the perimeter of the sandwich and make a straight cut from one point to the other. (These points can be on the same side.)

What is the probability that the smaller resulting piece has an area that is at least one-quarter of the whole area?

My solution:

[Show Solution]

Suppose the sandwich has side length 1. Let $t \in [0,1]$ be location of the first point (measured from a corner). We have three cases to consider:

- If the second point is on the same side (probability $\frac{1}{4}$), the area of the resulting smallest piece will be zero.
- If the second point is on an adjacent side (probability $\frac{1}{2}$), the area of the resulting smallest piece will be $\frac{1}{2}tr$, where $r \in [0,1]$ is the location of the second point on the adjacent side.
- If the second point is on the opposite side (probability $\frac{1}{4}$), the area of the resulting piece will be the smaller of the two resulting quadrilaterals. Specifically, it will be $\min(\frac{t+r}{2},1-\frac{t+r}{2})$, where $r \in [0,1]$ is the location of the second point on the opposite side.

We will solve the general case, which is to find the probability that the smallest slice will have a fraction at least $p$ of the total area. the problem asks for $p=\frac{1}{4}$. Since the total area of the square is $1$, we are effectively asking: “what is the probability that the smallest area is at least $p$?”.

**Case 1.** If we are in the first case (points on the same side), the probability that the area is greater than $p$ is zero, since the area is always zero. So we conclude that:

\[

a_1 = 0

\]

**Case 2.** If we are in the second case (points on an adjacent sides), we want the probability that $\frac{1}{2}tr > p$, where $r$ and $t$ are chosen uniformly at random in $[0,1]$. This amounts to computing:

\begin{align}

a_2 &= \int_0^1 \int_0^1 \mathbf{1}\bigl( \tfrac{1}{2}tr \gt p \bigr)\,\mathrm{d}r\,\mathrm{d}t \\

&= \int_{2p}^1 \int_0^1 \mathbf{1}\bigl(r \gt \tfrac{2p}{t} \bigr)\,\mathrm{d}r\,\mathrm{d}t \\

&= \int_{2p}^1 \left( 1-\frac{2p}{t}\right)\,\mathrm{d}t \\

&= 1-2p+2p\log(2p)

\end{align}Note that we had to change the lower bound of the integral for $t$ because when $t \lt 2p$, we have $\tfrac{2p}{t}\gt 1$, so the integrand is zero. Geometrically, this is the fraction of the region $(t,r)\in[0,1]^2$ where $tr\gt p^2$, sketched below.

**Case 3.** If we are in the third case (points on opposite sides), we perform a similar computation with the area of the quadrilateral:

\begin{align}

a_3 &= \int_0^1 \int_0^1 \mathbf{1}\bigl( \min(\tfrac{t+r}{2},1-\tfrac{t+r}{2}) \gt p \bigr)\,\mathrm{d}r\,\mathrm{d}t \\

&= \int_0^1 \int_0^1 \mathbf{1}\bigl( \tfrac{t+r}{2}\gt p\text{ and } 1-\tfrac{t+r}{2} \gt p \bigr) \,\mathrm{d}r\,\mathrm{d}t \\

&= \int_0^1 \int_0^1 \mathbf{1}\bigl( p \lt \tfrac{t+r}{2} \lt 1-p\bigr) \,\mathrm{d}r\,\mathrm{d}t \\

&= \int_0^1 \int_0^1 \mathbf{1}\bigl( 2p \lt t+r \lt 2-2p\bigr) \,\mathrm{d}r\,\mathrm{d}t \\

&= 1-4p^2

\end{align}A trick to evaluating the above integral is to do it geometrically. Sketching the region for which $2p\lt t+r\lt 2-2p$, we see that it is the square of area $1$ with the two corners cut off, whose area is $(2p)^2$, so the result is $1-4p^2$. See below for an illustration.

Putting everything together, the probability that the area of the smallest piece is at least $p$ is given by sum of the probabilities we already calculated, each weighted by their likelihood of occurrence, so $f(p) = \frac{1}{4}a_1 + \frac{1}{2}a_2 + \frac{1}{4}a_3$. Plugging in the results from above and simplifying, we obtain our final answer:

$\displaystyle

f(p) = \frac{3}{4}-p-p^2+p \log (2 p)

$

Here is what the function looks like:

Naturally, the plot only extends to $p=\frac{1}{2}$ because the area of the smaller piece cannot be more than half of the total area. When $p=\frac{1}{4}$ (what the original problem asked about), we obtain $f(\frac{1}{4}) = \frac{7}{16}-\frac{\log (2)}{4}\approx 0.264213$. So the probability that the smaller piece is at least one quarter of the whole area is about 26.4%.