Lagrangian Mechanics For Dummies: An Intuitive Introduction

Often the most common approach to describing motion and dynamics is through Newton’s laws, however, there is a much more fundamental approach called Lagrangian mechanics. But what is Lagrangian mechanics, exactly?

As a general introduction, Lagrangian mechanics is a formulation of classical mechanics that is based on the principle of stationary action and in which energies are used to describe motion. The equations of motion are then obtained by the Euler-Lagrange equation, which is the condition for the action being stationary.

Lagrangian mechanics is practically based on two fundamental concepts, both of which extend to pretty much all areas of physics in some way.

The first one is called the Lagrangian, which is a sort of function that describes the state of motion for a particle through kinetic and potential energy.

The other important quantity is called action, which is used to define a path through space and time.

The important thing about the action is that it is required to be stationary in order to get the right equations of motion.

This is known as the principle of stationary action, which is one of the most fundamental principles throughout all of physics.

These will both be explained in great detail in this article.

Quick tip: To build the mathematical skills necessary for Lagrangian mechanics, I’d highly recommend checking out my Advanced Math For Physics: A Complete Self-Study Course. This course will teach you ALL the advanced math you need to know – regardless of your previous knowledge – through lessons that focus on intuitive understanding, step-by-step physics examples and worksheets with tons of practice problems.

It is also worth noting that Lagrangian mechanics is really just an alternative to Newtonian mechanics (although more powerful in many cases). I actually have a whole article comparing the two formulations here.

The Intuition Behind Lagrangian Mechanics

To get started, let’s try to develop some intuition and reasoning behind what we’re going to be looking at in detail in this article.

For this, we’re going to rethink our notions of what motion really is in the most fundamental sense. Typically, we think of motion as being a result of different forces, which is practically what Newton’s laws are.

There is, however, nothing special about forces. Granted, they are intuitive and simple to understand, but after all, they are just one possible mathematical model to describe motion and dynamics.

Fundamentally though, motion is a description about changes. Think about it. If a net force is acting on you, your position will change and this is how we measure velocity and acceleration.

Ultimately, dynamics and motion are optimization processes. When a ball rolls down a hill, its height (position) will decrease in some way, but its velocity, on the other hand, will increase as it rolls.

If you really begin to think about it, there are only two quantities that we need in order to fully describe the motion of any object; its position and velocity at any given point.

Once we know where an object is and which direction and how much velocity it has, we can fully predict where it will be at the next instant.

Now, the next question is, how can these two quantities be combined into a useful theory? The answer is actually simple; energy.

In fact, the kinetic and potential energy of an object is all you need to know to fully predict where it will move next (not taking into account friction, for now).

Take for example the trajectory of a projectile (such as a ball thrown in the air):

This is, in fact, the basis for Lagrangian mechanics. It is fundamentally a description of changes in energy. This is done through a quantity called the action.

Lagrangian mechanics is fundamentally an optimization process of the kinetic and potential energies of objects and systems; this is how we predict their motion.

Now, the action is basically a quantity that describes a specific trajectory an object would take. So, each trajectory through space and time has a different action associated with it.

Since we established that motion could be described by energies, I’m going to invent a function L, which is a function of the kinetic and potential energies (we’ll specify later what this function is, but it is called the Lagrangian):

T is commonly used to denote kinetic energy, while V is potential energy (sometimes it’s also denoted by U).

How could the action of a trajectory be defined in a useful way then? One option would be to sum over each of these “energy functions” (Lagrangians) over the entire trajectory.

This would also make intuitive sense. If we know the kinetic and potential energy (i.e. the value of this Lagrangian function) at each point, we can determine the entire trajectory by simply adding all of them up.

Now, in classical mechanics, energy is a continuous variable, which means that the action wouldn’t be a discrete sum, but rather an integral over time (the time it takes from the starting point to the end point of the trajectory).

The action is defined as an integral
over time of the Lagrangian
at each point of the trajectory:


Based on a lot of evidence, we’ve seen that physical objects and even fields, will always behave and move in such a way that the action is minimized (or more accurately, stationary).

In the context of Lagrangian mechanics, this means that the trajectory of an object will always be the one in which the action is stationary. This is called the principle of stationary action.

The most fascinating thing is that this principle is one of the most fundamental in all of physics, which all observed systems obey (even outside of classical mechanics too!).

Later in this article, I’ll explain more of the intuition behind the principle of stationary action as well as define it in a more mathematical way.

The useful thing in the context of classical mechanics is that the principle of stationary action will uniquely define the trajectory a system will take.

Ultimately, the problem will then boil down to simply finding the Lagrangian of the system, which gives an extremely useful method for problem solving in classical mechanics (I talk about this more in my article Is Lagrangian Mechanics Useful?).

Now, one more thing; what actually is the Lagrangian? We haven’t defined it so far and the reason for this is that the Lagrangian doesn’t have a general form.

In classical mechanics, however, it has a well-defined form, but in other fields of physics, it may be different.

For now, I’m just going to tell you what the classical Lagrangian is (we’ll explore why this makes sense really soon).

The Lagrangian for classical mechanics is defined as
the difference of the kinetic and potential energy
of the object or system:


Now, you may want to ask something like; why is this the Lagrangian? Why is it the difference of energies (T-V) and not the total energy (T+V), for example?

The answer is that, actually, both of them would work, but T+V is used in a formulation called Hamiltonian mechanics (you can read my introductory article here and a comparison of Lagrangian and Hamiltonian mechanics here).

The answer above may still not explain why exactly T-V works. This we will explore next.

What Is The Lagrangian And Why Is It T-V?

Earlier I explained some of the intuitive logic behind what Lagrangian mechanics is really based on. In this section, I want to look a bit closer specifically at what the Lagrangian (L=T-V) is.

In physics, there is always a certain optimization process in determining how physical objects and systems move.

In Lagrangian mechanics, this whole process is ultimately encoded in the principle of stationary action and it is expressed by the Lagrangian L=T-V.

But, you might ask, why is the Lagrangian T – V, exactly? Why is it not the sum of the kinetic and potential energy, for example?

First of all, the Lagrangian is NOT the total energy of an object, it is something entirely different.

The Lagrangian has very little to do with the total energy, it can rather be thought of as a state of motion at any particular point in time, which is described by the kinetic and potential energies (since they include information about both the velocity and position).

Now, there are basically two reasonable ways that you could describe the motion with these two quantities; you could try to describe the “state of motion” at each point by the total energy (T+V), or by the difference of the energies (T-V).

Potential energy, however, isn’t really something that describes motion by itself. It can be converted into other forms of energy (namely kinetic energy), but potential energy itself does not describe motion, only the changes in potential energy do.

This is why it makes sense to describe motion by the difference of kinetic and potential energy, rather than the sum of the two; it allows for a sensible trade-off between the kinetic and potential energies (i.e. they can convert into one another) because of the sign difference between them:

This kind of dynamic process happens even in Newtonian mechanics, in the good old F=ma. The similarities between this and Lagrangian mechanics can easily be seen if we express Newton’s second law in the form:

There is also another way to think about this and it is through the notion of energy conservation.

Since the total energy (T+V) is a conserved quantity, it doesn’t change with time. Thus, it isn’t particularly useful in describing motion (although it can be made work in a different way, such as is done in Hamiltonian mechanics).

The difference in energies (T-V), on the other hand, is not a conserved quantity (meaning its values can change with time), so it makes for a much more useful tool for describing motion.

An interesting way to visualize this is by plotting the values for T+V and T-V for a pendulum (T+V being the total energy, which is called the Hamiltonian, but that’s not important for now):

I’m going to give credit where credit is due; I found this graph on a Physics Stack Exchange post here.

This gives a beautiful way of visualizing how the Lagrangian actually encodes a lot of information about the motion of a system (in this case, for a pendulum), which makes it a lot more useful than the total energy for modeling the dynamics of physical systems.

Another reason for why the Lagrangian is the difference of kinetic and potential energy is simply because it gives the desirable results.

In more advanced theories of physics, Lagrangians are simply treated as functions that generate equations of motion. So, a Lagrangian is judged by the usefulness of what results it gives and there is nothing more to it.

In classical mechanics, this particular Lagrangian, L = T – V, is precisely the Lagrangian that generates Newton’s second law, F = ma.

Ultimately, this comes from how forces are defined in terms of potential energies (the minus sign in L=T-V is what generates the minus sign here, which we’ll see later in the article):


To be fair, this Lagrangian of T-V is only really applicable to classical mechanics. For example, in special relativity the Lagrangian takes a different form, which you can read more about here.

What Is The Principle of Stationary Action, Intuitively?

Earlier, I covered what the action is (a quantity that describes a particular path through space and time). Now I’d like to explore what the principle of stationary action actually means.

Later we’ll see how it it leads to the Euler-Lagrange equations, which are basically the equivalent to Newton’s second law, F=ma.

First of all, the action is defined as this integral over time, which can intuitively be obtained by “dividing” the trajectory into small pieces of the form Ldt (the value of the Lagrangian L over a tiny period of time dt; these Ldt-pieces essentially represent the action over a small interval dt of the trajectory).

The action of the full trajectory is then the sum of all these little pieces of Ldt, or more accurately, the integral of Ldt as follows (since time is a continuous variable, we have to use integration here):

A=\int_{t_1}^{t_2}L\ dt
Sometimes you’ll see the action denoted by the letter S.

The real physical trajectory an object or a system will always take is the one in which the action happens to be stationary; this is known as the principle of stationary action.

Now, this might be a lot to digest at once, so let’s explore it a bit. Firstly, what does it even mean for something to be stationary?

The answer to this is actually very simple and you might even know it from basic high school math. A stationary point for a function is simply a point at which the tangent line is horizontal (i.e. the derivative at this point is zero):

Now, the same idea of stationary points applies to the action as well, but with a little more math involved (since the action is actually a functional, not just a function; the details of this are not important).

The basic idea is that a stationary point in the action is defined as the functional differential equal to zero (denoted as δA=0). This basically just means that a slight variation (differential) in the action should be zero.

The principle of stationary action mathematically:

\delta\int_{t_1}^{t_2}L\ dt=0

The path a system takes is then the path in which the action satisfies this equation.

This image has an empty alt attribute; its file name is image.jpg
A functional differential essentially means varying the value of the action a little (infinitesimal) bit. The stationary points are then those at which a slight variance doesn’t actually affect the value of the action.

That is essentially the principle of stationary action explained as simply as possible.

Now, you may be thinking that this is interesting and all, but why exactly should physical systems obey this principle? Why should an object take the path of stationary action instead of some other path?

Fundamentally, nobody actually knows the real answer to this. It’s quite funny how the stationary action principle underlies pretty much all of modern physics, but nobody knows why it happens to be true.

The best I can give you here is some kind of motivation as to why it might make sense that the universe should follow such a principle.

To me, at least, it makes sense as to why the universe would want to (not that the universe would literally “want” anything, but I think you get the point) optimize stuff in such a way that something would be stationary.

You could think of it as physical systems tending to evolve towards a state of equilibrium, just like in thermodynamics systems always evolve in a way in which it reaches a state of thermal equilibrium.

The same kind of process could be thought of as applying to motion as well, but just as a much higher-level concept.

The particular trajectory that makes the action stationary could be thought of as sort of the equilibrium state of the action, because the action does not vary (i.e. it is at a stationary point or an equilibrium state).

Now, if this seems too abstract, the point here really is that everything we can observe in the universe obeys the principle of stationary action, so the most reasonable thing is to just take it as postulate and work with it.

Intuition Behind The Euler-Lagrange Equation (+ Step-By-Step Derivation)

Now that we’ve established what the principle of stationary action is, the next thing is to figure out a practical way to actually use it.

To do this, let’s think about what the principle of stationary action means mathematically again:

\delta A=\delta\int_{t_1}^{t_2}L\ dt=0

This is really just an equation that should be solved and it is not too hard to do if you know a little bit of calculus (you’ll find the derivation down below).

Now, what you’ll get is that in order for the action to be stationary, the Lagrangian should satisfy something known as the Euler-Lagrange equation:

Euler-Lagrange equation:

\frac{d}{dt}\frac{\partial L}{\partial \dot x}=\frac{\partial L}{\partial x}

The above equation is arguably the most important equation you’ll need in Lagrangian mechanics; it is essentially the Lagrangian version of Newton’s second law, as we’ll see later.

Derivation of the Euler-Lagrange Equation (click to see more)

First of all, we need to think about what the Lagrangian and the action are actually functions of.

Since the Lagrangian is T-V and the kinetic energy T is a function of velocity and potential energy V is a function of position, the Lagrangian is then a function of velocity and position:

L=L\left(x{,}\ \dot{x}\right)\ \ \ \ \ \ {,}\ \dot{x}=\frac{dx}{dt}
I’m going to sometimes denote the time derivative of something by putting a dot above it. This is a standard convention.

Let’s now look at what we get from the principle of stationary action, i.e. the functional differential of the action (which should be equal to zero). We can also move the δ-symbol inside the integral:

\int_{t_1}^{t_2}\delta L\left(x{,}\ \dot{x}\right)dt=0

Now, the rule for a functional differential is (basically taking the derivative of the function with respect to each of its variables and multiplying with the change in that variable):

\delta f\left(x{,}y\right)=\frac{\partial f\left(x{,}y\right)}{\partial x}\delta x+\frac{\partial f\left(x{,}y\right)}{\partial y}\delta y
This is basically the standard chain rule for derivatives, but this is the total change (differential) in a functional, not just with respect to a single variable.

Now just replace f(x,y) with the Lagrangian and we have the action as:

\int_{t_1}^{t_2}\delta L\left(x{,}\ \dot{x}\right)dt=\int_{t_1}^{t_2}\left(\frac{\partial L}{\partial x}\delta x+\frac{\partial L}{\partial\dot{x}}\delta\dot{x}\right)dt

The x with the dot above it is just dx/dt, so the second term can be written as:

\int_{t_1}^{t_2}\left(\frac{\partial L}{\partial x}\delta x+\frac{\partial L}{\partial\dot{x}}\delta\dot{x}\right)dt=\int_{t_1}^{t_2}\left(\frac{\partial L}{\partial x}\delta x+\frac{\partial L}{\partial\dot{x}}\frac{d}{dt}\delta x\right)dt

Let’s look at this second term closer. We know from the rule for a derivative of the product of two functions that:

\frac{d}{dt}\left(f\left(t\right)g\left(t\right)\right)=g\frac{df}{dt}+f\frac{dg}{dt}\ \ \ \Rightarrow\ \ \ \ f\frac{dg}{dt}=\frac{d}{dt}\left(fg\right)-g\frac{df}{dt}

From this formula, we can just replace f and g with:

f=\frac{\partial L}{\partial\dot{x}}\ \ {,}\ \ g=\delta x\ \ \ \ \Rightarrow\ \ \ \ \frac{\partial L}{\partial\dot{x}}\frac{d}{dt}\delta x=\frac{d}{dt}\left(\frac{\partial L}{\partial\dot{x}}\delta x\right)-\delta x\frac{d}{dt}\frac{\partial L}{\partial\dot{x}}

So, the action integral then becomes:

\int_{t_1}^{t_2}\left(\frac{\partial L}{\partial x}\delta x+\frac{d}{dt}\left(\frac{\partial L}{\partial\dot{x}}\delta x\right)-\delta x\frac{d}{dt}\frac{\partial L}{\partial\dot{x}}\right)dt

Now we can split the integral into two parts (since it’s just a sum):

\int_{t_1}^{t_2}\frac{d}{dt}\left(\frac{\partial L}{\partial\dot{x}}\delta x\right)dt+\int_{t_1}^{t_2}\left(\frac{\partial L}{\partial x}\delta x-\delta x\frac{d}{dt}\frac{\partial L}{\partial\dot{x}}\right)dt

In the first term, we’re taking the integral of a derivative so the dt’s basically “cancel” and it just becomes a substitution. We can also bring the δx outside the parentheses in the second term:

=\bigg/_{\!\!\!\!\!{t_1}}^{t_2}\left(\frac{\partial L}{\partial\dot{x}}\delta x\right)+\int_{t_1}^{t_2}\delta x\left(\frac{\partial L}{\partial x}-\frac{d}{dt}\frac{\partial L}{\partial\dot{x}}\right)dt

Now, here comes a key little detail; the start and end points of the path should be kept the same when we vary the path (otherwise we basically couldn’t compare different paths and see which one has a stationary action).

What this means is that the variance in the start and end points should equal zero (i.e. the position x(t) at the start and end time t1 and t2):

\delta x\left(t_1\right)=0\ \ {,}\ \ \delta x\left(t_2\right)=0

If we now look at the first term in our formula, the first term will go to zero (since it has the terms δx(t1) and δx(t2) after we make the substitution):

\bigg/_{\!\!\!\!\!{t_1}}^{t_2}\left(\frac{\partial L}{\partial\dot{x}}\delta x\right)=0

We are then left with (the whole thing should also equal zero):

\int_{t_1}^{t_2}\delta x\left(\frac{\partial L}{\partial x}-\frac{d}{dt}\frac{\partial L}{\partial\dot{x}}\right)dt=0

Now, this integral can only be zero if whatever is inside the integral is also zero:

\frac{\partial L}{\partial x}-\frac{d}{dt}\frac{\partial L}{\partial\dot{x}}=0
\frac{d}{dt}\frac{\partial L}{\partial\dot{x}}=\frac{\partial L}{\partial x}

This, of course, is just the Euler-Lagrange equation.

Now, what is the Euler-Lagrange equation actually?

In short, the Euler-Lagrange equation is a condition that the Lagrangian has to satisfy in order for the principle of stationary action to be true. It is essentially what generates the equations of motion of a system given a specific Lagrangian, just as Newton’s second law does for a given force.

One important detail is that the Euler-Lagrange equation can actually be derived by only knowing that the Lagrangian depends on position and velocity, nothing more.

In other words, we do not need to know the specific form of the Lagrangian (T-V). Any Lagrangian that is a function of position and velocity, has to satisfy the Euler-Lagrange equation simply as a result of the stationary action principle.

So, the EL equation is actually very general, not just a result of some arbitrarily chosen Lagrangian (it is actually a very general equation used to calculate minima and maxima of functions in a field of math called calculus of variations).

The Lagrangian comes in if we wish to express motion in terms of kinetic and potential energy. This is where the T-V is necessary to describe motion as a dynamic process.

If we plug the Lagrangian (L=T-V) into the Euler-Lagrange equation, we get:

\frac{d}{dt}\frac{\partial\left(T-V\right)}{\partial \dot x}=\frac{\partial\left(T-V\right)}{\partial x}

Since the kinetic energy doesn’t depend on position and potential energy doesn’t depend on velocity (x with a dot above it), we’re left with:

The minus sign here comes from the minus sign in the Lagrangian, L=T-V.

This is indeed exactly what I meant earlier with the concept of a dynamic optimization process between the kinetic and potential energy and it is precisely because of the minus sign right here, which comes from the form of the Lagrangian, T-V.

Let me explain. Because of the minus sign, you can think of the changes in potential energy kind of as opposing the changes in kinetic energy.

To me this makes perfect sense. Think of, for example, an object falling down in a gravitational field.

When the object falls, it is accelerating downwards and its kinetic energy will increase as it gains more velocity. On the other, hand its potential energy will decrease (based on the formula V=mgh) as it gets closer to the ground.

So, there is a clear dynamic process between the kinetic and potential energy, which allows us to describe motion using them! This is the beauty of Lagrangian mechanics; everything is described simply by changes in energy.

Everything in Lagrangian mechanics is described as changes in the kinetic and potential energies and the dynamic relationship between these changes is given by the Euler-Lagrange equation.

Now, the really useful thing about the EL equation is that it is what gives us the equations of motion of a system, if we know the kinetic and potential energy. This is just like Newton’s second law gives us the equations of motion if we know each of the components of the forces.

There is actually a very close (and in my opinion, a very beautiful) connection between Newton’s equation, F=ma, and the Euler-Lagrange equation.

How Does The Euler-Lagrange Equation Relate To Newton’s Second Law?

Firstly, we know that Newton’s second law can be expressed in terms of momentum like this:

We’ve assumed the mass to be a constant, so it can be moved inside the derivative and then used the usual formula for momentum (p=mv).

Also, a key property of forces is that any conservative force can be expressed in terms of potential energy (as explained in this article):

F=-\frac{\partial V}{\partial x}
Generally, this would be the negative gradient of potential energy, but this is only in the x-direction.

We can then express F=ma as:

\frac{dp}{dt}=-\frac{\partial V}{\partial x}

Let’s now compare this to the Euler-Lagrange equation and it will become obvious how similar they actually are:

In fact, if you we’re to choose the kinetic energy as simply 1/2mv2, then the Euler-Lagrange equation would produce exactly F=ma.

Derivation of F=ma From The Euler-Lagrange Equation (click to see more)

To illustrate how F=ma can be derived as simply a consequence of Lagrangian mechanics, consider a Lagrangian of the form:

L=\frac{1}{2}m\dot x^2-V\left(x\right)

In physics, the potential is usually just written in a general form, because there are many different equations for the potential energy, but essentially they are all dependent on the position.

On the other hand, there is really only one equation for kinetic energy in classical mechanics and that is just ½mv2 (in this example, the velocity is simply the velocity in the x-direction).

Now, just plug the Lagrangian into the Euler-Lagrange equation and we get:

\frac{d}{dt}\frac{\partial}{\partial\dot{x}}\left(\frac{1}{2}m\dot{x}^2-V\left(x\right)\right)=\frac{\partial}{\partial x}\left(\frac{1}{2}m\dot{x}^2-V\left(x\right)\right)

Let’s move the constants outside the derivatives and write it like this:

\frac{d}{dt}\left(\frac{1}{2}m\frac{\partial}{\partial\dot{x}}\dot{x}^2-\frac{\partial}{\partial\dot{x}}V\left(x\right)\right)=\frac{1}{2}m\frac{\partial}{\partial x}\dot{x}^2-\frac{\partial}{\partial x}V\left(x\right)

When taking partial derivatives, the terms without the variable we are differentiating with respect to, simply go to 0 (the second term on the left hand side and the first term on the right):

\frac{d}{dt}\left(\frac{1}{2}m\cdot2\dot{x}-0\right)=0-\frac{\partial}{\partial x}V\left(x\right)

On the left side, the 1/2 and the 2 will cancel. We can also move the mass outside the derivative:

m\frac{d}{dt}\dot{x}=-\frac{\partial}{\partial x}V\left(x\right)

Now, that looks interesting. The left hand side is simply mass times the time derivative of velocity (= acceleration). The right side is just the force, so all in all this is nothing but Newton’s second law:


Later in the article, I’ll also cover some practical examples of how exactly the Euler-Lagrange equation is used and why it’s useful (and not just Newtonian mechanics with more complicated extra steps).

How To Solve Problems Using Lagrangian Mechanics (Step-By-Step Method)

Generally, to solve any problem in mechanics revolves around finding the equations of motion for a particular system of interest.

One of the main uses and advantages of Lagrangian mechanics is that there is a systematic method to derive equations of motion with very little effort (compared to something like using F=ma), even for very complicated systems.

Essentially, how you construct the Lagrangian (kinetic and potential energy terms) for a given system defines what kind of formulas you’ll derive from it. Generally, this will be in the form L=T-V.

Lagrangian mechanics is particularly useful for more complex systems, because all you need to do is define the kinetic and potential energies for each object in the system. The rest is then just applying the Euler-Lagrange equation.

The general step-by-step process for finding the equations of motion of a system goes more or less like this:

  1. Find a set of convenient coordinates (= generalized coordinates) for the specific problem. These might be the usual Cartesian coordinates (x, y, z), but it is also possible to use coordinate systems such as spherical coordinates (r, θ, φ).
  2. Define the Lagrangian through the generalized coordinates. For multiple objects in a system, the Lagrangian will be the sum of the difference between the kinetic and potential energies of each object:
L=\frac{1}{2}\sum_i^{ }m_iv_i^2-\sum_i^{ }V_i
It is usually easier to first define the Lagrangian in Cartesian coordinates and then transform to whatever generalized coordinates you’re using!
  1. Apply the Euler-Lagrange equations to the Lagrangian. You’ll have one Euler-Lagrange equation for each coordinate you’ve chosen for the system.
  1. Simplify and solve the equations of motion. At this point, you should have one second order differential equation for each coordinate you have.

Here, I’ve mentioned the use of generalized coordinates. These are one of the key advantages of Lagrangian mechanics which allow for such elegant and straightforward problem solving methods. I’ll explain everything about these later.

Practical Example: Projectile Motion With Lagrangian Mechanics (click to see more)

Projectile motion is the motion of an object under a gravitational field, like a ball thrown in the air where the ball will travel in a parabolic trajectory.

Here, I will go over the steps given above and show how they are used in practice.

Step 1: Find a set of convenient coordinates for the problem.

For this, we will simply choose the regular Cartesian coordinates (x and y). The coordinates and velocities are given by the picture:

The x-component of velocity will be the time derivative of the x-coordinate, same for y. These are denoted by a dot, but it’s really just more compact notation for dx/dt and dy/dt.

Step 2: Define the Lagrangian.

For the Lagrangian, we simply need the kinetic and potential energies of this ball.

The kinetic energy is then the kinetic energy in the x-direction plus the kinetic energy in the y-direction. In other words:

T=\frac{1}{2}m\dot x^2+\frac{1}{2}m\dot y^2=\frac{1}{2}m\left(\dot x^2+\dot y^2\right)

The potential energy will just be the usual gravitational potential energy V=mgh. In this case, the height is simply the y-coordinate:


The Lagrangian for this ball thrown in the air is then simply T-V:


Step 3: Apply the Euler-Lagrange equations.

In this case, we will have two Euler-Lagrange equations, one for each of our two coordinates (x and y). The first one will be for the coordinate x:

\frac{d}{dt}\frac{\partial L}{\partial\dot{x}}=\frac{\partial L}{\partial x}

Plugging in the Lagrangian, we get:

\frac{d}{dt}\frac{\partial}{\partial\dot{x}}\left(\frac{1}{2}m\left(\dot{x}^2+\dot{y}^2\right)-mgy\right)=\frac{\partial}{\partial x}\left(\frac{1}{2}m\left(\dot{x}^2+\dot{y}^2\right)-mgy\right)

Since the Lagrangian doesn’t have any x’s in it, the right hand side goes to zero. On the left hand side, it does have an x-dot and from that partial derivative, we get:

\frac{d}{dt}\left(\frac{1}{2}m\cdot2\dot{x}\right)=0\ \ \ \ \Rightarrow\ \ \ \frac{d}{dt}m\dot{x}=0

The mass here is just a constant, and by taking the time derivative of the velocity, we get the acceleration in the x-direction (x with a double dot):

\ddot x=0
We’ve also divided out the mass here.

Now, for the y-coordinate, we get another Euler-Lagrange equation:

\frac{d}{dt}\frac{\partial L}{\partial\dot{y}}=\frac{\partial L}{\partial y}

Plugging in the Lagrangian and following pretty much the same process, we get (note that the Lagrangian has a y in it, so the right hand side is not zero anymore):

\frac{d}{dt}\frac{\partial}{\partial\dot{y}}\left(\frac{1}{2}m\left(\dot{x}^2+\dot{y}^2\right)-mgy\right)=\frac{\partial}{\partial y}\left(\frac{1}{2}m\left(\dot{x}^2+\dot{y}^2\right)-mgy\right)
\frac{d}{dt}\left(\frac{1}{2}m\cdot2\dot{y}\right)=\frac{\partial}{\partial y}\left(-mgy\right)
m\ddot{y}=-mg\ \  \ \Rightarrow\ \  \ \ \ddot y=-g

Step 4: Solve the equations of motion.

At this point, we have the equations of motion we need (notice that there are two second order differential equations, one for each of our coordinates):

\ddot x=0

We can now integrate both of these twice with respect to time and get the coordinates as functions of time (the v0‘s here are the initial velocities in the x and y -directions):


These, of course, are the solutions to a projectile motion problem, which you may have seen before at some point.

It’s worth noting that there are also some restrictions for what kinds of problems you can solve using Lagrangian mechanics.

For example, non-conservative forces cannot be directly derived from a Lagrangian since they are not defined in terms of a potential energy.

An example of these are friction forces, like the viscous force in a fluid and for these kinds of non-conservative forces, it is usually easier to revert back to using Newtonian mechanics (this is explained in this article).

However, there are still ways of modifying Lagrangian mechanics in a way to include these forces, but they can’t directly come from the principle of least action.

What Makes Lagrangian Mechanics Useful?

Next, we’ll take a look at some important aspects of Lagrangian mechanics that make it unique and powerful.

All these reasons why Lagrangian mechanics is useful (and many more) are covered in my article Is Lagrangian Mechanics Useful?.

Generalized Coordinates

Usually, the Euler-Lagrange equation is written in terms of something called generalized coordinates, which are denoted by q’s (the i-index here simply represents how many coordinates you have; for example, with multiple different coordinates, you’d have one EL equation for q1, another for q2 and so on):

\frac{d}{dt}\frac{\partial L}{\partial\dot{q}_i}=\frac{\partial L}{\partial q_i}

But what exactly are these generalized coordinates? These are (as the name may suggest), more general types of coordinates, ones which allow for much more freedom in our choice of coordinates and coordinate systems.

See, in Lagrangian mechanics, we are not limited to any particular set of coordinates such as the typical x,y,z -coordinate system.

Instead, you could have, for example, some angle θ as your coordinate in a problem involving rotational motion.

The beautiful thing about Lagrangian mechanics is that the problem solving methods (discussed earlier) work exactly the same, no matter what coordinates you wish to use.

These generalized coordinates have some very useful advantages to the regular Cartesian coordinates (of course you can still use Cartesian coordinates, if you wish):

  • Generalized coordinates allow us to implicitly contain ALL information about how a system behaves (for example, choosing polar coordinates (r and θ) for a pendulum would already include the fact that the pendulum moves in a circle; using only Cartesian coordinates, you’d have to impose certain constraints on the system).
  • The right choice of generalized coordinates can make a calculation extremely simple.
  • Generalized coordinates can reduce the number of variables/equations needed to solve a specific problem (as an example, choosing only an angle θ for a pendulum would be enough to find the equations of motion, while in Cartesian coordinates, you’d need both the x and y -coordinates).
  • Generalized coordinates allow different quantities to be expressed easily in a more general form (generalized velocity, generalized momentum, generalized forces etc.).

Down below I’ve included an example of how generalized coordinates are actually used, which should hopefully bring some clarity on this.

I actually have a full article discussing generalized coordinates in detail and how to use them (as well as examples of this), which you’ll find here. I highly recommend checking it out, in case you want to build a deeper understanding of Lagrangian mechanics.

Also, there is a really useful method for finding constraint forces (such as the tension in pendulum rod) using so-called Lagrange multipliers. I have a full article on this that you’ll find here.

Practical Example: Planetary Motion Using Generalized Coordinates (click to see more)

Here, we’re going to find the equations of motion for a planet (say, the Earth) orbiting the Sun (or whatever other star or planet).

Now, planets generally travel in elliptical orbits, so here we’re also going to allow for that. This is essentially what we have then:

Here’ I’ve used basic trigonometry to write x and y in terms of the radius and angle (these are also known as polar coordinates). Also, note that I’ve drawn the orbit as a circle here, but if we allow for the distance r to also vary with time, then we’ll end up with some sort of elliptical orbits in general.

In this case, since we’re talking about a rotationally symmetric, using polar coordinates (r and θ) will be the best choice. So, essentially, we now have two generalized coordinates (q’s), which are:

q_1=r{,}\ q_2=\theta

Firstly, we’ll want to express the Lagrangian in Cartesian coordinates and then transfer to our generalized coordinates, since this is usually the easier and more surefire method:

L=\frac{1}{2}m\left(\dot x^2+\dot y^2\right)-V

Now let’s look at the relationships between Cartesian and polar coordinates (as given in the picture above):

x=r\cos\theta\ \ \ \ \ y=r\sin\theta

From these relations, we can then convert the Lagrangian into polar coordinate form and express it in terms of the generalized coordinates we chose for this problem (r and θ).

This is a fairly simple calculation to do, but it is a bit long. Essentially, you’ll just get a lot of cancellation of these trigonometric functions and you’ll get something quite simple at the end.

If you want to see that in more detail, you can watch this video that shows exactly how it is done:

What you’ll get the Lagrangian to be is:

This θ with a dot above it is simply the angular velocity (shorthand for dθ/dt).

The potential energy term (V) is just the gravitational potential energy:


So, all in all, our Lagrangian for the Earth is:


Now, see what we’ve done here? We now have the Lagrangian expressed only in terms of the generalized coordinates r and θ. So, basically we now have two coordinates and we’ll get two Euler-Lagrange equations.

The first Euler-Lagrange equation is for the coordinate r:

\frac{d}{dt}\frac{\partial L}{\partial\dot{r}}=\frac{\partial L}{\partial r}

Plugging in the Lagrangian, we get:

\frac{d}{dt}\frac{\partial}{\partial\dot{r}}\left(\frac{1}{2}m\left(\dot{r}^2+r^2\dot{\theta}^2\right)+\frac{GMm}{r}\right)=\frac{\partial}{\partial r}\left(\frac{1}{2}m\left(\dot{r}^2+r^2\dot{\theta}^2\right)+\frac{GMm}{r}\right)
\frac{d}{dt}\left(\frac{1}{2}m\cdot2\dot{r}\right)=\frac{\partial}{\partial r}\left(\frac{1}{2}mr^2\dot{\theta}^2+\frac{GMm}{r}\right)\ \ \ \Rightarrow\ \ \ \frac{d}{dt}m\dot{r}=mr\dot{\theta}^2-\frac{GMm}{r^2}

Here, we take the time derivative of the left side, which basically just adds another dot above the r. We can also cancel out m from both sides and we’re left with:


Now, we also have an Euler-Lagrange equation for the coordinate θ:

\frac{d}{dt}\frac{\partial L}{\partial\dot{\theta}}=\frac{\partial L}{\partial\theta}

Plugging in the Lagrangian here, we have:


Here comes an interesting part. Since the Lagrangian doesn’t involve the angle θ by itself at all (it only has the angular velocity), the right hand side will be zero and we get:

\frac{d}{dt}\left(\frac{1}{2}m\cdot2r^2\dot{\theta}\right)=0\ \ \ \Rightarrow\ \ \ \frac{d}{dt}mr^2\dot{\theta}=0
If you know something about rotational mechanics, this equation is actually the conservation of angular momentum.

We then have the equations of motion for this problem:


If we integrate the second equation with respect to time, we get this thing to be a constant (let’s denote it by l; it is the angular momentum):


Here, we can solve for theta-dot and plug it into the first equation and get:

\dot{\theta}=\frac{\ell}{mr^2}\ \ \ \Rightarrow\ \ \ \ \ddot{r}=\frac{\ell^2}{m^2r^3}-\frac{GM}{r^2}

Here we have the equation of motion for the Earth (the angular momentum is simply some constant, since it is conserved).

In case you’re interested in seeing how exactly this equation of motion relates to elliptic orbits (and also Kepler’s laws), I have a free downloadable PDF (available here) that covers exactly this and some other examples as well.

Quick tip: To build the mathematical skills necessary for Lagrangian mechanics, I’d highly recommend checking out my Advanced Math For Physics: A Complete Self-Study Course. This course will teach you ALL the advanced math you need to know – regardless of your previous knowledge – through lessons that focus on intuitive understanding, step-by-step physics examples and worksheets with tons of practice problems.

Generalized Momentum

As you start using the Euler-Lagrange equation, there are clear patterns that you might notice start showing up.

The most interesting of these is one of the terms in the Euler-Lagrange equation, which always somehow happens to give a momentum-like quantity. This term is, in fact, the definition for generalized momentum:

Generalized momentum is also sometimes called canonical momentum.

When you get into more advanced mechanics, regular momentum (also sometimes called kinetic momentum) is not going to be enough anymore.

Instead, we have this thing called generalized momentum, denoted by pi (i here represents the fact that each generalized momentum pi is always associated with a certain generalize coordinate qi in the system):

p_i=\frac{\partial L}{\partial\dot{q}_i}

What is this generalized momentum actually useful for, though? Well, the first reason is that it allows us to quickly identify the different momenta in a system, pretty much with the following statement:

If the Lagrangian has a time derivative of some generalized coordinate qi, then there must exist a generalized momentum pi associated with the coordinate qi.

Down below I’ve included some examples of what these generalized momenta may look like and how they are obtained from the Lagrangian (note that this definition is valid even outside of classical mechanics too).

Examples of Generalized Momenta (click to see more)

The first example of generalized momentum is going to be a simple one. consider the following Lagrangian (this is the Lagrangian for a free particle, i.e. no potential energy term, moving in the x,y -plane):

L=\frac{1}{2}m\left(\dot x^2+\dot y^2\right)

Here we have two different generalized coordinates, x and y. For each of them, we have a generalized momentum:

p_x=\frac{\partial L}{\partial\dot{x}}=\frac{\partial}{\partial\dot{x}}\left(\frac{1}{2}m\left(\dot{x}^2+\dot{y}^2\right)\right)=m\dot x
p_y=\frac{\partial L}{\partial\dot{y}}=\frac{\partial}{\partial\dot{y}}\left(\frac{1}{2}m\left(\dot{x}^2+\dot{y}^2\right)\right)=m\dot{y}

There are, of course, the usual components of the momentum. Indeed, when the Lagrangian has a kinetic energy of the usual 1/2mv2 -form, the generalized momentum will have the simple form p=mv.

Now, consider the Lagrangian for a particle in polar coordinates (this is from the last example, except we’re dropping the potential energy term since it doesn’t involve any velocity term anyway):


Here, we have the generalized coordinates r and θ, so we’ll have a generalized momentum for each of them:

p_r=\frac{\partial L}{\partial\dot{r}}=\frac{\partial}{\partial\dot{r}}\left(\frac{1}{2}m\left(\dot{r}^2+r^2\dot{\theta}^2\right)\right)=m\dot{r}
p_{\theta}=\frac{\partial L}{\partial\dot{\theta}}=\frac{\partial}{\partial\dot{\theta}}\left(\frac{1}{2}m\left(\dot{r}^2+r^2\dot{\theta}^2\right)\right)=mr^2\dot{\theta}

The first one (pr) is simply the ordinary momentum again (p=mv), since r is the position of the particle.

The second term (pθ) is more interesting; it is the angular momentum. Indeed, if you’re using polar coordinates, the generalized momentum associated with the coordinate θ will be the angular momentum.

Here, you might see how this generalized momentum is actually quite useful; it allows us to define the momentum in an extremely general way. If you’re not convinced yet, let’s do one more example, one that’s actually outside of classical mechanics.

Lagrangian mechanics can indeed be used in special relativity too, but the Lagrangian for that is not T-V, it rather looks something like this (this Lagrangian is explained in my introduction to special relativity):

L=-mc^2\sqrt{1-\frac{\dot r^2}{c^2}}
The r-dot here is the time derivative of the position vector, i.e. the total velocity.

The generalized momentum for this is:

p_r=\frac{\partial L}{\partial\dot{r}}=\frac{\partial}{\partial\dot{r}}\left(-mc^2\sqrt{1-\frac{\dot{r}^2}{c^2}}\right)=\frac{m\dot r}{\sqrt{1-\frac{\dot{r}^2}{c^2}}}

This, if you know anything about special relativity, is the usual formula for the momentum of a relativistic particle (i.e. one that’s traveling close to the speed of light).

Another particularly useful thing about the generalized momentum is that it allows us to generalize the notion of momentum to many different cases where the usual p=mv simply does not work anymore.

This I already showed an example of above, which allowed us to easily derive the formula for relativistic momentum (you’ll also find more about information about it in this article).

Generalized Forces

Just like these are generalized momenta, there are also things called generalized forces.

Now, these aren’t directly expressed through the Lagrangian, but they are expressed by using generalized coordinates (that’s kind of like the whole point of generalized coordinates; to express laws of motion using them).

The generalized forces are defined as (denoted by Q’s with the i-index being associated with the particular generalized coordinate qi):

The generalized forces are really just the usual Newtonian forces, but transformed to generalized coordinates, which we wish to use in Lagrangian mechanics.

Now, this may seem a little abstract at the moment and you may also ask; why do we even need these generalized forces if Lagrangian mechanics is all about using energies?

Well, the answer is that we don’t (usually). Sure, generalized forces allow us to quite easily specify forces using generalized coordinates (if we wish to know only the forces), but in most cases, the Euler-Lagrange equation will work just as well.

The only exception to this is if we want to incorporate things like friction into Lagrangian mechanics (friction being a force that can’t be derived from a potential energy, i.e. a non-conservative force as I explain in this article).

For friction and non-conservative forces in general, we have to add them manually into the Euler-Lagrange equations as generalized forces (the generalized friction forces I’ll denote by Qif) like this:

\frac{d}{dt}\frac{\partial L}{\partial\dot{q}_i}=\frac{\partial L}{\partial q_i}+Q_i^f

Now, the way these friction forces are dealt with in Lagrangian mechanics is by using something something called a dissipation function, which essentially accounts for the energy “lost” from friction.

I explain everything about how to incorporate friction into Lagrangian mechanics and also show a bunch of useful examples in this article.

Another useful application of generalized forces is for finding constraint forces (like tension or the normal force of a surface), which uses the Lagrange multiplier method. You can read more about it here.

Also, generalized forces actually allow for another formulation of Lagrangian mechanics (it’s practically just a different way to derive the Euler-Lagrange equation), which doesn’t use the principle of stationary action.

Instead, it uses something called the principle of virtual work and d’Alembert’s principle to basically derive Lagrangian mechanics.

The mathematics of this is a little more abstract and not really important for now, so I’ll just state that this formulation exists, but I won’t go over it now.

Scalars vs Vectors

In the Lagrangian formulation of classical mechanics, everything is described by just the kinetic and potential energy and those can both be fit nicely into just one equation, the Lagrangian.

The usefulness of this becomes explicitly clear when comparing it to the formulas for different forces, where you just have a bunch of different stuff that at first sight, don’t even seem to be connected in any obvious way.

In Lagrangian mechanics, it’s different, because everything is clearly connected to just a few concepts; namely the concepts of energy and action, the Lagrangian and the principle of stationary action. These are then all brought together by the Euler-Lagrange equation.

Another nice thing about Lagrangian mechanics and the fact that we’re only using energies instead of forces, is the fact that forces are vector quantities, while energies are scalar quantities.

What this means, is that forces always have a direction and a magnitude, while energies only have a magnitude (in the elementary sense; in relativity, this won’t be enough as a definition).

This is a clear advantage of using energies instead of forces, because it just eliminates a lot of hassle, like having to break the forces down into their vector components or having to worry about calculating dot products of forces, angles between the vectors etc.

Applications of Lagrangian Mechanics To Modern Physics

Now, using Lagrangian mechanics to find equations of motion for different systems is interesting and all, but really the importance of this formulation isn’t given enough justice in the classical context.

The Lagrangian formulation is, in fact, the cornerstone of a lot of modern physics and it actually underlies almost every theory we know so far (this isn’t even an exaggeration).

The real reason for this is that the principle of stationary action just happens to apply to fields as well, so it is pretty much the basis for most field theories.

On the other hand, almost all modern theories of physics are some sort of field theories (general relativity, quantum field theory, electromagnetism etc. are all field theories). This makes the action principle fundamental to pretty much everything.

Now, instead of there being a simple Lagrangian for fields, there is something called Lagrangian density (denoted by a curly L). The Lagrangian density is a function of the field and its first derivatives (just like the ordinary Lagrangian is a function of position and velocity):

\mathscr{L}=\mathscr{L}\left(\phi{,}\ \partial_{\mu}\phi\right)
This ∂µ is called the 4-gradient (i.e. the relativistic equivalent to a regular gradient, which I explain in this article), which is simply a derivative w.r.t both space and time (since the field depends on both space and time).

The action for a field is then this Lagrange density integrated, not over time, but over spacetime (this we denote as d4x). This action should also be stationary (i.e. δA=0):

\delta A=\delta\int_{ }^{ }\mathscr{L}\left(\phi{,}\ \partial_{\mu}\phi\right)d^4x=0
This is the principle of stationary action, but applied to a field.

Now, if this went over your head, don’t worry. The main point here is that the principle of stationary action is used all over modern physics.

For example, the Einstein field equations of general relativity are derived from something called the Einstein-Hilbert action, which is then required to be stationary. I talk more about this in my introduction to general relativity.

Even the famous equation E=mc2 can actually be derived as a consequence of Lagrangian mechanics, Hamiltonian mechanics and special relativity combined. I show how this is done in my introduction to special relativity.

Examples & Applications of Lagrangian Mechanics (Free PDF)

Below, you’ll find some examples that hopefully illustrate the applications of Lagrangian mechanics in practice (it’s a free PDF, feel free to download it for yourself).

Get the free PDF here.

In the PDF, we’re going to look at for example, finding the Lagrangian and the equations of motion for systems like the simple pendulum and the spherical pendulum. We also analyze the behaviour of these systems.

However, the most interesting example covered is the Kepler problem using Lagrangian mechanics.

The Kepler problem is one of the most foundational physics problems, perhaps, of all time and it has to do with solving for the motion of two massive bodies (such as planets) orbiting each other under the influence of gravity.

The results we obtain from the Lagrangian mechanics approach are then used to derive the orbit equation, which explains why planetary orbits are elliptical, as well as various other physical results like Kepler’s three laws.

Also, in case this article has been helpful and you’d like to download it as a PDF for yourself (or even print out), you can get a PDF version of this article here.

Where To Learn More About Lagrangian Mechanics? (Recommended Resources)

If this article was interesting and you wish to learn more about Lagrangian mechanics and the actual depths of this formulation, the next step to do is to look for other resources.

Now, before actually studying Lagrangian mechanics, it is worth noting that Lagrangian mechanics is NOT easy. This article only scratched the surface of what Lagrangian mechanics is really all about.

In the past, I used to just tell people that they can learn Lagrangian mechanics just from reading internet articles or watching Youtube videos on it. While this is possible for some people, I’ve come to realize that this is NOT the best way to go about it.

For most people, they would actually be able to learn Lagrangian (and Hamiltonian) mechanics much faster and more deeply if they had a dedicated and complete resource for it.

Of course, you’re free to pick any resource you want, but if you want my recommendation, then my new book, Lagrangian Mechanics For The Non-Physicist (link to the homepage of the book), is something you’ll probably love. This is the kind of book I personally would have wished to have when starting out learning physics.

The book will first cover basic Newtonian mechanics and also touch on some of the issues with Newton’s laws as a motivation for introducing Lagrangian mechanics.

The book then has an entire chapter on variational calculus, the area of mathematics that Lagrangian mechanics is based on, which will teach you the basic mathematical tools and how to apply them to Lagrangian mechanics.

After this, the book dives deep into various aspects of Lagrangian mechanics like generalized coordinates, momenta and forces, velocity-dependent potentials, constrained dynamics, dissipation functions, gauge transformations, symmetries, conservation laws as well as how to solve Lagrangian mechanics problems in the most efficient way.

Basically, the book aims to teach Lagrangian mechanics as a framework that can then be applied to various areas of modern physics. Everything is explained as intuitively as possible and each chapter will look at tons of examples to illustrate how the concepts covered are applied in practice.

Now, if this book isn’t something you’re interested in, you may also benefit from some of my other articles that are quite closely related to Lagrangian mechanics. Below I’ve included a list of a bunch of these.

  • This article on Hamiltonian mechanics covers another formulation of classical mechanics that is closely related to Lagrangian mechanics. In this article, the Lagrangian is also used to find a general expression for energy, the Hamiltonian.
  • If you want to learn more about generalized coordinates and what actually makes Lagrangian mechanics so useful, I recommend reading this article.
  • For more on using constraints in Lagrangian mechanics and the Lagrange multiplier method, you may want to read this article.
  • An interesting example of where the Lagrangian has a different form than the usual T-V comes from special relativity. You can read more about this in my article Special Relativity For Dummies.
  • I also have a couple articles comparing different formulations of classical mechanics, such as this one comparing Hamiltonian mechanics to Lagrangian mechanics and this one comparing Lagrangian mechanics to Newtonian mechanics.
  • For an interesting practical application of Lagrangian mechanics, check out this article, where I derive the trajectories of light passing by a star and how this leads to the deflection of a light ray (as predicted by general relativity).

Ville Hirvonen

I'm the founder of Profound Physics, a website I created to help especially those trying to self-study physics as that is what I'm passionate about doing myself. I like to explain what I've learned in an understandable and laid-back way and I'll keep doing so as I learn more about the wonders of physics.

Recent Posts