Continuum mechanics/Calculus of variations
Ideas from the calculus of variations are commonly found in papers dealing with the finite element method. This handout discusses some of the basic notations and concepts of variational calculus. Most of the examples are from Variational Methods in Mechanics by T. Mura and T. Koya, Oxford University Press, 1992.
The calculus of variations is a sort of generalization of the calculus that you all know. The goal of variational calculus is to find the curve or surface that minimizes a given function. This function is usually a function of other functions and is also called a functional.
Maxima and minima of functions 
The calculus of variations extends the ideas of maxima and minima of functions to functionals.
For a function of one variable , the minimum occurs at some point . For a functional, instead of a point minimum, we think in terms of a function that minimizes the functional. Thus, for a functional we can have a minimizing function .
The problem of finding extrema (minima and maxima) or points of inflection (saddle points) can either be constrained or unconstrained.
The unconstrained problem. 
Suppose is a function of one variable. We want to find the maxima, minima, and points of inflection for this function. No additional constraints are imposed on the function. Then, from elementary calculus, the function has
- a minimum if and .
- a maximum if and .
- a point of inflection if .
Any point where the condition is satisfied is called a stationary point and we say that the function is stationary at that point.
A similar concept is used when the function is of the form . Then, the function is stationary if
Since , , , and are independent variables, we can write the stationarity condition as
The constrained problem - Lagrange multipliers. 
Suppose we have a function . We want to find the minimum (or maximum) of the function with the added constraint that
The added constraint is equivalent to saying that the variables , , and are not independent and we can write one of the variables in terms of the other two.
The stationarity condition for is
Since the variables , , and are not independent, the coefficients of , , and are not zero.
At this stage we could express in terms of and using the constraint equation (1), form another stationarity condition involving only and , and set the coefficients of and to zero. However, it is usually impossible to solve equation (1) analytically for . Hence, we use a more convenient approach called the Lagrange multiplier method.
Lagrange multiplier method. 
From equation (1) we have
We introduce a parameter called the Lagrange multiplier and using equation (2) we get
Then we have,
We choose the parameter such that
Then, because and are independent, we must have
We can now use equations (1), (3), and (4) to solve for the extremum point and the Lagrange multiplier. The constraint is satisfied in the process.
Notice that equations (1), (3) and (4) can also be written as
Minima of functionals 
Consider the functional
We wish to minimize the functional with the constraints (prescribed boundary conditions)
Let the function minimize . Let us also choose a trial function (that is not quite equal to the solution )
where is a parameter, and is an arbitrary continuous function that has the property that
(See Figure 1 for a geometric interpretation.)
Plug (6) into (5) to get
You can show that equation (8) can be written as (show this)
The quantity is called the first variation of and the quantity is called the second variation of . Notice that consists only of terms containing while consists only of terms containing .
The necessary condition for to be a minimum is
The first variation of the functional in the direction is defined as
To find which function makes zero, we first integrate the first term of equation (9) by parts. We have,
Since at and , we have
Plugging equation (12) into (9) and applying the minimizing condition (11), we get
The fundamental lemma of variational calculus states that if is a piecewise continuous function of and is a continuous function that vanishes on the boundary, then
Applying (14) to (13) we get
Equation (15) is called the Euler equation of the functional . The solution of the Euler equation is the minimizing function that we seek.
Of course, we cannot be sure that the solution represents and minimum unless we check the second variation . From equation (10) we can see that if and and in that case the problem is guaranteed to be a minimization problem.
We often define
where is called a variation of .
In this notation, equation (9) can be written as
You see this notation in the principle of virtual work in the mechanics of materials.
An example 
Consider the string of length under a tension (see Figure 2). When a vertical load is applied, the string deforms by an amount in the -direction. The deformed length of an element of the string is
If the deformation is small, we can expand the relation into a Taylor series and ignore the higher order terms to get
The force T in the string moves a distance
Therefore, the work done by the force (per unit original length of the string) (the stored elastic energy) is
The work done by the forces (per unit original length of string) is
We want to minimize the total energy. Therefore, the functional to be minimized is
The Euler equation is
The solution is