Imagine two points, A and B, separated by some distance but at the same height (gravitational potential). If a ball is released (with zero initial velocity) at point A, in the presence of gravity it is possible to make a path between points A and B such that the ball eventually arrives at point B and then oscillates between A and B. In this scenario, different paths lead to different travel times or oscillation periods, as shown in this physics demonstration video. The ball will travel faster if it gains more kinetic energy from accelerating downwards, thus favoring a 'deep' path that allows the ball to travel downwards. However traveling downwards does not contribute to traveling from A to B (which are at the same height) so the path cannot be too 'deep'. This means there must be some fastest path between A and B, such that the ball released at A reaches B in the least amount of time by this path compared to other paths. What is this path?

It was quickly evident that my mathematics isn't quite good enough to solve this analytically. But I have a computer which can brute force the way to the solution! Such a solution doesn't necessarily prove that the fastest path is unique, but if a consistent path is found with a local optimization algorithm regardless of starting conditions then the uniqueness is a safe conclusion.

I assume that instead of a ball there is a point particle (so no angular momentum), and simulate travel along a path as the particle having a scalar velocity magnitude which is then directed along the vector tangent to the path where the particle is located. This assumption makes it possible for the particle to travel along right corners, but this isn't an issue since the particle itself doesn't have a size. The particle is accelerated along its direction of travel by the amount `sin( theta ) * g / m`

where theta is the path's angle with the horizontal at the particle's location. This relation arises from the normal force that keeps the particle on the path counteracting the remainder of the gravitational acceleration. In each path increment the particle travels according to `x = a * t^2 + v * t + x0`

along its travel direction.

The code starts with an initial guess for a path, and then moves each point on the path up and down and tracks the local change in particle travel time. If moving one point upwards leads to a longer travel time but moving it downwards leads to a shorter travel time, the point will be moved downwards. It would be a lot of work to consider all such combinations at once, so I consider the effect of each point individually, which makes this a local optimization algorithm. The code is available here.

*The numerical algorithm approaches the fastest path over 2000 iterations. The travel time is reduced from the 0.878 s for the initial guess to 0.804 s for the found solution. The calculated velocity of the particle at the end of the curve is also indicated, and remains at 0.0000 throughout the simulation reflective of the implicit energy conservation with this algorithm.*

A consistent fastest path is approached regardless of the starting point, which suggests that there is indeed one fastest path. Does the resulting path have a mathematical representation? I tried a few different curves, including parabolic, catenary, semicircle. The only good match was a trochoid, the path traced by a point on a circle rolling under the straight line from A to B.

*Comparison of the numerical solution and the trochoid curve.*

While researching the different curves, it turns out the trochoid is indeed the analytical solution to the brachistocrone problem! An excel file with the point coordinates and the analytical formula for the trochoid curve can be downloaded here. A code to compare different paths can be downloaded here (this code does not animate the path perfectly as it uses linear interpolation for time between calculated points whereas really it should be quadratic; however on the whole the timing is correct).

*Comparison of the motion of particles along different paths, with the trochoid curve finishing first.*

Having the shape profile, it was tempting to 3D print a track in this shape that would allow observing the fastest path in a real experiment with a steel ball. For this it is necessary to offset the track such that the ball's center (rather than its edges) travels along the trochoid curve. To have a reference point I 3D printed a second track with a hyperbolic cosine curve, which has a similar depth and appearance. The simulation claims the ratio of travel times from A to B (cosh time / trochoid time) is only 1.027, so it will be difficult to compare but hopefully over many oscillations the trochoid will be seen to come out ahead. It turned out the plastic track was too rough and incurred friction losses so over multiple oscillations the cosh curve came out ahead (since at low oscillation amplitude the cosh has a higher frequency than the flatter trochoid). But keeping a close eye on the initial release of two balls simultaneously shows the trochoid ball consistently getting past the halfway point before the cosh ball.

*The 3D printed optimal path and a similar-looking catenary curve for comparison.*