# Euler-Lagrange Equation and How to Use it in 5 Easy Steps

Level 3 (with higher mathematics)
Level 3 requires the basics of vector calculus, differential and integral calculus. Suitable for undergraduates and high school students.
Updated by Alexander Fufaev on

## Video - Euler-Lagrange Equation

Let us consider a particle in the gravitational field which is thrown vertically upwards from the height $$h_1 = 0$$ at the time $$t_1 = 0$$. It moves upwards in a straight line and arrives at the ground at the same location $$h_2 = 0$$ at time $$t_2$$.

In a position-time diagram, the particle has started at height $$h_1$$ at time $$t_1$$. Let us denote this starting point with $$\text{A}$$. And the particle has arrived at the end point $$\text{B}$$ at height $$h_2$$ at time $$t_2$$.

The connection between $$\text{A}$$ and $$\text{B}$$ must be a parabola in this problem. But why is this path $$h(t)$$ a parabola and not any other path? Why does nature choose exactly this path? And not for any other path as shown in illustration 2?

## Action Functional

To be able to answer this question, we need a quantity called action, which is abbreviated with the letter $$S$$. We can assign an action value to each of these conceivable paths. The action $$S$$ takes a whole function $$h$$ in the argument and spits out a number S[h], namely the value of the action for the corresponding function.

Such a mathematical object that eats a function $$h$$ and spits out a number is called a functional. Since the functional spits out the action, $$S[h]$$ is also called an action functional. To distinguish the action functional from usual functions that take just a number in the argument, we use square brackets.

The action has the unit Joulesecond ($$\mathrm{Js}$$). For example, one path might have the value $$3.5 \, \mathrm{Js}$$, another path might have the value $$5.6 \, \mathrm{Js}$$, and the parabolic path might have $$2 \, \mathrm{Js}$$.

So now back to the question: Why is the path a parabola? Experience shows that:

That means, if we calculate the action for all possible paths $$h_1(t)$$, $$h_2(t)$$, $$h_3(t)$$ and so on between $$A$$ and $$B$$, then nature takes the action value which is either maximum, minimum or a saddle point. Nature chooses one of these paths. Which of these extremal paths nature takes concretely depends on the considered problem.

In the case of a particle thrown upwards in the gravitational field, the path has the smallest action, so a minimum. Since the parabolic path has the smallest action, the particle chooses this path in the position vs. time diagram.

But how do we calculate these values of the action? For this we need the Lagrange function $$L$$. It depends on the time $$t$$, on the function value $$h(t)$$ and on the velocity $$\dot{h}(t)$$. The Lagrange function has the unit of energy, that is, joule ($$\mathrm{J}$$). If we integrate the Lagrange function over the time t between t1 and t2, we get a quantity that has the unit joules seconds. This is exactly the action we need. Thus we can calculate concretely the value of the action for each possible path "h", if we specify the Lagrange function.

If we integrate the Lagrange function over the time $$t$$ between $$t_1$$ and $$t_2$$, we get a quantity that has the unit joulesecond:

Action Functional Expressed with the Height Function
Formula anchor

This is exactly the action we need. Thus we can calculate concretely the value of the action for each possible path $$h$$, if we specify the Lagrange function.

Mostly you use the letter $$q$$ instead of $$h$$ and $$\dot{q}$$ instead of $$\dot{h}$$ and call $$q$$ as generalized coordinate and the derivate $$\dot{q}$$ as generalized velocity. What is meant by "generalized" you will learn in another lessen. For us it is only important to know that $$q$$ can be for example a height above the ground or an angle or any other quantity which can depend on the time $$t$$.

Action functional as integral of the Lagrange function
Formula anchor

## Euler-Lagrange equation to determine the path

Of course, it is totally cumbersome to calculate the integral for all possible paths and to take the path that results in the smallest value of the integral. To avoid such a huge task, the so-called Euler-Lagrange equation comes into play:

Euler-Lagrange equation
Formula anchor

The derivation of the Euler-Lagrange equation is based on the definition of action 2 and the stationary-action principle. In this lesson, we do not want to know how to obtain the Euler-Lagrange equation, but how to use it to determine the path $$q(t)$$ we are looking for.

The Euler-Lagrange equation contains the partial derivative of the Lagrangian function $$L$$ with respect to the genaralized velocity $$\dot{q}$$: $$\frac{\partial L}{\partial \dot{q}}$$. This derivative $$\frac{\partial L}{\partial \dot{q}}$$ is also called generalized momentum and abbreviated with $$p$$. The generalized momentum is then differentiated with respect to $$t$$.

Euler-Lagrange equation using momentum
Formula anchor

The second term in the Euler-Lagrange equation is the derivative of the Lagrangian function $$L$$ with respect to the generalized coordinate $$q$$: $$\frac{\partial L}{\partial q}$$.

If we bring the time derivative of the momentum to the other side, we can read from the Euler-Lagrange equation whether the momentum is conserved.

Conservation of momentum in the Euler-Lagrange equation
Formula anchor

For this, the time derivative of the momentum must be zero. So we only have to calculate if $$\frac{\partial L}{\partial q}$$ is equal zero.

## Lagrange function as ingredient

The Lagrange function $$L$$ is a scalar function that cannot be derived, but can only be guessed or motivated. If you think you have discovered a suitable Lagrangian for a problem, be it from quantum mechanics, classical mechanics or relativity, you can easily check whether the Lagrangian you found describes your problem correctly or not by using the Euler-Lagrange equation.

In most cases of classical mechanics, the Lagrange function is the difference between the kinetic energy $$W_{\text{kin}}$$and the potential energy $$W_{\text{pot}}$$ of a particle:

Lagrangian function of classical mechanics
Formula anchor

Thus, if we know the kinetic and potential energies of a particle, we can determine the Lagrange function $$L$$ and then use $$L$$ in the Euler-Lagrange equation 3.

## Example: How to use Euler-Lagrange equation

Let's look at our example and how we can calculate the parabola from the Lagrange function and the Euler-Lagrange equation. For this we have to do 5 steps.

### Step #1: Choose generalized coordinates

First, we need to know what $$q$$ and $$\dot{q}$$ represent. In our example, $$q = h$$ and $$\dot{q} = v$$, where $$v(t)$$ is the velocity of the thrown particle. Velocity here is nothing else than the time derivative of the path: $$\dot{q} = \dot{h}$$.

### Step #2: Set up Lagrange function

Next, we need to specify the Lagrange function 6 as a function of $$h$$ and $$\dot{h}$$. The kinetic energy $$W_{\text{kin}}(t, h, \dot{h})$$ of the thrown particle is given by:

Kinetic energy for the Lagrangian
Formula anchor

The potential energy $$W_{\text{pot}}(t, h, \dot{h})$$ of the particle in the gravitational field is given by:

Potential energy for the Lagrangian
Formula anchor

Thus, the Lagrange function is $$L(t, h, \dot{h})$$ for our problem:

Lagrange function for a particle in the gravitational field
Formula anchor

### Step #3: Calculate derivatives in the Euler-Lagrange equation

Now we can use the specified Lagrangian function 9 to calculate the derivatives occurring in the Euler-Lagrange equation 3. We first write the Euler-Lagrange equation using $$h$$ and $$\dot{h}$$:

Euler-Lagrange equation for a particle in the gravitational field
Formula anchor
• Differentiate the Lagrange function 9 with respect to $$h$$:

Lagrange function differentiated with respect to h
Formula anchor
• Differentiate the Lagrangian function 9 with respect to $$\dot{h}$$:

Lagrange function differentiated with respect to the velocity
Formula anchor
• Differentiate the momentum $$\frac{\partial L}{\partial \dot{q}} = m \, \dot{h}$$ with respect to time $$t$$:

Differentiation of the momentum with respect to time
Formula anchor

Let us substitute the calculated derivatives into the Euler-Lagrange equation:

Euler-Lagrange equation calculated
Formula anchor

Let's cancel the mass $$m$$ and bring $$\ddot{h}$$ to the other side:

Set up differential equation
Formula anchor

What we get is a differential equation for the function we are looking for $$h$$. Here you can see the meaning of the Euler-Lagrange equation! It tells us which differential equation we have to solve to find out the time behavior of $$h$$.

Note that our example is a one-dimensional problem, so we only got one differential equation out of it. For more complex multidimensional problems, we get several differential equations.

### Step #4: Solve the differential equation

Now we have to solve the differential equation 15 set up with the help of the Euler-Lagrange equation. To do this, we integrate both sides over time $$t$$:

Integrate both sides of the differential equation
Formula anchor

Then we get:

Result of the first integration
Formula anchor

This results in two integration constants. We combine these to one integration constant $$C_1$$. Then we integrate both sides again over time to eliminate the time derivative of $$h$$:

Integrate both sides of the differential equation a second time
Formula anchor

Then we get:

Solution of the differential equation
Formula anchor

Here $$C_2$$ is a combined integration constant. Now we have solved the differential equation for $$h$$!

### Step #5: Use boundary conditions

As a last step, we have to insert the boundary conditions of the considered problem into the solution of the differential equation and determine the unknown constants $$C_1$$ and $$C_2$$.

In our problem, we threw the particle from the height $$h_1 = 0$$ at the time $$t_1 = 0$$. So the first constraint is: $$h(0) = 0$$. Let's insert it into the result 19:

Determine second integration constant
Formula anchor

Thus we have figured out the integration constant $$C_2 = 0$$. Let's insert it into the Eq. 19:

Second constant inserted into the differential equation
Formula anchor

To find out the constant $$C_1$$, we need a second boundary condition. We know that the path of $$h(t)$$ ends at the point $$\text{B}$$. The point $$\text{B}$$ corresponds to the time $$t_2$$ at which the particle landed on the ground at $$h_2 = 0$$. The second boundary condition is therefore: $$h(t_2) = 0$$. Insert it into the differential equation:

Determine first integration constant
Formula anchor

Insert $$C_1$$ into the Eq. 21:

Final result: Function $$h$$
Formula anchor

If you plot the result in the position-time diagram, you get a parabola. The Euler-Lagrange equation delivers exactly the result we expected!

The Euler-Lagrange equation, together with the Lagrange function, helps us to set up differential equations for a concrete problem. The solution of these differential equations yields the shape of the function that nature allows.