# Chapter 3.

Calculus of Variations

(Most of the material presented in this chapter is taken from Thornton and Marion, Chap. 6) In preparation for our study of Lagrangian and Hamiltonian dynamics in later chapters, we must first consider the principles and techniques of the calculus of variations.

**3.1 Statement of the Problem
**

Let us first define an integral J such that

x2 x1

J=

"

f { y ( x ) , y! ( x ); x} dx

(3.1)

where f is a function of the dependent variable y ( x ) and its derivative y! ( x ) " dy dx (the semicolon in f separates them from the independent variable x ). The problem consists of imposing virtual variations on y ( x ) and finding which variation brings the functional integral J to an extremum. The limits of integration are kept fixed during this process. In order to keep track of the different versions of y ( x ) we will extend its definition to include a new parameter ! such that

y (! , x ) = y ( x ) + !" ( x )

(3.2)

where ! ( x ) is some function that has a continuous first derivative, and vanishes at the integration limits. We therefore impose the condition that ! ( x1 ) = ! ( x2 ) = 0 . We further define the function corresponding to ! = 0 , y ( 0, x ) = y ( x ) , as the one that yields the extremum for J . The situation is shown in Figure 3.1. For example, if y ( x ) brings J to a minimum, then any other function must make J increase. With the introduction of the parameter ! in equation (3.2), the integral also becomes a function of !

J (! ) =

#

x2 x1

f { y (! , x ) , y" (! , x ); x} dx

(3.3)

The condition necessary for equation (3.3) to be an extremum is

!J !"

for all function ! ( x ) .

=0

" =0

(3.4)

40

We first extend y ( x ) to include ! and ! ( x )
y (! . Show that the extremum of J (! ) happens when ! = 0 .
2
and find the functional J (! ) with integration limits 0 and 2! .6)
= 2" + ! 2" .Figure 3.1 – The function y ( x ) is the path that makes the functional J an extremum.
The neighboring functions y ( x ) + !" ( x ) vanish at the integration limits and may be close to y ( x ) .
41
. x ) = x + ! sin ( x ) .
(3.
We see that J (! ) is always greater than J ( 0 ) . but they are not extrema.5)
We then calculate
J (! ) = = =
# (1 + ! cos ( x ))
2" 0 2" 0
2
dx
2
# (1 + 2! cos ( x ) + ! #
2" 0
cos 2 ( x ) dx
)
$ !2 ' !2 & 1 + 2 + 2! cos ( x ) + 2 cos ( 2x )) dx % (
(3. It can also be verified that
!J !" " = 0 = 0 . Add to y ( x ) the function ! ( x ) = sin ( x ) .
Example
Consider the function f = ( y! ) . with y = x . Solution.

x ) = y ( x ) + !" ( x ) .11)
42
.e. That is
!f d $ !f ' " & =0 ( !y dx % !y# )
(3. ' *
(3. Inserting the remaining term in equation (3. it is otherwise completely arbitrary.
Even if ! ( x ) is subjected to the conditions that it vanishes at the integration limits and that it has a continuous first derivative. of equation (3.
x2 x1 x2 x1
& !f ) d & !f ) ( !y # ( x ) $ dx ( !y% + # ( x )+ dx ' * ' * & !f d !f ) ( !y $ dx !y% + # ( x ) dx.10)
. we have !y !" = # ( x ) and !y" !# = d$ dx .7)
!J = !"
+
x2 x1
% !f !f d# ( ' !y # + !y$ dx * dx.10) cancels when !J !" " = 0 = 0 . therefore.2 Euler’s Equation
We now calculate the derivative of J (! ) (i. Inserting these two derivatives in equation (3. x1 dx ( !y" + 1 ' * !y" dx !y"
$
x2 x1
(3. y# ( x ). that the quantity that is between the parentheses in the last equation of (3.7)
$
x2 x1
% !f !y !f !y# ( ' !y !" + !y# !" * dx. & )
(3.3)) to meet the condition expressed by equation (3.8)
We integrate by parts the second term in the integral
x2 d & !f ) !f d# !f x dx = # ( x ) x2 % $ # ( x ) dx.8) we get
!J = !" =
.3.9)
The first term on the right hand side vanishes since ! ( x1 ) = ! ( x2 ) = 0 . & )
Since y (! .4)
!J ! = !" !" =
$
x2 x1
f { y ( x ) . It must be. x} dx
(3..

therefore.
Examples
1. The shortest distance between two points in a plane. y2 ) is
(3. !y
we have
!f y" = . We. y1 ) and ( x2 .12)
I=
'(
( x2 .where y and y! are now the original functions since ! is now set to zero. 2 !y" 1 + ( y')
(3. Equation (3. " dx %
2
(3.14)
!f = 0. and is known as Euler’s equation.13)
The condition that the curve be the shortest path is that I be a minimum. An element of length in a plane is
ds = dx 2 + dy 2
and the total length of any curve going between point ( x1 . y1 )
ds =
'
x2 x1
! dy $ 1 + # & dx.11) is the necessary condition for the functional J to be an extremum.15)
% d " y! $ ' =0 dx $ 1 + ( y! )2 ' # &
(3. " dx %
Inserting f in equation (3.
(3.16)
or
y! 1 + ( y! )
This can only be true if
2
= cste.11) with
2
(3. define
! dy $ f = 1+ # & .17)
43
. y2 )
x1 .

18)
y = ax + b. the field is conservative) and the absence of friction.21)
Figure 3. starting at rest from a point ( x1 . y1 ) as the origin. and U = !mgx . The problem of the brachistochrone. the velocity of the particle will.e. we have
T + U = 0. U = 0 ).y! = a. the total energy T + U must be conserved. Furthermore.20)
At the arrival point ( x2 .e.
44
. and assume that the force field is directed along the positive x-axis (see Figure 3. Integrating equation (3. therefore.. y2 ) we have T = mv 2 2. y1 ) to point ( x2 . y1 ) and that we chose this point as the origin (i.19)
with b an another constant (of integration). We recognize in equation (3. We assume that the force on the particle is constant and that there is no friction. be
v = 2gx.2 – The brachistochrone problem.
(3. We must find the path that will bring a particle subjected to the force field F from point ( x1 .20).
(3. Consider a particle constrained to move in a force field (e. since the particle starts from rest at ( x1.
(3.. Solution.
where a is a constant. 2. Find the path that allows the particle to accomplish the transit in the least possible time. y1 ) to some lower point ( x2 . y2 ) . Let’s choose the point ( x1 . gravity).19) the equation of a straight line. Because of the assumptions of a constant force field (i.g. Using equation (3.1).18) finally yields
(3. y2 ) in the least amount of time..

28)
45
. ( '
(3.25)
This last equation can be written as
x 1 + ( y! )
(
y!
2
)
=
1 . identify the function to be used in Euler’s equation as
f =
1 + ( y! ) .24)
(
)
(3. 2a
(3. !y
which in turn implies that
# d # !f & d % y" % !y" ( = dx % 2 ' dx $ $ 2gx 1 + ( y" ) & ( = 0.The total time taken by the particle to travel the distance between the two points is given by the following integral
t= =
!( !
( x2 . therefore.26). 2gx
(3. rearrange the equation (we multiply by x on both sides of the equality). and rewrite the result in the form of an integral we get
y=
"
x dx 2ax ! x 2
.26)
where a is a constant. y1 )
2
dx 2 + dy 2 2gx
1 + ( y" ) dx. y1 ) x2 x1 = 0
v
=!
( x2 . y2 ) ds
x1 .
x = a (1 ! cos (" ))
(3.
(3. If now square equation (3.23)
When we apply Euler’s equation (3.22)
We can. 2gx
2
(3.11) we find that
!f = 0. y2 )
( x1 .27)
We now make the following change of variable
dx = a sin (" ) d" .

Suppose we form a surface of revolution by taking some curve passing between two fixed end points ( x1 .31) is shown in Figure 3.3 – The solution of the brachistochrone problem: a cycloid.
The path of the particle described by equation (3.31)
3.
#
0
(3. we now have the parametric equations of a cycloid.4).30)
Setting the constant in equation (3. y2 ) defining the
( x.
(3.30) to zero. Solution.29)
This last integral is easily solved to give
y = a (! " sin (! )) + cste.
2
(3. and revolving it around the y-axis (see Figure 3.27) becomes
y=
$ a (1 ! cos (# " )) d# ". y1 ) and ( x2 .Figure 3. The problem is to find
the curve for which the surface area is a minimum.3. Minimum surface of revolution. The area of a strip of surface is
dA = 2! x dx 1 + ( y" ) . y ) -plane. that is
x = a (1 ! cos (" ))
y = a (" ! sin (" )) . and equation (3.
(3.32)
and that for the total area is
46
.

34)
and insert it in equation (3.35)
xy! 1 + ( y! )
2
= a.
(3. 2 !y" 1 + ( y')
(3.
(3. we have
( y ! )2 ( x 2 " a 2 ) = a 2 . We find
!f = 0.33)
To find the extremum we define
f = x 1 + ( y! ) . The geometry of the problem and area dA are indicated to minimize the surface of revolution around the y-axis.
(3.36)
with a some constant.
A = 2! # x 1 + ( y" ) dx.4 – Minimum surface of revolution.38)
47
.37)
dy = dx
a x 2 ! a2
.11).Figure 3.
x2 2 x1
(3.
2
(3.
or solving. !y
which implies that
!f xy" = . Squaring the above equation and factoring terms.

40) is that of a catenary.41)
which is then expressed as
!J =
where
+
x2 x1
% "f d "f ( # ' "y dx "y$ * ! y dx. & )
(3. y".43)
! J = ! # f { y.44)
We now solve this equation
48
.
3. & )
(3. !"
The condition of extremum then becomes
(3. (3. or in physics.
x2 x1
(3.40) # a ' & where b is another constant of integration.10) as
!J d" = !"
+
x2 x1
% !f d !f ( !y ' !y # dx !y$ * !" d" dx. The so-called ! notation can be used to rewrite equation (3.The general solution of this differential equation is
y = a(
or
" x% = a cosh !1 $ ' + b.39)
" y ! b% x = a cosh $ . the curve of a flexible cord hanging freely between two points of support. we often encounter a different notation than what was presented in the preceding sections. x} dx = 0. # a& x 2 ! a2 dx
(3.3 The ! Notation
In analyses that use calculus of variations.42)
!J d" # $ J !" !y d" # $ y. Equation (3.

45)
However.. % (
(3.)
3. dx
= lim
(3. When dealing with physical problems.!J =
=
" "
x2 x1 x2 x1
!f
% #f ( #f ' #y ! y + #y$ ! y$ * dx.47)
where we have integrated by parts to derive the last equation. In that context. in fact. We then have
49
. the varied path ! y . will become the time. it is more common that several such functions are involved. Euler’s equation.
y ( x + )x ) + y ( x ) & # # dy & ! y" = ! % ( = ! % lim ( )x*0 $ dx ' $ ' )x
! y ( x + )x ) + ! y ( x ) )x*0 )x d = (! y ) .e. we get
!J =
=
* *
x2 x1 x2 x1
$ "f ' "f d & "y ! y + "y# dx (! y )) dx % ( $ "f d "f ' & "y + dx "y# ) ! y dx.11)) previously derived is the solution of the variation problem when only one dependent function y ( x ) was to be found to bring the integral J to an extremum. as we saw before. equation (3. (The independent variable. The varied path represented by ! y is a virtual displacement from the actual path that is consistent with the forces and constraint of the problem. Since ! y is arbitrary. It is important to realize that the ! notation is only an expedient for the derivation of Euler’s equation.4 Functions with Several Dependent Variables
Euler’s equation (i. when we apply calculus of variations to physical problems. ! J can only equal zero if the quantity in parentheses vanishes.45). but that is operated with the independent variable x being kept fixed. & )
(3. This quantity is.46)
Inserting this equation in equation (3. does not even need to correspond to a possible path of motion.

!yi dx !y $ ) & i
(3..
(3. we write
yi (! .& !y dx !y$ ) !" & !z dx !z$ ) !" /
50
(3. ... .54)
. determining the shortest path between two points can be complicated by the fact that we may require the path to follow the surface of a given shape (e. x ) = yi ( x ) + !"i ( x ) .53)
We now write equation (3. +' # -' # 0 dx. a sphere). the vanishing of equation (3. Let’s consider the case where we have two dependent variables y and z with one equation of constraint. z.
(3. x .
(3.. yn! ( x ).51) when ! = 0 implies that each equation in parentheses vanishes simultaneously.52)
3. z!.f = f y1 ( x ) . . These are called equations of constraints. 2. y1! ( x ) . . 2. y!. n. x .
or simply
{
}
(3.g.50)
and
!J = !"
.51) for the case of two variables
!J = !"
1
x2 x1
+% !f d !f ( !y % !f d !f ( !z .48)
f = f yi ( x ) . one must take the equations that make these requirements explicit. For example. x } . then
f = f { y. n.. . That is
!f d $ !f ' " & ) = 0. yn ( x ) ..5 Euler’s Equation with Equations of Constraints
The problem of finding an extremum can be further expanded to include cases where constraints are imposed.. * * .
{
}
i = 1.
x2 x1
% !f d !f ( # ' * +i ( x ) dx.49)
Just as was done for the case of a single function. !yi dx % !y # ( i i = 1. . When this is the case.51)
where Einstein’s summation convention was used. yi ! ( x ).
(3. Because the variations !i ( x ) are all independent of one another.

.54). z. constraints that can be written in a form similar to equation (3. we have
# !g !y !g !z & dg = % + d" = 0.55)
For example. however. $ !y !" !z !" ( '
(3.60) in equation (3. an equation of constraint that we must somehow include in the problem. y (! . Other types of constraint that can’t be expressed in this fashion (e. It is of the form
g { y.
(3. x ) = z ( x ) + !"2 ( x ) .55).57)
We can evaluate the derivatives with respect to ! with
z (! .
(3. x} = 0.61) while slightly rearranging the terms 51
.' # * +1 ( x ) + ' !z # dx !z$ * +2 ( x ) 1 dx.56)
(Incidentally.There is.54) do not vanish separately when ! = 0 .57). and (3.g.58)
which gives
!y = #1 ( x ) . we would have
y 2 + z 2 ! a 2 = 0.59)
Inserting these in equations (3. & ) -& !y dx !y$ ) 0
(3. we respectively get
!g !g "1 ( x ) = # "2 ( x ) .60)
!J = !"
2
x2 x1
.61)
We now insert equation (3. in the case of restricting the problem to a great circle (of radius a) on the surface of a sphere. x ) = y ( x ) + !"1 ( x )
(3. If we differentiate the equation of constraint.% !f d !f ( / % !f d !f ( . the variations !y !" and !z !" are no longer independent.) Because of equation (3.55) are called holonomic. !" !z = #2 ( x ) . !"
(3. !y !z
and
(3. if “=” is replaced by “ ! ”) are called non-holonomic. so the two terms in the parentheses of equation (3.

That is
$ !f d !f ' $ !g ' & !y " dx !y# ) & !y ) % (% (
"1
$ !f d !f ' $ !g ' =& " . % !z dx !z# ) & !z ) (% (
"1
(3. z! and x . The function ! ( x ) is known as a Lagrange undetermined multiplier. We define this function as ! " ( x ) . The procedure described in this section can readily be generalized to the case of several dependent variables and more than a single equation of constraints are involved.64)
We. need to find a solution to three equations (i. will be used. and can be set to zero. the two equations (3.62)
The terms within the brackets in this last equation now include a contribution from the equation of constraint.55). and we have
!f d !f !g " + $ ( x) = 0 !y dx !y# !y !f d !f !g " + $ ( x) = 0 !z dx !z# !z
(3. therefore. the only way that the two sides of equation (3.63)
The left-hand side of equation (3.63) can be equal for all value of x is if they are both equal to the same function of x .& !y dx !y$ ) & !z dx !z$ ) & !g !z ) /
(3. y! . For this.!J = !"
2
x2 x1
+% !f d !f ( % !f d !f ( % !g !y ( .e. y ( x ) .
(3.66)
52
. #' # -' # *' * * 0 11 ( x ) dx. z ( x ) . and ! ( x ) ) in order to completely solve the problem. We then have the following solution
!g j !f d !f " + $j ( x) =0 !yi dx !y # !yi g j { yi . for a total of three. . and x .64) along with the equation of constraint (3. while the right-hand side involves only derivatives with respect to z. x} = 0.63) involves only derivatives of f and g with respect to y..
i
(3. But because both y and z are functions of x .65)
It is to be noted that the equation of constraints will often be presented in a differential form such as
!g j !yi dyi = 0.

67)
(3. Solution.Figure 3.6 Equation of Constraints as Integrals
It is also possible that an equation of constraints can be stated in the form of an integral. !y
!g = #R. The equation of constraint is then
g ( y.
(3.
with R the radius of the disk. From Figure 3.5 – A disk rolling on an incline plane without slipping. suppose that we want to find an extremum for a functional integral J by determining the corresponding curve which satisfies the boundary conditions y ( a ) = A and y ( b ) = B
53
.! ) = y " R! = 0.
Example
Determine the equation of constraint for a disk rolling on an incline plane without slipping.69)
3.68)
or in a differential form
!g = 1. For example. !"
(3.5 we can easily determine the relation the two coordinates y and ! as
y = R! .

since K.
!J !" !K !"
=0
" =0
(3.J [ y] =
" f { y. it is not a function of the independent variable x .73)
Take note that in this case ! is truly a constant. we can introduce a Lagrange undetermined multiplier such that
!K ' ! $ !J +# = ( J + # K )" = 0 = 0. We now rewrite equation (3.74) in the same way as was done before.74)
We can find the extremum for equation (3. & !y dx !y# * ) !y dx !y#
(3. we can write
K = K (! ) . and we get
% !g d !g ( !f d !f " + $' " = 0. we now consider virtual variations on the curve such that y (! .71)
where ! is the aforementioned length of y . Since these variations apply to both J and K .72)
= 0. y!.
b a
(3. & ) % !" !" ( " = 0 !"
(3.70)
Suppose also that the constraint is stated as a functional (or integral) K that fixes the value for the length of the curve
K [ y] =
" g { y.
(3.
b a
(3. x} dx = !. x} dx.73) as
! !"
$ ( f + # g ) dx
b a
" =0
= 0. J = J (! )
and. and !K !" are not a function of x . Similarly as was done before. x ) = y ( x ) + !" ( x ) . y!.75)
54
.
" =0
Furthermore.

it is appropriate to change coordinates and consider the curve r (! ) instead of y ( x ) . 4#
(3.76) can be rewritten as
J= K=
# #
0 2$ 0
2$
r (" )
0
r !dr !d" =
1 2$ 2 r (" ) d" 2 #0
# r (" ) d" = !.78)
Using equation (3. and K [ y ] = ! . with ! as the independent variable instead of x . Equations (3.with the constraints y ( a ) = A .
55
.
Example
We want to maximize the area of a closed curve y ( x ) that has a length ! . y ( b ) = B . Solution.75) we find
r (! ) + " = 0. !
J=
(3. The area inside a closed curve and its length are
!! dx dy K = " ds = !.
(3.77)
We can now identify the two functions f and g
f = 1 2 r (! ) .
(3.80)
We therefore find that the area is maximized if the curve is that of a circle.
(3. 2 g = r (! ) . Using equation (3.76)
Since the curve is closed.79)
which implies that r is a constant.77) we find
r = !" =
! 2# !2 J = #r2 = .