Two pegs. Draw any track you like between them and a sled slides down it with no friction and no push. The only question is how long it takes, and the answer is almost never the one your hand draws first.
The hinge is a single ratio
Measuring y downward from the release point, the fastest curve is a cycloid:
x = a(θ − sin θ) y = a(1 − cos θ)
An endpoint (run, drop) pins the sweep Θ through
run/drop = (Θ − sin Θ)/(1 − cos Θ), which is strictly increasing on (0, 2π)
and so has exactly one solution. Everything on screen follows from that one
number.
A cycloid bottoms out at θ = π. So the track goes under the finish exactly
when Θ > π — and Θ = π gives run/drop = π/2. That is the whole headline,
and it is not an empirical observation about ramps, it is a line of algebra.
The Dead Flat stage is that ratio exactly: sweep reads 1.000π, the finish
sits at the bottom of the curve, and the arrival angle reads 0° because the
sled gets there travelling horizontally. Free mode draws the π/2 line on
the ground and lets you drag the finish flag across it; the sweep readout goes
teal the moment it passes π.
What the dive is worth
Below the hinge, nothing — there is no dive to find. Above it the gap opens fast, because a straight line cannot buy speed early and the cycloid is entirely a scheme for buying speed early:
| run / drop | fastest track dives | straight line costs | circle costs |
|---|---|---|---|
| 0.25 (a cliff) | — | +0.76% | +0.15% |
| 1 (square) | — | +9.5% | +1.56% |
| π/2 (the hinge) | 0 (it just touches) | +18.5% | +2.54% |
| 4 | 0.504 × the drop | +53.7% | +4.27% |
| 8 | 1.694 × the drop | +97.6% | +4.84% |
The Cliff stage is in that table for a reason. Everybody wants a mechanic to reward the clever move everywhere; this one doesn’t. At a run of a quarter the drop, the straight line is eight tenths of a percent off optimal and the difference between a brilliant track and a lazy one is four milliseconds. The honest reading is that the dive is worth something precisely in proportion to how far sideways you have to go.
Two ways to be wrong, and they are not symmetric
Diving too deep is cheap. Not diving is not. A plain y ∝ √x parabola — a very
natural thing to draw — is within 0.2% of optimal on the square and
13.4% off at 4:1, because its shape doesn’t change with the ratio and the
right answer’s does. Saving the height for the end, y ∝ x^1.7, is the only
way to do dramatically worse than the straight line: at 4:1 it is 123% slower
than the chord and 242% off the best. You can draw all three in about ten
seconds each and watch the chips.
Galileo’s circle
Galileo’s 1638 answer to a related question was an arc of a circle. Pin a circle to leave the start vertically — the one thing it and the cycloid agree about — and it is a defensible wrong answer: never more than 4.84% off anywhere from 1:4 to 8:1, and under 1.6% on a square. That is why it took until Johann Bernoulli’s 1696 challenge, 58 years later, for anyone to be bothered.
Press Arc on the Long Haul stage and look at how it is wrong, though. The circle dives to 1.125 drops below the finish where the cycloid stops at 0.504 — more than twice as deep, a visibly different curve — and pays 4.3% for it. The cost surface around the optimum is extremely flat, which is the real lesson about optimal paths and the reason a hand-drawn track can land within a percent while looking nothing like the answer.
The same curve, twice
Same Time is the other half of the cycloid. Release a sled anywhere on the
π/2 arc and it reaches the bottom in π√(a/g) — independent of where it
started. Three sleds, three heights, one track, and they arrive together: that
is the tautochrone, and it is the same curve, which is not obvious and took
Huygens to notice in 1659.
The stage puts three release markers on whatever you have drawn and shows the spread. Freehand gets you a few hundred milliseconds apart. Press Trace it and the spread reads 1 ms — and in the module, over five release points on a 2000-segment copy of the arc, 61 microseconds, which is discretisation and not physics. It is the only stage here you cannot win by being roughly right.
The clock is not a simulation
Worth saying plainly, because it changes what the demo is. A drawn track is a
polyline, a polyline segment is a ramp of constant slope, and a ramp of constant
slope has constant acceleration. So for a segment of length ds entered at v₁
and left at v₂ = √(v₁² + 2g·Δy):
t = (v₂ − v₁)/a = 2·ds / (v₁ + v₂)
exactly. No integrator, no timestep, no error to tune. The whole-track time is a sum over 192 segments, which costs nothing, which is why the readout updates continuously while you draw rather than when you release. Against the analytic cycloid time the 192-segment version is 0.0005% slow; the animation then reads positions back out of the same segment table, so the sled you watch and the number you are graded on are the same object.
The two failure modes are physics rather than bookkeeping. Draw the track above the release height and there is no energy to get there — it is painted red, and the sled stops and the readout says where. Draw it flat out of the gate and it never starts, because it has no speed yet and nothing to gain any with.
What is on screen
Metres, with a uniform scale in both axes — a ramp problem drawn with a squashed axis is a lie about every angle in it, which costs the Cliff stage a lot of empty width and is worth it.
The white line is your track and the hill is cut away beneath it. Grey dashed is
the straight chord, always shown. Teal is the fastest possible curve
(Fastest, or g), with a bracket measuring the dive when there is one. Amber
is the circle (Arc, or a). The dotted line across the top is the release
height; nothing above it is reachable. The four chips are the four times, live.
Drag to draw — it is a height field, so sweeping back over a stretch redraws it
rather than adding a loop. space re-runs, t traces the answer onto your
track, c resets to the chord, 1–6 pick stages, and the 1× button steps
down to ½× and ¼× when you want to watch the overtake instead of the result.
Things worth knowing if you reuse this
src/dip.mjshas no renderer and no DOM.geometry(drop, run)returns the cycloid, the chord and the circle with their analytic times;prepare(points, from)costs an arbitrary polyline;at(run, t)gives the position. Depths are positive downward throughout, which removes every sign error in the energy equation at the cost of one surprise in the renderer.facts()recomputes every number quoted above, including the tautochrone spread, rather than trusting this file.- The height field pins
x₀andx₁, so the first segment always descends and a track can’t be made unstartable by a stray pixel at the gate. Everything from index 2 on is yours, including above the release line. - The model is a point mass. A real sled or a rolling ball puts some of the energy into rotation — a solid sphere keeps only 5/7 of it — which scales every time here by √(7/5) and changes not one of the arguments, since the factor is the same for every curve. Friction would change the arguments, and is the honest reason a real ski line is not a cycloid.
- No obstacles, no floor. A constrained brachistochrone is a genuinely different problem and I would rather ship the clean one than a stage whose “optimal” number I could only get numerically.




