Lagrangian Mechanics Problems: A Pendulum Fully Worked
Solve Lagrangian mechanics problems step by step: choose coordinates, write T and V, apply the Euler-Lagrange equation and check a pendulum with limiting cases.
Professor Eric Editorial · Nov 29, 2026 · 7 min read
In this article
- When do you use Lagrangian mechanics?
- What are the steps?
- How do you work out a pendulum?
- What does the equation tell you?
- How do you test the answer with limiting cases?
- What is another quick example?
- What are the most common mistakes?
- What assignments does this help with, and what help is allowed?
- Lagrangian checklist
- Frequently asked questions
- Try it on a new system
The Lagrangian method replaces vector forces with one scalar function and one equation per coordinate. For constrained systems, it is often much faster than drawing every force. The method is a standard topic in upper-division classical mechanics.
When do you use Lagrangian mechanics?
It is taught in upper-division classical mechanics (often the junior year of a physics major) and in graduate mechanics. It assumes calculus, including partial derivatives. It is not part of algebra-based physics or AP Physics. AP is a trademark of the College Board, which isn't affiliated with Professor Eric.
It pays off when constraints make force diagrams awkward: pendulums, beads on wires, pulleys, coupled oscillators and motion on curved surfaces. Constraint forces such as tension don't appear in the Lagrangian when the constraint is ideal.
Conditions for the form used here: the constraints are holonomic (they can be written as equations among coordinates) and ideal (they do no work), the forces other than constraints come from a potential, and the potential depends on position only.
What are the steps?
- Choose generalized coordinates, as many as the system has degrees of freedom.
- Write T and V in terms of those coordinates and their time derivatives.
- Form L = T − V.
- For each coordinate q, compute ∂L/∂q̇ and ∂L/∂q.
- Apply d/dt(∂L/∂q̇) − ∂L/∂q = 0.
- Check units, limits and a second method.
How do you work out a pendulum?
Setup. The rod fixes the mass at distance l from the pivot, so there is one degree of freedom. Take the potential energy zero at the pivot height.
Kinetic energy. The speed is l θ̇, so T = ½ m l² θ̇².
Potential energy. The mass is a height l cos θ below the pivot, so its height relative to the pivot is −l cos θ and V = −m g l cos θ.
Lagrangian:
L = ½ m l² θ̇² + m g l cos θ
Derivatives. ∂L/∂θ̇ = m l² θ̇, so d/dt(∂L/∂θ̇) = m l² θ̈. And ∂L/∂θ = −m g l sin θ.
Euler-Lagrange equation: m l² θ̈ − (−m g l sin θ) = 0, so
θ̈ = −(g/l) sin θ
This is the standard pendulum equation. A computer algebra system gives the same equation. You can also check it with numbers. For m = 0.50 kg, l = 1.00 m, θ = 0.60 rad and θ̇ = 1.3 rad/s, ∂L/∂θ was −2.767 and −m g l sin θ gives −2.767, and the equation gives θ̈ = −5.53 rad/s². For m = 2.0 kg, l = 0.35 m, θ = −1.1 rad and θ̇ = 0.40 rad/s, θ̈ = +24.95 rad/s², again matching.
The mass cancels. The tension in the rod never appeared, since it does no work.
What does the equation tell you?
Small angles. For small θ, sin θ ≈ θ and θ̈ = −(g/l) θ. This is simple harmonic motion with ω = √(g/l). For l = 1.00 m, ω = 3.13 rad/s and the period is 2π/ω = 2.01 s. For l = 0.50 m, ω = 4.43 rad/s, so shorter pendulums swing faster, as expected.
Energy. The Lagrangian has no explicit time dependence, so the energy is conserved: E = ½ m l² θ̇² − m g l cos θ. If the pendulum is released from rest at θ₀ = 0.50 rad, the speed at the bottom follows from energy conservation: v = √(2 g l (1 − cos θ₀)) = 1.55 m/s for l = 1.00 m. The small-angle estimate θ₀√(g l) = 1.57 m/s is close, and that agreement is a useful check.
Canonical momentum. p = ∂L/∂θ̇ = m l² θ̇, which is the angular momentum about the pivot. The equation of motion says dp/dt = −m g l sin θ, the torque from gravity.
How do you test the answer with limiting cases?
- θ = 0: the equation gives θ̈ = 0, so hanging straight down is an equilibrium. Correct.
- θ = π (balanced upside down): put θ = π + ε. Then sin θ = −sin ε ≈ −ε, so ε̈ = +(g/l) ε. A small displacement grows exponentially at a rate √(g/l) = 3.13 s⁻¹ for l = 1.00 m, which means the inverted position is unstable, as expected.
- g = 0: θ̈ = 0, so the rod rotates at constant angular velocity. Correct.
- Dimensions: g/l has units s⁻², matching θ̈ for a dimensionless angle.
What is another quick example?
An Atwood machine, with masses m₁ and m₂ on a light string over an ideal pulley, has one coordinate: let x be the downward position of m₁. The string constraint means m₂ moves up by x, so T = ½ (m₁ + m₂) ẋ² and V = −(m₁ − m₂) g x. Then L = ½ (m₁ + m₂) ẋ² + (m₁ − m₂) g x, and the Euler-Lagrange equation gives
ẍ = (m₁ − m₂) g / (m₁ + m₂)
For m₁ = 3.0 kg and m₂ = 1.0 kg, ẍ = 4.90 m/s². A symbolic check returned the same result, and it matches the Newtonian solution. Notice that the string tension never appeared. The constraint did the work in step 1.
What are the most common mistakes?
- Too many coordinates. Use as many as the system has degrees of freedom, or add constraints with multipliers (a later topic).
- Kinetic energy in the wrong frame. T must use speeds in an inertial frame.
- Mixing up q̇ and q. Take ∂L/∂q̇ treating q as constant, and then take the total time derivative.
- Forgetting the zero of potential energy. Any constant can be added to V, and the equations of motion don't change, but be consistent.
- Using this for dissipative forces without generalizing. Friction and drag need extra treatment.
What assignments does this help with, and what help is allowed?
Lagrangian problems appear on weekly problem sets, midterms and finals in classical mechanics. Allowed help can include a model solution to a similar problem, such as a bead on a rotating hoop, feedback on your own setup of T, V and coordinates, tutoring and help organizing a problem set write-up.
Follow your school's honor code and your instructor's rules on outside help, and submit only your own work. We don't do graded online homework, quizzes, labs or exams. See our physics assignment help page.
Lagrangian checklist
Your checklist
0 of 7 done
Frequently asked questions
Why is the Lagrangian T minus V and not T plus V?
The combination T − V is the one for which the Euler-Lagrange equation reproduces Newton's second law, since it is the action's integrand. T + V is the total energy, which is a different quantity.
Do I always get the same equations as Newton's laws?
For the systems in standard mechanics courses, yes. The Lagrangian approach is equivalent and often shorter, especially when constraints are involved.
What are generalized coordinates?
They are any set of independent variables that fully describe the configuration, such as an angle, a distance along a curve or a combination. You choose them to fit the constraints.
Can the Lagrangian handle friction?
Not in the basic form, since friction isn't derived from a potential. Extensions add generalized forces or a dissipation function.
Try it on a new system
Set up and solve a bead sliding on a frictionless wire hoop that spins at a constant rate, and check the limit where the spin rate goes to zero. For feedback on your setup, a tutor or a model solution to a similar problem can help.