Two coordinates, one recipe. Apply Lagrange twice and the equations stack into a
mass matrix — your first look at the shape of the robot equation.
Source: course notes, Week 2 worked example C.
Before you start
What you need first
Lagrange's equation, applied once per coordinate (Topic 12).
Spring potential energy \(\tfrac12 kx^2\), including a spring between
two moving masses.
What you'll be able to do
Write \(T\) and \(V\) for a two-mass system.
Get two coupled equations and stack them into matrices.
Read the mass matrix \(M\), stiffness \(K\), and the coupling.
The recipe does not change
The real power of Lagrange shows up with more than one degree of freedom. Nothing new is
needed — you simply apply the master formula once for each coordinate, giving
one equation per coordinate.
🔭 Looking ahead: a 2-link robot arm also has two coordinates. Here we
use a simpler two-mass system so the algebra stays clean — but the shape of the
answer is the same.
Step 1 · the picture
Two masses, two springs
Wall — spring \(k_1\) — mass \(m_1\) — spring \(k_2\) — mass \(m_2\),
on a frictionless line. Coordinates \(x_1,x_2\) from each block's rest position.
Two degrees of freedom → two coordinates \(x_1,x_2\) → we will get
two equations of motion.
Step 2 · the energies
Kinetic and potential energy
1Kinetic energy — the two blocks move independently:
The key modelling step is \(k_2\)'s stretch: the middle spring feels the
relative motion \((x_2-x_1)\), not \(x_2\) alone. That difference is what ties
the two masses together.
In short, \(M\ddot{\mathbf{x}} + K\mathbf{x} = \mathbf 0\): a mass matrix
\(M\) and a stiffness matrix \(K\).
The off-diagonal \(-k_2\) is the coupling — it
is what ties \(x_1\) and \(x_2\) together. If \(k_2=0\) the masses uncouple into two separate
springs. Coupling lives off the diagonal.
📄 Full line-by-line derivation (printable PDF)
— every partial derivative and algebra step, with the setup figure. A pen-and-paper companion;
the page above is already complete on its own.
Why this matters for robots
The robot equation has the very same shape — a mass matrix, plus extra terms:
\(C(q,\dot q)\dot q\) — Coriolis, from moving fast
🔭 Every one of these comes straight out of Lagrange's equation. You now have
the engine; Themes 4–5 build the pieces \(M(q)\), \(C\), and \(G\) for a real arm.
📐 Worked example
Write \(M\) and \(K\) for real numbers
Take \(m_1 = 2\ \text{kg}\), \(m_2 = 1\ \text{kg}\), \(k_1 = 100\ \text{N/m}\),
\(k_2 = 50\ \text{N/m}\). Write the mass and stiffness matrices and the two equations.
Apply Lagrange once per coordinate → two equations
The coupling
Middle spring feels \((x_2-x_1)\); appears off-diagonal
Matrix form
\(M\ddot{\mathbf x}+K\mathbf x=\mathbf 0\) — mass & stiffness matrices
Robot link
Same shape as \(M(q)\ddot q + C\dot q + G(q)=\tau\)
Next theme
Frames & the rotation matrix
To write \(T\) and \(V\) for a real arm, we first need to say exactly where each link
is. Theme 4 — robot geometry — starts with frames and the rotation matrix \(R(\theta)\), the
language for describing position in space.