Lagrangian dynamics are an alternative to Newtonian mechanics. Lagrangian dynamics are particularly useful in solving for the equations of a motion of a system operating under constraints. Often it is possible, using Lagrangian dynamics, to solve for the equations of motion for a system without needing to solve for the constraint forces, which is why they are often preferred over Newtonian mechanics for these types of problems. It is important to note that both methods will yield the same end result, the only thing that changes is the method of arriving at the end result.
One form of the Lagrangian equation is as follows:
Where: L, the Lagrangian function, is defined as L = T - V, where T is the total kinetic energy of the system and V is the total potential energy of the system, q is the generalized coordinate, and Q is the generalized force. is known as the generalized momentum.
Consider a mass m attached a spring with spring constant k. The system has a single degree of freedom: x, the displacement of the mass from its equilibrium position. Then,
(Note that the generalized momentum is the same as the "normal" Newtonian momentum of mass times velocity in this problem.) for this simple problem, and so the equation of motion is
which is the same as the result one arrives at by just considering the forces acting on the mass in Newtonian mechanics.