Lagrangian — Definition, Formula & Example
The Lagrangian is a single function that packs a whole problem into one expression. In physics it is kinetic energy minus potential energy, , and it produces a system's equations of motion. In optimization it combines an objective with its constraints, .
In constrained optimization, for an objective and a constraint , the Lagrangian is . Here is a new variable called the Lagrange multiplier. With constraints you add one term for each. If at a constrained extremum, then that point is a critical point of . In classical mechanics, the Lagrangian is , kinetic minus potential energy. The motion of the system satisfies the Euler–Lagrange equations .
Key Formula
Where:
- = Kinetic energy of the system
- = Potential energy of the system
- = A coordinate of the system (such as an angle) and its rate of change with respect to time
- = In optimization, the objective function you want to maximize or minimize
- = The constraint, rearranged so that g(x, y) = 0
- = The Lagrange multiplier, treated as an extra unknown
Worked Example
Problem: A simple pendulum has a bob of mass on a massless rod of length , at angle from vertical. Write its Lagrangian and use the Euler–Lagrange equation to find its equation of motion.
Step 1: Write the kinetic and potential energy. The bob moves at speed , and its height below the pivot is .
Step 2: Take the two partial derivatives, treating and as separate variables.
Step 3: Substitute into and divide by .
Answer: , found without drawing a force diagram. For small angles, gives simple harmonic motion with .
Why It Matters
In economics, the Lagrangian sets up problems like maximizing utility on a fixed budget. At the optimum, measures how much the optimal value changes per unit of extra budget. In physics and engineering, writing lets you derive equations of motion for pendulums and robot arms in any coordinates, without drawing force diagrams.
Common Mistakes
Mistake: Writing the Lagrangian as , the total energy.
Correction: The Lagrangian is . Using flips the sign of the force: for the pendulum it gives , which pushes the bob away from the bottom instead of back toward it.
Mistake: Thinking the Lagrangian must be and that writing is wrong.
Correction: Both conventions appear in textbooks. They give the same critical points. The only change is that flips sign. Use one convention consistently, especially if you plan to interpret as a rate of change.
