Skip to content

03. Fastest descent

Release a ball from rest on a frictionless track. What shape reaches a point 1 m horizontally away fastest? A straight line is shortest, but it is not fastest. Johann Bernoulli posed this classical problem in 1696.

ItemDefinition
StatesHorizontal position xx, depth yy, speed vv
ControlTrack angle θ\theta, measured from downward vertical
ObjectiveMinimize arrival time tft_f
PhasesOne phase, 20 nodes, free final time
New conceptsNonlinear dynamics, inequality constraints, a free terminal depth, analytic comparison

Rather than searching directly for a track, choose the ball’s direction at each instant. A steep descent builds speed but makes little horizontal progress; a shallow track advances horizontally but accelerates slowly. The fastest path balances these effects by descending steeply first, then turning horizontally.

Only terminal horizontal position is fixed. Depth is free, so the target is a vertical line. Gravity and horizontal distance are both set to 1.

Depth is positive downward. Angle θ=0\theta=0 points down, and θ=90∘\theta=90^\circ is horizontal.

x˙=vsin⁡θ,y˙=vcos⁡θ,v˙=gcos⁡θ.\dot{x}=v\sin\theta,\qquad\dot{y}=v\cos\theta,\qquad\dot{v}=g\cos\theta.

The first two equations resolve velocity into components. Only the component of gravity along the track accelerates the ball. Since vv˙=gy˙v\dot v=g\dot y, energy is conserved:

12v2=gy,v=2gy.\tfrac12v^2=gy,\qquad v=\sqrt{2gy}. x(0)=y(0)=v(0)=0,x(tf)=l.x(0)=y(0)=v(0)=0,\qquad x(t_f)=l.

Terminal depth and speed are left to optimization.

y≥0,θ≥0,tf≥0.1.y\ge0,\qquad\theta\ge0,\qquad t_f\ge0.1.

The depth inequality excludes the initial node, already fixed by an equality. The angle condition restricts the intended forward-moving solution, and the time bound prevents a degenerate duration. Inequalities are written as nonnegative residuals.

J=tf.J=t_f.
SymbolParameterValue
ggPARAMETERS["g"]1 m/s²
llPARAMETERS["l"]1 m

Use time 0 to 2, horizontal position linear from 0 to 1, depth linear from 0 to 1/31/\sqrt3, and constant direction 30∘30^\circ. Speed starts from zero at all nodes. The guess is not dynamically consistent; optimization corrects it.

The track, with depth increasing downward. Blue interpolation through 20 nodes overlaps the analytic cycloid (black dashed). The gray dotted line joins the same endpoints directly.
The track, with depth increasing downward. Blue interpolation through 20 nodes overlaps the analytic cycloid (black dashed). The gray dotted line joins the same endpoints directly.
Speed and track angle in degrees. Dots are node values, blue curves are interpolants, and black dashed curves are analytic.
Speed and track angle in degrees. Dots are node values, blue curves are interpolants, and black dashed curves are analytic.
A ball on the fastest track (blue) compared with a ball on the straight track (white). The straight-track ball is still traveling when the cycloid reaches the endpoint.
  • Arrival time: 1.772454 s, agreeing to about seven digits with π=\sqrt\pi= 1.772454 s.
  • The straight track takes 2.101 s. The longer cycloid is about 16% faster.
  • Final depth: 0.6365 m, versus 2/π=2/\pi= 0.6366 m; final speed: 1.128 m/s.
  • Direction changes nearly linearly from downward to horizontal: 90.0° at the end.

The fastest descent curve is a cycloid, traced by a point on a circle rolling beneath a horizontal ceiling:

x=a(ϕ−sin⁡ϕ),y=a(1−cos⁡ϕ).x=a(\phi-\sin\phi),\qquad y=a(1-\cos\phi).

It points down at ϕ=0\phi=0 and becomes horizontal at its deepest point, ϕ=π\phi=\pi. An optical analogy explains the shape: Snell’s law for a minimum-time path requires sin⁡θ/v\sin\theta/v to remain constant. Since v=2gyv=\sqrt{2gy}, the required curve has sin⁡θ/y\sin\theta/\sqrt y constant, which gives the cycloid.

Terminal depth is free, so a downward velocity component at arrival contributes nothing to reaching the target line sooner. The best endpoint directs all speed horizontally. Thus aπ=la\pi=l and

y(tf)=2lπ,tf=πlg.y(t_f)=\frac{2l}{\pi},\qquad t_f=\sqrt{\frac{\pi l}{g}}.

For g=l=1g=l=1, tf≈1.7725t_f\approx1.7725. Along the cycloid, θ=ϕ/2\theta=\phi/2 and ϕ\phi grows linearly with time, so the angle history is a straight line.

The dynamics are nonlinear because of trigonometric terms and products of states and controls. The smooth solution nevertheless gives about seven-digit agreement with 20 nodes (convergence plot).

  • Set l to 2: duration becomes 2π≈2.507\sqrt{2\pi}\approx2.507 s and final depth 4/π≈1.2734/\pi\approx1.273 m.
  • Set g to 4: the track is unchanged, but duration halves to about 0.886 s.
  • Reduce 20 nodes to 8 or 7 and compare errors (roughly 10−710^{-7} and 10−510^{-5}). With 5 or 6 nodes, success can be reported despite errors exceeding 0.2 s. Solver success and accuracy are different checks.
Terminal window
uv run python examples/03_brachistochrone.py

View the Python source on GitHub.