Brachistochrone ball race: why the shortest track loses
Five balls start together 0.9 m above the finish and 1.5 m to its left. The straight track is the shortest (1.75 m), yet it comes last, 54 cm behind when the winner crosses the line. The winner is the brachistochrone, a cycloid, 1.89 m long: 0.820 s against 0.985 s. Bend your own track below and see how close you can get.
Can you beat the cycloid?
Drag the four amber handles to shape your white track, then press Race.
| Track | Time | Behind | Length |
|---|
Solid balls rolling without slipping, no friction losses or air drag. "Behind" is how much track a ball still has left when the cycloid ball arrives. Times update live while you drag.
The race, measured
All five tracks join the same two points. We timed each with the same physics model (below) for a solid ball that rolls without slipping and, for comparison, a frictionless sliding bead, the version in the original 1696 puzzle.
| Track (start 0.9 m up, 1.5 m across) | Length | Rolling ball | Sliding bead | Behind at the finish |
|---|---|---|---|---|
| Cycloid (brachistochrone) | 1.89 m | 0.820 s | 0.693 s | winner |
| Circle arc (Galileo's guess) | 1.84 m | 0.834 s | 0.705 s | 4.9 cm |
| Dip below the finish | 2.09 m | 0.848 s | 0.717 s | 10.0 cm |
| Straight drop + turn | 2.21 m | 0.877 s | 0.742 s | 20 cm |
| Straight line (shortest) | 1.75 m | 0.985 s | 0.833 s | 54 cm |


Why the longer track wins
- Speed comes from height, not from the track. With no losses, a ball's speed at any point depends only on how far below the start it is. All five balls cross the finish at the same 3.55 m/s. What differs is how soon they get fast.
- The straight line builds speed slowly. It drops at the same gentle angle the whole way. After 0.4 s its ball is still 75 cm above the finish; the cycloid ball is down to 45 cm. It has dropped 3.1 times as far, so it is moving 1.7 times as fast.
- Too steep wastes distance. The straight drop gets fast soonest, but its ball spends the first 0.36 s falling without moving toward the finish at all, and its track is the longest (2.21 m). It loses by 20 cm.
- Going below the finish doesn't pay either. The dip reaches 19 cm below the finish and reaches the highest speed of any ball, but it is the second-longest track and has to climb back up. 10.0 cm behind.
- The cycloid gets the trade-off exactly right. It starts vertical, curves out, and bottoms out 2 mm below the finish height just before B. Galileo's circle arc is close (4.9 cm behind), but not the best.
Experiment: an optimizer rediscovers the cycloid
Instead of trusting the textbook, we asked a computer. The track is a chain of straight pieces at equal steps across; the height of every joint is free. Starting from the straight line, scipy's L-BFGS-B optimizer changes the heights to make the ball's time as short as possible. It is told nothing about cycloids.

| Pieces | Best time | Slower than the cycloid | Largest gap to the cycloid | …after the first corner | Race-time evaluations |
|---|---|---|---|---|---|
| 4 | 0.8417 s | +2.59% | 76 mm | 43 mm | 56 |
| 8 | 0.8301 s | +1.18% | 47 mm | 32 mm | 176 |
| 16 | 0.8250 s | +0.56% | 29 mm | 21 mm | 816 |
| 32 | 0.8226 s | +0.27% | 18 mm | 14 mm | 5,216 |
| 64 | 0.8215 s | +0.13% | 11 mm | 9 mm | 14,976 |
With more pieces the optimizer's best track gets faster and closer to the cycloid: 64 pieces come within 0.13% of the exact cycloid time (0.8204 s). The largest gap is always at the first joint next to the start, where the true cycloid is vertical and a straight piece can only approximate it. This is the same idea robots use to plan fast motions (trajectory optimization): describe the motion with numbers, simulate it, let an optimizer improve it.
Bonus: the cycloid's other trick
Release balls from different heights on the same cycloid and they all reach the bottom at the same moment. Christiaan Huygens described this "tautochrone" property in 1673 and used it in pendulum clocks [4]. Our model agrees to four decimals, for every start height, and matches the formula π √(r / (5/7 g)) = 0.7970 s:
| Start height above the bottom | Time to the bottom |
|---|---|
| 90.2 cm | 0.7970 s |
| 67.6 cm | 0.7970 s |
| 45.1 cm | 0.7970 s |
| 22.5 cm | 0.7970 s |
| 4.5 cm | 0.7970 s |
How the simulation works
Each track is a chain of short straight pieces (2,000 for the curves above). On a straight piece the slope is constant, so the acceleration is constant too, and the time to cross it is exact: t = 2 · length / (speed at the start + speed at the end). The speed at any height comes from energy: v = √(2 · k · g · drop), with k = 5/7 for a solid ball rolling without slipping (rolling-motion equation a = g sin θ / (1 + I/mr²) with I = 2/5 m r² [3]) and k = 1 for a sliding bead. Two checks against closed-form answers:
- Straight line: formula 0.9851 s, our model 0.9851 s.
- Cycloid (r = 0.451 m, θ = 3.234 rad, t = θ √(r / (k g))): formula 0.8204 s, our model 0.8204 s.
The browser game uses a JavaScript port of the same code. For the five tracks above the two versions agree to 2e-15 s.
Get the Python code (free)
Race any start and finish you like (--height, --width), switch to a sliding bead (--slide), make the slow-motion gif, run the optimizer with your own number of pieces, and check the tautochrone. About 350 lines of Python: numpy + scipy + matplotlib.
Download the brachistochrone code
Enter your email and we'll send you a confirmation email: click it and your download starts. We'll also email you when we publish a new robot experiment (about once a week). Unsubscribe anytime.
Unzip, then follow README.md.
We ran it from a fresh virtual environment (Python 3.13.17, numpy 2.5.4, scipy 1.18.1, matplotlib 3.11.2, pillow 13.0.0). This is the real output; the whole run took a few seconds:
$ python -m venv venv && source venv/bin/activate
$ pip install -r requirements.txt
$ python race.py --gif
Start 0.90 m above the finish, 1.50 m across. Solid ball rolling without slipping (k = 0.7143).
Track length time behind at finish
Cycloid (brachistochrone) 1.887 m 0.820 s 0.0 cm
Circle arc (Galileo's guess) 1.837 m 0.834 s 4.9 cm
Dip below the finish 2.089 m 0.848 s 10.0 cm
Straight drop + turn 2.207 m 0.877 s 20.2 cm
Straight line (shortest) 1.749 m 0.985 s 53.6 cm
Cycloid check: closed form 0.8204 s, polyline 0.8204 s (r = 0.451 m, theta = 3.234 rad)
wrote race.png
wrote race.gif
$ python optimize.py
Cycloid (exact): 0.8204 s. Straight line: 0.9851 s.
pieces best time vs cycloid max gap to cycloid evaluations seconds
4 0.8417 s +2.59 % 76.2 mm 56 0.0
8 0.8301 s +1.18 % 46.6 mm 176 0.0
16 0.8250 s +0.56 % 28.6 mm 816 0.1
32 0.8226 s +0.27 % 17.6 mm 5216 0.4
64 0.8215 s +0.13 % 11.0 mm 14976 1.4
wrote optimize.png
$ python tautochrone.py
Cycloid r = 0.451 m. Theory for every start: 0.7970 s
start height above bottom time to bottom
90.2 cm 0.7970 s
67.6 cm 0.7970 s
45.1 cm 0.7970 s
22.5 cm 0.7970 s
4.5 cm 0.7970 s
And with --slide (a frictionless bead). Every time is shorter by the same factor √(7/5) = 1.183, so the order and the gaps don't change:
$ python race.py --slide Start 0.90 m above the finish, 1.50 m across. Sliding bead, no friction (k = 1.0000). Track length time behind at finish Cycloid (brachistochrone) 1.887 m 0.693 s 0.0 cm Circle arc (Galileo's guess) 1.837 m 0.705 s 4.9 cm Dip below the finish 2.089 m 0.717 s 10.0 cm Straight drop + turn 2.207 m 0.742 s 20.2 cm Straight line (shortest) 1.749 m 0.833 s 53.6 cm Cycloid check: closed form 0.6934 s, polyline 0.6934 s (r = 0.451 m, theta = 3.234 rad) wrote race.png
Limits of this simulation
- No rolling resistance, no air drag, no slipping. Real balls on real rails lose some energy, so real times are a little longer.
- The ball is treated as a point that never leaves the track. On a real vertical start, or a tight corner like the drop's, a ball can slip, bounce or jump the rail.
- The ball's own size is ignored; it matters on tight curves.
Build a robot, not just a race track
Kit 1 is our ESP32 obstacle-avoiding car kit, with a simulation twin of the same car. Its avoidance code was tested in 40 simulated rooms before we built it: see that experiment.
More experiments you can run: race 4 robot vacuums in your own room and CMA-ES vs reinforcement learning on a walking robot.
FAQ
What is the brachistochrone?
The curve of fastest descent: the track between two points, one lower than the other, on which a ball (or a bead) rolling under gravity alone gets there in the least time. Johann Bernoulli posed it as a challenge in Acta Eruditorum in June 1696; the answer is a cycloid, the curve traced by a point on a rolling wheel.
Why is the straight line not the fastest path?
Speed comes from height. A track that drops steeply at the start makes the ball fast early and keeps it fast for the rest of the way, which more than pays for the longer distance. In our race the straight line was the shortest track (1.75 m) and the slowest (0.985 s); the cycloid was 0.14 m longer and won in 0.820 s.
Was Galileo right that a circle is fastest?
Close, but no. In 1638 Galileo argued that an arc of a circle beats the straight line, which is true, and suggested it was the fastest path, which is not. On our track his circle arc finished 4.9 cm behind the cycloid (0.834 s vs 0.820 s).
Does it matter if the ball rolls or slides?
Not for who wins. A solid ball rolling without slipping speeds up at 5/7 of a frictionless slider's rate, so every time gets longer by the same factor (1.183) and the order and the gaps at the finish stay the same. The cycloid wins either way: 0.693 s sliding, 0.820 s rolling.
Can a computer find the fastest track on its own?
Yes. We gave an optimizer a track made of straight pieces, started it from the straight line and let it minimize the race time. With 64 pieces it found a track only 0.13% slower than the exact cycloid, lying on the cycloid to within 9 mm everywhere except the first corner. The code is in the free download.
Sources
- J. J. O'Connor and E. F. Robertson, The brachistochrone problem, MacTutor History of Mathematics, University of St Andrews (Johann Bernoulli's challenge, Acta Eruditorum, June 1696; the solutions of Newton, Jacob Bernoulli, Leibniz and l'Hôpital; Galileo's circle-arc argument of 1638).
- Galileo Galilei, Dialogues Concerning Two New Sciences (1638), English translation by H. Crew and A. de Salvio, Macmillan, 1914.
- OpenStax, University Physics Volume 1, 11.1 Rolling Motion, equation 11.4 (acceleration of an object rolling without slipping down an incline).
- L. R. Evangelista and F. Mainardi, The Tautochrone of Huygens and Abel: From Constructive Geometry to Fractional Calculus, arXiv:2509.05308 (Huygens, Horologium Oscillatorium, 1673).
- Simulation, optimizer, measurements and images: TinyBot Forge, October 2026. All numbers on this page come from the code in the free download (analysis script available on request).
Need a physics simulation for your class or product?
We build physics-simulated robot videos and Python simulations to order.
Email us