Given two points, along what path can you slide the fastest? See if you can pick the fastest path in this simulation of the famous Brachistochrone problem.
Click near one of the paths to choose the fastest one and begin the simulation. You can also change parameters such as gravity, damping, etc.
The math behind the simulation is shown below. Also available: source code, documentation and how to customize.
Given two points A and B in a vertical plane, what is the curve traced out by a point acted on only by gravity, which starts at A and reaches B in the shortest time?
This was the challenge problem that Johann Bernoulli set to the thinkers of his time in 1696. Calculus had only just been invented, yet the solution to this problem uses a fairly advanced technique called the Calculus of Variations.
You are perhaps familiar with the use of calculus to figure out things like area under a given curve. Using Calculus of Variations we can find the curve which maximizes the area enclosed by a curve of a given length (a circle). Or, in the case of the Brachistochrone problem, we find the curve which minimizes the time it takes to slide down between two given points. The unknown here is an entire function - the curve - not just a single number like area or time. We wind up thinking about infinitesmal variations of a function, similarly to how in calculus we think about the infinitesmal variation of a single variable.
The name brachistochrone comes from two Greek words, brachistos meaning shortest, and chronos meaning time. The brachistochrone curve can be generated by tracking a point on the rim of a wheel as it rolls on the ground. The general equation for the brachistochrone is given parametrically as
x=a(θ−sinθ)+x0
y=−a(1−cosθ)+y0
where a is the radius of the wheel, and the wheel rolls along the horizontal line y=y0.
This simulation uses software techniques identical to those described for the Simple Roller Coaster, please see that page for more information on the physics and on how the simulation is done.
The points chosen for the simulation are A=(0,0) and B=(3,−2). The equations for the paths in the simulation are
Here are some videos about the Brachistochrone.
This section shows how to find the solution to the Brachistochrone problem using Calculus of Variations. (In his original solution, Bernoulli used a different method from the study of optics). We generally follow the exposition given in Calculus Of Variations by Robert Weinstock.
Let the minimal-time-of-descent path be given by the function y(x) and let the starting and ending points have the coordinates (x1,y1) and (x2,y2). Therefore we have that y(x1)=y1 and y(x2)=y2. Let ds be the infinitesimal arc length along the path, so we can write the velocity as v=ds/dt. In calculus, we study how to find the length of a curve, and so we know (REFERENCE?) that ds=√1+y′2dx where y′=dydx. Rearrange the velocity equation to dt=ds/v, and integrate it to get the time it takes to slide between the points:
∫x2x1dt=∫x2x1√1+y′2vdx
We can get an expression for the velocity by looking at the energy. Let the initial velocity at the first point be v1. Without friction, the energy should be constant and is given by the sum of kinetic and potential energy.
E=12mv21+mgy1=12mv2+mgy
v=√v21+2g(y1−y)
To simplify our analysis, let's assume that the ball starts at rest so that v1=0. (Otherwise, we could define a constant for y1+v21/2g which would let us get the equation into the same form as shown below). Equation (1) then becomes
∫x2x1dt=1√2g∫x2x1√1+y′2√y1−ydx
Our job is to find the function y(x) which minimizes this integral and passes through the two points.
The Euler-Lagrange equation is a differential equation that y(x) must satisfy in order to minimize (or possibly maximize) an integral of the form
I=∫x2x1f(x,y,y′)dx
where also y(x) must pass through the two fixed end points y(x1)=y1 and y(x2)=y2. Through reasoning about families of curves that include the minimizing curve y(x), (REFERENCE?) we can get the Euler-Lagrange equation:
∂f∂y−ddx(∂f∂y′)=0
We next use the following identity (easily verified by using rules for partial and total differentiation REFERENCE?),
ddx(y′∂f∂y′−f)=−y′[∂f∂y−ddx(∂f∂y′)]−∂f∂x
Since we know that y(x) satisfies the Euler-Lagrange equation (5), we see that the first term on the right hand side must be zero. If it happens that f(y,y′,x) is independent of x then the second term will also be zero so that
ddx(y′∂f∂y′−f)=0
which we can immediately integrate to find
y′∂f∂y′−f=C1
where C1 is a constant. This special case, where f is independent of x, gives us the first-order differential equation (8) involving only y,y′ which is easier to solve than the Euler-Lagrange equation (5).
Since the integrand in equation (3) is independent of x, we can use the results of the previous section to find y(x) that minimizes the integral (3). Let f(y,y′,x) be given by
f(y,y′,x)=√1+y′2√y1−y
Equation (8) then becomes
y′2√(y1−y)(1+y′2)−√1+y′2√y1−y=C1
Next we solve the above equation for y′.
−1√(y1−y)(1+y′2)=C1
1(y1−y)C21=1+y′2
y′=√1(y1−y)C21−1=√1/C21−(y1−y)y1−y
Take the reciprocal of both sides
dxdy=√y1−y1/C21−(y1−y)
Define the constant a=12C21 and integrate (14) to get
x=∫√y1−ydy√2a−(y1−y)
Solving this integral will give us the minimal-time-of-descent path y(x) we are seeking. Use a change of variables
y1−y=2asin2θ2
which also implies
dy=−2asinθ2cosθ2dθ
Now equation (15) becomes
x=∫√2asin2θ2(−2asinθ2cosθ2)dθ√2a−2asin2θ2=∫−2asin2θ2cosθ2dθ√1−sin2θ2
which simplifies to
x=∫−2asin2θ2dθ
Using the trig identity 2sin2θ2=1−cosθ, we can solve this integral getting
x=−a(θ−sinθ)+C2
where C2 is a constant of integration. Now we have the equation of the path in terms of the parameter θ from equations (16) and (20). We can rewrite equation (16) as
y=−a(1−cosθ)+y1
When θ=0 we find that x=C2 and y=y1, so this corresponds to the first point and we conclude that C2=x1. To find a we need to solve the simultaneous equations (22) and (23) for a,θ.
x2=−a(θ−sinθ)+x1
y2=−a(1−cosθ)+y1
For the points used in the simulation, which were (0,0) and (3, -2), we can use an equation solver (such as Mathematica's FindRoot function) to find a=1.00133,θ=−3.06878. As a final cosmetic transformation, so that the value of θ is increasing instead of decreasing as we go from the first point to the second, we can substitute −θ for θ and get
x=a(θ−sinθ)+x1
y=−a(1−cosθ)+y1
with a=1.00133 and θ increasing from 0 to 3.06878.