I was just wondering this morning - what exactly are Lagrangian and Hamiltonian Mechanics? I know that they are a reformulation of Newtonian Mechanics, not taught very often until late in university, and used in quite a few high level papers. I also know that they involve some kind of sum or product that is used to solve a system. I did read the Wikipedia pages, but I am unable to think of a use for the two formulations, let alone how to use them. Seeing as this is XKCD and a Science forum, I supposed that someone might be able to clarify this for me.

-raike (pronounced like "rake")

## Hamiltonian and Lagrangian Mechanics

**Moderators:** gmalivuk, Moderators General, Prelates

### Hamiltonian and Lagrangian Mechanics

"When your work speaks for itself, don't interrupt." - H.J. Kaiser

رات دن گردش میں ہیں سات آسماں

ہو رہیگا کچھ نہ کچھ گھبرائیں کیا

(غالب)

رات دن گردش میں ہیں سات آسماں

ہو رہیگا کچھ نہ کچھ گھبرائیں کیا

(غالب)

### Re: Hamiltonian and Lagrangian Mechanics

You underestimate their importance. Both are very important in classical mechanics, and Lagrangian is big in general relatively and Hamiltonian is huge in quantum mechanics.

The underlying assumptions I'm not too good with, so I'll let someone else explain those. I'll just say that they're based on the Calculus of Variations, which is a way of finding, of all possible functions to describe something, the one that minimize a certain variable. In each system you have a quantity called either the Lagrangian or Hamiltonian. L is kinetic energy minus potential, H is their sum. L is expressed in terms of coordinates and their derivatives, H in terms of cooridinates and momentum.

For a Lagrangian, there is an equation (Euler-Lagrange) that determines the equation of motion of the system. I will describe that after posting to avoid ninjas.

Ok. So let's say you have a simple harmonic oscillator, where your kinetic energy is [math]1/2 m\dot{x}^{2}[/math] a dot is a time derivative and kinetic is [math]1/2kx^{2}[/math] where k is your spring constant. So your Lagrangian is [math]1/2 m\dot{x}^{2}-1/2kx^{2}[/math] Then you do the Euler-Lagrange equation on that, which is [math]\frac{d}{dt}\frac{dL}{d\dot{x}}-\frac{dL}{dx}=0[/math]. The result of that is [math]m\ddot{x}+kx=0[/math] which is your equation for simple harmonic motion; the solution is a sin and/or cosine function.

With Hamiltonian you have two first-order ODEs instead of one second-order ODE. They are dP/dt=dH/dx and dx/dt=-dH/dP. Your Hamiltonian for a simple harmonic oscillator is [math]\frac{kx^{2}}{2}+\frac{P^{2}}{2m}[/math]

Plugging that in to those equations you get [math]\dot{P}=kx[/math][math]\dot{x}=-P/m[/math]. Then if you can solve the ODEs in either P or x.

Hamiltonian is used in quantum mechanics because a Hamiltonian matrix can be created based on any potential, and the eigenvalues of that matrix are the possible energy states of that system. One form of the Shroedinger equation is [math]H|\phi>=E|\phi>[/math].

The underlying assumptions I'm not too good with, so I'll let someone else explain those. I'll just say that they're based on the Calculus of Variations, which is a way of finding, of all possible functions to describe something, the one that minimize a certain variable. In each system you have a quantity called either the Lagrangian or Hamiltonian. L is kinetic energy minus potential, H is their sum. L is expressed in terms of coordinates and their derivatives, H in terms of cooridinates and momentum.

For a Lagrangian, there is an equation (Euler-Lagrange) that determines the equation of motion of the system. I will describe that after posting to avoid ninjas.

Ok. So let's say you have a simple harmonic oscillator, where your kinetic energy is [math]1/2 m\dot{x}^{2}[/math] a dot is a time derivative and kinetic is [math]1/2kx^{2}[/math] where k is your spring constant. So your Lagrangian is [math]1/2 m\dot{x}^{2}-1/2kx^{2}[/math] Then you do the Euler-Lagrange equation on that, which is [math]\frac{d}{dt}\frac{dL}{d\dot{x}}-\frac{dL}{dx}=0[/math]. The result of that is [math]m\ddot{x}+kx=0[/math] which is your equation for simple harmonic motion; the solution is a sin and/or cosine function.

With Hamiltonian you have two first-order ODEs instead of one second-order ODE. They are dP/dt=dH/dx and dx/dt=-dH/dP. Your Hamiltonian for a simple harmonic oscillator is [math]\frac{kx^{2}}{2}+\frac{P^{2}}{2m}[/math]

Plugging that in to those equations you get [math]\dot{P}=kx[/math][math]\dot{x}=-P/m[/math]. Then if you can solve the ODEs in either P or x.

Hamiltonian is used in quantum mechanics because a Hamiltonian matrix can be created based on any potential, and the eigenvalues of that matrix are the possible energy states of that system. One form of the Shroedinger equation is [math]H|\phi>=E|\phi>[/math].

Last edited by Klotz on Sat Feb 07, 2009 8:42 pm UTC, edited 1 time in total.

- doogly
- Dr. The Juggernaut of Touching Himself
**Posts:**5526**Joined:**Mon Oct 23, 2006 2:31 am UTC**Location:**Lexington, MA-
**Contact:**

### Re: Hamiltonian and Lagrangian Mechanics

So they are some pretty powerful things.

In Lagrangian mechanics, you start with something called the Lagrangian. This is the input of your problem. For a simple system it is kinetic energy minus potential energy. You integrate it, and that gives you the action. You want to minimize the action, because Lagrange tells you to do this. To minimize things you do the Euler Lagrange equations, key players in the calculus of variations, which you can use for other such tasks as minimizing the length of a curve or the perimeter of a shape or the volume of a soap bubble or the time it takes to fall down a curve or whatever else. You are minimizing action. Out pops the equations of motion! Pros:

- Easy to include constraints. Like if you have a particle constrained to the surface of a bowl falling down due to gravity. You can not worry about calculating the normal force and just treat it like a constraint, and you wind up getting the normal force as a result.

- The action is a relativistic invariant. Force and the Hamiltonian are both not, so for relativistic work the Lagrangian is heavily preferred.

In Hamiltonian mechanics, you start with something called the Hamiltonian. For simple systems it is kinetic energy plus potential energy. You treat the momentum as its own coordinate in a higher dimensional space, and your equations that you need to solve are all first order. In Newtonian mechanics, you have d 2nd order diff eqs, and in Hamiltonian, you have 2d 1st order diff eqs. Often this is easier. Pros:

- Really nice geometric interpretation if you know how to handle symplectic geometry.

- Hamilton, Jacobi and Poisson help you go from classical to quantum mechanics

- ...other stuff I don't know as much about since I rarely use it.

In Lagrangian mechanics, you start with something called the Lagrangian. This is the input of your problem. For a simple system it is kinetic energy minus potential energy. You integrate it, and that gives you the action. You want to minimize the action, because Lagrange tells you to do this. To minimize things you do the Euler Lagrange equations, key players in the calculus of variations, which you can use for other such tasks as minimizing the length of a curve or the perimeter of a shape or the volume of a soap bubble or the time it takes to fall down a curve or whatever else. You are minimizing action. Out pops the equations of motion! Pros:

- Easy to include constraints. Like if you have a particle constrained to the surface of a bowl falling down due to gravity. You can not worry about calculating the normal force and just treat it like a constraint, and you wind up getting the normal force as a result.

- The action is a relativistic invariant. Force and the Hamiltonian are both not, so for relativistic work the Lagrangian is heavily preferred.

In Hamiltonian mechanics, you start with something called the Hamiltonian. For simple systems it is kinetic energy plus potential energy. You treat the momentum as its own coordinate in a higher dimensional space, and your equations that you need to solve are all first order. In Newtonian mechanics, you have d 2nd order diff eqs, and in Hamiltonian, you have 2d 1st order diff eqs. Often this is easier. Pros:

- Really nice geometric interpretation if you know how to handle symplectic geometry.

- Hamilton, Jacobi and Poisson help you go from classical to quantum mechanics

- ...other stuff I don't know as much about since I rarely use it.

LE4dGOLEM: What's a Doug?

Noc: A larval Doogly. They grow the tail and stinger upon reaching adulthood.

Keep waggling your butt brows Brothers.

Or; Is that your eye butthairs?

Noc: A larval Doogly. They grow the tail and stinger upon reaching adulthood.

Keep waggling your butt brows Brothers.

Or; Is that your eye butthairs?

- danpilon54
**Posts:**322**Joined:**Fri Jul 20, 2007 12:10 am UTC

### Re: Hamiltonian and Lagrangian Mechanics

In classical mechanics, Lagrangians are used to simplify complex force problems, so you don't have to worry about force at all. Instead of considering all possible forces in a problem, all you need is potential and kinetic energy. This can be reduced, as stated by Klotz, to a differential equation that describes the system. This system is usually unsolvable, but numerical methods can be used to study the system.

The Hamiltonian appears in classical mechanics but mostly quantum mechanics. It is the energy term that appears in the schroedinger equation, the solution of which describes the quantum state of a particle.

The Hamiltonian appears in classical mechanics but mostly quantum mechanics. It is the energy term that appears in the schroedinger equation, the solution of which describes the quantum state of a particle.

Mighty Jalapeno wrote:Well, I killed a homeless man. We can't all be good people.

### Re: Hamiltonian and Lagrangian Mechanics

Thanks for all the replies!

On a related note, I picked up M G Calkin's book on Lagrangian and Hamiltonian Mechanics - it seems to be good...

On a related note, I picked up M G Calkin's book on Lagrangian and Hamiltonian Mechanics - it seems to be good...

"When your work speaks for itself, don't interrupt." - H.J. Kaiser

رات دن گردش میں ہیں سات آسماں

ہو رہیگا کچھ نہ کچھ گھبرائیں کیا

(غالب)

رات دن گردش میں ہیں سات آسماں

ہو رہیگا کچھ نہ کچھ گھبرائیں کیا

(غالب)

### Re: Hamiltonian and Lagrangian Mechanics

Actually Hamiltonian Mechanics is essential for some questions in classical mechanics as well, not just for QM.

Essentially every physical theory in the last century or so was developed through a Hamiltonian/Lagrangian.

The key advantage they have over the equations of motion themselves is that symmetries of the system are usually more explicit and transparent. For gauge symmetries you could even say that without Hamiltonian dynamics it is close to impossible to understand what's going on. Even a question as basic as how many degrees of freedom you have in a system might not be easily answerable unless you go to the Hamiltonian formulation.

In general Hamiltonian and Lagrangian mechanics explain why we have conservation of momentum, energy and angular momentum. These are perfectly general consequences of symmetries. Using Lagrangian mechanics you can, for example, easily find certain invariants in the motion of light through symmetric optical media.

If somebody proposes a physical theory the first question any professional physicist will ask is: What is the Lagrangian?

Now if you are in the business of solving physical problems rather than finding ways to state them mathematically that perspective might not be of much help. That would depend on the problem at hand.

Essentially every physical theory in the last century or so was developed through a Hamiltonian/Lagrangian.

The key advantage they have over the equations of motion themselves is that symmetries of the system are usually more explicit and transparent. For gauge symmetries you could even say that without Hamiltonian dynamics it is close to impossible to understand what's going on. Even a question as basic as how many degrees of freedom you have in a system might not be easily answerable unless you go to the Hamiltonian formulation.

In general Hamiltonian and Lagrangian mechanics explain why we have conservation of momentum, energy and angular momentum. These are perfectly general consequences of symmetries. Using Lagrangian mechanics you can, for example, easily find certain invariants in the motion of light through symmetric optical media.

If somebody proposes a physical theory the first question any professional physicist will ask is: What is the Lagrangian?

Now if you are in the business of solving physical problems rather than finding ways to state them mathematically that perspective might not be of much help. That would depend on the problem at hand.

"I conclude that all is well," says Edipus, and that remark is sacred.

- Camus, The Myth of Sysiphus

Mental Health Break

- Camus, The Myth of Sysiphus

Mental Health Break

### Re: Hamiltonian and Lagrangian Mechanics

Beside their wide uses in relativity and quantum mechanics, Lagrangian and Hamiltonian formalisms are also very useful to obtain the equations of motion of a complex system without having to know the forces acting on it. You only have to know the potential and kinetic energies (in function of the canonical coordinates) which are usually quite simple to write down. Then you write the Lagrangian; the Euler-Lagrange equation is equivalent to the equations of motion.

### Who is online

Users browsing this forum: No registered users and 15 guests