1. Home
  2. Explore
  3. Physics
  4. Lagrange’s Equations of Motion

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Lagrange’s Equations of Motion

Lagrange’s Equations: Generalized Coordinates, Forces, and Applications

The Lagrangian and equations of motion

The Lagrangian of a mechanical system is the difference between its total kinetic and potential energies:

L=T−VL = T - VL=T−V

Here, TTT includes the kinetic energy of every part of the system, and VVV includes its potential energy.

For each generalized coordinate qjq_jqj​, Lagrange’s equation is

ddt(∂L∂q˙j)−∂L∂qj=Qj\frac{d}{dt}\left(\frac{\partial L}{\partial \dot q_j}\right) - \frac{\partial L}{\partial q_j} = Q_jdtd​(∂q˙​j​∂L​)−∂qj​∂L​=Qj​

where:

  • qjq_jqj​ is a generalized coordinate describing one degree of freedom.

  • q˙j\dot q_jq˙​j​ is its generalized velocity.

  • QjQ_jQj​ is the corresponding generalized force, representing the effects of applied nonconservative forces.

A system with nnn degrees of freedom requires nnn equations of motion, one for each coordinate qjq_jqj​, where jjj ranges from 111 to nnn.

For mechanical systems whose potential energy does not depend on velocity, substituting L=T−VL=T-VL=T−V gives a practical form:

ddt(∂T∂q˙j)−∂T∂qj+∂V∂qj=Qj\frac{d}{dt}\left(\frac{\partial T}{\partial \dot q_j}\right) - \frac{\partial T}{\partial q_j} + \frac{\partial V}{\partial q_j} = Q_jdtd​(∂q˙​j​∂T​)−∂qj​∂T​+∂qj​∂V​=Qj​

This form separates the calculations into four terms:

  1. ddt(∂T∂q˙j)\displaystyle \frac{d}{dt}\left(\frac{\partial T}{\partial \dot q_j}\right)dtd​(∂q˙​j​∂T​)

  2. −∂T∂qj\displaystyle -\frac{\partial T}{\partial q_j}−∂qj​∂T​

  3. +∂V∂qj\displaystyle +\frac{\partial V}{\partial q_j}+∂qj​∂V​

  4. QjQ_jQj​

The first three terms form the left-hand side of the equation; the generalized force is on the right. A systematic calculation repeats these steps for every generalized coordinate.

For ordinary mechanical systems, VVV depends on position but not on velocity, so the term involving ∂V/∂q˙j\partial V/\partial \dot q_j∂V/∂q˙​j​ is zero. Some systems, such as those involving charged particles in magnetic fields, can have velocity-dependent potential terms and require more care.


Choosing generalized coordinates

A generalized coordinate is any coordinate that helps describe the system’s configuration. It need not be a Cartesian coordinate such as xxx, yyy, or $z`; it can be an angle, a distance along a guide, or another suitable quantity. Generalized coordinates also need not themselves be inertial-frame coordinates.

A valid set of coordinates must be independent, complete, and appropriate for a holonomic system.

Independence

Coordinates are independent when fixing all but one still leaves the remaining coordinate free to vary continuously through its allowed range.

For example, a double pendulum can be described by two angles. Fixing the first angle still allows the second link to move; fixing the second angle still allows the first link to move. The two angles therefore provide independent coordinates.

By contrast, describing the positions of both particles of a double pendulum with four Cartesian coordinates, x1x_1x1​, y1y_1y1​, x2x_2x2​, and y2y_2y2​, introduces more coordinates than the system’s two degrees of freedom. Fixed string lengths impose constraints among those coordinates. If enough coordinates are fixed, the system can be immobilized, showing that the four-coordinate description is not an independent set.

Completeness

Coordinates are complete when their values determine the location of every relevant part of the system at any instant.

For the double pendulum, the two link angles are complete: knowing both angles determines the locations of both particles. A set of coordinates that leaves some part of the configuration unspecified is incomplete.

Holonomic systems and constraints

A system is holonomic when its constraints can be expressed as relationships among its configuration coordinates (and possibly time), so that the configuration can be fully described by a number of independent generalized coordinates equal to the system’s degrees of freedom.

In holonomic problems, the number of suitable independent coordinates matches the number of degrees of freedom. If a system’s constraints do not permit this kind of description, the standard Lagrange-coordinate procedure cannot be applied directly in the usual way.

A rolling ball illustrates the issue. Consider a rigid ball constrained to remain on a plane, with no vertical translation, no rotation about the vertical axis, and no slipping in either horizontal direction. Counting the instantaneous freedoms suggests two degrees of freedom: the ball’s position on the plane. However, the ball’s orientation also depends on the path taken to reach that position. Rolling along two different paths to the same location can leave a marked stripe on the ball in different orientations. Thus, the ball’s configuration cannot be determined from its two position coordinates alone. The no-slip constraints are nonholonomic: path history matters, and additional orientation information is needed to specify the state.


Generalized forces and virtual work

The generalized force QjQ_jQj​ is determined from the virtual work done by the nonconservative applied forces during a small, imagined displacement in coordinate qjq_jqj​.

A virtual displacement is an infinitesimal variation consistent with the system’s constraints. For force vectors Fi\mathbf{F}_iFi​ acting at locations with virtual displacements δri\delta \mathbf{r}_iδri​, the nonconservative virtual work is

δWnc=∑iFi⋅δri\delta W_{\mathrm{nc}} = \sum_i \mathbf{F}_i \cdot \delta \mathbf{r}_iδWnc​=∑i​Fi​⋅δri​

The generalized forces are defined by expressing this work in terms of the generalized-coordinate variations:

δWnc=∑jQj δqj\delta W_{\mathrm{nc}} = \sum_j Q_j\,\delta q_jδWnc​=∑j​Qj​δqj​

Thus, QjQ_jQj​ is the coefficient of δqj\delta q_jδqj​ in the virtual-work expression. Only the component of a force along the corresponding displacement contributes, as determined by the dot product.

A generalized force’s units depend on its coordinate. If qjq_jqj​ is a distance, QjQ_jQj​ has units of force. If qjq_jqj​ is an angle, QjQ_jQj​ has units of torque.

In this approach, conservative forces such as gravity and ideal springs are usually accounted for through VVV. Nonconservative effects such as damping and externally applied forces are included in QjQ_jQj​.


A systematic procedure for applying Lagrange’s equations

For each problem:

  1. Determine the degrees of freedom and choose a set of generalized coordinates.

  2. Check the coordinate set: the coordinates should be independent and complete, and the problem should be holonomic for the standard procedure.

  3. Calculate the total kinetic energy TTT and potential energy VVV, including all relevant bodies and energy sources.

  4. For each coordinate qjq_jqj​, calculate the first three terms in the practical Lagrange equation.

  5. Find QjQ_jQj​ by calculating the virtual work of the nonconservative forces for a virtual displacement in qjq_jqj​.

  6. Check the result against physical expectations, such as force or torque units, expected acceleration terms, and static equilibrium.

Careful bookkeeping is important: the calculation of the four terms must be repeated for every generalized coordinate.


Example: mass–spring–damper system

Consider a mass mmm moving in the xxx direction, attached to a spring of stiffness kkk and a damper with coefficient bbb. Let an external force f(t)f(t)f(t) also act in the xxx direction. The coordinate xxx is a suitable generalized coordinate: it completely and independently specifies the motion.

The kinetic energy is

T=12mx˙2T = \frac{1}{2}m\dot x^2T=21​mx˙2

With the chosen gravitational reference and sign convention, the potential energy is

V=12kx2−mgxV = \frac{1}{2}kx^2 - mgxV=21​kx2−mgx

The spring and gravity are conservative, so their effects appear in VVV. The damper and applied force are nonconservative. The net generalized force is

Qx=f(t)−bx˙Q_x = f(t)-b\dot xQx​=f(t)−bx˙

Applying the practical Lagrange equation:

  • The first term is ddt(∂T∂x˙)=mx¨\displaystyle \frac{d}{dt}\left(\frac{\partial T}{\partial \dot x}\right)=m\ddot xdtd​(∂x˙∂T​)=mx¨.

  • The second term is −∂T∂x=0\displaystyle -\frac{\partial T}{\partial x}=0−∂x∂T​=0, because TTT does not depend on xxx.

  • The third term is ∂V∂x=kx−mg\displaystyle \frac{\partial V}{\partial x}=kx-mg∂x∂V​=kx−mg.

  • The fourth term is Qx=f(t)−bx˙Q_x=f(t)-b\dot xQx​=f(t)−bx˙.

Therefore,

mx¨+kx−mg=f(t)−bx˙m\ddot x+kx-mg=f(t)-b\dot xmx¨+kx−mg=f(t)−bx˙

or, after rearranging,

mx¨+bx˙+kx=mg+f(t)m\ddot x+b\dot x+kx=mg+f(t)mx¨+bx˙+kx=mg+f(t)

The equation contains the expected inertial term, spring force, damping contribution, gravity, and external excitation. It is equivalent to the equation obtained by applying Newton’s second law to a free-body diagram.


Example: a sliding mass on a swinging rod

Coordinates and system description

Consider a rod of mass m1m_1m1​ and length l1l_1l1​ pinned at a fixed point AAA. A sleeve or sliding mass of mass m2m_2m2​ moves along the rod while the rod swings. A spring acts on the sliding assembly, and a horizontal time-varying force is applied to it.

Two generalized coordinates describe the motion:

  • θ\thetaθ: the rod’s angle from its downward vertical position.

  • x1x_1x1​: the distance from AAA to the center of mass of the sliding mass.

These coordinates describe both the rod’s swing and the sleeve’s motion along the rod. Each can vary while the other is held fixed, so they are independent; together, they completely specify the configuration.

Let l0l_0l0​ be the spring’s unstretched length, and let l2l_2l2​ be the sleeve’s length. Because x1x_1x1​ locates the sleeve’s center of mass, the spring extension is

x1−l0−l22x_1-l_0-\frac{l_2}{2}x1​−l0​−2l2​​

The rod’s center of mass is a distance l1/2l_1/2l1​/2 from the pivot. Let IA1I_{A1}IA1​ denote the rod’s mass moment of inertia about AAA, and let IG2I_{G2}IG2​ denote the sleeve’s mass moment of inertia about its own center of mass. An applied horizontal force may be written as f0cos⁡(ωt)f_0\cos(\omega t)f0​cos(ωt), where f0f_0f0​ is its amplitude and ω\omegaω is its angular frequency.

Potential energy

The total potential energy includes the spring and gravitational contributions of both bodies.

The spring energy is

Vspring=12k(x1−l0−l22)2V_{\mathrm{spring}} = \frac{1}{2}k\left(x_1-l_0-\frac{l_2}{2}\right)^2Vspring​=21​k(x1​−l0​−2l2​​)2

Taking the rod’s lowest position as its gravitational reference, the rod’s gravitational potential energy is

Vrod=m1gl12(1−cos⁡θ)V_{\mathrm{rod}} = m_1g\frac{l_1}{2}(1-\cos\theta)Vrod​=m1​g2l1​​(1−cosθ)

For the sliding mass, the change in height depends on both its distance along the rod and the rod’s angle. With the reference convention used here,

Vslider=m2g(l0+l22−x1cos⁡θ)V_{\mathrm{slider}} = m_2g\left(l_0+\frac{l_2}{2}-x_1\cos\theta\right)Vslider​=m2​g(l0​+2l2​​−x1​cosθ)

Thus,

V=12k(x1−l0−l22)2+m1gl12(1−cos⁡θ)+m2g(l0+l22−x1cos⁡θ)V = \frac{1}{2}k\left(x_1-l_0-\frac{l_2}{2}\right)^2 + m_1g\frac{l_1}{2}(1-\cos\theta) + m_2g\left(l_0+\frac{l_2}{2}-x_1\cos\theta\right)V=21​k(x1​−l0​−2l2​​)2+m1​g2l1​​(1−cosθ)+m2​g(l0​+2l2​​−x1​cosθ)

The reference level for potential energy can be chosen for convenience; the equations depend on changes in potential energy, not on an arbitrary additive constant.

Kinetic energy

The rod rotates about its fixed pivot, so its kinetic energy is

Trod=12IA1θ˙2T_{\mathrm{rod}} = \frac{1}{2}I_{A1}\dot\theta^2Trod​=21​IA1​θ˙2

The sleeve has rotational kinetic energy about its center of mass and translational kinetic energy of its center of mass. Its center-of-mass speed has a component from sliding along the rod and a component from the rod’s rotation. Therefore,

Tslider=12IG2θ˙2+12m2(x˙12+x12θ˙2)T_{\mathrm{slider}} = \frac{1}{2}I_{G2}\dot\theta^2 + \frac{1}{2}m_2\left(\dot x_1^2+x_1^2\dot\theta^2\right)Tslider​=21​IG2​θ˙2+21​m2​(x˙12​+x12​θ˙2)

Combining the terms gives

T=12IA1θ˙2+12IG2θ˙2+12m2(x˙12+x12θ˙2)T = \frac{1}{2}I_{A1}\dot\theta^2 + \frac{1}{2}I_{G2}\dot\theta^2 + \frac{1}{2}m_2\left(\dot x_1^2+x_1^2\dot\theta^2\right)T=21​IA1​θ˙2+21​IG2​θ˙2+21​m2​(x˙12​+x12​θ˙2)

The rod’s inertia is taken about the fixed pivot, while the sleeve’s rotational inertia is taken about its moving center of mass; the sleeve’s translational energy is included separately.

Equation for sliding motion

For the coordinate x1x_1x1​, the kinetic-energy terms are

ddt(∂T∂x˙1)=m2x¨1\frac{d}{dt}\left(\frac{\partial T}{\partial \dot x_1}\right) = m_2\ddot x_1dtd​(∂x˙1​∂T​)=m2​x¨1​

and

−∂T∂x1=−m2x1θ˙2-\frac{\partial T}{\partial x_1} = -m_2x_1\dot\theta^2−∂x1​∂T​=−m2​x1​θ˙2

The first term is the mass’s acceleration along the rod. The second is the centripetal contribution associated with the rotation of the rod.

The potential-energy derivative is

∂V∂x1=k(x1−l0−l22)−m2gcos⁡θ\frac{\partial V}{\partial x_1} = k\left(x_1-l_0-\frac{l_2}{2}\right)-m_2g\cos\theta∂x1​∂V​=k(x1​−l0​−2l2​​)−m2​gcosθ

The horizontal applied force has a component along the rod proportional to sin⁡θ\sin\thetasinθ. Its generalized force for sliding is therefore

Qx1=f0cos⁡(ωt)sin⁡θQ_{x_1} = f_0\cos(\omega t)\sin\thetaQx1​​=f0​cos(ωt)sinθ

The equation of motion along the rod is

m2x¨1−m2x1θ˙2+k(x1−l0−l22)−m2gcos⁡θ=f0cos⁡(ωt)sin⁡θm_2\ddot x_1 - m_2x_1\dot\theta^2 + k\left(x_1-l_0-\frac{l_2}{2}\right) - m_2g\cos\theta = f_0\cos(\omega t)\sin\thetam2​x¨1​−m2​x1​θ˙2+k(x1​−l0​−2l2​​)−m2​gcosθ=f0​cos(ωt)sinθ

This is a force equation: its terms have units of force. It includes sliding acceleration, the centripetal contribution, spring force, gravity along the rod, and the applied force’s component in the sliding direction.

Equation for swinging motion

For the angular coordinate, the kinetic-energy derivative is

ddt(∂T∂θ˙)=(IA1+IG2+m2x12)θ¨+2m2x1x˙1θ˙\frac{d}{dt}\left(\frac{\partial T}{\partial \dot\theta}\right) = \left(I_{A1}+I_{G2}+m_2x_1^2\right)\ddot\theta + 2m_2x_1\dot x_1\dot\thetadtd​(∂θ˙∂T​)=(IA1​+IG2​+m2​x12​)θ¨+2m2​x1​x˙1​θ˙

The factor m2x12m_2x_1^2m2​x12​ represents the contribution of the sliding mass’s distance from the pivot to the system’s angular inertia. The term 2m2x1x˙1θ˙2m_2x_1\dot x_1\dot\theta2m2​x1​x˙1​θ˙ arises because that distance changes while the rod rotates; it is the angular equation’s Coriolis-type coupling term.

The potential-energy derivative is

∂V∂θ=m1gl12sin⁡θ+m2gx1sin⁡θ\frac{\partial V}{\partial\theta} = m_1g\frac{l_1}{2}\sin\theta + m_2gx_1\sin\theta∂θ∂V​=m1​g2l1​​sinθ+m2​gx1​sinθ

A virtual change δθ\delta\thetaδθ moves the point where the applied force acts through a tangential distance proportional to its distance from the pivot. Since the force acts at the end of the sleeve, that distance is x1+l2/2x_1+l_2/2x1​+l2​/2. Taking the component of the horizontal force in the tangential direction gives

Qθ=f0cos⁡(ωt)(x1+l22)cos⁡θQ_\theta = f_0\cos(\omega t)\left(x_1+\frac{l_2}{2}\right)\cos\thetaQθ​=f0​cos(ωt)(x1​+2l2​​)cosθ

The angular equation of motion is therefore

(IA1+IG2+m2x12)θ¨+2m2x1x˙1θ˙+(m1gl12+m2gx1)sin⁡θ=f0cos⁡(ωt)(x1+l22)cos⁡θ\left(I_{A1}+I_{G2}+m_2x_1^2\right)\ddot\theta + 2m_2x_1\dot x_1\dot\theta + \left(m_1g\frac{l_1}{2}+m_2gx_1\right)\sin\theta = f_0\cos(\omega t)\left(x_1+\frac{l_2}{2}\right)\cos\theta(IA1​+IG2​+m2​x12​)θ¨+2m2​x1​x˙1​θ˙+(m1​g2l1​​+m2​gx1​)sinθ=f0​cos(ωt)(x1​+2l2​​)cosθ

This is a torque equation. Its terms represent angular acceleration, coupling caused by simultaneous sliding and rotation, gravitational restoring effects, and the applied force’s moment about the pivot.

Physical checks

A useful equation should contain the accelerations expected from the motion and should have consistent units. The x1x_1x1​ equation should have units of force, while the θ\thetaθ equation should have units of torque.

Static equilibrium provides another check. With no time-dependent forcing and no motion, take θ=0\theta=0θ=0 and set all time derivatives to zero. The sliding equation reduces to

k(x1−l0−l22)=m2gk\left(x_1-l_0-\frac{l_2}{2}\right)=m_2gk(x1​−l0​−2l2​​)=m2​g

The spring’s static extension therefore balances the sliding mass’s weight.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent