previous next

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.

The Brachistochrone Problem

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(\theta - \sin \theta) + x_0$$

$$y = -a(1 - \cos \theta) + y_0$$

where a is the radius of the wheel, and the wheel rolls along the horizontal line \( y = y_0 \).

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.

Setting up the Math for the Brachistochrone Problem

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 \( (x_1, y_1) \) and \( (x_2, y_2) \). Therefore we have that \( y(x_1) = y_1 \) and \( y(x_2) = y_2 \). 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 = \sqrt{1 + y'^2} dx \) where \( y' = \frac{dy}{dx} \). Rearrange the velocity equation to \( dt = ds/v \), and integrate it to get the time it takes to slide between the points:

$$ \int_{x_1}^{x_2} dt = \int_{x_1}^{x_2} \frac{\sqrt{1 + y'^2}}{v} dx \tag{1}$$

We can get an expression for the velocity by looking at the energy. Let the initial velocity at the first point be \( v_1 \). Without friction, the energy should be constant and is given by the sum of kinetic and potential energy.

$$E = \frac{1}{2} m v_1^2 + m g y_1 = \frac{1}{2} m v^2 + m g y$$

$$ v = \sqrt{v_1^2 + 2 g (y_1 - y)} \tag{2}$$

To simplify our analysis, let's assume that the ball starts at rest so that \( v_1 = 0 \). (Otherwise, we could define a constant for \( y_1 + v_1^2/2g \) which would let us get the equation into the same form as shown below). Equation (1) then becomes

$$ \int_{x_1}^{x_2} dt = \frac{1}{\sqrt{2 g}} \int_{x_1}^{x_2} \frac{\sqrt{1 + y'^2}}{\sqrt{y_1 - y}} dx \tag{3}$$

Our job is to find the function \( y(x) \) which minimizes this integral and passes through the two points.

The Euler-Lagrange Equation

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 = \int_{x_1}^{x_2} f(x, y, y') dx \tag{4}$$

where also \( y(x) \) must pass through the two fixed end points \( y(x_1) = y_1 \) and \( y(x_2) = y_2 \). Through reasoning about families of curves that include the minimizing curve \( y(x) \), (REFERENCE?) we can get the Euler-Lagrange equation:

$$ \frac{\partial f}{\partial y} - \frac{d}{dx} \left( \frac{\partial f}{\partial y'} \right) = 0 \tag{5}$$

We next use the following identity (easily verified by using rules for partial and total differentiation REFERENCE?),

$$ \frac{d}{dx} \left( y' \frac{\partial f}{\partial y'} - f \right) = -y' \left[ \frac{\partial f}{\partial y} - \frac{d}{dx} \left( \frac{\partial f}{\partial y'} \right) \right] -\frac{\partial f}{\partial x} \tag{6}$$

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

$$ \frac{d}{dx} \left( y' \frac{\partial f}{\partial y'} - f \right) = 0 \tag{7}$$

which we can immediately integrate to find

$$ y' \frac{\partial f}{\partial y'} - f = C_1 \tag{8}$$

where \( C_1 \) 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).

Solving for the Brachistochrone

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) = \frac{\sqrt{1 + y'^2}}{\sqrt{y_1 - y}} \tag{9}$$

Equation (8) then becomes

$$ \frac{y'^2}{ \sqrt{(y_1 - y)(1 + y'^2)}} - \frac{\sqrt{1 + y'^2}}{\sqrt{y_1 - y}} = C_1 \tag{10}$$

Next we solve the above equation for \( y' \).

$$ \frac{-1}{ \sqrt{(y_1 - y)(1 + y'^2)}} = C_1 \tag{11}$$

$$ \frac{1}{ (y_1 - y)C_1^2} = 1 + y'^2 \tag{12}$$

$$ y' = \sqrt{\frac{1}{ (y_1 - y)C_1^2} - 1} = \sqrt{\frac{1/C_1^2 - (y_1 -y)}{ y_1 - y}} \tag{13}$$

Take the reciprocal of both sides

$$ \frac{dx}{dy} = \sqrt{\frac{y_1 - y}{1/C_1^2 - (y_1 - y)}} \tag{14}$$

Define the constant \( a = \frac{1}{2 C_1^2} \) and integrate (14) to get

$$ x = \int \frac{\sqrt{y_1 - y} \; dy}{\sqrt{2a - (y_1 - y)}} \tag{15}$$

Solving this integral will give us the minimal-time-of-descent path \( y(x) \) we are seeking. Use a change of variables

$$ y_1 - y = 2a \sin^2 \frac{\theta}{2} \tag{16}$$

which also implies

$$ dy = -2a \sin \frac{\theta}{2} \cos \frac{\theta}{2} d\theta \tag{17}$$

Now equation (15) becomes

$$ x = \int \frac{\sqrt{2a \sin^2 \frac{\theta}{2}} \; (-2a \sin \frac{\theta}{2} \cos \frac{\theta}{2}) d\theta}{\sqrt{2a - 2a \sin^2 \frac{\theta}{2}}} = \int \frac{-2a \sin^2 \frac{\theta}{2} \cos \frac{\theta}{2} d\theta}{\sqrt{1 - \sin^2 \frac{\theta}{2}}} \tag{18}$$

which simplifies to

$$ x = \int -2a \sin^2 \frac{\theta}{2} d\theta \tag{19}$$

Using the trig identity \( 2 \sin^2 \frac{\theta}{2} = 1 - \cos \theta \), we can solve this integral getting

$$ x = -a(\theta - \sin \theta) + C_2 \tag{20}$$

where \( C_2 \) is a constant of integration. Now we have the equation of the path in terms of the parameter \( \theta \) from equations (16) and (20). We can rewrite equation (16) as

$$ y = -a (1 - \cos \theta) + y_1 \tag{21}$$

When \( \theta = 0 \) we find that \( x = C_2 \) and \( y = y_1 \), so this corresponds to the first point and we conclude that \( C_2 = x_1 \). To find \( a \) we need to solve the simultaneous equations (22) and (23) for \( a, \theta \).

$$ x_2 = -a(\theta - \sin \theta) + x_1 \tag{22}$$

$$ y_2 = -a (1 - \cos \theta) + y_1 \tag{23}$$

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, \theta=-3.06878 \). As a final cosmetic transformation, so that the value of \( \theta \) is increasing instead of decreasing as we go from the first point to the second, we can substitute \( -\theta \) for \( \theta \) and get

$$ x = a(\theta - \sin \theta) + x_1 \tag{24}$$

$$ y = -a (1 - \cos \theta) + y_1 \tag{25}$$

with \( a = 1.00133 \) and \( \theta \) increasing from 0 to 3.06878.

previous next Valid HTML 4.01