Multibody Dynamics · Module 7 of 10
Lagrangian Dynamics and Virtual Work
Free-body diagrams get heavy with many bodies. Lagrange’s method works from energy instead, and virtual work turns any applied load into the right generalized force.
Readiness check
Tick only what you can do closed-notes before starting.
- Write kinetic and potential energy for a simple system.
- Differentiate an energy expression with respect to a coordinate.
- Recall what virtual work means.
- State that a generalized force pairs with a generalized coordinate.
- Recall the pendulum natural frequency √(g/L).
The core idea
Lagrange’s equations derive the equations of motion from a single scalar, the Lagrangian L = T − V, plus generalized forces found by virtual work. For constrained systems, Lagrange multipliers add the joint reactions.
Lagrangian: L = T − Vd/dt(∂L/∂q̇) − ∂L/∂q = Qvirtual work: δW = Q · δqNewton-Euler works force by force; for many bodies that becomes a lot of vector bookkeeping and unknown joint reactions. Lagrange’s method sidesteps most of it by working from energy. Form the kinetic energy T and potential energy V in whatever generalized coordinates you chose, take their difference as the Lagrangian, and apply the Euler-Lagrange operator to each coordinate. Joint reaction forces that do no work, ideal pins and sliders, drop out automatically, so the equations come out in terms of the motions you care about. Applied loads that are not derivable from a potential enter through the generalized force Q, computed by virtual work: give the coordinate a small virtual change, find the work the load does, and read off Q as work per unit coordinate. When you keep dependent coordinates and explicit constraints, the reactions come back deliberately as Lagrange multipliers times the constraint Jacobian, one multiplier per constraint. That multiplier form is the bridge to the constrained equations of motion in the next module.
The skills, taught in order
Five skills build equations of motion from energy.
7.1 Kinetic and potential energy
Write T and V in the chosen coordinates. Getting these two scalars right is the whole modeling step; everything else is differentiation.
7.2 The Lagrangian and its equation
Form L = T − V and apply d/dt(∂L/∂q̇) − ∂L/∂q = Q for each coordinate. Each coordinate gives one equation of motion.
7.3 Generalized forces by virtual work
For loads without a potential, compute Q from δW = Q · δq. Virtual work projects a real force onto each coordinate correctly, including through linkages.
7.4 Workless constraints drop out
Ideal joint reactions do no virtual work, so a minimal-coordinate Lagrangian never shows them. This is the efficiency that makes the method scale.
7.5 Lagrange multipliers for constraints
With dependent coordinates, add Φ_qTλ to bring the reactions back explicitly, one multiplier per constraint. This links Lagrange’s method to the constrained (DAE) form.
| Method | Works from | Joint reactions |
|---|---|---|
| Newton-Euler | forces and moments | explicit unknowns |
| Lagrange (minimal) | energy scalars | eliminated |
| Lagrange (multipliers) | energy plus constraints | λ per constraint |
Choose minimal coordinates to hide reactions, or multipliers to recover them; both give the same motion.
Engineering connection: robot-arm controllers are usually built on the Lagrangian form, because joint torques are the natural generalized forces and the reactions drop out.
Worked example 1: the pendulum by Lagrange
A point mass on a massless rod of length L = 0.5 m swings under gravity. Using the angle θ as the generalized coordinate, derive the equation of motion and the small-angle natural frequency.
- ProblemFind the equation of motion and natural frequency of the pendulum in Figure 1.
- Given / findL = 0.5 m, g = 9.81 m/s², coordinate θ. Find the equation of motion and ω_n.
- AssumptionsPoint mass, massless rigid rod, frictionless pivot, gravity constant.
- ModelT = ½ m L² θ̇², V = −m g L cosθ. Apply Lagrange’s equation to θ.
- Equationsd/dt(m L² θ̇) + m g L sinθ = 0θ̈ = −(g/L) sinθ
- SolveSmall angles give θ̈ + (g/L)θ = 0, so ω_n = √(g/L) = √(9.81/0.5) = 4.43 rad/s, period T = 2π/ω_n = 1.42 s.
- CheckThe mass cancels, as it must for a pendulum, and the frequency rises when the rod is shortened, matching everyday experience.
- ConclusionOne energy expression gave the full nonlinear equation and its small-angle frequency of 4.43 rad/s. No joint reaction ever appeared.
Worked example 2: a generalized force by virtual work
A horizontal force F = 100 N is applied at the tip of a link of length L = 0.5 m pinned at the origin, at angle θ = 30 degrees from vertical. Find the generalized force associated with θ.
- ProblemFind Q_θ for the applied force in Figure 2.
- Given / findF = 100 N horizontal, L = 0.5 m, θ = 30°. Find the generalized force Q_θ.
- AssumptionsRigid link, ideal pin, the force stays horizontal during the virtual displacement.
- ModelTip horizontal position x = L sinθ, so δx = L cosθ δθ; virtual work δW = F δx gives Q_θ = F L cosθ.
- Equationsδx = L cosθ δθQ_θ = F L cosθ
- SolveQ_θ = 100 × 0.5 × cos30° = 50 × 0.866 = 43.3 N·m.
- CheckThe units are a moment, as a generalized force paired with an angle must be, and Q falls to zero at θ = 90° where the force is along the link and does no work turning it.
- ConclusionVirtual work turns a 100 N horizontal load into a 43.3 N·m generalized force on θ. This projection is how any load enters Lagrange’s equations.
Worked example 3: a two-degree-of-freedom system by Lagrange
Two equal masses m = 1 kg lie in a line, each tied to a wall by a spring k = 1 N/m and to each other by a coupling spring k_c = 1 N/m. Using x₁ and x₂ as coordinates, build the equations of motion by Lagrange and find the natural frequencies and mode shapes.
- ProblemFind the two natural frequencies and mode shapes of the system in Figure 3.
- Given / findm = 1 kg each, outer springs k = 1 N/m, coupling spring k_c = 1 N/m. Find the mass and stiffness matrices, the natural frequencies, and the mode shapes.
- AssumptionsMassless linear springs, frictionless motion, small displacements so the system is linear.
- ModelT = ½ m(ẋ₁² + ẋ₂²); V = ½ k x₁² + ½ k_c(x₂ − x₁)² + ½ k x₂². Lagrange gives M ẍ + K x = 0, then det(K − ω² M) = 0.
- EquationsM = [[m, 0], [0, m]], K = [[k + k_c, −k_c], [−k_c, k + k_c]]det(K − ω² M) = 0
- SolveWith the numbers, M = [[1, 0], [0, 1]] and K = [[2, −1], [−1, 2]]. The eigenvalues ω² are 2 − 1 = 1 and 2 + 1 = 3, so ω₁ = 1 rad/s and ω₂ = √3 = 1.73 rad/s, with mode shapes (1, 1) and (1, −1).
- CheckThe low mode (1, 1) moves both masses together, stretching only the outer springs, so ω₁ = √(k/m) = 1. The high mode (1, −1) also stretches the coupling spring, so ω₂ = √((k + 2k_c)/m) = √3.
- ConclusionThe system has an in-phase mode at 1 rad/s and an out-of-phase mode at 1.73 rad/s. Two energy scalars became the mass and stiffness matrices, and one eigenproblem gave both modes, the pattern that scales to any multi-body model.
Misconceptions and diagnostics
| Mistake | Symptom | Diagnostic question | Correction |
|---|---|---|---|
| Sign error in potential energy | Frequency or equilibrium comes out wrong | Does V increase as the body rises? | Take V positive upward and be consistent with the datum. |
| Forgetting a generalized force | An applied load silently disappears | Did I do virtual work for every non-potential load? | Project each load with δW = Q · δq. |
| Keeping constraint forces in minimal coordinates | Extra unknown reactions clutter the equations | Do ideal reactions do any virtual work? | In minimal coordinates they vanish; leave them out. |
| Mismatched multiplier count | Constraint reactions do not close | Is there one λ per constraint? | Add exactly one multiplier for each constraint equation. |
Practice ladder
A pendulum has L = 2 m. Find its small-angle natural frequency.
Show answer
ω_n = √(g/L) = √(9.81/2) = 2.21 rad/s.
A vertical force F = 60 N acts at the tip of a link (L = 0.4 m) at θ = 0 from vertical. Find Q_θ for a horizontal virtual displacement.
Show answer
Tip x = L sinθ, δx = L cosθ δθ; but a vertical force does work through δy = L sinθ δθ, so at θ = 0, Q_θ = −F L sin0 = 0.
Write the Lagrangian of a mass m on a spring k (coordinate x), and derive its equation of motion.
Show answer
L = ½ m ẋ² − ½ k x²; Lagrange gives m ẍ + k x = 0, so ω_n = √(k/m).
For a two-coordinate system you know, write T and V and set up the Lagrange equations without solving them.
What good work looks like
A good answer states T and V in the chosen coordinates, forms L = T − V, and writes one Euler-Lagrange equation per coordinate with generalized forces included.
Working with AI, and proving it yourself
Ask AI to check your energy expressions, not to derive for you
Portfolio task
For one system, derive the equations of motion by Lagrange’s method and confirm they match a Newton-Euler derivation of the same system.
Retrieval and spaced review
Closed notes. Answer out loud, then reveal.
1. Define the Lagrangian.
L = T − V, kinetic minus potential energy.
2. Write Lagrange’s equation.
d/dt(∂L/∂q̇) − ∂L/∂q = Q for each coordinate.
3. How is a generalized force found?
By virtual work: δW = Q · δq.
4. Why do ideal joint reactions vanish?
They do no virtual work in minimal coordinates.
5. How do reactions return?
As Lagrange multipliers times the constraint Jacobian, one per constraint.
Textbook mapping
Analytical mechanics underlies Wittenburg’s formalism through d’Alembert’s principle. Use these references to read further.
| Topic in this module | Where to read more |
|---|---|
| d’Alembert’s principle and energy methods | Wittenburg, Dynamics of Multibody Systems, ch. 3 |
| Generalized coordinates and forces | Wittenburg, Dynamics of Multibody Systems, ch. 5 |
| Lagrange multipliers for constraints | Nikravesh, Computer-Aided Analysis of Mechanical Systems |
Chapter references are to Wittenburg, Dynamics of Multibody Systems (Springer).