# Definitions of the Lagrangian and the Hamiltonian

I've just encountered the terms Hamiltonian and Lagrangian. I've read that the Hamiltonian is the total energy $$H = T + U$$, while the Lagrangian $$L = T - U$$, where $$T$$ is kinetic energy, and $$U$$ potential energy. In the case of Newtonian gravitational potential energy,

$$U = -G\frac{Mm}{r}$$.

So am I right in thinking that, in this case,

$$H = \frac{1}{2}mv^{2} - G\frac{Mm}{r}$$

and

$$L = \frac{1}{2}mv^{2} + G\frac{Mm}{r}$$ ?

That's to say, is the sign of the potential significant, rather than just the absolute value?

dx
Homework Helper
Gold Member
Yes, that's correct. The sign certainly is important.

Thanks!

dx
Homework Helper
Gold Member
If you're ever unsure of the sign, here's a good way to check: the potential must decrease in the direction of force. For example, for two masses m and M, the gravitational potential must decrease as you bring them closer together (i.e. as you decrease r).

I think this might shed some light on what was confusing me about this gravity simulation applet. I was puzzled by the fact that a smaller radius corresponded to a higher value, but on rereading the instructions, I see that the values plotted are actually "effective potential" (another new idea to me), rather than gravitational potential. Although sometimes the instructions simply call it potential...

http://astro.u-strasbg.fr/~koppen/body/Lagrange.html
http://astro.u-strasbg.fr/~koppen/body/LagrangeHelp.html

But what exactly is "effective potential" and how does it relate to "potential" and "potential energy". From Wikipedia, I get the impression that it's is a property of an object with a particular mass and angular velocity, whereas the applet seems to treat it more like potential, not dependent on the properties of the object being affected. Or perhaps I've misunderstood. Wikipedia has the following equation, among others:

$$\frac{1}{2}mv^{2} = E - V_{E}\left(r \right)$$

http://en.wikipedia.org/wiki/Effective_potential

where $$V_{E}\left(r \right)$$ is effective potential, and $$E$$ is the total energy, the Hamiltonian. But wouldn't that make effective potential equivalent to potential energy, or is this equation only applicable to a special case?

I've just encountered the terms Hamiltonian and Lagrangian. I've read that the Hamiltonian is the total energy $$H = T + U$$, while the Lagrangian $$L = T - U$$, where $$T$$ is kinetic energy, and $$U$$ potential energy.
In fact, the Lagrangian and the Hamiltonian are functions of unknown variables (x,v) and (x,p) correspondingly. The formers serve to derive the equations. If you find solutions, then the Hamiltonian expressed via the solutions is called the system energy E. It may be conserved and then it is an important integral of motion.

The Lagrangian is usually is not expressed via the solutions - it is not conserved and it has no importance. But some functions of its derivatives (obtained via Neuter theorem) may be conserved due to possible system symmetries.

Bob.

Last edited:
But what exactly is "effective potential" and how does it relate to "potential" and "potential energy".
In 3D case you can use the spherical coordinates. For r(t) you obtain a 1D equation with a "potential term". It looks like 1D real potential, thus the name "potential". It is not pure U(r) but something different (by an addenda due to conserved angular momentum), thus the name "effective". In reality the motion occurs in r and theta, not only along r, so not only U(r) is involved in the r-equation.

If the applet treats 1D mechanical problems (1D equations), you can use it with the true potential energy in the true 1D case and with the effective potential energy in case of separated variables of 2D or 3D mechanical problem.

Bob.

Last edited:
diazona
Homework Helper
To explain it another way: when you're working out the equations that govern orbital motion, one of them is the equation of energy conservation
$$E = \frac{1}{2} m \dot{r}^2 + \frac{1}{2} m r^2 \dot{\phi}^2 - \frac{GMm}{r}$$
The total energy is the sum of kinetic energy, which depends on both $$r$$ and $$\dot{r}$$ (position and velocity), and potential energy, which depends on only $$r$$. The thing is, in elementary mechanics we get used to thinking about systems where the kinetic energy depends only on the velocity, not on the position. So it's convenient to take the position-dependent term of the kinetic energy and lump it in with the potential energy to define an "effective potential"
$$U_{\text{eff}} = \frac{1}{2} m r^2 \dot{\phi}^2 - \frac{GMm}{r} = \frac{L^2}{2mr^2} - \frac{GMm}{r}$$
Then you can graph the effective potential and use your intuition about how particles behave in potential wells to see what happens to the orbiting body.

In fact, the Lagrangian and the Hamiltonian are functions of unknown variables (x,v) and (x,p) correspondingly.
Are you using v and p as arbitrary symbols for unspecified variables, unknown in the sense that what they represent is unspecified, rather than as symbols standing for unknown values of velocity and and momentum (mass times velocity) respectively? Otherwise I don't understand how a change of sign would make the Hamiltonian depend partly on mass while the Lagrangian didn't, if

$$K = \frac{1}{2}m\mathbf{v}\cdot\mathbf{v}$$

and

$$U = \int_{r}^{\infty} \mathbf{F} \cdot d\mathbf{r}.$$

How do these variables relate to the definitions involving kinetic and potential energy? Are they perhaps part of a more general definition of the Lagrangian and Hamiltonian, or do they relate to more general definitions of kinetic and potential energy?

The formers serve to derive the equations.
The former set of variables (x,v) serve to derive the equations H = K + U and L = K - U?

Hepth
Gold Member
Are you using v and p as arbitrary symbols for unspecified variables, unknown in the sense that what they represent is unspecified, rather than as symbols standing for unknown values of velocity and and momentum (mass times velocity) respectively? Otherwise I don't understand how a change of sign would make the Hamiltonian depend partly on mass while the Lagrangian didn't, if

$$K = \frac{1}{2}m\mathbf{v}\cdot\mathbf{v}$$

and

$$U = \int_{r}^{\infty} \mathbf{F} \cdot d\mathbf{r}.$$

How do these variables relate to the definitions involving kinetic and potential energy? Are they perhaps part of a more general definition of the Lagrangian and Hamiltonian, or do they relate to more general definitions of kinetic and potential energy?

The former set of variables (x,v) serve to derive the equations H = K + U and L = K - U?
Yes there is a definition. Usually you call them "generalized coordinates" and "generalized momentums" and I believe in this case they are also "conjugate variables".

http://en.wikipedia.org/wiki/Hamiltonian_mechanics

has an ok explanation.

I just want to comment that the Hamiltonian function in the original post is incorrect, because the velocity v should never appear in a Hamiltonian function, only momenta p and positions x. The Hamiltonian function in the original post can be easily corrected by writing the kinetic energy as p^2 / 2 m instead of m v^2 / 2.

Cyosis
Homework Helper
Actually $H=T+U$ does not hold in general either. It falls apart when $p\neq mv$. The general expression for the Hamiltonian is given by $H(p,q)=p_i \dot{q}^i-L(p,\dot{q})$,where $\dot{q}$ will be replaced by the expression for momentum.

Not to sidetrack the thread (ignore these comments if your a beginner), but even when p is not mv we can still have H = T + U, for example in spherical coordinates the angular momentum is not mv nor does it even have the same units, but it can still be the case that the Hamiltonian function is equal to the total energy when evaluated along the physical trajectory of the system. The precise condition for the Hamiltonian to be equal to the total energy is given in Arnold or Abraham: the lagrangian must be quadratic in the velocities and independent of time; this is also sufficient.