# Square wheels on a round(ish) floor

The ever-challenging Adam Atkinson, having noticed my attention to the “impossible” New Zealand exams, pointed me at a tricky question from an Italian exam which asked students to verify that, to give a smooth ride on a bike with square wheels (of side length 2), the height of the floor would need to be of the form $h(x)=\sqrt{2}-\frac{e^x + e^{-x}}{2}$.

I quite like that as a puzzle - it’s a nice mix of geometry and calculus, but I’d be surprised to see it as an A-level question, at least without a good deal of scaffolding.

Below the line be spoilers.

### Verification

Verifying that it works isn’t too difficult. For a smooth ride, the height of the centre of the square must stay constant, and the point of contact must be directly below the centre.

Suppose the square rests at a point on the surface with $x$-coordinate, uh, $x$. The gradient there is $h’(x)=-\frac{e^x - e^{-x}}{2}$, which is $\tan(\theta)$, with $\theta$ being the angle between the bottom of the square and the horizontal.

Let $C$ be the centre of the square, $T$ the point of contact and $P$ the point on the base of the square such that $CPT$ is a right angle. Then, angle $TCP=\theta$ and length $CP=1$.

The distance $PT$ is then $\sec(\theta)$, or $\sqrt{1+\tan^2(\theta)}$.

Pretending we haven’t spotted the hyperbolic function, we can square $\tan(\theta)$ to get $\frac{e^{2x}- 2 + e^{-2x}}{4}$, add 1 to get $\frac{e^{2x}+ 2 + e^{-2x}}{4} = \frac{\br{e^{x}+ e^{-x}}^2}{4}$, and square root to get $PT = \frac{e^x + e^{-x}}{2}$.

Adding this on to $h(x)$ gives $h(x)+\sec(\theta)=\sqrt{2}$, and the centre of the wheel remains at a constant height as the wheel moves.

But wait… we could have derived that, and it would have been *way* more satisfying.

### Deriving

The derivation is roughly the same thing, but backwards (with a *really* nice bit of trig towards the end).

Start with the triangle $CPT$ as before, and define $h(x)$ to be the function that keeps $PT + h(x) = \sqrt{2}$ (the height of the centre when the wheel is standing diagonally on its corner).

Now, as before, let $\theta$ be the angle $TCP$; the bottom of the square forms an angle of $\theta$ with the horizontal, which means:

- $h(x) = \sqrt{2} - \sec(\theta)$
- $h’(x) = \tan(\theta)$

Differentiating $h(x)$ gives $h’(x) = - \sec(\theta)\tan(\theta) \diff {\theta}{x}$, which means $\diff \theta x = - \cos(\theta)$.

That’s a differential equation we can solve.

$\int \sec(\theta) \d \theta = \int - \d x$

$\ln \left| \tan(\theta)+ \sec(\theta) \right| = -x + C$

Knowing that $\theta = 0$ when $x=0$ means $C=0$.

$\left| \tan(\theta) + \sec(\theta) \right| = e^{-x}$.

For $-\piby 4 < \theta < \piby 4$, which is the interval we’re working on, the thing inside the absolute values is positive, so we can remove them.

$\tan(\theta) + \sec(\theta) = e^{-x}$

We can rewrite the left-hand side as $\frac{\sin(\theta)+1}{\cos(\theta)}$, so we have $\frac{\sin(\theta)+1}{\cos(\theta)} = e^{-x}$ and (taking reciprocals) $\frac{\cos(\theta)}{\sin(\theta)+1} = e^x$.

Adding these together gives $ \frac{\br{\sin(\theta)+1}^2 + \cos^2 (\theta)}{\cos(\theta)\br{1+\sin(\theta)}} = e^x + e^{-x}$

Expanding and simplifying the top gives $\frac{ \sin^2(\theta) + 2 \sin(\theta) + 1 + \cos^2(\theta)}{\cos(\theta)\br{1 + \sin(\theta)}}$

But wait! That’s $\frac{2\br{1+\sin(\theta)}}{\cos(\theta)\br{1+\sin(\theta)}}$, or simply $2\sec(\theta)$!

Therefore, $\sec(\theta)= \frac{e^x + e^{-x}}{2}$, and, going all the way back, $h(x) = \sqrt{2} - \frac{e^x + e^{-x}}{2}$.

I reckon that deserves a $\blacksquare$.