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:
Here, T includes the kinetic energy of every part of the system, and V includes its potential energy.
For each generalized coordinate qj, Lagrange’s equation is
where:
qj is a generalized coordinate describing one degree of freedom.
q˙j is its generalized velocity.
Qj is the corresponding generalized force, representing the effects of applied nonconservative forces.
A system with n degrees of freedom requires n equations of motion, one for each coordinate qj, where j ranges from 1 to n.
For mechanical systems whose potential energy does not depend on velocity, substituting L=T−V gives a practical form:
This form separates the calculations into four terms:
dtd(∂q˙j∂T)
−∂qj∂T
+∂qj∂V
Qj
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, V depends on position but not on velocity, so the term involving ∂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 x, y, 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, x1, y1, x2, and y2, 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 Qj is determined from the virtual work done by the nonconservative applied forces during a small, imagined displacement in coordinate qj.
A virtual displacement is an infinitesimal variation consistent with the system’s constraints. For force vectors Fi acting at locations with virtual displacements δri, the nonconservative virtual work is
The generalized forces are defined by expressing this work in terms of the generalized-coordinate variations:
Thus, Qj is the coefficient of δ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 qj is a distance, Qj has units of force. If qj is an angle, Qj has units of torque.
In this approach, conservative forces such as gravity and ideal springs are usually accounted for through V. Nonconservative effects such as damping and externally applied forces are included in Qj.
A systematic procedure for applying Lagrange’s equations
For each problem:
Determine the degrees of freedom and choose a set of generalized coordinates.
Check the coordinate set: the coordinates should be independent and complete, and the problem should be holonomic for the standard procedure.
Calculate the total kinetic energy T and potential energy V, including all relevant bodies and energy sources.
For each coordinate qj, calculate the first three terms in the practical Lagrange equation.
Find Qj by calculating the virtual work of the nonconservative forces for a virtual displacement in qj.
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 m moving in the x direction, attached to a spring of stiffness k and a damper with coefficient b. Let an external force f(t) also act in the x direction. The coordinate x is a suitable generalized coordinate: it completely and independently specifies the motion.
The kinetic energy is
With the chosen gravitational reference and sign convention, the potential energy is
The spring and gravity are conservative, so their effects appear in V. The damper and applied force are nonconservative. The net generalized force is
Applying the practical Lagrange equation:
The first term is dtd(∂x˙∂T)=mx¨.
The second term is −∂x∂T=0, because T does not depend on x.
The third term is ∂x∂V=kx−mg.
The fourth term is Qx=f(t)−bx˙.
Therefore,
or, after rearranging,
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 m1 and length l1 pinned at a fixed point A. A sleeve or sliding mass of mass m2 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:
θ: the rod’s angle from its downward vertical position.
x1: the distance from A 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 l0 be the spring’s unstretched length, and let l2 be the sleeve’s length. Because x1 locates the sleeve’s center of mass, the spring extension is
The rod’s center of mass is a distance l1/2 from the pivot. Let IA1 denote the rod’s mass moment of inertia about A, and let 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), where f0 is its amplitude and ω is its angular frequency.
Potential energy
The total potential energy includes the spring and gravitational contributions of both bodies.
The spring energy is
Taking the rod’s lowest position as its gravitational reference, the rod’s gravitational potential energy is
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,
Thus,
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
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,
Combining the terms gives
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 x1, the kinetic-energy terms are
and
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
The horizontal applied force has a component along the rod proportional to sinθ. Its generalized force for sliding is therefore
The equation of motion along the rod is
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
The factor m2x12 represents the contribution of the sliding mass’s distance from the pivot to the system’s angular inertia. The term 2m2x1x˙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
A virtual change δθ 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/2. Taking the component of the horizontal force in the tangential direction gives
The angular equation of motion is therefore
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 x1 equation should have units of force, while the θ equation should have units of torque.
Static equilibrium provides another check. With no time-dependent forcing and no motion, take θ=0 and set all time derivatives to zero. The sliding equation reduces to
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.