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.

01

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).
0 or 1 weak itemsContinue with this module.
2 weak itemsRevisit energy methods in Dynamics, Module 4.
3 or more weak itemsReview virtual work in Statics, virtual work.
02

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 · δq

Newton-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 skill works when: you choose good generalized coordinates so that workless constraint forces vanish from the equations.
The skill breaks down when: you forget a generalized force or mis-project a load, so an applied effect is silently dropped.
The concept. Lagrange’s method builds the equations of motion from two scalars, kinetic minus potential energy, avoiding the vector bookkeeping of free-body diagrams.
03

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.

MethodWorks fromJoint reactions
Newton-Eulerforces and momentsexplicit unknowns
Lagrange (minimal)energy scalarseliminated
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.

04

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.

Figure 1. The simple pendulum from Lagrange’s equation: one energy expression yields the equation of motion and a small-angle natural frequency of 4.43 rad/s.
  1. ProblemFind the equation of motion and natural frequency of the pendulum in Figure 1.
  2. Given / findL = 0.5 m, g = 9.81 m/s², coordinate θ. Find the equation of motion and ω_n.
  3. AssumptionsPoint mass, massless rigid rod, frictionless pivot, gravity constant.
  4. ModelT = ½ m L² θ̇², V = −m g L cosθ. Apply Lagrange’s equation to θ.
  5. Equationsd/dt(m L² θ̇) + m g L sinθ = 0θ̈ = −(g/L) sinθ
  6. 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.
  7. CheckThe mass cancels, as it must for a pendulum, and the frequency rises when the rod is shortened, matching everyday experience.
  8. ConclusionOne energy expression gave the full nonlinear equation and its small-angle frequency of 4.43 rad/s. No joint reaction ever appeared.
Result. θ̈ = −(g/L) sinθ, ω_n = 4.43 rad/s, T = 1.42 s.
05

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 θ.

Figure 2. A generalized force from virtual work: the horizontal force projects onto the coordinate through the virtual displacement, giving Q = F L cosθ.
  1. ProblemFind Q_θ for the applied force in Figure 2.
  2. Given / findF = 100 N horizontal, L = 0.5 m, θ = 30°. Find the generalized force Q_θ.
  3. AssumptionsRigid link, ideal pin, the force stays horizontal during the virtual displacement.
  4. ModelTip horizontal position x = L sinθ, so δx = L cosθ δθ; virtual work δW = F δx gives Q_θ = F L cosθ.
  5. Equationsδx = L cosθ δθQ_θ = F L cosθ
  6. SolveQ_θ = 100 × 0.5 × cos30° = 50 × 0.866 = 43.3 N·m.
  7. 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.
  8. 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.
Result. Q_θ = 43.3 N·m, the projected generalized force.
06

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.

Figure 3. Two equal masses on three springs. Lagrange’s method yields a mass and a stiffness matrix whose eigenproblem gives two modes: an in-phase mode at 1 rad/s and an out-of-phase mode at √3 rad/s.
  1. ProblemFind the two natural frequencies and mode shapes of the system in Figure 3.
  2. 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.
  3. AssumptionsMassless linear springs, frictionless motion, small displacements so the system is linear.
  4. ModelT = ½ m(ẋ₁² + ẋ₂²); V = ½ k x₁² + ½ k_c(x₂ − x₁)² + ½ k x₂². Lagrange gives M ẍ + K x = 0, then det(K − ω² M) = 0.
  5. EquationsM = [[m, 0], [0, m]], K = [[k + k_c, −k_c], [−k_c, k + k_c]]det(K − ω² M) = 0
  6. 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).
  7. 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.
  8. 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.
Result. ω₁ = 1 rad/s (in-phase), ω₂ = 1.73 rad/s (out-of-phase).
07

Misconceptions and diagnostics

MistakeSymptomDiagnostic questionCorrection
Sign error in potential energyFrequency or equilibrium comes out wrongDoes V increase as the body rises?Take V positive upward and be consistent with the datum.
Forgetting a generalized forceAn applied load silently disappearsDid I do virtual work for every non-potential load?Project each load with δW = Q · δq.
Keeping constraint forces in minimal coordinatesExtra unknown reactions clutter the equationsDo ideal reactions do any virtual work?In minimal coordinates they vanish; leave them out.
Mismatched multiplier countConstraint reactions do not closeIs there one λ per constraint?Add exactly one multiplier for each constraint equation.
08

Practice ladder

Level 1 · Direct skill

A pendulum has L = 2 m. Find its small-angle natural frequency.

Show answer

ω_n = √(g/L) = √(9.81/2) = 2.21 rad/s.

Level 2 · Mixed concept

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.

Level 3 · Independent problem

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).

Transfer task | Real engineering

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.

09

Working with AI, and proving it yourself

Ask AI to check your energy expressions, not to derive for you

"Confirm my kinetic and potential energy for this system."
"Check the generalized force I got from virtual work for this load."
"Derive the equations of motion." Writing T and V is the skill.
"What is Q here?" Projecting the load by virtual work is the point.

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.

Must include: kinetic and potential energy, a Lagrange derivation, and agreement with a force-based derivation.
10

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.

TodayFinish this quiz and Levels 1 and 2 of the ladder.
+1 dayRe-derive the pendulum equation from a blank page.
+3 daysCompute generalized forces for three new loads.
+7 daysMove on to constrained equations in Module 8.
+30 daysReuse the energy-then-Lagrange routine when free bodies get heavy.
11

Textbook mapping

Analytical mechanics underlies Wittenburg’s formalism through d’Alembert’s principle. Use these references to read further.

Topic in this moduleWhere to read more
d’Alembert’s principle and energy methodsWittenburg, Dynamics of Multibody Systems, ch. 3
Generalized coordinates and forcesWittenburg, Dynamics of Multibody Systems, ch. 5
Lagrange multipliers for constraintsNikravesh, Computer-Aided Analysis of Mechanical Systems

Chapter references are to Wittenburg, Dynamics of Multibody Systems (Springer).