# Lagrangian mechanics

Joseph-Louis Lagrange (1736—1813)

Lagrangian mechanics is a reformulation of classical mechanics, introduced by the Italian-French mathematician and astronomer Joseph-Louis Lagrange in 1788.

In Lagrangian mechanics, the trajectory of a system of particles is derived by solving the Lagrange equations in one of two forms, either the Lagrange equations of the first kind,[1] which treat constraints explicitly as extra equations, often using Lagrange multipliers;[2][3] or the Lagrange equations of the second kind, which incorporate the constraints directly by judicious choice of generalized coordinates.[1][4] In each case, a mathematical function called the Lagrangian is a function of the generalized coordinates, their time derivatives, and time, and contains the information about the dynamics of the system.

No new physics is introduced by Lagrangian mechanics; it is actually less general than Newtonian mechanics.[5] Newton's laws can include non-conservative forces like friction, however they must include constraint forces explicitly and are best suited to Cartesian coordinates. Lagrangian mechanics is ideal for systems with conservative forces and for bypassing constraint forces, and some (not all) non-conservative forces, in any coordinate system. Generalized coordinates can be chosen by convenience, to exploit symmetries in the system or the geometry of the constraints, which considerably simplifies describing the dynamics of the system. Lagrangian mechanics also reveals conserved quantities and their symmetries in a direct way, although only as a special case of Noether's theorem. The theory connects with the principle of stationary action,[6] although Lagrangian mechanics is less general because it is restricted to equilibrium problems.[7] Also, Lagrangian mechanics can only be applied to systems with holonomic constraints, because the formulation does not work for Nonholonomic constraints. Three examples[8] are when the constraint equations are nonintegrable, when the constraints have inequalities, or with complicated non-conservative forces like friction. Nonholonomic constraints require special treatment, and one may revert to Newtonian mechanics, or use other methods.

The Lagrangian formulation of mechanics is important not just for its broad applications, but also for its role in advancing deep understanding of physics. Although Lagrange only sought to describe classical mechanics, Hamilton's principle that can be used to derive the Lagrange equation was later recognized to be applicable to much of theoretical physics as well. In quantum mechanics, action and quantum-mechanical phase are related via Planck's constant, and the principle of stationary action can be understood in terms of constructive interference of wave functions. If the Lagrangian is invariant under a symmetry, then the resulting equations of motion are also invariant under that symmetry. This characteristic is very helpful in showing that theories are consistent with either special relativity or general relativity. The action principle, and the Lagrangian formalism, are tied closely to Noether's theorem, which connects physical conserved quantities to continuous symmetries of a physical system. Lagrangian mechanics and Noether's theorem together yield a natural formalism for first quantization by including commutators between certain terms of the Lagrangian equations of motion for a physical system.

Lagrangian mechanics is widely used to solve mechanical problems in physics and engineering when Newton's formulation of classical mechanics is not convenient. Lagrange's equations are also used in optimisation problems of dynamic systems. In mechanics, Lagrange's equations of the second kind are used much more than those of the first kind.

## Motivation

Bead constrained to move on a frictionless wire. The wire exerts a reaction force C on the bead to keep it on the wire. The non-constraint force N in this case is gravity. Notice the initial position of the wire can lead to different motions.
Simple pendulum. Since the rod is rigid, the position of the bob is constrained according to the equation f(x, y) = 0, the constraint force C is the tension in the rod. Again the non-constraint force N in this case is gravity.
A double pendulum consists of two simple pendulums attached end to end. There is a constraint for each pendulum bob.
Spherical pendulum: angles and velocities.

The strength of Lagrangian mechanics is its ability to handle constrained mechanical systems. The following examples motivate the need for the concepts and terminology used to handle such systems.

For a bead sliding on a frictionless wire subject only to gravity in 2d space, the constraint on the bead can be stated in the form f(r) = 0, where the position of the bead can be written r = (x(s), y(s)), in which s is a parameter, the arc length s along the curve from some point on the wire. Only one coordinate is needed instead of two, because the position of the bead can be parameterized by one number, s, and the constraint equation connects the two coordinates x and y; either one is determined from the other. The constraint force is the reaction force the wire exerts on the bead to keep it on the wire, and the non-constraint applied force is gravity acting on the bead.

Suppose the wire changes its shape with time, by flexing. Then the constraint equation is f(r, t) = constant, where the position of the bead r = (x(s, t), y(s, t)) now depends on time t due to the changing coordinates as the wire changes its shape. Notice time appears implicitly via the coordinates, and explicitly in the constraint equations.

Another interesting 2d example is the chaotic double pendulum, again subject to gravity. The length of one pendulum is l1 and the length of the other is l2. Each pendulum bob has a constraint equation, f(r1) = x12 + y12l12 = 0, in which r1 = (x1(θ1), y1(θ1)) is the position of bob 1, and θ1 is the angle of pendulum 1 from some reference direction. Likewise for bob 2, f(r2) = x22 + y22l22 = 0, where r2 = (x2(θ2), y2(θ2)) is its position, and θ2 is the angle of pendulum 2 from some reference direction (not necessarily the same as pendulum 1). Each pendulum can be described by one coordinate since the constraint equation for each connects the two spatial coordinates.

For a 3d example, a spherical pendulum with constant length l free to swing in any angular direction subject to gravity, the constraint on the pendulum bob can be stated in the form f(r) = |r|2l2 = x2 + y2 + z2l2 = 0. The position of the pendulum bob can be written r = (x(θ, φ), y(θ, φ), z(θ, φ)), in which (θ, φ) are the spherical polar angles because the bob moves in the surface of a sphere. A logical choice of variables to describe the motion are the angles (θ, φ). Notice only two coordinates are needed instead of three, because the position of the bob can be parameterized by two numbers, and the constraint equation connects the three coordinates x, y, z so any one of them is determined from the other two.

For N particles in 3d space, the position vector of each particle can written as a 3-tuple in Cartesian coordinates

$\mathbf{r}_1 = (x_1,y_1,z_1) \,, \quad \mathbf{r}_2 = (x_2,y_2,z_2) \,, \ldots \,, \mathbf{r}_N = (x_N,y_N,z_N)\,,$

so overall, there are 3N coordinates to define the configuration of the system. If each particle is subject to one or more holonomic constraints, described by a constraint equation of the form f(rk, t) = 0 for particle k (where k = 1, 2, ..., N), then at any instant of time the position coordinates of that particle are linked together and not independent. If there are C constraints in the system, then each has a constraint equation and C coordinates can be eliminated using these constraint equations. The number of independent coordinates is therefore n = 3NC. We can transform each position vector to a common set of n generalized coordinates, conveniently written as an n-tuple q = (q1, q2, ... qn), according to rk = rk(q, t) = (xk(q, t), yk(q, t), zk(q, t), t).

The time derivatives of the generalized coordinates are called the generalized velocities, and for each particle the transformation of its velocity vector, the total derivative of its position with respect to time, is

$\mathbf{v}_k = \frac{d\mathbf{r}_k}{dt} = \left(\frac{dx_k}{dt},\frac{dy_k}{dt},\frac{dz_k}{dt}\right)\,, \quad \dot{q}_j = \frac{dq_j}{dt} \,, \quad \mathbf{v}_k = \dot{\mathbf{r}}_k = \sum_{j=1}^n \frac{\partial \mathbf{r}_k}{\partial q_j}\dot{q}_j +\frac{\partial \mathbf{r}_k}{\partial t}\,,$

(each overdot indicates a time derivative).

In the previous examples, if one tracks each of the massive objects as a particle (bead, pendulum bob, etc.), calculation of the motion of the particle using Newtonian mechanics would require solving for the time-varying constraint force required to keep the particle in the constrained motion (reaction force exerted by the wire on the bead, or tension in the pendulum rods). For the same problem using Lagrangian mechanics, one looks at the path the particle can take and chooses a convenient set of independent generalized coordinates that completely characterize the possible motion of the particle. This choice eliminates the need for the constraint force to enter into the resultant system of equations. There are fewer equations since one is not directly calculating the influence of the constraint on the particle at a given moment.

## Definition of the Lagrangian (non-relativistic)

The central quantity of Lagrangian mechanics is the Lagrangian, a function which summarizes the dynamics of the entire system. Overall, the Lagrangian has no single expression for all physical systems. Any function which generates the correct equations of motion from the Euler–Lagrange equations, in agreement with physical laws, can be taken as a Lagrangian. However, it is possible to construct general expressions for large classes of applications.

The non-relativistic Lagrangian for a system of particles can be defined by[9]

$L = T - V \,,$

where T is the total kinetic energy of the system, and V the potential energy of the system. The dimension of the Lagrangian is the same as energy.

The total kinetic energy of the system is the energy of the system's motion, defined as[10]

$T = \frac {1}{2} \sum_{k=1}^N m_k \dot{\mathbf{r}}_k \cdot \dot{\mathbf{r}}_k\,,$

in which · is the dot product. The kinetic energy is a function only of the velocities vk, not the coordinates rk nor time t, so T = T(dr1/dt, dr2/dt, ...). By contrast, the above expression for velocity shows the kinetic energy in generalized coordinates depends on the generalized velocities, coordinates, and time if the constraint also varies with time, so T = T(q, dq/dt, t).

The potential energy V of the system reflects the energy of interaction between the particles, i.e. how much energy any one particle will have due to all the others and other external influences. For conservative forces, it is a function of the position vectors of the particles only, so V = V(r1, r2, ...). For those non-conservative forces which can be derived from an appropriate potential, the velocities will appear also, V = V(r1, r2, ..., v1, v2, ...). If there is some external field changing with time, or external driving force, the potential will change with time, so most generally V = V(r1, r2, ..., v1, v2, ..., t).

If the potential or kinetic energy, or both, depend explicitly on time due to time-varying constraints or external influences, the Lagrangian L(q, dq/dt, t) is explicitly time-dependent. If neither the potential nor the kinetic energy depend on time, then the Lagrangian L(q, dq/dt) is explicitly independent of time. In either case, the Lagrangian will always have implicit time-dependence through the generalized coordinates.

Even more generally, in addition to the Lagrangian, it is sometimes possible to introduce another function to account for dissipative forces. In relativistic mechanics, L needs more subtle attention, because it is not the difference between kinetic and potential energy. These cases are detailed later.

## Equations of motion

Although the equations of motion include partial derivatives denoted by ∂/∂, they are still ordinary differential equations in the position coordinates of the particles. The total time derivative denoted d/dt may involve implicit differentiation. By solving the equations, subject to the initial values of the positions and velocities, will give the positions of the particles as functions of time, and one can see how the system evolves.

### Lagrange's equations of the first kind

Lagrange introduced an analytical method for finding stationary points using the method of Lagrange multipliers, and also applied it to mechanics.

If a system of N particles in 3d is subject to C holonomic constraints, given by the equations f1, f2,..., fC, and the dynamics given by a Lagrangian L(r, dr/dt, t), Lagrange's equations of the first kind are[11]

 Lagrange's equations (First kind) $\frac{\partial L}{\partial \mathbf{r}_k} - \frac{d}{dt}\frac{\partial L}{\partial \dot{\mathbf{r}}_k} + \sum_{i=1}^C \lambda_i\frac{\partial f_i}{\partial \mathbf{r}_k }=0$

where k = 1, 2, ..., N labels the particles, there is a Lagrange multiplier λi for each constraint equation fi, and

$\frac{\partial}{\partial \mathbf{r}_k} \equiv \left(\frac{\partial}{\partial x_k},\frac{\partial}{\partial y_k},\frac{\partial}{\partial z_k}\right)\,,\quad \frac{\partial}{\partial \dot{\mathbf{r}}_k} \equiv \left(\frac{\partial}{\partial \dot{x}_k},\frac{\partial}{\partial \dot{y}_k},\frac{\partial}{\partial \dot{z}_k}\right)$

are each shorthands for a vector of derivatives with respect to the indicated variables (not a derivative with respect to the entire vector).[nb 1]

This procedure does increase the number of equations to solve compared to Newton's laws, from 3N to 3N + C, because there are 3N coupled second order differential equations in the position coordinates and multipliers, plus C constraint equations. However, when solved alongside the position coordinates of the particles, the multipliers can yield information about the constraint forces. The coordinates do not need to be eliminated by solving the constraint equations.

### Lagrange's equations of the second kind

The Euler–Lagrange equations, or Lagrange's equations of the second kind[12][13]

 Lagrange's equations (Second kind) $\frac{d}{dt} \left ( \frac {\partial L}{\partial \dot{q}_j} \right ) = \frac {\partial L}{\partial q_j}$

are mathematical results from the calculus of variations, which can also be used in mechanics. Substituting in the Lagrangian L(q, dq/dt, t), gives the equations of motion of the system.

The number of equations has decreased compared to Newtonian mechanics, from 3N to n = 3NC coupled second order differential equations in the generalized coordinates. These equations do not include constraint forces at all, only non-constraint forces need to be accounted for.

## From Newtonian to Lagrangian mechanics

### Newton's laws

Isaac Newton (1642—1726)

For simplicity, Newton's laws can be illustrated for one particle without much loss of generality (for a system of N particles, all of these equations apply to each particle in the system). The equation of motion for particle of mass m is Newton's second law of 1687, in modern vector notation

$\mathbf{F} = m \mathbf{a} \,,$

where a is its acceleration and F the resultant force acting on it. In three spatial dimensions, this is a system of three coupled second order ordinary differential equations to solve, since there are three components in this vector equation. The solutions are the position vectors r of the particles at time t, subject to the initial conditions of r and v when t = 0.

Newton's laws are easy to use in Cartesian coordinates, but Cartesian coordinates are not always convenient, and for other coordinate systems the equations of motion can become complicated. In curvilinear coordinates ξ = (ξ1, ξ2, ξ3), which are not the same as the Cartesian coordinates r = (x, y, z) nor generalized coordinates q, the law in tensor index notation is[14][15]

$F^a = m \left( \frac{d^2 \xi^a}{dt^2} + \Gamma^a {}_{bc} \frac{d\xi^b}{dt}\frac{d\xi^c}{dt} \right) = \frac{d}{dt} \frac{\partial T}{\partial \dot{\xi}^a} - \frac{\partial T}{\partial \xi^a} \,, \quad \dot{\xi}^a \equiv \frac{d \xi^a }{dt} \,,$

where Fa is the ath contravariant components of the resultant force acting on the particle, Γabc are the Christoffel symbols of the second kind,

$T = \frac{1}{2} m g_{bc} \frac{d \xi^b}{dt} \frac{d \xi^c}{dt} \,,$

is the kinetic energy of the particle, and gbc the covariant components of the metric tensor of the curvilinear coordinate system. All the indices a, b, c, each take the values 1, 2, 3.

It may seem like an overcomplication to cast Newton's law in this form, but there is an advantage. If there is no resultant force acting on the particle, F = 0, it does not accelerate, but moves with constant velocity in a straight line. Mathematically, the solutions of the differential equation are the curves of shortest length between two points in space. These curves are called geodesics; in flat 3d real space the geodesics are simply straight lines. So for a free particle, Newton's second law coincides with the geodesic equation, and states free particles follow geodesics, the shortest trajectories it can move along. If the particle is subject to forces, F0, the particle accelerates due to forces acting on it, and deviates away from the geodesics it would follow if non-interacting.

The idea of finding the shortest path a particle can follow motivated the first applications of the calculus of variations to mechanical problems, such as the Brachistochrone problem solved by Jean Bernoulli in 1696, as well as Leibniz, Daniel Bernoulli, and L'Hôpital around the same time, and a year later when Newton heard of the problem, he solved it the following day.[16] Newton himself was thinking along the lines of the variational calculus, but did not publish.[17] These ideas in turn lead to the variational principles of mechanics, of Fermat, Maupertuis, Euler, Hamilton, and others. With appropriate extensions of the quantities given here in flat 3d space to 4d curved spacetime, the above form of Newton's law also carries over to Einstein's general relativity, in which case free particles follow geodesics in curved spacetime that are no longer "straight lines" in the ordinary sense.[18]

In addition, the acceleration components in terms of the Christoffel symbols can be replaced by derivatives of the kinetic energy, a scalar invariant which takes the same value in all frames of reference, and is easier to calculate with. However, we still need to know the total resultant force F acting on the particle, which in turn requires the resultant non-constraint force N plus the resultant constraint force C,

$\mathbf{F} = \mathbf{C} + \mathbf{N} \,.$

The constraint forces can be complicated, since they will generally depend on time. Also, if there are constraints, the curvilinear coordinates are not independent but related by one or more constraint equations.

The constraint forces can either be eliminated from the equations of motion so only the non-constraint forces remain, or included by including the constraint equations in the equations of motion.

### D'Alembert's principle

Jean d'Alembert (1717—1783)
One degree of freedom.
Two degrees of freedom.
Constraint force C and virtual displacement δr for a particle of mass m confined to a curve. The resultant non-constraint force is N.

A fundamental result in analytical mechanics is D'Alembert's principle, introduced in 1708 by Jacques Bernoulli to understand static equilibrium, and developed by D'Alembert in 1743 to solve dynamical problems.[19] The principle asserts for N particles[10]

$\sum_{k=1}^N ( \mathbf {N}_k + \mathbf {C}_k - m_k \mathbf{a}_k )\cdot \delta \mathbf{r}_k = 0\,.$

The δrk are virtual displacements, by definition they are infinitesimal changes in the configuration of the system consistent with the constraint forces acting on the system at an instant of time,[20] i.e. in such a way that the constraint forces maintain the constrained motion. They are not the same as the actual displacements in the system, which are caused by the resultant constraint and non-constraint forces acting on the particle to accelerate and move it.[nb 2] Virtual work is the work done along a virtual displacement for any force (constraint or non-constraint).

Since the constraint forces act perpendicular to the motion of each particle in the system to maintain the constraints, the total virtual work by the constraint forces acting on the system is zero;[21]

$\sum_{k=1}^N \mathbf {C}_k \cdot \delta \mathbf{r}_k = 0\,,$

so that

$\sum_{k=1}^N (\mathbf {N}_k - m_k \mathbf{a}_k ) \cdot \delta \mathbf{r}_k = 0\,.$

Thus D'Alembert's principle allows us to concentrate on only the applied non-constraint forces, and exclude the constraint forces in the equations of motion.[22][23] The form shown is also independent of the choice of coordinates. However, it is not readily usable to set up the equations of motion and solve for the motion of the system; therefore equations of motion in a set of independent coordinates are sought for.

### Equations of motion from D'Alembert's principle

The components of the virtual displacements δri are not independent but related by a constraint equation. Since the generalized coordinates are independent, we can avoid the complications with the δrk by converting to virtual displacements in the generalized coordinates. These are related in the same form as a total differential,[24]

$\delta \mathbf{r}_k = \sum_{j=1}^n \frac {\partial \mathbf{r}_k} {\partial q_j} \delta q_j \,.$

There is no partial time derivative with respect to time multiplied by a time increment, since this is a virtual displacement, one along the constraints in an instant of time.

The first term in D'Alembert's principle above is the virtual work done by the non-constraint forces in terms of the position coordinates rk, and can without loss of generality be converted to the generalized analogues by the definition of generalized forces

$Q_j = \sum_{k=1}^N \mathbf {N}_k \cdot \frac {\partial \mathbf{r}_k} {\partial q_j} \,,$

so that

$\sum_{k=1}^N \mathbf{N}_k \cdot \delta \mathbf{r}_k = \sum_{k=1}^N \mathbf {N}_k \cdot \sum_{j=1}^n \frac {\partial \mathbf{r}_i} {\partial q_j} \delta q_j = \sum_{j=1}^n Q_j \delta q_j \,.$

This is half of the conversion to generalized coordinates. It remains to convert the acceleration term into generalized coordinates, which is not immediately obvious. Recalling the Lagrange form of Newton's second law, the partial derivatives of the kinetic energy with respect to the generalized coordinates and velocities can be found to give the desired result;[25]

$\sum_{i=1}^N m_i \mathbf{a}_i \cdot \frac {\partial \mathbf{r}_i}{\partial q_j} = \frac{d}{dt}\frac{\partial T}{\partial \dot{q}_j} - \frac{\partial T}{\partial q_j} \,.$

Now D'Alembert's principle is now in the generalized coordinates as required,

$\sum_{j=1}^n \left[ Q_j - \left(\frac{d}{dt}\frac{\partial T}{\partial \dot{q}_j} - \frac{\partial T}{\partial q_j} \right) \right] \delta q_j = 0 \,,$

and since these virtual displacements δqj are independent and nonzero, the coefficients can be equated to zero, resulting in Lagrange's equations[26][27] or the generalized equations of motion,[28]

$Q_j = \frac{d}{dt}\frac{\partial T}{\partial \dot{q}_j} - \frac{\partial T}{\partial q_j}$

These equations are equivalent to Newton's laws for the non-constraint forces. The generalized forces in this equation are derived from the non-constraint forces only - the constraint forces they have been excluded from D'Alembert's principle and do not need to be found. The generalized forces may be non-conservative, provided they satisfy D'Alembert's principle.[29]

### Euler–Lagrange equations and Hamilton's principle

As the system evolves, q traces a path through configuration space (only some are shown). The path taken by the system (red) has a stationary action (δS = 0) under small changes in the configuration of the system (δq).[30]

For a non-conservative force which depends on velocity, it may be possible to find a potential energy function V that depends on positions and velocities. If the generalized forces Qi can be derived from a potential V such that[31][32]

$Q_j = \frac{d}{dt}\frac{\partial V}{\partial \dot{q}_j} - \frac{\partial V}{\partial q_j} \,,$

equating to Lagrange's equations and defining the Lagrangian as L = TV obtains Lagrange's equations of the second kind or the Euler–Lagrange equations of motion

$\frac{\partial L}{\partial q_j} - \frac{d}{dt}\frac{\partial L}{\partial \dot{q}_j} = 0 \,.$

However, the Euler–Lagrange equations can only account for non-conservative forces if a potential can be found as shown. Lagrange's equations do not involve any potential, only forces; therefore they are more general than the Euler–Lagrange equations.

These equations also follow from the calculus of variations. The variation of the Lagrangian is

$\delta L = \sum_{j=1}^n \left(\frac{\partial L}{\partial q_j} \delta q_j + \frac{\partial L}{\partial \dot{q}_j} \delta \dot{q}_j \right) \,,\quad \delta \dot{q}_j \equiv \delta\frac{dq_j}{dt} \equiv \frac{d(\delta q_j)}{dt} \,,$

which has a similar form to the total differential of L, but the virtual displacements and their time derivatives replace differentials, and there is no time increment in accordance with the definition of the virtual displacements. An integration by parts with respect to time can transfer the time derivative of δqj to the ∂L/∂(dqj/dt), in the process exchanging d(δqj)/dt for δqj, allowing the independent virtual displacements to be factorized from the derivatives of the Lagrangian,

$\int_{t_1}^{t_2} \delta L \, dt = \sum_{j=1}^n\left[\frac{\partial L}{\partial \dot{q}_j}\delta q_j\right]_{t_1}^{t_2} + \int_{t_1}^{t_2} \sum_{j=1}^n \left(\frac{\partial L}{\partial q_j} - \frac{d}{dt}\frac{\partial L}{\partial \dot{q}_j} \right)\delta q_j \, dt \,.$

Now, if the condition δqj(t1) = δqj(t2) = 0 holds for all j, the terms not integrated are zero. If in addition the entire time integral of δL is zero, then because the δqj are independent, and the only way for a definite integral to be zero is if the integrand equals zero, each of the coefficients of δqj must also be zero. Then we obtain the equations of motion. This can be summarized by Hamilton's principle;

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

The time integral of the Lagrangian is another quantity called the action, defined as[33]

$S = \int_{t_1}^{t_2} L\,dt\,,$

which is a functional; it takes in the Lagrangian function for all times between t1 and t2 and returns a scalar value. Its dimensions are the same as [ angular momentum ], [energy]·[time], or [length]·[momentum]. With this definition Hamilton's principle is

$\delta S = 0\,. \,\!$

Thus, instead of thinking about particles accelerating in response to applied forces, one might think of them picking out the path with a stationary action, with the end points of the path in configuration space held fixed at the initial and final times. Hamilton's principle is sometimes referred to as the principle of least action, however the action functional need only be stationary, not necessarily a maximum or a minimum value. Any variation of the functional gives an increase in the functional integral of the action. It is not widely stated that Hamilton's principle is a variational principle only with holonomic constraints, if we are dealing with nonholonomic systems then the variational principle should be replaced with one involving d'Alembert principle of virtual work.

### Lagrange multipliers and constraints

We can vary L in the Cartesian r coordinates, for N particles,

$\int_{t_1}^{t_2} \sum_{k=1}^N \left(\frac{\partial L}{\partial \mathbf{r}_k} - \frac{d}{dt}\frac{\partial L}{\partial \dot{\mathbf{r}}_k} \right)\cdot\delta \mathbf{r}_k \, dt = 0 \,.$

Hamilton's principle is still valid even if the coordinates L is expressed in are not independent, here rk, but the constraints are still assumed to be holonomic.[34] What can be done here is to introduce the Lagrange multipliers which will include the constraints. Varying the constraint equations and multiplying each by a Lagrange multiplier λi gives

$\delta f_i = \sum_{k=1}^N \frac{\partial f_i}{\partial \mathbf{r}_k} \cdot \delta \mathbf{r}_k = 0 \,,\quad \lambda_i \delta f_i = \lambda_i \sum_{k=1}^N \frac{\partial f_i}{\partial \mathbf{r}_k} \cdot \delta \mathbf{r}_k = 0$

where i = 1, 2, ..., C. Since this contributes nothing to the variation of L, inserting into the integral of δL gives

$\int_{t_1}^{t_2} \sum_{k=1}^N \left(\frac{\partial L}{\partial \mathbf{r}_k } - \frac{d}{dt}\frac{\partial L}{\partial \dot{\mathbf{r}}_k} + \sum_{i=1}^C \lambda_i \frac{\partial f_i}{\partial \mathbf{r}_k } \right)\cdot \delta \mathbf{r}_k \, dt = 0 \,.$

Now, the Lagrange multipliers are not functions of the coordinates rk, but are arbitrary functions of time t, and can be found so that the coefficients of δrk are zero, even though the rk are not independent. The equations are then Lagrange's equations of the first kind

$\frac{\partial L}{\partial \mathbf{r}_k} - \frac{d}{dt}\frac{\partial L}{\partial \dot{\mathbf{r}}_k} + \sum_{i=1}^C \lambda_i \frac{\partial f_i}{\partial \mathbf{r}_k} = 0 \,,$

For the case of a conservative force given by the gradient of some potential energy V, a function of the rk coordinates only, substituting the Lagrangian L = TV gives

$\frac{\partial T}{\partial \mathbf{r}_k} - \frac{d}{dt}\frac{\partial T}{\partial \dot{\mathbf{r}}_k} - \frac{\partial V}{\partial \mathbf{r}_k} + \sum_{i=1}^C \lambda_i \frac{\partial f_i}{\partial \mathbf{r}_k} = 0 \,,$

where from the Lagrangian form of Newton's second law above, the derivatives of kinetic energy form the (negative of) resultant force acting on the particle k, and the derivative of the potential is the non-constraint force acting on the particle k,

$-\mathbf{F}_k = \frac{\partial T}{\partial \mathbf{r}_k} - \frac{d}{dt}\frac{\partial T}{\partial \dot{\mathbf{r}}_k} \,, \quad \mathbf{N}_k = - \frac{\partial V}{\partial \mathbf{r}_k} \,.$

It follows the constraint forces are given by

$\mathbf{C}_k = \sum_{i=1}^C \lambda_i \frac{\partial f_i}{\partial \mathbf{r}_k} \,,$

which relates the constraint equations to the constraint forces via the Lagrange multipliers.

## Properties of the Euler–Lagrange equation

In some cases, the Lagrangian has properties which can provide information about the system without solving the equations of motion. These follow from Lagrange's equations of the second kind.

### Non uniqueness

The Lagrangian of a given system is not unique. A Lagrangian L can be multiplied by a nonzero constant a, an arbitrary constant b can be added, and the new Lagrangian aL + b will describe exactly the same motion as L. A less obvious result is that two Lagrangians describing the same system can differ by the total derivative (not partial) of some function f(q, t) with respect to time;[35]

$L' = L + \frac{df(\mathbf{q},t)}{dt}\,.$

Each Lagrangian will obtain exactly the same equations of motion.[36][37]

### Invariance under point transformations

Given a set of generalized coordinates q, if we change these variables to a new set of generalized coordinates s according to a point transformation q = q(s, t), the new Lagrangian L′ is a function of the new coordinates

$L(\mathbf{q}(\mathbf{s},t), \dot{\mathbf{q}}(\mathbf{s},\dot{\mathbf{s}},t), t ) = L'(\mathbf{s}, \dot{\mathbf{s}},t) \,,$

and by the chain rule for partial differentiation, Lagrange's equations are invariant under this transformation;[38]

$\frac{d}{dt}\frac{\partial L'}{\partial \dot{s}_i} = \frac{\partial L'}{\partial s_i} \,.$

This may simplify the equations of motion. The procedure is analogous to Canonical transformations in Hamiltonian mechanics, which preserves the form of Hamiltonian equations.

### Cyclic coordinates and conservation laws

An important property of the Lagrangian is that conserved quantities can easily be read off from it. The generalized momentum "canonically conjugate to" the coordinate qi is defined by

$p_i =\frac{\partial L}{\partial\dot q_i}.$

If the Lagrangian L does not depend on some coordinate qi, then it follows from the Euler–Lagrange equations that the corresponding generalized momentum will be a conserved quantity, because its time derivative is zero so the momentum must be a constant of the motion;

$\dot{p}_i = \frac{d}{dt}\frac{\partial L}{\partial\dot q_i} = \frac{\partial L}{\partial q_i}=0\,.$

This is a special case of Noether's theorem. Such coordinates are called "cyclic" or "ignorable".

For example, a system may have a Lagrangian

$L(r,\theta,\dot{s},\dot{z},\dot{r},\dot{\theta},\dot{\phi},t)\,,$

where r and z are lengths along straight lines, s is an arc length along some curve, and θ and φ are angles. Notice z, s, and φ are all absent in the Lagrangian even though their velocities are not. Then the momenta

$p_z =\frac{\partial L}{\partial\dot z}\,,\quad p_s =\frac{\partial L}{\partial \dot s}\,,\quad p_\phi =\frac{\partial L}{\partial \dot \phi}\,,$

are all conserved quantities. The units and nature of each generalized momentum will depend on the corresponding coordinate; in this case pz is a translational momentum in the z direction, ps is also a translational momentum along the curve s is measured, and pφ is an angular momentum in the plane the angle φ is measured in. Whatever the complicated the motion of the system is; all the coordinates and velocities will vary in such a way that these momenta are conserved.

### Energy conservation

Taking the total derivative of the Lagrangian

$L = T - V$

with respect to time leads to the general result

$\frac{\partial L}{\partial t} = \frac{d }{d t}\left(\sum_{i=1}^n \dot{q}_i\frac{\partial L}{\partial \dot{q}_i} - L\right)\,.$

If the entire Lagrangian is explicitly independent of time, it follows the partial time derivative of the Lagrangian is zero, L/∂t = 0, so the quantity under the total time derivative in brackets

$E = \sum_{i=1}^n \dot{q}_i\frac{\partial L}{\partial \dot{q}_i} - L$

must be a constant for all times during the motion of the system, and it also follows the kinetic energy is a homogenous function of degree 2 in the generalized velocities. If in addition the potential V is only a function of coordinates and independent of velocities, it follows by direct calculation, or use of Euler's theorem for homogenous functions, that

$\sum_{i=1}^n \dot{q}_i\frac{\partial L}{\partial \dot{q}_i} = \sum_{i=1}^n \dot{q}_i\frac{\partial T}{\partial \dot{q}_i} = 2T \,.$

Under all these circumstances,[39] the constant

$E = 2T - L = T + V$

is the total conserved energy of the system. The kinetic and potential energies still change as the system evolves, but the motion of the system will be such that their sum, the total energy, is constant. This is a valuable simplification, since the energy E is a constant of integration that counts as an arbitrary constant for the problem, and it may be possible to integrate the velocities from this energy relation to solve for the coordinates. In the case the velocity or kinetic energy or both depends on time, then the energy is not conserved.

The Hamiltonian is related to the Lagrangian by a Legendre transformation. By definition it is the above quantity in brackets,

$H = \sum_{i=1}^n \dot{q}_i\frac{\partial L}{\partial \dot{q}_i} - L \,.$

Under the same conditions, the Hamiltonian equals the total energy of the system and is conserved.

### Mechanical similarity

Main article: Mechanical similarity

If the potential energy is a homogeneous function of the coordinates and independent of time,[40] and all position vectors are scaled by the same nonzero constant α, rk′ = αrk, so that

$V(\alpha\mathbf{r}_1,\alpha\mathbf{r}_2,\ldots, \alpha\mathbf{r}_N)=\alpha^N V(\mathbf{r}_1,\mathbf{r}_2,\ldots, \mathbf{r}_N)$

and time is scaled by a factor β, t′ = βt, then the velocities vk are scaled by a factor of α/β and the kinetic energy T by (α/β)2. The entire Lagrangian has been scaled by the same factor if

$\frac{\alpha^2}{\beta^2}=\alpha^N \quad\Rightarrow\quad \beta = \alpha^{1-N/2}\,.$

Since the lengths and times have been scaled, the trajectories of the particles in the system follow geometrically similar paths differing in size. The length l traversed in time t in the original trajectory corresponds to a new length l′ traversed in time t′ in the new trajectory, given by the ratios

$\frac{t'}{t}= \left(\frac{l'}{l}\right)^{1-N/2}\,.$

### Interacting particles

For a given system, if two subsystems A and B are non-interacting, the Lagrangian L of the overall system is the sum of the Lagrangians LA and LB for the subsystems:[35]

$L = L_A + L_B \,.$

If they do interact this is not possible. In some situations, it may be possible to separate the Lagrangian of the system L into the above form of non-interacting Lagrangians, plus another Lagrangian LAB containing information about their intertwined motion and the potential energy for the interaction,

$L = L_A + L_B + L_{AB}\,.$

This can be physically motivated from the limiting case of negligible interaction - then interaction Lagrangian tends to zero reducing to the non-interacting case above.

The extension to more than two non-interacting subsystems is straightforwards - the overall Lagrangian is the sum of the separate Lagrangians for each subsystem. If there are interactions, then interaction Lagranians may be added.

## Examples in specific coordinate systems

In the following examples, a particle of mass m moves under the influence of a conservative force derived from the gradient ∇ of the a scalar potential,

$\mathbf{F} = -\nabla V(\mathbf{r})\,.$

If there are more particles, in accordance with the above results, the total kinetic energy is a sum over all the particle kinetic energies, and the potential is a function of all the coordinates.

### Cartesian coordinates

The Lagrangian of the particle can be written

$L(x,y,z, \dot{x}, \dot{y},\dot{z}) = \frac{1}{2} m (\dot{x}^2 + \dot{y}^2 + \dot{z}^2) - V(x,y,z)\,.$

The equations of motion for the particle are found by applying the Euler–Lagrange equation, for the x coordinate

$\frac{d}{dt} \left( \frac{\partial L}{\partial \dot{x}} \right) - \frac{\partial L}{\partial x} = 0,$

and similarly for the y and z coordinates. For the x coordinate

$\frac{\partial L}{\partial x} = - \frac{\partial V}{\partial x}\,,\quad \frac{\partial L}{\partial \dot{x}} = m \dot{x}\,,\quad \frac{d}{dt} \left( \frac{\partial L}{\partial \dot{x}} \right) = m \ddot{x}\,,$

hence

$m \ddot{x} = - \frac{\partial V}{\partial x}\,.$

and similarly for the y and z coordinates. Collecting the equations in vector form we find

$m\ddot{\mathbf{r}}=-\nabla V$

which is Newton's second law of motion for a particle subject to a conservative force.

### Polar coordinates in 2d and 3d

The Lagrangian for the above problem in spherical coordinates is

$L = \frac{m}{2}(\dot{r}^2+r^2\dot{\theta}^2 +r^2\sin^2\theta \, \dot{\varphi}^2)-V(r)\,,$

so the Euler–Lagrange equations are

$m\ddot{r}-mr(\dot{\theta}^2+\sin^2\theta \, \dot{\varphi}^2)+\frac{\partial V}{\partial r} =0\,,$
$\frac{d}{dt}(mr^2\dot{\theta}) -mr^2\sin\theta\cos\theta \, \dot{\varphi}^2=0\,,$
$\frac{d}{dt}(mr^2\sin^2\theta \, \dot{\varphi})=0\,.$

The φ coordinate is cyclic since it does not appear in the Lagrangian, so the conserved momentum in the system is the angular momentum

$p_\varphi = \frac{\partial L}{\partial \dot{\varphi}} = mr^2\sin^2\theta \dot{\varphi}\,,$

in which r, θ and dφ/dt can all vary with time, but only in such a way that pφ is constant.

## Non-relativistic examples

The following examples apply Lagrange's equations of the second kind to mechanical problems.

### Pendulum on a movable support

Consider a pendulum of mass m and length , which is attached to a support with mass M, which can move along a line in the x-direction. Let x be the coordinate along the line of the support, and let us denote the position of the pendulum by the angle θ from the vertical.

Sketch of the situation with definition of the coordinates (click to enlarge)

The kinetic energy can then be shown to be

$\begin{array}{rcl} T &=& \frac{1}{2} M \dot{x}^2 + \frac{1}{2} m \left( \dot{x}_\mathrm{pend}^2 + \dot{y}_\mathrm{pend}^2 \right) \\ &=& \frac{1}{2} M \dot{x}^2 + \frac{1}{2} m \left[ \left( \dot x + \ell \dot\theta \cos \theta \right)^2 + \left( \ell \dot\theta \sin \theta \right)^2 \right], \end{array}$

and the potential energy of the system is

$V = m g y_\mathrm{pend} = - m g \ell \cos \theta \,.$

The Lagrangian is therefore

$\begin{array}{rcl} L &=& T - V \\ &=& \frac{1}{2} M \dot{x}^2 + \frac{1}{2} m \left[ \left( \dot x + \ell \dot\theta \cos \theta \right)^2 + \left( \ell \dot\theta \sin \theta \right)^2 \right] + m g \ell \cos \theta \\ &=& \frac{1}{2} \left( M + m \right) \dot x^2 + m \dot x \ell \dot \theta \cos \theta + \frac{1}{2} m \ell^2 \dot \theta ^2 + m g \ell \cos \theta \end{array}$

Since x is absent from the Lagrangian, it is a cyclic coordinate. The conserved momentum is

$p_x = (M + m) \dot x + m \ell \dot\theta \cos\theta \,.$

The Lagrange equation for the the support coordinate x is therefore

$\frac{d}{dt} \left[ (M + m) \dot x + m \ell \dot\theta \cos\theta \right] = 0,$

or

$(M + m) \ddot x + m \ell \ddot\theta\cos\theta-m \ell \dot\theta ^2 \sin\theta = 0$

The Lagrange equation for the angle θ is

$\frac{d}{dt}\left[ m( \dot x \ell \cos\theta + \ell^2 \dot\theta ) \right] + m \ell (\dot x \dot \theta + g) \sin\theta = 0;$

therefore

$\ddot\theta + \frac{\ddot x}{\ell} \cos\theta + \frac{g}{\ell} \sin\theta = 0.\,$

These equations may look quite complicated, but finding them with Newton's laws would have required carefully identifying all forces, which would have been much more laborious and prone to errors. By considering limit cases, the correctness of this system can be verified: For example, $\ddot x \to 0$ should give the equations of motion for a pendulum that is at rest in some inertial frame, while $\ddot\theta \to 0$ should give the equations for a pendulum in a constantly accelerating system, etc. Furthermore, it is trivial to obtain the results numerically, given suitable starting conditions and a chosen time step, by stepping through the results iteratively.

### Two-body central force problem

Main articles: Two-body problem and Central force

The basic problem is that of two bodies of masses m1 and m2 with position vectors r1 and r2 are in orbit about each other due to an attractive central force V. We may naïvely write down the Lagrangian in terms of the position coordinates as they are, but it is an established procedure to convert the two-body problem into a one-body problem as follows. Introduce the Jacobi coordinates; the separation of the bodies r = r2r1 and the location of the center of mass R = (m1r1 + m2r2)/(m1 + m2). The Lagrangian is then[41][42][nb 3]

\begin{align} L &= T-U = \frac {1}{2} M \dot{\mathbf{R}}^2 + \left( \frac {1}{2} \mu \dot{\mathbf{r}}^2 - V(|\mathbf{r}|) \right) \\ &= L_{\text{cm}} + L_{\text{rel}} \end{align}

where M = m1 + m2 is the total mass, μ = m1m2/(m1 + m2) is the reduced mass, and V the potential of the radial force, which depends only on the magnitude of the separation |r| = |r2r1|. The Lagrangian is divided into a center-of-mass term Lcm and a relative motion term Lrel. The Euler–Lagrange equation for R is simply

$M\ddot{\mathbf{R}} = 0 \,,$

which states the center of mass moves in a straight line at constant velocity. The since the relative motion only depends on the magnitude of the separation, it is ideal to use polar coordinates (r, θ) and take r = |r|,

$L=\frac{1}{2} \mu (\dot{r}^2 +r^2 \dot{\theta}^2 ) - V(r) \,,$

which does not depend upon θ, therefore θ is an ignorable coordinate. The conserved momentum corresponding to θ is

$p_\theta = \frac {\partial L}{\partial \dot \theta} = \mu r^2 \dot \theta = \ell \,,$

which will be abbreviated . The radial coordinate r and angular velocity /dt can vary with time, but only in such a way that is constant. The Lagrange equation for r is

$\frac{\partial L}{\partial r} = \frac{d}{dt} \frac{\partial L}{\partial \dot r} \quad\Rightarrow\quad \mu r \dot \theta ^2 -\frac {dU}{dr} = \mu \ddot r \,.$

This equation is identical to the radial equation obtained using Newton's laws in a co-rotating reference frame, that is, a frame rotating with the reduced mass so it appears stationary. Eliminating the angular velocity /dt from this radial equation,[43]

$\mu \ddot r = -\frac{dU}{dr} + \frac{\ell^2}{\mu r^3} \,.$

which is the equation of motion for a one-dimensional problem in which a particle of mass μ is subjected to the inward central force −dU/dr and a second outward force, called in this context the centrifugal force

$F_{\mathrm{cf}} = \mu r \dot \theta ^2 = \frac {\ell^2}{\mu r^3} \,.$

Of course, if one remains entirely within the one-dimensional formulation, enters only as some imposed parameter of the external outward force, and its interpretation as angular momentum depends upon the more general two-dimensional problem from which the one-dimensional problem originated.

If one arrives at this equation using Newtonian mechanics in a co-rotating frame, the interpretation is evident as the centrifugal force in that frame due to the rotation of the frame itself. If one arrives at this equation directly by using the generalized coordinates (r, θ) and simply following the Lagrangian formulation without thinking about frames at all, the interpretation is that the centrifugal force is an outgrowth of using polar coordinates. As Hildebrand says:[44]

"Since such quantities are not true physical forces, they are often called inertia forces. Their presence or absence depends, not upon the particular problem at hand, but upon the coordinate system chosen." In particular, if Cartesian coordinates are chosen, the centrifugal force disappears, and the formulation involves only the central force itself, which provides the centripetal force for a curved motion.

This viewpoint, that fictitious forces originate in the choice of coordinates, often is expressed by users of the Lagrangian method. This view arises naturally in the Lagrangian approach, because the frame of reference is (possibly unconsciously) selected by the choice of coordinates. For example, see[45] for a comparison of Lagrangians in an inertial and in a noninertial frame of reference. See also the discussion of "total" and "updated" Lagrangian formulations in.[46] Unfortunately, this usage of "inertial force" conflicts with the Newtonian idea of an inertial force. In the Newtonian view, an inertial force originates in the acceleration of the frame of observation (the fact that it is not an inertial frame of reference), not in the choice of coordinate system. To keep matters clear, it is safest to refer to the Lagrangian inertial forces as generalized inertial forces, to distinguish them from the Newtonian vector inertial forces. That is, one should avoid following Hildebrand when he says (p. 155) "we deal always with generalized forces, velocities accelerations, and momenta. For brevity, the adjective "generalized" will be omitted frequently."

It is known that the Lagrangian of a system is not unique. Within the Lagrangian formalism the Newtonian fictitious forces can be identified by the existence of alternative Lagrangians in which the fictitious forces disappear, sometimes found by exploiting the symmetry of the system.[47]

### Non-relativistic test particles in fields

A test particle is a particle whose mass and charge are assumed to be so small that its effect on external system is insignificant. It is often a hypothetical simplified point particle with no properties other than mass and charge. Real particles like electrons and up quarks are more complex and have additional terms in their Lagrangians.

#### Non-relativistic test particle in a Newtonian gravitational field

For a particle with mass m in a Newtonian gravitation potential

$V(\mathbf{r}(t),t) = m \Phi (\mathbf{r}(t),t) \,,$

since the force is conservative, one can follow the same procedure in the Cartesian coordinates example to find

$\ddot{\mathbf{r}} = - \nabla \Phi$

where the mass cancels algebraically, and physically it should because the acceleration of all massive objects due to gravity is independent of the mass.

#### Non-relativistic test particle in an electromagnetic field

The case of a charged particle with electrical charge q interacting with an electromagnetic field is more complicated. The electric scalar potential ϕ(r(t), t) and magnetic vector potential A(r(t), t) are defined from the electric field

$\mathbf{E}(\mathbf{r}(t),t) = - \nabla\phi (\mathbf{r}(t),t) - \frac{\partial \mathbf{A} (\mathbf{r}(t),t)}{\partial t} \,,$
$\mathbf{B}(\mathbf{r}(t),t) = \nabla \times \mathbf{A} (\mathbf{r}(t),t) \,.$

Notice all the fields depend on the position r of the particle at time t, and depend explicitly on time as well as implicitly via the position.

The Lagrangian of a massive charged test particle in an electromagnetic field is

$L = \frac{m}{2} \dot{\mathbf{r}}^2 - q \phi + q \dot{\mathbf{r}} \cdot \mathbf{A} \,,$

which produces the Lorentz force law

$m \ddot{\mathbf{r}} = q \mathbf{E} + q \dot{\mathbf{r}} \times \mathbf{B} \,.$

An interesting point in this example is the generalized momentum conjugate to r is the ordinary momentum plus a contribution from the A field,

$\mathbf{p} = \frac{\partial L}{\partial \dot{\mathbf{r}}} = m \dot{\mathbf{r}} + q \mathbf{A} \,.$

This relation is used in the minimal coupling prescription in quantum mechanics and quantum field theory.

## Extensions to include non-conservative forces

Dissipation (i.e. non-conservative systems) can also be treated with an effective Lagrangian formulated by a certain doubling of the degrees of freedom; see.[48][49][50][51]

In a more general formulation, the forces could be both conservative and viscous. If an appropriate transformation can be found from the Fi, Rayleigh suggests using a dissipation function, D, of the following form:[52]

$D = \frac {1}{2} \sum_{j=1}^m \sum_{k=1}^m C_{j k} \dot{q}_j \dot{q}_k \,.$

where Cjk are constants that are related to the damping coefficients in the physical system, though not necessarily equal to them. If D is defined this way, then[52]

$Q_j = - \frac {\partial V}{\partial q_j} - \frac {\partial D}{\partial \dot{q}_j}\,$

and

$\frac{d}{dt} \left ( \frac {\partial L}{\partial \dot{q}_j} \right ) - \frac {\partial L}{\partial q_j} + \frac {\partial D}{\partial \dot{q}_j} = 0\,.$

## Definitions of the Lagrangian (relativistic mechanics)

Lagrangian mechanics can be formulated in special relativity as follows. Consider one particle (N particles are considered later).

### Coordinate formulation

The Euler–Lagrange equations retain their form in special relativity, provided the Lagrangian generates equations of motion consistent with special relativity. It is instructive to look at the total relativistic energy of a free test particle. Expanding in a power series, the first term is the particle's rest energy, plus its non-relativistic kinetic energy, followed by higher order relativistic corrections;

$E = m_0 c^2 \frac{dt}{d \tau} = \frac{m_0 c^2}{\sqrt {1 - \frac{\dot{\mathbf{r}}^2 (t)}{c^2}}} = m_0 c^2 + {1 \over 2} m_0 \dot{\mathbf{r}}^2 (t) + {3 \over 8} m_0 \frac{\dot{\mathbf{r}}^4(t)}{c^2} + \dots \,.$

where c is the speed of light in vacuum, v = dr/dt is the coordinate velocity of the particle as measured in some lab frame, t is the coordinate time in the lab frame, and τ is the proper time (the time measured by a clock moving with the particle). The differentials in t and τ are related by the Lorentz factor γ,

$dt=\gamma(\dot{\mathbf{r}})d\tau \,, \quad \gamma(\dot{\mathbf{r}}) = \frac{1}{\sqrt{1-\frac{\dot{\mathbf{r}}^2}{c^2}}} \,, \quad \dot{\mathbf{r}}^2 (t) = \dot{\mathbf{r}}(t) \cdot \dot{\mathbf{r}}(t)\,.$

The relativistic kinetic energy for an uncharged particle of rest mass m0 is

$T = (\gamma(\dot{\mathbf{r}}) - 1)m_0c^2$

and we may naïvely guess the relativistic Lagrangian for a particle to be this relativistic kinetic energy minus the potential energy. However, even for a free particle for which V = 0, this is wrong. Following the non-relativistic approach, we expect the derivative of this seemingly correct Lagrangian with respect to the velocity to be the relativistic momentum, which it is not.

A more fundamental approach, for a free particle, is to take the action as proportional to the integral of the Lorentz invariant line element in spacetime, the length of the particle's world line between proper times τ1 and τ2,

$S = \varepsilon \int_{\tau_1}^{\tau_2} d\tau = \varepsilon \int_{t_1}^{t_2} \frac{dt}{\gamma(\dot{\mathbf{r}})} \,,\quad L = \frac{\varepsilon}{\gamma(\dot{\mathbf{r}})} = \varepsilon\sqrt{1-\frac{\dot{\mathbf{r}}^2}{c^2}}\,,$

where ε is a constant to be found, and by definition the integrand is the Lagrangian. The momentum must be the relativistic momentum,

$\mathbf{p} = \frac{\partial L}{\partial \dot{\mathbf{r}}} = \left(\frac{- \varepsilon}{c^2}\right)\gamma(\dot{\mathbf{r}})\dot{\mathbf{r}} = m_0 \gamma(\dot{\mathbf{r}})\dot{\mathbf{r}} \,,$

which requires ε = −m0c2. The vector r is absent from the Lagrangian and therefore cyclic, so the Euler–Lagrange equations are consistent with the constancy of relativistic momentum,

$\frac{d}{dt}\frac{\partial L}{\partial \dot{\mathbf{r}}} = \frac{\partial L}{\partial \mathbf{r}} \quad \Rightarrow \quad \frac{d}{dt} (m_0 \gamma(\dot{\mathbf{r}})\dot{\mathbf{r}} ) = 0 \,,$

which must be the case for a free particle. Also, expanding the Lagrangian to first order in (v/c)2,

$L = -m_0 c^2 \left[ 1 + \frac{1}{2}\left(- \frac{\dot{\mathbf{r}}^2}{c^2}\right) + \cdots \right] \approx -m_0 c^2 + \frac{m_0}{2}\dot{\mathbf{r}}^2 \,,$

in the non-relativistic limit when v is small, the higher order terms not shown are negligible, and the Lagrangian is the non-relativistic kinetic energy as it should be. The remaining term is the negative of the particle's rest energy, a constant term which can be ignored in the Lagrangian.

For the case of a particle influenced by a potential V which may be non-conservative, it is possible for a number of interesting cases to subtract this potential from the free particle Lagrangian,

$L = -\frac{m_0 c^2}{\gamma(\dot{\mathbf{r}})} - V(\mathbf{r}, \dot{\mathbf{r}}, t) \,.$

and the Euler–Lagrange equations lead to the relativistic version of Newton's second law, the coordinate time derivative of relativistic momentum is the force acting on the particle;

$\mathbf{F} = \frac{d}{dt}\frac{\partial V}{\partial \dot{\mathbf{r}}} - \frac{\partial V}{\partial \mathbf{r}} = \frac{d}{dt}(m_0 \gamma(\dot{\mathbf{r}})\dot{\mathbf{r}})\,.$

assuming the potential V can generate the corresponding force F in this way.

It is possible to transform to generalized coordinates exactly as in non-relativistic mechanics, r = r(q, t). The velocity v in terms of the generalized coordinates and velocities remains the same. Also, the definition of the canonical momenta conjugate to generalized coordinates also remains exactly the same, so the connection between cyclic coordinates and conserved quantities still applies. All these quantities are to be measured in the lab frame.

It is also true that if the Lagrangian is explicitly independent of time and the potential V(r) independent of velocities, then the total relativistic energy

$E = \frac{\partial L}{\partial \dot{\mathbf{r}}}\cdot\dot{\mathbf{r}} - L = \gamma(\dot{\mathbf{r}})m_0c^2 + V(\mathbf{r})$

is conserved, although the identification is less obvious since the first term is the relativistic energy of the particle which includes the rest mass of the particle, not merely the relativistic kinetic energy. Also, the argument for homogenous functions does not apply to relativistic Lagrangians.

The extension to N particles is streightforward, the relativistic Lagrangian is just a sum of the "free particle" terms, minus the potential energy of their interaction;

$L = - c^2 \sum_{k=1}^N \frac{m_{0k} }{\gamma(\dot{\mathbf{r}}_k)} - V(\mathbf{r}_1, \mathbf{r}_2, \ldots, \dot{\mathbf{r}}_1,\dot{\mathbf{r}}_2,\ldots, t) \,,$

where all the positions and velocities are measured in the same lab frame, including the time.

The advantage of this coordinate formulation is that it can be applied to a variety of systems, including multiparticle systems. The disadvantage is that some lab frame has been singled out as a preferred frame, and none of the equations are manifestly covariant (in other words, they do not take the same form in all frames of reference). For an observer moving relative to the lab frame, everything must be recalculated using Lorentz transformations of all the quantities; the position r, the momentum p, total energy E, potential energy, etc. The action will remain the same since it is Lorentz invariant by construction.

### Covariant formulation

In the covariant formulation of the Euler–Lagrange equations, the proper time of a particle and four vectors replace the coordinate time t and the purely spatial vectors used throughout above for non-relativistic mechanics. The Lorentz invariant action is (abusing notation)

$S = \int \Lambda(x^\nu(\tau),u^\nu(\tau),\tau) d\tau$

and the Lagrange equations in the spacetime coordinates are

$\frac{d}{d\tau}\frac{\partial \Lambda}{\partial u^\nu} = \frac{\partial \Lambda}{\partial x^\nu} \,.$

where uμ = dxμ/ is the four-velocity of the particle, and lower and upper indices are used according to covariance and contravariance of vectors. While this does apply to a single particle for which the proper time is well-defined, and is manifestly covariant, this does not extend to an N particle system, since then the proper time cannot be defined as a common parameter for all the particles.

## Relativistic examples

### Special relativistic 1d harmonic oscillator

For a 1d relativistic simple harmonic oscillator, the Lagrangian is[53][54]

$L = - m c^2 \sqrt {1 - \frac{\dot{x}^2(t)}{c^2}} - \frac{k}{2}x^2 \,.$

where k is the spring constant.

### Special relativistic constant force

For a particle under a constant force, the Lagrangian is[55]

$L = - m c^2 \sqrt {1 - \frac{\dot{x}^2(t)}{c^2}} - max \,.$

where a is the force per unit mass.

### Special relativistic test particle in an electromagnetic field

In special relativity, the Lagrangian of a massive charged test particle in an electromagnetic field modifies to[56]

$L = - m c^2 \sqrt {1 - \frac{v^2 }{c^2}} - q \phi + q \dot{\mathbf{r}} \cdot \mathbf{A} \,.$

The Lagrangian equations in r lead to the Lorentz force law, in terms of the relativistic momentum

$\frac{d}{d t}\left(\frac{m \dot{\mathbf{r}}} {\sqrt {1 - \frac{v^2 }{c^2}}}\right) = q \mathbf{E} + q \dot{\mathbf{r}} \times \mathbf{B} \,.$

In the language of four vectors and tensor index notation, the Lagrangian takes the form

$L(\tau) = \frac{1}{2}m u^\mu(\tau)u_\mu(\tau) + qu^\mu(\tau)A_\mu(x)$

where uμ = dxμ/ is the four-velocity of the test particle, and Aμ the electromagnetic four potential.

The Euler–Lagrange equations are (notice the total derivative with respect to proper time instead of coordinate time)

$\frac{\partial L}{\partial x^\nu} - \frac{d}{d\tau}\frac{\partial L}{\partial u^\nu} = 0$

obtains

$qu^\mu\frac{\partial A_\mu}{\partial x^\nu} = \frac{d}{d\tau} (m u_\nu + q A_\nu) \,.$

Under the total derivative with respect to proper time, the first term is the relativistic momentum, the second term is

$\frac{d A_\nu}{d\tau} = \frac{\partial A_\nu}{\partial x^\mu} \frac{d x^\mu}{d\tau} = \frac{\partial A_\nu}{\partial x^\mu} u^\mu \,,$

then rearranging, and using the definition of the antisymmetric electromagnetic tensor, gives the covariant form of the Lorentz force law in the more familiar form,

$\frac{d}{d\tau} (m u_\nu) = qu^\mu F^\nu{}_\mu \,,\quad F^\nu{}_\mu = \frac{\partial A_\mu}{\partial x^\nu} - \frac{\partial A_\nu}{\partial x^\mu} \,.$

### General relativistic test particle in an electromagnetic field

In general relativity, the first term generalizes (includes) both the classical kinetic energy and the interaction with the gravitational field. For an uncharged particle, it is

$L = - m c^2 \frac{d \tau(t)}{d t} = - m c^2 \sqrt {- c^{-2} g_{\mu\nu}(x(t)) \frac{d x^{\mu}(t)}{d t} \frac{d x^{\nu}(t)}{d t}}\,,$

while for a charged particle in an electromagnetic field,

$L(t) = - m c^2 \sqrt {- c^{-2} g_{\mu\nu}(x(t)) \frac{d x^{\mu}(t)}{d t} \frac{d x^{\nu}(t)}{d t}} + q \frac{d x^{\mu}(t)}{d t} A_{\mu}(x(t))\,.$

If the four spacetime coordinates rµ are given in arbitrary units (i.e. unitless), then gµν in m2 is the rank 2 symmetric metric tensor which is also the gravitational potential. Also, Aµ in V·s is the electromagnetic 4-vector potential.

More generally, suppose the Lagrangian is that of a single particle plus an interaction term LI

$L = - m c^2 \frac{d \tau}{d t} + L_I \,.$

Varying this with respect to the position of the particle rα as a function of time t gives

\begin{align} \delta L & = m \frac{d t}{2 d \tau} \delta \left( g_{\mu\nu} \frac{d x^{\mu}}{d t} \frac{d x^{\nu}}{d t} \right) + \delta L_I \\ & = m \frac{d t}{2 d \tau} \left( g_{\mu\nu,\alpha} \delta x^{\alpha} \frac{d x^{\mu}}{d t} \frac{d x^{\nu}}{d t} + 2 g_{\alpha\nu} \frac{d \delta x^{\alpha}}{d t} \frac{d x^{\nu}}{d t} \right) + \frac{\partial L_I}{\partial x^{\alpha}} \delta x^{\alpha} + \frac{\partial L_I}{\partial \frac{d x^{\alpha}}{d t}} \frac{d \delta x^{\alpha}}{d t} \\ & = \frac12 m g_{\mu\nu,\alpha} \delta x^{\alpha} \frac{d x^{\mu}}{d \tau} \frac{d x^{\nu}}{d t} - \frac{d }{d t} \left( m g_{\alpha\nu} \frac{d x^{\nu}}{d \tau} \right) \delta x^{\alpha} + \frac{\partial L_I}{\partial x^{\alpha}} \delta x^{\alpha} - \frac{d }{d t} \left( \frac{\partial L_I}{\partial \frac{d x^{\alpha}}{d t}} \right) \delta x^{\alpha} + \frac{d (...)}{d t} \,. \end{align}

This gives the equation of motion

$0 = \frac12 m g_{\mu\nu,\alpha} \frac{d x^{\mu}}{d \tau} \frac{d x^{\nu}}{d t} - \frac{d }{d t} \left( m g_{\alpha\nu} \frac{d x^{\nu}}{d \tau} \right) + f_{\alpha}$

where

$f_{\alpha} = \frac{\partial L_I}{\partial x^{\alpha}} - \frac{d }{d t} \left( \frac{\partial L_I}{\partial \frac{d x^{\alpha}}{d t}} \right)$

is the non-gravitational force on the particle. (For m to be independent of time, we must have $f_{\alpha} \tfrac{d x^{\alpha}}{d t} = 0$.)

Rearranging gets the force equation

$\frac{d }{d t} \left( m \frac{d x^{\nu}}{d \tau} \right) = - m \Gamma^{\nu}_{\mu\sigma} \frac{d x^{\mu}}{d \tau} \frac{d x^{\sigma}}{d t} + g^{\nu\alpha} f_{\alpha}$

where Γ is the Christoffel symbol which is the gravitational force field.

If we let

$p^{\nu} = m \frac{d x^{\nu}}{d \tau}$

be the (kinetic) linear momentum for a particle with mass, then

$\frac{d p^{\nu}}{d t} = - \Gamma^{\nu}_{\mu\sigma} p^{\mu} \frac{d x^{\sigma}}{d t} + g^{\nu\alpha} f_{\alpha}$

and

$\frac{d x^{\nu}}{d t} = \frac{p^{\nu}}{p^0}$

hold even for a massless particle.

## Applications or extensions of Lagrangian mechanics in other contexts

### Relation to other formulations of classical mechanics

The Hamiltonian, denoted by H, is obtained by performing a Legendre transformation on the Lagrangian, which introduces new variables, canonically conjugate to the original variables. This doubles the number of variables, but makes differential equations first order. The Hamiltonian is the basis for an alternative formulation of classical mechanics known as Hamiltonian mechanics. It is a particularly ubiquitous quantity in quantum mechanics (see Hamiltonian (quantum mechanics)). In the classical view, time is an independent variable and qi (and dqi/dt) are dependent variables as is often seen in phase space explanations of systems.

Routhian mechanics is a hybrid formulation of Lagrangian and Hamiltonian mechanics, which is not often used in practice but an efficient formulation for cyclic coordinates.

### Applications in quantum mechanics

In 1948, Feynman discovered the path integral formulation extending the principle of least action to quantum mechanics for electrons and photons. In this formulation, particles travel every possible path between the initial and final states; the probability of a specific final state is obtained by summing over all possible trajectories leading to it. In the classical regime, the path integral formulation cleanly reproduces Hamilton's principle, and Fermat's principle in optics.

### Classical field theory

In Lagrangian mechanics, the generalized coordinates form a discrete set of variables that define the configuration of a system. The continuum analogue for defining a field are field variables, say ϕ(r, t), which represents some density function varying with position and time.

In classical field theory, the physical system is not a set of discrete particles, but rather a continuous field defined over a region of 3d space. Associated with the field is a Lagrangian density

$\mathcal{L}(\phi, \nabla \phi, \partial\phi/\partial t , \mathbf{r},t)$

defined in terms of the field and its space and time derivatives at a location r and time t. The Lagrangian is then the integral of the Lagrangian density over 3d space (see volume integral):

$L(t) = \int \mathcal{L} \, d^3 \mathbf{r} \,$

where d3r is a 3d differential volume element, must be used instead. The Lagrangian is a function of time since the Lagrangian density has implicit space dependence via the fields, and may explicit spatial dependence, but these are removed in the integral, leaving only time in as the variable for the Lagrangian.

### Uses in Engineering

Circa 1963[when?] Lagrangians were a general part of the engineering curriculum, but a quarter of a century later, even with the ascendency of dynamical systems, they were dropped as requirements for some engineering programs, and are generally considered to be the domain of theoretical dynamics. Circa 2003[when?] this changed dramatically, and Lagrangians are not only a required part of many ME and EE graduate-level curricula, but also find applications in finance, economics, and biology, mainly as the basis of the formulation of various path integral schemes to facilitate the solution of parabolic partial differential equations via random walks.

Circa 2013,[when?] Lagrangians find their way into hundreds of direct engineering solutions, including robotics, turbulent flow analysis (Lagrangian and Eulerian specification of the flow field), signal processing, microscopic component contact and nanotechnology (superlinear convergent augmented Lagrangians), gyroscopic forcing and dissipation, semi-infinite supercomputing (which also involve Lagrange multipliers in the subfield of semi-infinite programming), chemical engineering (specific heat linear Lagrangian interpolation in reaction planning), civil engineering (dynamic analysis of traffic flows), optics engineering and design (Lagrangian and Hamiltonian optics) aerospace (Lagrangian interpolation), force stepping integrators, and even airbag deployment (coupled Eulerian-Lagrangians as well as SELM—the stochastic Eulerian Lagrangian method).[57]

## Footnotes

1. ^ Sometimes in this context the variational derivative denoted and defined as
$\frac{\delta}{\delta \mathbf{r}_k} \equiv \frac{\partial}{\partial \mathbf{r}_k} - \frac{d}{dt}\frac{\partial}{\partial \dot{\mathbf{r}}_k} \,$
is used. Throughout this article only partial and total derivatives are used.
2. ^ Here the virtual displacements are assumed reversible, it is possible for some systems to have non-reversible virtual displacements that violate this principle, see Udwadia–Kalaba equation.
3. ^ The Lagrangian also can be written explicitly for a rotating frame. See Padmanabhan, 2000.

## Notes

1. ^ a b Dvorak & Freistetter 2005, p. 24
2. ^ Haken 2006, p. 61
3. ^ Lanczos 1986, p. 43
4. ^ Menzel & Zatzkis 1960, p. 160
5. ^ Feynman
6. ^
7. ^ http://williamhoover.info/Scans1990s/1995-10.pdf
8. ^ Hand & Finch 2008, p. 36–40
9. ^ Torby1984, p.270
10. ^ a b Torby 1984, p. 269
11. ^ Hand & Finch 2008, p. 60–61
12. ^ Hand & Finch 2008, p. 19
13. ^ Penrose 2007
14. ^ Schuam 1988, p. 156
15. ^ Synge & Schild 1949, p. 150–152
16. ^ Hand & Finch 2008, p. 44–45
17. ^ Hand & Finch 2008, p. 44–45
18. ^ Foster & Nightingale 1995, p. 89
19. ^ Hand & Finch 2008, p. 4
20. ^ Goldstein 1980, p. 16–18
21. ^ Hand 2008, p. 15
22. ^ Hand & Finch 2008, p. 15
23. ^ Fetter & Walecka 1980, p. 53
24. ^ Torby 1984, p. 264
25. ^ Torby 1984, p. 269
26. ^ Kibble & Berkshire 2004, p. 234
27. ^ Fetter & Walecka 1980, p. 56
28. ^ Hand & Finch 2008, p. 17
29. ^ Hand & Finch 2008, p. 15–17
30. ^ R. Penrose (2007). The Road to Reality. Vintage books. p. 474. ISBN 0-679-77631-1.
31. ^ Goldstien 1980, p. 23
32. ^ Kibble & Berkshire 2004, p. 234–235
33. ^ Hand & Finch 2008, p. 51
34. ^ Fetter Walecka, pp. 68–70
35. ^ a b Landau & Lifshitz 1976, p. 4
36. ^
37. ^ Landau & Lifshitz 1976, p. 4
38. ^ Goldstien 1980, p. 21
39. ^ Landau & Lifshitz 1976, p. 14
40. ^ Landau & Lifshitz 1976, p. 22
41. ^ Taylor 2005, p. 297
42. ^ Padmanabhan 2000, p. 48
43. ^ Hand & Finch 1998, pp. 140–141
44. ^ Hildebrand 1992, p. 156
45. ^ Zak, Zbilut & Meyers 1997, pp. 202
46. ^ Shabana 2008, pp. 118–119
47. ^ Gannon 2006, p. 267
48. ^ Kosyakov 2007
49. ^ Galley 2013
50. ^ Hadar, Shahar & Kol 2014
51. ^ Birnholtz, Hadar & Kol 2013
52. ^ a b Torby 1984, p. 271
53. ^ Goldstein 1980, p. 324
54. ^ Hand & Finch 2008, p. 551
55. ^ Goldstein 1980, p. 323
56. ^ Hand & Finch 2008, p. 534
57. ^ Gans 2013

## References

• Hand, L. N.; Finch, J. D. Analytical Mechanics (2nd ed.). Cambridge University Press. p. 23. ISBN 9780521575720.
• Kibble, T. W. B.; Berkshire, F. H. (2004). Classical Mechanics (5th ed.). Imperial College Press. p. 236. ISBN 9781860944352.
• Fetter, A. L.; Walecka, J. D. (1980). Theoretical Mechanics of Particles and Continua. Dover. pp. 53–57. ISBN 978-0-486-43261-8.
• The Principle of Least Action, R. Feynman
• Doughty, Noel A. (1990). Lagrangian Interaction. Addison-Wesley Publishers Ltd. ISBN 0-201-41625-5.
• Kosyakov, B. P. (2007). Introduction to the classical theory of particles and fields. Berlin, Germany: Springer. doi:10.1007/978-3-540-40934-2.
• Torby, Bruce (1984). "Energy Methods". Advanced Dynamics for Engineers. HRW Series in Mechanical Engineering. United States of America: CBS College Publishing. ISBN 0-03-063366-4.
• Foster, J; Nightingale, J.D. (1995). A Short Course in General Relativity (2nd ed.). Springer. ISBN 0-03-063366-4.