Lagrangian Dynamics
Lagrangian dynamics derives the equations of motion of a mechanical system from a single scalar function — the Lagrangian — instead of from vector force balances. The Lagrangian is the difference between kinetic and potential energy:
where is a vector of generalized coordinates that uniquely specifies the system’s configuration. Generalized coordinates need not be Cartesian or orthogonal, need not have units of length (angles are typical), and are chosen so that holonomic constraints are automatically satisfied — the count equals the number of degrees of freedom.Hamilton’s principle of stationary action asserts that the physical trajectory between fixed endpoints makes the action functional
stationary, i.e. . The variational condition is equivalent to the Euler–Lagrange equations, a system of second-order ODEs:
where is the generalized force (joint torque, applied force, etc.) conjugate to via virtual work . With the system is conservative; for a robot, is the vector of joint torques delivered by the motors.For robots and other multi-body mechanisms, Lagrange has decisive advantages over Newton:
- Energies (scalar) instead of forces (vector), so frame choice is irrelevant.
- Constraint forces drop out because virtual displacements respect the constraints by construction — no need to solve for joint reaction forces.
- Non-inertial frames pose no problem — fictitious centrifugal, Coriolis, and Euler forces appear automatically in the equations.
- Fewer coordinates: a 6-DoF serial arm needs generalized coordinates, vs. scalar parameters in Newton before constraints reduce them.
The output is the equations of motion in manipulator standard form (see 6.3. Manipulator Equations of Motion):
which are mathematically identical to those derived via Newton–Euler.Treat and as independent variables When evaluating and , hold the other variable fixed. Their physical coupling is enforced only by the outer total time derivative . Confusing partial and total derivatives here is the most common algebra error in deriving equations of motion.
Intuition
Newton tracks vectors: every body gets one in three components, plus a constraint force per joint. A six-link arm needs 36 scalar equations before constraints reduce the system back to six. Lagrange tracks a single scalar — the energy difference — and applies the same Euler–Lagrange operator once per degree of freedom. Constraint forces never appear because they do no work along the constraint surface, and non-inertial frames pose no problem because energies are coordinate-free scalars.
The reason this works is variational: of all conceivable paths between the endpoints, the physical one is the critical point of the action . The Euler–Lagrange equations are the calculus-of-variations analog of “set the derivative to zero” — the local condition that produces .
Procedure
Apply this five-step recipe to any mechanical system:
- Pick generalized coordinates. Choose a minimal set that uniquely specifies the configuration and respects all holonomic constraints. For a serial manipulator, joint angles are the natural choice.
- Write the kinetic energy . For a system of rigid bodies, use from 6.2. Kinetic Energy of a Rigid Body.
- Write the potential energy . Sum gravitational over all links and elastic over all springs. The zero of is arbitrary — pick it to make algebra clean.
- Form the Lagrangian .
- Apply Euler–Lagrange for each :
The result is a system of coupled second-order ODEs that can be put in standard form .
Properties
Foundations
(Energy vs. Force) The Lagrangian formulation replaces vector force balance with the scalar function .
Newton requires one vector equation per rigid body and an explicit constraint force for every joint. Lagrange replaces all of this with the energies and , which are coordinate-frame-independent scalars. The dimensionality collapses from down to — the number of DoF — and one Euler–Lagrange equation is computed per generalized coordinate.
(Generalized Coordinates Eliminate Constraints) Holonomic constraints are absorbed by the choice of , so constraint forces never appear in the equations of motion.
A pendulum of length has the Cartesian constraint ; in Newton this is enforced by a tension that must be solved for. Choosing (swing angle) automatically encodes the constraint and the tension drops out. This is why a serial 6-DoF manipulator needs only joint-angle coordinates instead of the 36 scalar parameters required to track six independent rigid bodies.
(Frame Independence) The Euler–Lagrange equations hold in any choice of generalized coordinates, including non-inertial and rotating ones.
Newton requires an inertial frame; rotating frames introduce fictitious centrifugal, Coriolis, and Euler forces that must be added by hand. Because the Lagrangian only sees energies, a rotating frame is just another choice of — the centrifugal and Coriolis effects appear automatically through the term in standard form, not as external corrections.
(Equivalence to Newton) The Euler–Lagrange equations produce the same equations of motion as Newton–Euler for any mechanical system.
The two formulations are mathematically equivalent. Lagrange is preferred for derivation; recursive Newton–Euler is sometimes preferred for numerical evaluation on serial chains because forces can be propagated outward and inward in time.
Mechanics of the Derivative
(Independence of and in Partials) When evaluating and , treat and as independent.
The Lagrangian is viewed as a function with two independent vector arguments. Their physical coupling is enforced only by the outer total time derivative in the Euler–Lagrange equation.
(Generalized Force Conjugacy) The right-hand side is the force conjugate to via virtual work, .
If is a length, is a force; if is an angle, is a torque. For a robot, is exactly the torque (or force, for a prismatic joint) that the motor at joint must supply — this is what makes Lagrange the natural language for inverse dynamics and torque-based control.
(Lagrangian Equivalence) Adding a function of time alone, or any total time derivative , leaves the Euler–Lagrange equations unchanged.
This is the source of the freedom to pick the zero of potential energy arbitrarily, and the reason gauge-like simplifications (dropping constants, absorbing total derivatives) are always allowed.
Exam & Homework Hacks
(Pick the Gravity Reference Smartly) The zero of is arbitrary — choose it to kill terms.
For a pendulum, measure height from the pivot (); for a manipulator, measure each link’s CoM height from the base frame’s plane. A constant offset never changes .
(Compute in Whatever Frame Is Easiest) Kinetic energy depends only on the magnitude of velocity, so it can be evaluated in body or spatial coordinates.
Pick the frame that diagonalizes the inertia tensor (typically the body frame aligned with principal axes — see 6.2. Kinetic Energy of a Rigid Body).
(Check Units of Against ) If has units of radians, must come out in .
A unit mismatch on either side of the equation usually traces to a missing Jacobian in the velocity expression.
(Sanity-Check by Setting ) At rest, the equations should reduce to — the static torque needed to hold the configuration against gravity.
A plausible “hold-up torque” is a strong indicator the derivation is correct. If comes out negative where it should be positive (or vice versa), there is likely a sign error in the height function inside .
(Look for Symmetries) Cyclic coordinates () yield conserved momenta .
If a coordinate does not appear explicitly in , its conjugate momentum is conserved. Useful for first integrals on exam problems where direct integration of the second-order ODE is hard.
Derivation
Derivation of the Euler–Lagrange equations from
Consider a one-parameter family of paths with the same endpoints, so . The action along this family is
Stationarity at requires . Differentiating under the integral and using the chain rule,
Integrate the second term by parts and use to kill the boundary term:
Combining,
Since is an arbitrary variation, the bracketed expression must vanish at every , giving the Euler–Lagrange equations. Generalized forces enter on the right-hand side via the principle of virtual work.
Examples
Mass–spring on a frictionless surface
A block of mass slides horizontally and is attached to a wall by a spring of stiffness . Let , the displacement from the spring’s natural length.
Setup , . Lagrangian: .
Energies:
Apply Euler–Lagrange With : .
This matches the Newtonian derivation , but required no free-body diagram.
Simple pendulum
A point mass hangs from a massless rod of length pivoting at the origin under gravity . The Cartesian constraint is absorbed by choosing (angle from the downward vertical).
Position, velocity, and energies , , so . Then and . Lagrangian: .
Apply Euler–Lagrange Setting :
For small this linearizes to simple harmonic motion with angular frequency . Notice the rod tension never appears — that is the constraint-elimination property in action.
Two-link planar arm
Two revolute joints with angles , link lengths , point-mass loads at the link ends, gravity along .
Positions of the masses
Kinetic and potential energy
Euler–Lagrange and standard form and applying Euler–Lagrange to each produces two coupled second-order ODEs that fall directly into the standard form . The coefficients of populate , the coefficients of populate , and the gradient of populates . The full extraction is worked through in that note.
Forming