The Lagrangian Function

In 1788 Joseph-Louis Lagrange published a mechanics book with a boast in the preface: "No figures will be found in this work." A century after Newton, he had rebuilt the entire science of motion so that it no longer needed force diagrams at all. His replacement for the arrows — for the tensions, normal forces, and carefully resolved components of every Newtonian analysis — was a single scalar function, L=T−VL = T - V, the difference between a system's kinetic and potential energy. Write that one function in any coordinates you like, feed it to a fixed differential operator, and the equations of motion fall out mechanically. No vectors. No constraint forces. No fictitious-force bookkeeping when your coordinates rotate. That trade — geometry for algebra, vectors for one scalar — is the heart of analytical mechanics, and this article is about the scalar itself: what the Lagrangian function is, why it is T minus V rather than any other combination, how to build it in generalized coordinates, and why its scalar nature makes the resulting equations look identical in every coordinate system. You already have the ingredients: generalized coordinates to describe constrained systems with the minimum number of variables, and d'Alembert's principle to project the constraint forces out of Newton's law. Mastering the Lagrangian buys you the rest of the subject at a discount. Conserved momenta will be read off from coordinates that LL ignores, energy conservation from its indifference to time, and eventually — through Noether's theorem — every conservation law in physics from its symmetries. Quantum field theory, general relativity, and the Standard Model are all specified by writing down their Lagrangians. This one function is where that language begins.

Key takeaways
  • The Lagrangian L(q,q˙,t)=T−VL(q,\dot q,t) = T - V is a single scalar function of the generalized coordinates, the generalized velocities, and possibly time; for holonomic systems with conservative forces it encodes the entire dynamics.
  • Substituted into the Euler–Lagrange operator ddt∂L∂q˙k−∂L∂qk=0\frac{\mathrm{d}}{\mathrm{d}t}\frac{\partial L}{\partial \dot q_k} - \frac{\partial L}{\partial q_k} = 0, it reproduces Newton's equations without ever computing a constraint force.
  • Because LL is a scalar attached to a point of configuration space (and a velocity), its equations keep exactly the same form under any invertible point transformation q→Q(q,t)q \to Q(q,t) — centrifugal and Coriolis terms are generated automatically by the derivatives of TT.
  • In generalized coordinates the kinetic energy has the graded structure T=T2+T1+T0T = T_2 + T_1 + T_0; the velocity-quadratic piece T2=12∑ajkq˙jq˙kT_2 = \tfrac12 \sum a_{jk}\dot q_j \dot q_k defines the mass matrix, and the lower-grade pieces appear only when constraints move.
  • LL is not unique: adding a total time derivative dF(q,t)/dt\mathrm{d}F(q,t)/\mathrm{d}t changes nothing physical, and velocity-dependent forces like magnetism are absorbed by generalizing VV to a velocity-dependent potential U(q,q˙,t)U(q,\dot q,t).
  • Key idea: encode all the dynamics of a constrained system in one scalar L(q,q˙,t)=T−VL(q,\dot q,t) = T - V; the equations of motion then follow mechanically from the Euler–Lagrange operator, and because LL is a scalar the recipe is independent of the coordinate chart you choose.

Where this lives today

Every legged robot, robot arm, and physics-engine character that moves in 2026 is running Lagrange's recipe in real time. The standard form of robot dynamics, M(q)q¨+C(q,q˙)q˙+g(q)=τM(q)\ddot q + C(q,\dot q)\dot q + g(q) = \tau, is nothing but the Euler–Lagrange equations of L=12q˙TM(q)q˙−V(q)L = \tfrac12\dot q^{\mathsf T} M(q)\dot q - V(q): the mass matrix M(q)M(q) is the ajka_{jk} of equation (3), the Coriolis matrix CC is assembled from its qq-derivatives, and simulation frameworks like MuJoCo and Drake generate all of it automatically from a robot's geometry file. When a humanoid catches its balance, a model-predictive controller is optimizing over trajectories of exactly the function this article defined. The newest twist inverts the direction: instead of writing LL and deriving motion, machine-learning systems observe motion and learn LL. Lagrangian neural networks parametrize L(q,q˙)L(q,\dot q) with a neural net and train it so the Euler–Lagrange equations match observed trajectories — inheriting energy conservation and coordinate-freedom by construction, where a generic learned dynamics model would violate both. That such "physics-informed" models outperform brute-force ones is a 2026-era rediscovery of this article's oldest lesson: the scalar LL is the most compressed correct description of a mechanical world.

The physical picture

Take the humblest constrained system there is: a pendulum. Newton's method demands that you draw the bob, resolve gravity along and across the rod, introduce an unknown tension T\mathbf{T}, write two component equations, and then eliminate the tension you never cared about. Lagrange's method asks for one line of algebra: the bob's speed is ℓθ˙\ell\dot\theta, its height is −ℓcos⁡θ-\ell\cos\theta, so L=12mℓ2θ˙2+mgℓcos⁡θL = \tfrac12 m\ell^2\dot\theta^2 + mg\ell\cos\theta. Turn the crank and the equation of motion θ¨=−(g/ℓ)sin⁡θ\ddot\theta = -(g/\ell)\sin\theta appears — with the tension never mentioned, because the coordinate θ\theta was chosen so that the rod's constraint is satisfied automatically.

Figure
One scalar replaces the force diagram — the pendulum done twice
Newton: resolve every force mg T = ? components… two equations, one unknown tension to eliminate Lagrange: one scalar, one crank L = ½ m l² ω² + m g l cos θ d/dt (∂L/∂ω) − ∂L/∂θ = 0 θ̈ = −(g/l) sin θ tension never appears — the coordinate absorbed the constraint

Why does this work? Two structural facts conspire. First, kinetic and potential energy are scalars — numbers attached to the state of the system, indifferent to how you label that state. A pendulum bob moving at 0.5 m/s has T=12mv2T = \tfrac12 m v^2 whether you describe it by (x,y)(x,y), by θ\theta, or by coordinates painted on a rotating turntable. Second, d'Alembert's principle guarantees that ideal constraint forces do no virtual work, so once you adopt coordinates that respect the constraints, those forces simply have no slot in which to appear. The Lagrangian formalism is what remains of Newton's law after everything frame-dependent and constraint-dependent has been squeezed out.

Figure
A scalar does not care about your chart — the same state, three coordinate systems, one value of L
Cartesian (x, y) polar (r, θ) rotating chart (r', φ) same number L the labels change, the scalar does not — this is why the equations keep their form in every chart

The payoff of that second picture is worth stating bluntly. Newton's equations change form when you change coordinates: go to polar coordinates and you must remember m(r¨−rθ˙2)m(\ddot r - r\dot\theta^2), not mr¨m\ddot r; go to a rotating frame and you must add centrifugal and Coriolis forces by hand. The Euler–Lagrange equations never change form. All the awkward extra terms are generated automatically, because the kinetic energy TT, re-expressed in the new coordinates, carries the geometry inside its dependence on qq and q˙\dot q. The centrifugal force, in the Lagrangian view, is nothing but ∂T/∂r\partial T/\partial r doing its job. One more reading habit pays dividends for the rest of the subject: learn to see a Lagrangian as an anatomy, term by term. Every term quadratic in velocities is inertia; every velocity-free term is (minus) a potential; anything linear in velocity signals magnetism or a rotating reference. When the coordinate qkq_k is missing from LL, its momentum is conserved. When tt is missing, energy is. A trained eye extracts most of the physics of a system from thirty seconds of staring at LL, before solving anything.

Building the Lagrangian

The recipe has three moves: choose independent generalized coordinates that respect the constraints, express the kinetic and potential energies in them, and subtract. For a system of particles at positions ri(q1,…,qn,t)\mathbf{r}_i(q_1,\dots,q_n,t) acted on by conservative applied forces, the Lagrangian function is

L(q,q˙,t)=T(q,q˙,t)−V(q,t)(1)L(q,\dot q,t) = T(q,\dot q,t) - V(q,t) \qquad (1)

where: TT — the total kinetic energy ∑i12mir˙i2\sum_i \tfrac12 m_i \dot{\mathbf{r}}_i^2 re-expressed in the generalized coordinates and velocities; VV — the potential energy of the applied (not constraint) forces; tt — time, which enters explicitly only if the constraints or the potential move on their own schedule. Note what LL is not: it is not the energy. The minus sign is not a typo for the innocuous plus of E=T+VE = T + V; it is precisely what makes the machinery below generate correct equations of motion, as Derivation A shows. The one fixed piece of machinery is the Euler–Lagrange operator. For each generalized coordinate qkq_k,

ddt∂L∂q˙k−∂L∂qk=0,k=1,…,n(2)\frac{\mathrm{d}}{\mathrm{d}t}\frac{\partial L}{\partial \dot q_k} - \frac{\partial L}{\partial q_k} = 0, \qquad k = 1,\dots,n \qquad (2)

where: ∂L/∂q˙k≡pk\partial L/\partial \dot q_k \equiv p_k — the generalized momentum conjugate to qkq_k; ∂L/∂qk\partial L/\partial q_k — the generalized force supplied by the potential together with the geometric terms hiding in TT. This article takes equation (2) as given machinery and concentrates on the function you feed it; where the operator itself comes from — d'Alembert's principle on one route, Hamilton's stationary-action principle on the other — is the business of the Euler–Lagrange equations article. To use the recipe fluently you need to know what kinetic energy looks like in generalized coordinates. Start from the chain rule for r˙i\dot{\mathbf{r}}_i and square: the result (Derivation B) is a graded polynomial in the velocities,

T=12∑j,kajk(q,t) q˙jq˙k⏟T2+∑kbk(q,t) q˙k⏟T1+c(q,t)⏟T0(3)T = \underbrace{\tfrac{1}{2}\sum_{j,k} a_{jk}(q,t)\,\dot q_j \dot q_k}_{T_2} + \underbrace{\sum_k b_k(q,t)\,\dot q_k}_{T_1} + \underbrace{c(q,t)}_{T_0} \qquad (3)

where: ajk=∑imi∂ri∂qj ⁣⋅ ⁣∂ri∂qka_{jk} = \sum_i m_i \frac{\partial \mathbf{r}_i}{\partial q_j}\!\cdot\!\frac{\partial \mathbf{r}_i}{\partial q_k} — the symmetric, positive-definite mass matrix, which plays the role of a metric on configuration space; bkb_k and cc — terms that exist only when the map ri(q,t)\mathbf{r}_i(q,t) depends explicitly on time, i.e. when the constraints themselves move. For a pendulum on a fixed pivot, T=T2T = T_2 alone; for a bead on a wire that a motor spins at fixed rate ω\omega, a T0=12mω2r2T_0 = \tfrac12 m\omega^2 r^2 term appears — and, as the worked examples show, that innocent-looking term is the entire story of the centrifugal escape. The simplest nontrivial instance of the recipe deserves its own display, because it recurs in half the problems you will ever solve. For the plane pendulum of mass mm and length ℓ\ell, with θ\theta measured from the downward vertical, the speed is ℓθ˙\ell\dot\theta and the height below the pivot is ℓcos⁡θ\ell\cos\theta, so

L(θ,θ˙)=12mℓ2θ˙2+mgℓcos⁡θ(4)L(\theta,\dot\theta) = \tfrac{1}{2} m \ell^2 \dot\theta^2 + m g \ell \cos\theta \qquad (4)

where: the first term is TT with mass matrix aθθ=mℓ2a_{\theta\theta} = m\ell^2 (the moment of inertia about the pivot — mass matrices in angular coordinates are moments of inertia); the second is −V-V with V=−mgℓcos⁡θV = -mg\ell\cos\theta. Feeding (4) into (2) gives mℓ2θ¨+mgℓsin⁡θ=0m\ell^2\ddot\theta + mg\ell\sin\theta = 0 in one line. The rod tension, a genuine mystery guest in the Newtonian analysis, never has a chance to appear.

Which form of L answers which question

situationLagrangiannotes
conservative holonomic systemL=T−VL = T - V, eq. (1)the default recipe
moving (rheonomic) constraintsL=T2+T1+T0−VL = T_2 + T_1 + T_0 - V, eq. (3)T1,T0T_1, T_0 generated by ∂r/∂t\partial \mathbf{r}/\partial t; energy function h≠T+Vh \neq T+V
charged particle in an EM fieldL=12mv2−qϕ+q v⋅AL = \tfrac12 m v^2 - q\phi + q\,\mathbf{v}\cdot\mathbf{A}, eq. (6)velocity-dependent potential U=qϕ−q v⋅AU = q\phi - q\,\mathbf{v}\cdot\mathbf{A}
free relativistic particleL=−mc21−v2/c2L = -mc^2\sqrt{1 - v^2/c^2}not T−VT - V; chosen so SS is proper time
same physics, different LLL′=L+dF(q,t)/dtL' = L + \mathrm{d}F(q,t)/\mathrm{d}t, eq. (5)gauge freedom — equations of motion identical

Two entries of that table need unpacking before the derivations. First, the non-uniqueness. The Lagrangian that generates a given dynamics is not unique: adding the total time derivative of any smooth function F(q,t)F(q,t),

L′(q,q˙,t)=L(q,q˙,t)+dF(q,t)dt(5)L'(q,\dot q,t) = L(q,\dot q,t) + \frac{\mathrm{d}F(q,t)}{\mathrm{d}t} \qquad (5)

where: dF/dt=∑k∂F∂qkq˙k+∂F∂t\mathrm{d}F/\mathrm{d}t = \sum_k \frac{\partial F}{\partial q_k}\dot q_k + \frac{\partial F}{\partial t} — evaluated along the motion, changes the action only by the fixed endpoint values F(q2,t2)−F(q1,t1)F(q_2,t_2) - F(q_1,t_1) and therefore leaves every equation of motion untouched. So "the" Lagrangian is really an equivalence class, and T−VT - V is its most convenient representative — a freedom with real consequences (it is where electromagnetic gauge invariance lives in mechanics) that gets its own full treatment in the article on Lagrangian gauge freedom. Here, treat it as a license: if your LL and a textbook's differ by a total derivative, you are both right. Second, forces that depend on velocity. A magnetic force qv×Bq\mathbf{v}\times\mathbf{B} cannot come from any V(q,t)V(q,t) — yet it fits the formalism perfectly. Allow the potential to depend on velocity, L=T−U(q,q˙,t)L = T - U(q,\dot q,t), and choose U=qϕ−q v⋅AU = q\phi - q\,\mathbf{v}\cdot\mathbf{A}:

L=12mv2−qϕ+q v⋅A(6)L = \tfrac{1}{2} m \mathbf{v}^2 - q\phi + q\,\mathbf{v}\cdot\mathbf{A} \qquad (6)

where: ϕ\phi and A\mathbf{A} — the scalar and vector potentials, with E=−∇ϕ−∂tA\mathbf{E} = -\nabla\phi - \partial_t\mathbf{A} and B=∇×A\mathbf{B} = \nabla\times\mathbf{A}; qq — the charge. The Euler–Lagrange equations of (6) reproduce the full Lorentz force q(E+v×B)q(\mathbf{E} + \mathbf{v}\times\mathbf{B}), and the momentum conjugate to r\mathbf{r} comes out as p=mv+qA\mathbf{p} = m\mathbf{v} + q\mathbf{A} — not mvm\mathbf{v}. That splitting of canonical from kinetic momentum, read off in one glance from (6), is the classical seed of gauge coupling in quantum mechanics and of the Aharonov–Bohm effect; the systematics of velocity-dependent potentials belong to their own article. Finally, one object built directly from LL that you should meet now and study later: the energy function

h(q,q˙,t)=∑kq˙k∂L∂q˙k−L(7)h(q,\dot q,t) = \sum_k \dot q_k \frac{\partial L}{\partial \dot q_k} - L \qquad (7)

where: hh — the Jacobi integral, conserved whenever LL has no explicit time dependence, and equal to the familiar T+VT + V only when T=T2T = T_2 (no moving constraints). When constraints move, h=T2−T0+Vh = T_2 - T_0 + V is conserved while the mechanical energy T+VT + V is not — a subtlety with teeth, exercised in Worked Example 2 and dissected fully in the energy function and Jacobi integral.

Derivation AWhy T Minus V Comes Out of dAlemberts Principle

We are deriving the Lagrangian form of the equations of motion — and with it the answer to "why the minus sign?" — starting from the generalized equation of motion that d'Alembert's principle delivers. The strategy: take the projected Newton law ddt∂T∂q˙k−∂T∂qk=Qk\frac{\mathrm{d}}{\mathrm{d}t}\frac{\partial T}{\partial \dot q_k} - \frac{\partial T}{\partial q_k} = Q_k as established input (its derivation, via virtual work and the dot-cancellation lemma, lives in the d'Alembert article), specialize the generalized force QkQ_k to conservative forces, and watch VV get absorbed into both slots of the operator. The point to watch is where the velocity-independence of VV is used — that is the only reason VV can slide inside the ∂/∂q˙k\partial/\partial\dot q_k slot, and it is exactly the assumption that velocity-dependent potentials later relax.

Step 1. Start from the generalized equation of motion for a holonomic system, valid in any generalized coordinates:

ddt∂T∂q˙k−∂T∂qk=Qk\frac{\mathrm{d}}{\mathrm{d}t}\frac{\partial T}{\partial \dot q_k} - \frac{\partial T}{\partial q_k} = Q_k

Why we may start here: d'Alembert's principle has already projected Newton's law onto the constraint surface, eliminating ideal constraint forces; the identity ∂r˙i/∂q˙k=∂ri/∂qk\partial\dot{\mathbf{r}}_i/\partial\dot q_k = \partial\mathbf{r}_i/\partial q_k (dot cancellation) is what converts ∑imir¨i⋅∂ri/∂qk\sum_i m_i\ddot{\mathbf{r}}_i\cdot\partial\mathbf{r}_i/\partial q_k into the two TT-derivatives on the left.

Step 2. Specialize to applied forces derivable from a potential, Fi=−∇iV(r1,…,t)\mathbf{F}_i = -\nabla_i V(\mathbf{r}_1,\dots,t). The generalized force collapses by the chain rule:

Qk=∑iFi⋅∂ri∂qk=−∑i∇iV⋅∂ri∂qk=−∂V∂qkQ_k = \sum_i \mathbf{F}_i \cdot \frac{\partial \mathbf{r}_i}{\partial q_k} = -\sum_i \nabla_i V \cdot \frac{\partial \mathbf{r}_i}{\partial q_k} = -\frac{\partial V}{\partial q_k}

Why this is just the chain rule: VV, re-expressed in generalized coordinates as V(q,t)V(q,t), changes under δqk\delta q_k only through the positions ri(q,t)\mathbf{r}_i(q,t) — the sum over particles is precisely ∂V/∂qk\partial V/\partial q_k.

Step 3. Move the force to the left-hand side and use ∂V/∂q˙k=0\partial V/\partial \dot q_k = 0 to smuggle VV into the velocity slot as well:

ddt∂(T−V)∂q˙k−∂(T−V)∂qk=0\frac{\mathrm{d}}{\mathrm{d}t}\frac{\partial (T-V)}{\partial \dot q_k} - \frac{\partial (T-V)}{\partial q_k} = 0

Why the smuggling is legal: adding zero — namely ddt∂(−V)/∂q˙k\frac{\mathrm{d}}{\mathrm{d}t}\partial(-V)/\partial\dot q_k — costs nothing precisely because VV contains no velocities. This single step is the origin of the minus sign: VV must enter with the sign that reproduces −∂V/∂qk-\partial V/\partial q_k on the force side after the overall sign convention of the operator is fixed by TT.

Step 4. Name the combination: with L≡T−VL \equiv T - V, the boxed statement is the Euler–Lagrange equation (2). The construction also exposes the non-uniqueness immediately: any L′=L+dF(q,t)/dtL' = L + \mathrm{d}F(q,t)/\mathrm{d}t satisfies the same equation, since a total time derivative contributes identically zero to the operator. As a quick check: for a single particle in Cartesian coordinates, L=12m(x˙2+y˙2+z˙2)−V(x,y,z)L = \tfrac12 m(\dot x^2 + \dot y^2 + \dot z^2) - V(x,y,z) gives mx¨i=−∂V/∂xim\ddot x_i = -\partial V/\partial x_i — Newton's second law recovered exactly.

Go deeper · Derivation B · 1 minThe Anatomy of Kinetic Energy in Generalized Coordinates
Derivation BThe Anatomy of Kinetic Energy in Generalized Coordinates

The goal is the graded structure (3): kinetic energy in generalized coordinates is a quadratic-plus-linear-plus-constant polynomial in the generalized velocities, T=T2+T1+T0T = T_2 + T_1 + T_0, with the quadratic piece defining the mass matrix. The strategy is nothing deeper than the chain rule followed by honest squaring — but the bookkeeping identifies exactly when the lower-grade terms switch on (moving constraints), and that diagnosis controls everything from the form of the energy function to which systems feel centrifugal-like forces. Watch the explicit-time term ∂ri/∂t\partial\mathbf{r}_i/\partial t: it alone generates T1T_1 and T0T_0.

Step 1. Differentiate the coordinate map ri=ri(q1,…,qn,t)\mathbf{r}_i = \mathbf{r}_i(q_1,\dots,q_n,t) along the motion:

r˙i=∑k∂ri∂qk q˙k+∂ri∂t\dot{\mathbf{r}}_i = \sum_k \frac{\partial \mathbf{r}_i}{\partial q_k}\,\dot q_k + \frac{\partial \mathbf{r}_i}{\partial t}

Why the last term: if the constraint geometry itself moves — a pivot on a cart, a wire spun by a motor — a particle moves even with all q˙k=0\dot q_k = 0; ∂ri/∂t\partial\mathbf{r}_i/\partial t is that dragging velocity.

Step 2. Square, multiply by 12mi\tfrac12 m_i, and sum over particles. The three kinds of cross terms sort themselves by their power of q˙\dot q:

T=12∑j,k(∑imi∂ri∂qj ⁣⋅ ⁣∂ri∂qk)q˙jq˙k+∑k(∑imi∂ri∂qk ⁣⋅ ⁣∂ri∂t)q˙k+12∑imi(∂ri∂t)2T = \tfrac{1}{2}\sum_{j,k}\Big(\sum_i m_i \tfrac{\partial \mathbf{r}_i}{\partial q_j}\!\cdot\!\tfrac{\partial \mathbf{r}_i}{\partial q_k}\Big)\dot q_j \dot q_k + \sum_k\Big(\sum_i m_i \tfrac{\partial \mathbf{r}_i}{\partial q_k}\!\cdot\!\tfrac{\partial \mathbf{r}_i}{\partial t}\Big)\dot q_k + \tfrac{1}{2}\sum_i m_i\Big(\tfrac{\partial \mathbf{r}_i}{\partial t}\Big)^2

Step 3. Read off the three grades: the coefficients in the first sum are the mass matrix ajk(q,t)a_{jk}(q,t), symmetric by construction and positive definite because TT vanishes only when every particle is at rest; the second and third sums are T1=∑kbkq˙kT_1 = \sum_k b_k \dot q_k and T0=c(q,t)T_0 = c(q,t). Why positive-definiteness matters: it makes ajka_{jk} a genuine Riemannian metric on configuration space — free motion is geodesic motion in this metric, and the matrix is invertible, so accelerations can always be solved for.

Step 4. Specialize to fixed (scleronomic) constraints: ∂ri/∂t=0\partial\mathbf{r}_i/\partial t = 0 kills T1T_1 and T0T_0, leaving T=T2T = T_2 homogeneous quadratic. Euler's theorem on homogeneous functions then gives ∑kq˙k ∂T/∂q˙k=2T\sum_k \dot q_k \,\partial T/\partial \dot q_k = 2T — the identity that will make the energy function hh equal T+VT + V in exactly this case and no other. As a concrete illustration: for the bead on a wire rotating at fixed ω\omega (coordinates: radial distance rr; map: x=rcos⁡ωtx = r\cos\omega t, y=rsin⁡ωty = r\sin\omega t), Step 2 yields T=12mr˙2+12mω2r2T = \tfrac12 m\dot r^2 + \tfrac12 m\omega^2 r^2 — pure T2+T0T_2 + T_0 with br=0b_r = 0, confirming the direct computation.

Go deeper · Derivation C · 1 minForm Invariance Under Point Transformations
Derivation CForm Invariance Under Point Transformations

We now prove the hallmark advertised throughout: if the Euler–Lagrange equations hold in coordinates qq, they hold in identical form in any invertible new coordinates QQ, with the new Lagrangian being merely the old scalar re-expressed, Lˉ(Q,Q˙,t)=L(q(Q,t),q˙(Q,Q˙,t),t)\bar L(Q,\dot Q,t) = L(q(Q,t), \dot q(Q,\dot Q,t), t). The strategy is direct computation: relate the QQ-derivatives of Lˉ\bar L to the qq-derivatives of LL by the chain rule, and show that the new Euler–Lagrange expression is a nonsingular linear combination of the old ones — so one vanishes exactly when the other does. Two small identities carry the whole proof; watch for them.

Step 1. Differentiate the transformation qi=qi(Q,t)q_i = q_i(Q,t) along the motion to relate velocities:

q˙i=∑j∂qi∂Qj Q˙j+∂qi∂t\dot q_i = \sum_j \frac{\partial q_i}{\partial Q_j}\,\dot Q_j + \frac{\partial q_i}{\partial t}

Because the right side is linear in Q˙j\dot Q_j, two identities follow immediately: ∂q˙i∂Q˙j=∂qi∂Qj\dfrac{\partial \dot q_i}{\partial \dot Q_j} = \dfrac{\partial q_i}{\partial Q_j} (dot cancellation) and ddt∂qi∂Qj=∂q˙i∂Qj\dfrac{\mathrm{d}}{\mathrm{d}t}\dfrac{\partial q_i}{\partial Q_j} = \dfrac{\partial \dot q_i}{\partial Q_j} (derivatives commute). Why these are the crux: the first lets velocity-derivatives of Lˉ\bar L pull back through the coordinate Jacobian; the second makes the unwanted cross terms cancel in Step 4.

Step 2. Chain-rule the velocity derivative of Lˉ\bar L:

∂Lˉ∂Q˙j=∑i∂L∂q˙i ∂q˙i∂Q˙j=∑i∂L∂q˙i ∂qi∂Qj\frac{\partial \bar L}{\partial \dot Q_j} = \sum_i \frac{\partial L}{\partial \dot q_i}\,\frac{\partial \dot q_i}{\partial \dot Q_j} = \sum_i \frac{\partial L}{\partial \dot q_i}\,\frac{\partial q_i}{\partial Q_j}

Step 3. Chain-rule the coordinate derivative — both qiq_i and q˙i\dot q_i depend on QjQ_j:

∂Lˉ∂Qj=∑i(∂L∂qi∂qi∂Qj+∂L∂q˙i∂q˙i∂Qj)\frac{\partial \bar L}{\partial Q_j} = \sum_i \left(\frac{\partial L}{\partial q_i}\frac{\partial q_i}{\partial Q_j} + \frac{\partial L}{\partial \dot q_i}\frac{\partial \dot q_i}{\partial Q_j}\right)

Step 4. Assemble the Euler–Lagrange expression in the new coordinates, using the product rule on Step 2 and the commuting identity from Step 1 to cancel the ∂q˙i/∂Qj\partial\dot q_i/\partial Q_j terms:

ddt∂Lˉ∂Q˙j−∂Lˉ∂Qj=∑i∂qi∂Qj(ddt∂L∂q˙i−∂L∂qi)(8)\frac{\mathrm{d}}{\mathrm{d}t}\frac{\partial \bar L}{\partial \dot Q_j} - \frac{\partial \bar L}{\partial Q_j} = \sum_i \frac{\partial q_i}{\partial Q_j}\left(\frac{\mathrm{d}}{\mathrm{d}t}\frac{\partial L}{\partial \dot q_i} - \frac{\partial L}{\partial q_i}\right) \qquad (8)

where: the matrix ∂qi/∂Qj\partial q_i/\partial Q_j is the Jacobian of an invertible transformation, hence nonsingular. Why this finishes the proof: a nonsingular matrix annihilates a vector only if the vector is zero — so the new Euler–Lagrange expressions vanish exactly when the old ones do. The equations of motion are form-invariant; nothing about the operator needs modification in the new chart. *As a concrete illustration: for the free particle in the plane, L=12m(x˙2+y˙2)L = \tfrac12 m(\dot x^2 + \dot y^2) transforms to Lˉ=12m(r˙2+r2ϕ˙2)\bar L = \tfrac12 m(\dot r^2 + r^2\dot\phi^2); equation (8) maps mx¨=my¨=0m\ddot x = m\ddot y = 0 to m(r¨−rϕ˙2)=0m(\ddot r - r\dot\phi^2) = 0 and ddt(mr2ϕ˙)=0\frac{\mathrm{d}}{\mathrm{d}t}(mr^2\dot\phi) = 0 — the correct polar equations, centrifugal term included, with no manual insertion.*

Limiting cases

CaseResultMeaning
free particle, CartesianL=12m(x˙2+y˙2+z˙2)L = \tfrac12 m(\dot x^2 + \dot y^2 + \dot z^2)Euler–Lagrange gives mr¨=0m\ddot{\mathbf r} = 0: straight lines — geodesics of the mass-matrix metric
central potential, polarL=12m(r˙2+r2θ˙2)−V(r)L = \tfrac12 m(\dot r^2 + r^2\dot\theta^2) - V(r)θ\theta absent from LL ⇒ pθ=mr2θ˙p_\theta = mr^2\dot\theta conserved by inspection
fixed constraintsT=T2T = T_2 onlyh=T+Vh = T + V: the energy function is the mechanical energy
moving constraintsT1,T0≠0T_1, T_0 \neq 0h=T2−T0+V≠T+Vh = T_2 - T_0 + V \neq T + V; the constraint motor does work
electromagnetic forceL=12mv2−qϕ+q v⋅AL = \tfrac12 mv^2 - q\phi + q\,\mathbf v\cdot\mathbf Avelocity-dependent potential; canonical momentum mv+qAm\mathbf v + q\mathbf A
relativistic free particleL=−mc21−v2/c2L = -mc^2\sqrt{1 - v^2/c^2}not T−VT - V; L→12mv2−mc2L \to \tfrac12 mv^2 - mc^2 (constant shift) as v≪cv \ll c

Worked examples

1 · Build, crank, read: the plane pendulum with numbers (confidence builder)

A pendulum has mass m=0.5 kgm = 0.5\ \mathrm{kg} and length ℓ=0.8 m\ell = 0.8\ \mathrm{m}. Construct LL, derive the equation of motion, evaluate the generalized momentum at θ˙=2 rad/s\dot\theta = 2\ \mathrm{rad/s}, and find the small-oscillation period.

Step 1. Choose the coordinate and build the Lagrangian. One degree of freedom survives the rod constraint: θ\theta. Speed =ℓθ˙= \ell\dot\theta, height below pivot =ℓcos⁡θ= \ell\cos\theta, so L=12mℓ2θ˙2+mgℓcos⁡θ=0.16 θ˙2+3.924cos⁡θL = \tfrac12 m\ell^2\dot\theta^2 + mg\ell\cos\theta = 0.16\,\dot\theta^2 + 3.924\cos\theta (joules, θ\theta in radians), using 12mℓ2=12(0.5)(0.64)=0.16 kg m2\tfrac12 m \ell^2 = \tfrac12(0.5)(0.64) = 0.16\ \mathrm{kg\,m^2} and mgℓ=0.5×9.81×0.8=3.924 Jmg\ell = 0.5 \times 9.81 \times 0.8 = 3.924\ \mathrm{J}.

Step 2. Crank. ∂L/∂θ˙=mℓ2θ˙\partial L/\partial\dot\theta = m\ell^2\dot\theta, ∂L/∂θ=−mgℓsin⁡θ\partial L/\partial\theta = -mg\ell\sin\theta, so equation (2) reads mℓ2θ¨=−mgℓsin⁡θm\ell^2\ddot\theta = -mg\ell\sin\theta, i.e. θ¨=−(g/ℓ)sin⁡θ\ddot\theta = -(g/\ell)\sin\theta with g/ℓ=9.81/0.8=12.26 s−2g/\ell = 9.81/0.8 = 12.26\ \mathrm{s^{-2}}. At θ=10°\theta = 10°: θ¨=−12.26×sin⁡(10°)=−2.13 rad/s2\ddot\theta = -12.26 \times \sin(10°) = \boxed{-2.13\ \mathrm{rad/s^2}}.

Step 3. The generalized momentum is pθ=mℓ2θ˙=0.5×0.64×2=0.64 kg m2/sp_\theta = m\ell^2\dot\theta = 0.5 \times 0.64 \times 2 = \boxed{0.64\ \mathrm{kg\,m^2/s}} — dimensions of angular momentum, not linear momentum. Conjugate momenta inherit their character from their coordinate: angular coordinate, angular momentum.

Step 4. Small oscillations: sin⁡θ≈θ\sin\theta \approx \theta gives θ¨=−(g/ℓ)θ\ddot\theta = -(g/\ell)\theta, simple harmonic with ω0=g/ℓ=12.26=3.50 rad/s\omega_0 = \sqrt{g/\ell} = \sqrt{12.26} = 3.50\ \mathrm{rad/s} and period T=2π/ω0=1.79 sT = 2\pi/\omega_0 = \boxed{1.79\ \mathrm{s}}. Sanity check: a metre-scale pendulum swings in about two seconds — right regime. Total cost of the entire analysis: one scalar function and two partial derivatives; the rod tension was never computed, because θ\theta respects the constraint automatically.

2 · The bead on a spinning wire — when L has a T₀ term (exam level)

A bead of mass m=0.1 kgm = 0.1\ \mathrm{kg} slides without friction on a straight horizontal wire that a motor spins at constant ω=3 rad/s\omega = 3\ \mathrm{rad/s} about a vertical axis through one end. The bead starts at r0=0.2 mr_0 = 0.2\ \mathrm{m}, at rest relative to the wire. Build LL, solve the motion, and track the energy bookkeeping at t=1 st = 1\ \mathrm{s}.

Step 1. Build LL. The azimuth is not a coordinate — the motor enforces ϕ=ωt\phi = \omega t (a rheonomic constraint), leaving the single coordinate rr. The bead's velocity has radial part r˙\dot r and transverse part rωr\omega, so T=12m(r˙2+ω2r2)T = \tfrac12 m(\dot r^2 + \omega^2 r^2) and V=0V = 0 (horizontal plane): L=12mr˙2+12mω2r2L = \tfrac12 m\dot r^2 + \tfrac12 m\omega^2 r^2. Note the anatomy: T2=12mr˙2T_2 = \tfrac12 m\dot r^2, T0=12mω2r2T_0 = \tfrac12 m\omega^2 r^2, exactly the structure of equation (3) with a time-dependent coordinate map.

Step 2. Crank: ddt(mr˙)−mω2r=0\frac{\mathrm{d}}{\mathrm{d}t}(m\dot r) - m\omega^2 r = 0, so r¨=ω2r\ddot r = \omega^2 r. The T0T_0 term, sitting in LL where a −V-V would sit, acts exactly like a repulsive potential Veff=−12mω2r2V_{\mathrm{eff}} = -\tfrac12 m\omega^2 r^2 — the centrifugal escape, generated by the formalism with no talk of fictitious forces.

Step 3. Solve with r(0)=0.2r(0) = 0.2, r˙(0)=0\dot r(0) = 0: r(t)=r0cosh⁡(ωt)r(t) = r_0\cosh(\omega t). At t=1 st = 1\ \mathrm{s}: r=0.2cosh⁡(3)=0.2×10.068=2.01 mr = 0.2\cosh(3) = 0.2 \times 10.068 = \boxed{2.01\ \mathrm{m}}, and r˙=r0 ωsinh⁡(3)=0.2×3×10.018=6.01 m/s\dot r = r_0\,\omega\sinh(3) = 0.2 \times 3 \times 10.018 = \boxed{6.01\ \mathrm{m/s}}. An exponential runaway from a two-term Lagrangian.

Step 4. Energy bookkeeping. The energy function (7) is h=r˙ (mr˙)−L=12mr˙2−12mω2r2=T2−T0h = \dot r\,(m\dot r) - L = \tfrac12 m\dot r^2 - \tfrac12 m\omega^2 r^2 = T_2 - T_0. At t=0t = 0: h=0−12(0.1)(9)(0.04)=−0.0180 Jh = 0 - \tfrac12(0.1)(9)(0.04) = -0.0180\ \mathrm{J}. At t=1 st = 1\ \mathrm{s}: h=12(0.1)(6.011)2−12(0.1)(9)(2.014)2=1.807−1.825=−0.018 Jh = \tfrac12(0.1)(6.011)^2 - \tfrac12(0.1)(9)(2.014)^2 = 1.807 - 1.825 = -0.018\ \mathrm{J}. Conserved to four decimals — as it must be, since LL has no explicit tt.

Step 5. But the mechanical energy is not conserved: T=12m(r˙2+ω2r2)T = \tfrac12 m(\dot r^2 + \omega^2 r^2) grows from 0.018 J0.018\ \mathrm{J} at t=0t=0 to 12(0.1)(6.0112+9×2.0142)=3.63 J\tfrac12(0.1)(6.011^2 + 9 \times 2.014^2) = \boxed{3.63\ \mathrm{J}} at t=1 st = 1\ \mathrm{s} — a factor of 200. The motor holding ω\omega fixed supplies the difference through the constraint torque. Moral: with moving constraints, the conserved quantity built from LL is h=T2−T0+Vh = T_2 - T_0 + V, not T+VT + V; the Lagrangian's anatomy told us so before we solved anything.

Origins · 1 minJoseph-Louis Lagrange and how this was discovered
JL
Joseph-Louis Lagrange
1736–1813 · Turin, Berlin, Paris

Lagrange taught himself mathematics in Turin as a teenager and at nineteen was corresponding with Euler about a new, purely analytic way to solve extremum problems — the δ\delta-calculus that became the calculus of variations. Euler, then Europe's greatest mathematician, adopted the young man's notation and lobbied for his career. Succeeding Euler in Berlin in 1766, Lagrange spent two decades perfecting the program of reducing mechanics to analysis, culminating in the Mécanique analytique (1788): mechanics with no figures, no geometric constructions, everything flowing from generalized coordinates and what we now call the Lagrangian. He carried the project to Paris through the Revolution — he headed the commission that created the metric system and survived the Terror that executed his friend Lavoisier. Napoleon made him a count. He is buried in the Panthéon, the same building where Foucault would later hang his pendulum.

History
1687
— Newton's Principia founds dynamics on forces and geometry; every problem demands its own diagram and its own decomposition.
1743
— d'Alembert's Traité de dynamique recasts dynamics as statics via virtual work, opening the road that eliminates constraint forces.
1760
— Lagrange, age 24, sends the Turin Academy his purely analytic δ\delta-method for variational problems, replacing Euler's geometric constructions.
1788
— Mécanique analytique appears in Paris: the function T−VT - V in generalized coordinates, with the equations of motion that now bear Lagrange's name.
1834
— Hamilton shows the same equations follow from a stationary-action principle, and recasts them in the canonical form that carries mechanics into quantum theory.

Going further

References. Goldstein, Poole & Safko, Classical Mechanics, 3rd ed., Ch. 1 · Landau & Lifshitz, Mechanics, 3rd ed., §1-5 · Morin, Introduction to Classical Mechanics, Ch. 6 · Taylor, Classical Mechanics, Ch. 7 Key results to keep in mind: the EM Lagrangian yields the Lorentz force and canonical momentum mv+qAm\mathbf{v}+q\mathbf{A}; the energy function h=T2−T0+Vh=T_2-T_0+V follows from Euler's theorem on homogeneous functions. Worked-example numbers on this page (pendulum: θ¨=−2.13 rad/s2\ddot\theta = -2.13\ \mathrm{rad/s^2} at 10°10°, pθ=0.64 kg m2/sp_\theta = 0.64\ \mathrm{kg\,m^2/s}, T=1.79 sT = 1.79\ \mathrm{s}; bead: r=2.01 mr = 2.01\ \mathrm{m}, r˙=6.01 m/s\dot r = 6.01\ \mathrm{m/s}, h=−0.018 Jh = -0.018\ \mathrm{J} conserved, TT growing to 3.63 J3.63\ \mathrm{J}) are illustrative arithmetic recomputed from the boxed formulas.

Builds on: Generalized Coordinates and Configuration Space · Constraints and Their Classification · Degrees of Freedom · d'Alembert's Principle Leads to: The Euler-Lagrange Equations · The Action Functional · Hamilton's Principle of Stationary Action · Cyclic Coordinates and Conservation of Conjugate Momenta · The Energy Function and Jacobi Integral · Symmetries and Continuous Transformations

Is there a deep reason the Lagrangian is T − V, or is it a lucky guess that happens to work?

There is a reason, and Derivation A locates it precisely: starting from d'Alembert's form of Newton's law, the force term Qk=−∂V/∂qkQ_k = -\partial V/\partial q_k can be absorbed into the operator's two slots only if VV enters with a minus sign — and only because VV is velocity-independent. So T−VT - V is derived, not guessed, for conservative holonomic systems. But do not over-read it: the honest definition of a Lagrangian is "whatever scalar makes the variational principle produce the right equations." The relativistic particle uses −mc21−v2/c2-mc^2\sqrt{1 - v^2/c^2}, which is not T−VT - V by anyone's accounting, and the deeper quantum answer (via the path integral) is that LL is whatever phase-per-unit-time makes interference select classical paths. T−VT - V is the classical-mechanics face of that more general object.

Does the value of L at some instant mean anything physically? Can I measure the Lagrangian?

Essentially no — and that is not a defect. Two facts make the pointwise value of LL unphysical: it changes under the gauge shift L→L+dF(q,t)/dtL \to L + \mathrm{d}F(q,t)/\mathrm{d}t (eq. 5), which alters nothing observable, and it is not conserved, so it is not a bookkeepable quantity like energy. What carries physics is not LL's value but its shape: its partial derivatives (which build the equations of motion), its symmetries (which build conservation laws), and its time integral along paths — the action — whose stationarity picks the true motion. Compare with potential energy, where only differences matter: the Lagrangian pushes that one step further, where only variations matter. Instruments measure trajectories; LL is the generator behind them, one gauge representative among many.

In ∂L/∂q̇ we treat q and q̇ as independent variables — but velocity is determined by the trajectory. How can they be independent?

Because at the moment you differentiate LL, there is no trajectory yet. The Lagrangian is a function on states — pairs (configuration, velocity), the tangent bundle of configuration space — and any position can be paired with any velocity: a pendulum at θ=10°\theta = 10° may have any θ˙\dot\theta whatsoever. The partial derivatives ∂L/∂q\partial L/\partial q and ∂L/∂q˙\partial L/\partial\dot q probe how LL varies across this space of possible states, holding the other slot fixed. Only after those derivatives are assembled into the Euler–Lagrange equation does the equation select trajectories q(t)q(t), and only along a chosen trajectory does q˙\dot q become the time derivative of qq. The total-derivative operator d/dt\mathrm{d}/\mathrm{d}t in equation (2) is exactly the step that re-imposes the trajectory relationship. Confusing the two derivative types is the single most common calculational error in the subject.

When does the recipe L = T − V actually fail, and what replaces it?

Three regimes. (1) Velocity-dependent forces that conserve energy — magnetism — are handled by promoting VV to a velocity-dependent potential: L=T−UL = T - U with U=qϕ−q v⋅AU = q\phi - q\,\mathbf v\cdot\mathbf A reproduces the full Lorentz force (eq. 6). (2) Dissipation — friction, drag — comes from no potential of either kind; you either keep a generalized force QkQ_k on the right-hand side of the equations or introduce a Rayleigh dissipation function alongside LL. (3) Relativity — the free particle takes L=−mc21−v2/c2L = -mc^2\sqrt{1-v^2/c^2}, chosen so the action is proportional to proper time; it limits to 12mv2\tfrac12 mv^2 minus a constant when v≪cv \ll c. In every case the formalism survives; only the identification of LL with T−VT - V is renegotiated. That is why the variational definition is the one to internalize.

How do I actually choose the generalized coordinates for a new problem?

Three habits cover almost everything. First, count: an NN-particle system with kk independent holonomic constraints needs exactly n=3N−kn = 3N - k coordinates, so know your target before you start. Second, parametrize the allowed motions directly — angles for things that swing or roll, arc lengths for things that slide along curves, relative coordinates plus center of mass for isolated pairs. If a constraint still appears as an equation among your coordinates, you have not finished choosing. Third, chase symmetry: prefer coordinates the Lagrangian will not depend on, because each such cyclic coordinate hands you a conserved momentum for free — for a planet, polar (r,θ)(r,\theta) beats Cartesian (x,y)(x,y) precisely because θ\theta ends up absent from LL. When several choices tie on those criteria, pick the one that makes TT simplest; VV is usually easy either way.

Where exactly did the constraint forces go? The rod tension is a real force — the Lagrangian never mentions it.

It was projected out before LL was ever written. The chain runs: ideal constraint forces do no work under virtual displacements (the defining property of "ideal"); d'Alembert's principle therefore removes them from the projected equation of motion; and choosing generalized coordinates that respect the constraint means every remaining direction of variation is one the constraint force is perpendicular to. The tension is real — it is what curves the bob's path — but it is workless bookkeeping, and the formalism is engineered to never ask about it. When you do want it (will the rod snap?), you have two options: return to Newton with the Lagrangian solution in hand, or keep the constraint as an equation and enforce it with a Lagrange multiplier, whose value along the motion is the constraint force. That technique gets its own article.

Why does T stop being a pure quadratic in the velocities when constraints move, and why should I care?

Derivation B shows the mechanism: differentiating ri(q,t)\mathbf r_i(q,t) produces the dragging velocity ∂ri/∂t\partial\mathbf r_i/\partial t alongside the q˙\dot q terms, and squaring then yields pieces linear (T1T_1) and independent (T0T_0) of q˙\dot q. Physically, the constraint's own motion injects kinetic energy that no generalized velocity accounts for — the spinning wire carries the bead even when r˙=0\dot r = 0. You should care for two reasons. Practically, T0T_0 sits in LL exactly where a potential would, so it acts like one: the bead's T0=12mω2r2T_0 = \tfrac12 m\omega^2 r^2 is a repulsive effective potential, the centrifugal effect with no fictitious forces invoked. Conceptually, the grading decides the energy bookkeeping: the conserved Jacobi function is h=T2−T0+Vh = T_2 - T_0 + V, which equals T+VT + V only when T1=T0=0T_1 = T_0 = 0. Misidentifying which energy is conserved on a moving constraint is a classic exam ambush.

Are Lagrangians unique? My answer and the textbook's differ by more than a total derivative.

First run the standard check: compute the difference and test whether it is dF(q,t)/dt\mathrm{d}F(q,t)/\mathrm{d}t for some FF — if yes, you are done, both are correct (eq. 5). If not, further freedoms exist. Any constant multiple cLcL gives the same equations (it rescales the action uniformly), as does cL+dF/dtcL + \mathrm{d}F/\mathrm{d}t combined. More exotically, some systems admit genuinely inequivalent Lagrangians — for the 1D harmonic oscillator there are alternative Lagrangians not related by these operations that still yield x¨=−ω2x\ddot x = -\omega^2 x — but these are curiosities rather than tools at this level. The practical rule: two candidate Lagrangians describe the same physics if and only if their Euler–Lagrange equations agree; the total-derivative and constant-multiple freedoms are the systematic ways that happens, and checking the equations of motion directly settles any dispute.

Before this

Where this leads