SEARCH

How to Find Hamiltonian from Lagrangian

The Journey from Lagrangian to Hamiltonian: A Practical Guide

If you've ever dabbled in physics, especially classical mechanics or quantum mechanics, you've likely encountered two fundamental concepts: the Lagrangian and the Hamiltonian. They might seem abstract at first, but they're powerful tools for describing the motion of systems. While the Lagrangian often feels more intuitive, understanding how to derive the Hamiltonian from it is a crucial step for deeper analysis and for bridging the gap to quantum mechanics. This article will walk you through the process, making it accessible to the average American reader.

What are the Lagrangian and Hamiltonian, Anyway?

Before we dive into the "how," let's quickly define what these terms represent.

  • The Lagrangian (L): Think of the Lagrangian as the "action" of a system, minus its potential energy. More formally, it's defined as the difference between the kinetic energy (T) and the potential energy (V) of a system: L = T - V. The Lagrangian formulation is particularly useful for setting up the equations of motion using something called the Euler-Lagrange equations.
  • The Hamiltonian (H): The Hamiltonian represents the total energy of a system. It's often expressed in terms of generalized coordinates and their corresponding *conjugate momenta*. The Hamiltonian formulation is especially important for transitioning to quantum mechanics, where energy is a key observable.

The Core Concept: Legendre Transformation

The bridge between the Lagrangian and the Hamiltonian is a mathematical technique called the **Legendre Transformation**. Don't let the fancy name intimidate you! At its heart, it's a way of switching from one set of variables to another. In our case, we're switching from generalized coordinates and their velocities to generalized coordinates and their conjugate momenta.

Step-by-Step Guide to Deriving the Hamiltonian

Let's break down the process into manageable steps. We'll assume you've already written down the Lagrangian for your system.

Step 1: Identify Your Generalized Coordinates and Velocities

First, you need to know what your generalized coordinates are. These are variables that uniquely describe the configuration of your system. For example, in a simple pendulum, the angle of the bob from the vertical is a good generalized coordinate. You'll also need the corresponding generalized velocities, which are the time derivatives of these coordinates (e.g., d(angle)/dt).

Step 2: Calculate the Conjugate Momenta

This is a key step. For each generalized coordinate, there's a corresponding **conjugate momentum**. You calculate it using the following formula:

p_i = ∂L / ∂(dq_i/dt)

Here:

  • p_i is the conjugate momentum for the i-th generalized coordinate.
  • ∂L / ∂(dq_i/dt) means taking the partial derivative of the Lagrangian (L) with respect to the i-th generalized velocity (dq_i/dt).

Let's say your Lagrangian is written in terms of coordinates `q1`, `q2`, ... and velocities `dq1/dt`, `dq2/dt`, .... You'll perform this derivative calculation for each coordinate.

Step 3: Express Velocities in Terms of Momenta

The next crucial step is to algebraically rearrange the equations you got in Step 2. You want to solve each equation for the generalized velocity (`dq_i/dt`) in terms of the corresponding conjugate momentum (`p_i`) and the generalized coordinates (`q_i`).

For example, if you found that `p1 = m * (dq1/dt)`, you would rearrange this to `dq1/dt = p1 / m`.

Step 4: Construct the Hamiltonian

Now comes the final construction. The Hamiltonian (H) is defined by the Legendre transformation as:

H = Σ (p_i * dq_i/dt) - L

Here:

  • Σ (p_i * dq_i/dt) means you sum up the product of each conjugate momentum (`p_i`) and its corresponding generalized velocity (`dq_i/dt`) over all your generalized coordinates.
  • L is your original Lagrangian.

Important Note: In this step, you will substitute the expressions for `dq_i/dt` that you found in Step 3 (the ones in terms of `p_i` and `q_i`) into the `p_i * dq_i/dt` terms and into the Lagrangian `L` itself. The goal is to have the Hamiltonian expressed *only* in terms of generalized coordinates (`q_i`) and conjugate momenta (`p_i`), and not in terms of velocities.

When the Hamiltonian is Equal to the Total Energy

For many common systems, especially those where the potential energy doesn't depend on velocity and the coordinate transformations are time-independent, the Hamiltonian you derive will indeed be equal to the total energy of the system (Kinetic Energy + Potential Energy). This is a good sanity check!

Example: A Simple Harmonic Oscillator

Let's put this into practice with a classic example: a one-dimensional simple harmonic oscillator (like a mass on a spring).

1. Lagrangian:

Kinetic Energy (T) = (1/2) * m * (dx/dt)^2

Potential Energy (V) = (1/2) * k * x^2

Lagrangian (L) = T - V = (1/2) * m * (dx/dt)^2 - (1/2) * k * x^2

Here, our generalized coordinate is `x`, and the generalized velocity is `dx/dt`.

2. Conjugate Momentum:

p = ∂L / ∂(dx/dt)

p = ∂/∂(dx/dt) [ (1/2) * m * (dx/dt)^2 - (1/2) * k * x^2 ]

p = m * (dx/dt)

3. Express Velocity in Terms of Momentum:

From `p = m * (dx/dt)`, we solve for `dx/dt`:

dx/dt = p / m

4. Construct the Hamiltonian:

H = (p * dx/dt) - L

Substitute `dx/dt = p / m` and `L = (1/2) * m * (dx/dt)^2 - (1/2) * k * x^2`:

H = (p * (p / m)) - [ (1/2) * m * (p / m)^2 - (1/2) * k * x^2 ]

H = (p^2 / m) - [ (1/2) * m * (p^2 / m^2) - (1/2) * k * x^2 ]

H = (p^2 / m) - [ (1/2) * (p^2 / m) - (1/2) * k * x^2 ]

H = (p^2 / m) - (1/2) * (p^2 / m) + (1/2) * k * x^2

H = (1/2) * (p^2 / m) + (1/2) * k * x^2

And there you have it! The Hamiltonian for the simple harmonic oscillator is (p^2 / 2m) + (1/2) k x^2. Notice that this is exactly the total energy: kinetic energy (p^2 / 2m, since p=mv so p^2 = m^2 v^2 and p^2/2m = mv^2/2) plus potential energy ((1/2) k x^2).

Why is This Useful?

Understanding the Hamiltonian from the Lagrangian is essential for several reasons:

  • Canonical Transformations: The Hamiltonian formalism is built around **canonical transformations**, which are transformations of coordinates and momenta that preserve the form of Hamilton's equations of motion. This is incredibly powerful for simplifying complex problems.
  • Phase Space: The Hamiltonian describes the evolution of a system in **phase space**, a space where each point represents a unique state of the system defined by its generalized coordinates and conjugate momenta.
  • Quantum Mechanics: As mentioned, the Hamiltonian is the operator that corresponds to the total energy in quantum mechanics. The Schrödinger equation, the fundamental equation of quantum mechanics, is written in terms of the Hamiltonian operator.

Frequently Asked Questions (FAQ)

How do I know which generalized coordinates to use?

The choice of generalized coordinates often depends on the constraints of the system. For simple systems, Cartesian coordinates might work. For systems with fixed lengths or angles, polar or other generalized coordinates are more efficient. The goal is to use the minimum number of independent variables to describe the system's configuration.

Why is it called a Legendre Transformation?

The Legendre Transformation is a mathematical technique named after French mathematician Adrien-Marie Legendre. It's used to convert a function of several variables into a new function of its partial derivatives. In physics, it's a way to change the variables of a system from coordinates and velocities to coordinates and momenta, which is crucial for the Hamiltonian formulation.

What happens if the Lagrangian depends on time?

If the Lagrangian itself explicitly depends on time (L(q_i, dq_i/dt, t)), the Hamiltonian derived through the Legendre transformation will still be H = Σ (p_i * dq_i/dt) - L. However, if the Lagrangian has explicit time dependence, the Hamiltonian may not conserve total energy. You would then use Hamilton's equations to see how both coordinates, momenta, and the Hamiltonian itself evolve with time.

Is the Hamiltonian always the total energy?

Not always, but very often! The Hamiltonian is equal to the total energy (T+V) when the potential energy does not depend on velocity and when the coordinate transformations used to define the generalized coordinates are not explicitly time-dependent. In these cases, the canonical momentum is simply the mass times velocity, and the system is "conservative."