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, , 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 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.
- The Lagrangian 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 , it reproduces Newton's equations without ever computing a constraint force.
- Because 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 — centrifugal and Coriolis terms are generated automatically by the derivatives of .
- In generalized coordinates the kinetic energy has the graded structure ; the velocity-quadratic piece defines the mass matrix, and the lower-grade pieces appear only when constraints move.
- is not unique: adding a total time derivative changes nothing physical, and velocity-dependent forces like magnetism are absorbed by generalizing to a velocity-dependent potential .
- Key idea: encode all the dynamics of a constrained system in one scalar ; the equations of motion then follow mechanically from the Euler–Lagrange operator, and because 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, , is nothing but the Euler–Lagrange equations of : the mass matrix is the of equation (3), the Coriolis matrix is assembled from its -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 and deriving motion, machine-learning systems observe motion and learn . Lagrangian neural networks parametrize 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 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 , 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 , its height is , so . Turn the crank and the equation of motion appears — with the tension never mentioned, because the coordinate was chosen so that the rod's constraint is satisfied automatically.
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 whether you describe it by , by , 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.
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 , not ; 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 , re-expressed in the new coordinates, carries the geometry inside its dependence on and . The centrifugal force, in the Lagrangian view, is nothing but 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 is missing from , its momentum is conserved. When is missing, energy is. A trained eye extracts most of the physics of a system from thirty seconds of staring at , 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 acted on by conservative applied forces, the Lagrangian function is
where: — the total kinetic energy re-expressed in the generalized coordinates and velocities; — the potential energy of the applied (not constraint) forces; — time, which enters explicitly only if the constraints or the potential move on their own schedule. Note what is not: it is not the energy. The minus sign is not a typo for the innocuous plus of ; 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 ,
where: — the generalized momentum conjugate to ; — the generalized force supplied by the potential together with the geometric terms hiding in . 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 and square: the result (Derivation B) is a graded polynomial in the velocities,
where: — the symmetric, positive-definite mass matrix, which plays the role of a metric on configuration space; and — terms that exist only when the map depends explicitly on time, i.e. when the constraints themselves move. For a pendulum on a fixed pivot, alone; for a bead on a wire that a motor spins at fixed rate , a 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 and length , with measured from the downward vertical, the speed is and the height below the pivot is , so
where: the first term is with mass matrix (the moment of inertia about the pivot — mass matrices in angular coordinates are moments of inertia); the second is with . Feeding (4) into (2) gives 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
| situation | Lagrangian | notes |
|---|---|---|
| conservative holonomic system | , eq. (1) | the default recipe |
| moving (rheonomic) constraints | , eq. (3) | generated by ; energy function |
| charged particle in an EM field | , eq. (6) | velocity-dependent potential |
| free relativistic particle | not ; chosen so is proper time | |
| same physics, different | , 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 ,
where: — evaluated along the motion, changes the action only by the fixed endpoint values and therefore leaves every equation of motion untouched. So "the" Lagrangian is really an equivalence class, and 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 and a textbook's differ by a total derivative, you are both right. Second, forces that depend on velocity. A magnetic force cannot come from any — yet it fits the formalism perfectly. Allow the potential to depend on velocity, , and choose :
where: and — the scalar and vector potentials, with and ; — the charge. The Euler–Lagrange equations of (6) reproduce the full Lorentz force , and the momentum conjugate to comes out as — not . 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 that you should meet now and study later: the energy function
where: — the Jacobi integral, conserved whenever has no explicit time dependence, and equal to the familiar only when (no moving constraints). When constraints move, is conserved while the mechanical energy is not — a subtlety with teeth, exercised in Worked Example 2 and dissected fully in the energy function and Jacobi integral.
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 as established input (its derivation, via virtual work and the dot-cancellation lemma, lives in the d'Alembert article), specialize the generalized force to conservative forces, and watch get absorbed into both slots of the operator. The point to watch is where the velocity-independence of is used — that is the only reason can slide inside the 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:
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 (dot cancellation) is what converts into the two -derivatives on the left.
Step 2. Specialize to applied forces derivable from a potential, . The generalized force collapses by the chain rule:
Why this is just the chain rule: , re-expressed in generalized coordinates as , changes under only through the positions — the sum over particles is precisely .
Step 3. Move the force to the left-hand side and use to smuggle into the velocity slot as well:
Why the smuggling is legal: adding zero — namely — costs nothing precisely because contains no velocities. This single step is the origin of the minus sign: must enter with the sign that reproduces on the force side after the overall sign convention of the operator is fixed by .
Step 4. Name the combination: with , the boxed statement is the Euler–Lagrange equation (2). The construction also exposes the non-uniqueness immediately: any 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, gives — Newton's second law recovered exactly.
Go deeper · Derivation B · 1 minThe 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, , 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 : it alone generates and .
Step 1. Differentiate the coordinate map along the motion:
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 ; is that dragging velocity.
Step 2. Square, multiply by , and sum over particles. The three kinds of cross terms sort themselves by their power of :
Step 3. Read off the three grades: the coefficients in the first sum are the mass matrix , symmetric by construction and positive definite because vanishes only when every particle is at rest; the second and third sums are and . Why positive-definiteness matters: it makes 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: kills and , leaving homogeneous quadratic. Euler's theorem on homogeneous functions then gives — the identity that will make the energy function equal in exactly this case and no other. As a concrete illustration: for the bead on a wire rotating at fixed (coordinates: radial distance ; map: , ), Step 2 yields — pure with , confirming the direct computation.
Go deeper · Derivation C · 1 minForm Invariance Under Point Transformations
We now prove the hallmark advertised throughout: if the Euler–Lagrange equations hold in coordinates , they hold in identical form in any invertible new coordinates , with the new Lagrangian being merely the old scalar re-expressed, . The strategy is direct computation: relate the -derivatives of to the -derivatives of 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 along the motion to relate velocities:
Because the right side is linear in , two identities follow immediately: (dot cancellation) and (derivatives commute). Why these are the crux: the first lets velocity-derivatives of 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 :
Step 3. Chain-rule the coordinate derivative — both and depend on :
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 terms:
where: the matrix 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, transforms to ; equation (8) maps to and — the correct polar equations, centrifugal term included, with no manual insertion.*
Limiting cases
| Case | Result | Meaning |
|---|---|---|
| free particle, Cartesian | Euler–Lagrange gives : straight lines — geodesics of the mass-matrix metric | |
| central potential, polar | absent from ⇒ conserved by inspection | |
| fixed constraints | only | : the energy function is the mechanical energy |
| moving constraints | ; the constraint motor does work | |
| electromagnetic force | velocity-dependent potential; canonical momentum | |
| relativistic free particle | not ; (constant shift) as |
Worked examples
1 · Build, crank, read: the plane pendulum with numbers (confidence builder)
A pendulum has mass and length . Construct , derive the equation of motion, evaluate the generalized momentum at , and find the small-oscillation period.
Step 1. Choose the coordinate and build the Lagrangian. One degree of freedom survives the rod constraint: . Speed , height below pivot , so (joules, in radians), using and .
Step 2. Crank. , , so equation (2) reads , i.e. with . At : .
Step 3. The generalized momentum is — dimensions of angular momentum, not linear momentum. Conjugate momenta inherit their character from their coordinate: angular coordinate, angular momentum.
Step 4. Small oscillations: gives , simple harmonic with and period . 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 respects the constraint automatically.
2 · The bead on a spinning wire — when L has a T₀ term (exam level)
A bead of mass slides without friction on a straight horizontal wire that a motor spins at constant about a vertical axis through one end. The bead starts at , at rest relative to the wire. Build , solve the motion, and track the energy bookkeeping at .
Step 1. Build . The azimuth is not a coordinate — the motor enforces (a rheonomic constraint), leaving the single coordinate . The bead's velocity has radial part and transverse part , so and (horizontal plane): . Note the anatomy: , , exactly the structure of equation (3) with a time-dependent coordinate map.
Step 2. Crank: , so . The term, sitting in where a would sit, acts exactly like a repulsive potential — the centrifugal escape, generated by the formalism with no talk of fictitious forces.
Step 3. Solve with , : . At : , and . An exponential runaway from a two-term Lagrangian.
Step 4. Energy bookkeeping. The energy function (7) is . At : . At : . Conserved to four decimals — as it must be, since has no explicit .
Step 5. But the mechanical energy is not conserved: grows from at to at — a factor of 200. The motor holding fixed supplies the difference through the constraint torque. Moral: with moving constraints, the conserved quantity built from is , not ; the Lagrangian's anatomy told us so before we solved anything.
Origins · 1 minJoseph-Louis Lagrange and how this was discovered
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 -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.
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 ; the energy function follows from Euler's theorem on homogeneous functions. Worked-example numbers on this page (pendulum: at , , ; bead: , , conserved, growing to ) 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 can be absorbed into the operator's two slots only if enters with a minus sign — and only because is velocity-independent. So 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 , which is not by anyone's accounting, and the deeper quantum answer (via the path integral) is that is whatever phase-per-unit-time makes interference select classical paths. 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 unphysical: it changes under the gauge shift (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 '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; 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 , 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 may have any whatsoever. The partial derivatives and probe how 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 , and only along a chosen trajectory does become the time derivative of . The total-derivative operator 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 to a velocity-dependent potential: with reproduces the full Lorentz force (eq. 6). (2) Dissipation — friction, drag — comes from no potential of either kind; you either keep a generalized force on the right-hand side of the equations or introduce a Rayleigh dissipation function alongside . (3) Relativity — the free particle takes , chosen so the action is proportional to proper time; it limits to minus a constant when . In every case the formalism survives; only the identification of with 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 -particle system with independent holonomic constraints needs exactly 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 beats Cartesian precisely because ends up absent from . When several choices tie on those criteria, pick the one that makes simplest; 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 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 produces the dragging velocity alongside the terms, and squaring then yields pieces linear () and independent () of . Physically, the constraint's own motion injects kinetic energy that no generalized velocity accounts for — the spinning wire carries the bead even when . You should care for two reasons. Practically, sits in exactly where a potential would, so it acts like one: the bead's 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 , which equals only when . 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 for some — if yes, you are done, both are correct (eq. 5). If not, further freedoms exist. Any constant multiple gives the same equations (it rescales the action uniformly), as does 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 — 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.