ME3120 · Dynamic Modelling
Theme 3 · Energy / Lagrange

The Lagrangian & Lagrange's equation

Combine the two energies into one quantity, turn a fixed crank, and the equation of motion drops out — no forces, no free-body diagram.

Source: course notes, Week 2 (the energy method); Spong, Lynch & Park.

Before you start

What you need first

  • Kinetic & potential energy \(T\), \(V\) (Topic 10).
  • Velocity from position — getting \(\dot q\) into \(T\) (Topic 11).
  • Generalized coordinates \(q\) — one per degree of freedom.

What you'll be able to do

  • Form the Lagrangian \(\mathcal{L}=T-V\).
  • Apply Lagrange's equation — the master formula.
  • Run the partial-derivative and \(d/dt\) steps, and re-derive the spring.

A note on the symbol \(\mathcal{L}\)

We write the Lagrangian as the script \(\mathcal{L}\), on purpose. Plain \(L\) already means the rod length in this course (the pendulum), so to avoid two meanings in one equation, the Lagrangian gets its own symbol \(\mathcal{L}\). Read \(\mathcal{L}\) as "the Lagrangian," \(L\) as "a length."

Step 1 · combine the energies

The Lagrangian: \(\mathcal{L} = T - V\)

$$\mathcal{L} = T - V$$
where:
SymbolMeaningSI unit
\(\mathcal{L}\)the LagrangianJ
Tkinetic energy (of motion)J
Vpotential energy (of position)J
It is a minus, not a plus. \(\mathcal{L}\) is not the total energy \(T+V\). It is a special combination \(T-V\) that makes the next formula produce the equation of motion.

Step 2 · the master formula

Lagrange's equation

$$\frac{d}{dt}\!\left(\frac{\partial \mathcal{L}}{\partial \dot q}\right) - \frac{\partial \mathcal{L}}{\partial q} = Q$$
where:
SymbolMeaningSI unit
qa generalized coordinatem or rad
\(\dot q\)its velocitym/s or rad/s
Qgeneralized force (applied push/torque, damping)N or N·m
Apply it once for each coordinate \(q\) — each application gives one equation of motion. If nothing external pushes the system, \(Q=0\) (we cover \(Q\) fully next topic).

Reading the master formula

PieceWhat it does
\(\dfrac{\partial \mathcal{L}}{\partial \dot q}\)differentiate \(\mathcal{L}\) treating the velocity \(\dot q\) as the variable → the "momentum" term
\(\dfrac{d}{dt}(\ \cdot\ )\)then differentiate that in time → produces the acceleration \(\ddot q\)
\(\dfrac{\partial \mathcal{L}}{\partial q}\)differentiate \(\mathcal{L}\) treating the position \(q\) as the variable → the spring/gravity term
\(Q\)applied forces / torques / damping (else \(0\))

Quick refresher: partial derivatives

A partial derivative differentiates with respect to one variable, holding the others fixed. The key trick here: treat the position \(q\) and the velocity \(\dot q\) as two separate, independent symbols. For \(\mathcal{L}=\tfrac12 m\dot x^{2}-\tfrac12 k x^{2}\):

Hold \(x\) fixed, differentiate by \(\dot x\)

$$\frac{\partial \mathcal{L}}{\partial \dot x}=m\dot x$$

Hold \(\dot x\) fixed, differentiate by \(x\)

$$\frac{\partial \mathcal{L}}{\partial x}=-k x$$

Quick refresher: the \(d/dt\) step

After the partial \(\partial\mathcal{L}/\partial\dot q\), the \(d/dt\) lets everything depend on time again and differentiates in time — turning a velocity into an acceleration:

$$\frac{\partial \mathcal{L}}{\partial \dot x}=m\dot x \quad\xrightarrow{\ d/dt\ }\quad \frac{d}{dt}(m\dot x)=m\ddot x$$
That step is where the acceleration \(\ddot q\) in every equation of motion comes from.

The energy recipe (replaces the free-body diagram)

1Choose coordinates \(q\) — one per degree of freedom.
2Write \(T\) — add \(\tfrac12 mv^2\) and \(\tfrac12 I\omega^2\) for every part.
3Write \(V\) — gravity \(mgh\) and springs \(\tfrac12 kx^2\).
4Form \(\mathcal{L}=T-V\).
5Apply Lagrange's equation for each \(q\).
6Check — units, limits, equilibrium.
📐 Worked example

Re-derive the spring by Lagrange

The block-and-spring of Theme 2: mass \(m\), stiffness \(k\), coordinate \(x\) from rest, on a frictionless table. Let us get \(m\ddot x + kx = 0\) again — this time from energy, with no free-body diagram.

k m x
The same block-and-spring — now modelled by energy.
1Energies, then the Lagrangian (\(T=\tfrac12 m\dot x^2\), \(V=\tfrac12 kx^2\)):
$$\mathcal{L} = T - V = \tfrac12 m\dot x^{2} - \tfrac12 k x^{2}$$
2Momentum term — differentiate by \(\dot x\), then by time:
$$\frac{\partial \mathcal{L}}{\partial \dot x}=m\dot x \quad\Longrightarrow\quad \frac{d}{dt}\!\left(\frac{\partial \mathcal{L}}{\partial \dot x}\right)=m\ddot x$$
3Position term — differentiate by \(x\):
$$\frac{\partial \mathcal{L}}{\partial x}=-k x$$
4Assemble (no applied force, so \(Q=0\)):
$$m\ddot x - (-k x) = 0 \;\Longrightarrow\; m\ddot x + k x = 0$$
Exactly the Newton answer from Theme 2 ✓ — but we never drew a single force. Write \(T\) and \(V\), turn the crank, done.

✏️ Try it yourself

A mass \(m\) falls freely under gravity. With \(y\) measured upward, \(T=\tfrac12 m\dot y^2\) and \(V=mgy\). Apply Lagrange's equation (with \(Q=0\)) and find the acceleration \(\ddot y\).

Lagrangian. \(\mathcal{L}=T-V=\tfrac12 m\dot y^2 - mgy\) Momentum term. \(\dfrac{\partial \mathcal{L}}{\partial \dot y}=m\dot y \Rightarrow \dfrac{d}{dt}(m\dot y)=m\ddot y\) Position term. \(\dfrac{\partial \mathcal{L}}{\partial y}=-mg\) Assemble. \(m\ddot y-(-mg)=0 \Rightarrow m\ddot y + mg = 0 \Rightarrow \ddot y = -g\) — free fall, accelerating downward at \(g\). ✓

Common mistakes to avoid

MistakeFix
Writing \(\mathcal{L}=T+V\)It is \(T-V\) — always a minus.
Mixing \(\partial/\partial q\) and \(\partial/\partial\dot q\)Treat \(q\) and \(\dot q\) as separate symbols when taking partials.
Skipping the \(d/dt\) stepThat step makes the acceleration \(\ddot q\) appear.
Forgetting the minus on \(-\partial\mathcal{L}/\partial q\)The formula subtracts the position term; a sign slip flips the spring/gravity term.
Applying it once for a 2-DOF systemApply the formula once per coordinate.

Recap — the whole topic on one screen

$$\mathcal{L}=T-V \qquad\quad \frac{d}{dt}\!\left(\frac{\partial \mathcal{L}}{\partial \dot q}\right) - \frac{\partial \mathcal{L}}{\partial q} = Q$$
IdeaWhat you own now
The Lagrangian\(\mathcal{L}=T-V\) (minus, and \(\mathcal{L}\) not \(L\))
The master formulaThe crank, applied once per coordinate
The two stepsPartial by \(\dot q\) then \(d/dt\); partial by \(q\)
The pay-offSpring re-derived from energy, no forces drawn

Next topic

Generalized forces & damping \(Q\)

So far \(Q=0\). Real machines have motors, hands, and friction. Next we fill in the right-hand side: how an applied torque and a damper enter as the generalized force \(Q\).

→ Generalized forces & damping