July 5, 2025

What is Lagrangian and Hamiltonian?

  • The Lagrangian is a function used to derive how a system moves (i.e., the equations of motion).
  • The Hamiltonian is a function that describes the energy state of the system, specifically conserved quantities.

These are able to handle a system in a unified way even in complex coordinate systems.

Differentials in Hamiltonian

What does it mean?

Well, You don’t have to worry about coordinate systems when writing the equations of motion using the Hamiltonian. Hamilton’s canonical equation is

\dot{q}_i = \frac{\partial H}{\partial p_i}, \quad \dot{p}_i = -\frac{\partial H}{\partial q_i}

This format can be used as is regardless of the coordinate system used.
For example, whether you use Cartesian or polar coordinates, you can obtain the same form of equation of motion by properly defining the generalized coordinates q_i.

Euler–Lagrange equation (of motion) is as follows:

\frac{d}{dt}\left(\frac{\partial L}{\partial \dot{q}_i}\right) - \frac{\partial L}{\partial q_i} = 0

How Lagrangian is related with Hamiltonian?

The Hamiltonian extracts an energy-based perspective from the Lagrangian. As you can see, The Hamiltonian is defined from the Lagrangian.

H(q, p) = \sum_i p_i \dot{q}_i - L(q, \dot{q})

where p_i = \frac{\partial L}{\partial \dot{q}_i} is generalized momentum, \dot{q}_i is generalized velocity, and L is Lagrangian.

The Lagrangian

L = T - V = \frac{1}{2} m \dot{x}^2 - \frac{1}{2} k x^2 \\ 

Generalized Momentum

p = \frac{\partial L}{\partial \dot{x}} = m \dot{x}
\Rightarrow \dot{x} = \frac{p}{m}

The definition of Hamiltonian

H = p \dot{x} - L = \frac{p^2}{m} - \left( \frac{1}{2} m \dot{x}^2 - \frac{1}{2} k x^2 \right)

This is exactly T+V, the total energy.

AspectLagrangian L=T−VHamiltonian H=T + V
MeaningDescribes how the system moves. focus on the trajectory of motion itselfDescribes what energy the system has, and describe the structure of time evolution (dynamical system structure)
PurposeDeriving equations of motionDescribing energy conservation, evolution, and quantization
Variablesq, \dot{q}(position and velocity)q,p(position and momentum)
Mathematical LinkH=pq˙−LH = p \dot{q} - LDerived from the Lagrangian