# Am I missing something fundamental in the switch from Lagrangians to Hamiltonians?

1. May 15, 2012

### Bosh

Hi,

A fundamental aspect in the Hamiltonian framework of mechanics is that the q's and p's are independent. I feel like I understand the steps in the Legendre transform from Lagrangian to Hamiltonian mechanics, but I don't see how you can go from a system where only the q's are independent (the qdots are just time derivatives of the q's) to one where both q and p are independent.

In thermodynamics Legendre transforms you always go from from sets of 2 independent quantities to other sets of 2 independent quantities. It seems to be saying that in Lagrangian mechanics q and qdot are independent, but I can't seem to make sense of that.

Any help would be appreciated!

2. May 15, 2012

### K^2

Re: Am I missing something fundamental in the switch from Lagrangians to Hamiltonians

You always have Hamiltonian relations between q's and p's. They just aren't explicit when you are working with Lagrangian.

3. May 16, 2012

### vanhees71

Re: Am I missing something fundamental in the switch from Lagrangians to Hamiltonians

This is, in fact, an important point! Indeed in the Lagrangian formalism of Hamilton's principle the action is a function of the trajectories $q(t)$. Now, when you Legendre transform to the Hamiltonian formalism, you realize that you get the constraint

$$\dot{q}=\frac{\partial H}{\partial p}$$

if you extend the Hamilton principle of least action to independent variations to phase-space trajectories $(q(t),p(t))$. This in turn extends the invariance of the Lagrangian formalism under point transformations, i.e., under diffeomorphisms from one set of generalized position coordinates to another set, to canonicial transformations (symplectomorphisms) of the generalized coordinates and their canonically conjugated momenta, i.e., such transformations $q'=q'(q,p)$, $p'=p'(q,p)$ that leave the canonical Poisson brackets

$$\{q_j,q_k\}=\{p_j,p_k\}=0, \quad \{q_j,p_k\}=\delta_{jk}$$

invariant.

4. May 16, 2012

### Bosh

Re: Am I missing something fundamental in the switch from Lagrangians to Hamiltonians

Right, I think where I'm getting confused is that with Lagrangians, along any path you can't vary q without varying $\dot{q}$. I therefore have trouble seeing how you can transform to a Hamiltonian and now vary q and p independently. p = $\frac{\partial L}{\partial \dot{q}}$, so since L = L(q, $\dot{q}$, t), p = p(q, $\dot{q}$, t). So how can you vary q without varying p?

5. May 16, 2012

### vanhees71

Re: Am I missing something fundamental in the switch from Lagrangians to Hamiltonians

The point is to define the q and the p as independent variables. Then the action becomes a functional of these phase-space variables,

$$A[q,p]=\int_{t_1}^{t_2} \mathrm{d} t [\dot{q} \cdot p-H(q,p)].$$

Then you take the variations of phase-space trajectories, with the endpoints of q fixed, this leads to

$$\delta A=\int_{t_1}^{t_2} \mathrm{d} t [\delta \dot{q} \cdot p+\dot{q} \cdot \delta p-\delta q \cdot \partial_q H(q,p)-\delta p \cdot \partial_p H(q,p)].$$

Since $\delta q(t_1)=\delta q(t_2)$ the integration by parts of the first term yields

$$\delta A=\int_{t_1}^{t_2} \mathrm{d} t \{ \delta q \cdot [-\dot{p}-\partial_q H(q,p)] + \delta p \cdot [\dot q-\partial_p H(q,p)] \}.$$

Since this has to vanish for all variations of the phase-space trajectory, one is lead to

$$\dot{p}=-\partial_q H(q,p), \quad \dot{q}=\partial_p H(q,p).$$

These are the Hamilton canonical equations of motion, which are equivalent to the Euler-Lagrange equations of motion of Hamilton's principle in the Lagrangian formulation.

The advantage of the Hamiltonian formulation is that the symplectic structure of the phase space is made explicit and thus that the formalism becomes invariant under symplectomorphisms of phase space (vulgo known as canonical transformations), which is a larger invariance group than the diffeomorphism group on configuration space, which of course is a subgroup of the symplectomorphism group.

Thus, as Helmholtz has put it in one of his marvelous textbooks: The Hamiltonian formulation in phase space is the true arena for classical mechanics.

Nowadays we know how right he was with this claim since Hamiltons principle in the Hamilton formulation is the starting point for quantum mechanics and quantum field field theory that are the most comprehensive models of nature we have today!

6. May 16, 2012

### nonequilibrium

Re: Am I missing something fundamental in the switch from Lagrangians to Hamiltonians

This is incorrect. In the Lagrangian formalism, q and qdot are taken as independent of each other. (You might be confused because physically q and qdot are dependent of each other; the thing is, the independence is mathematical and it's only after solving the math that you get that q and qdot depend on the time variable t, creating the dependence between q and qdot).

By varying qdot!

7. May 16, 2012

### Jano L.

Re: Am I missing something fundamental in the switch from Lagrangians to Hamiltonians

Exactly, in Lagrangian theory both $q$ and $\dot q$ are independent, so in standard cases when we derive the Hamiltonian from the Lagrangian, we change variables from $q$,$\dot q$ to q and p.

The fact that in deriving the equations of motion from the action principle we vary only $q$ and not $\dot q$ only means that the whole trajectory q(t) determines all velocities during the time interval considered. It does not imply that from values of $q$ $\dot q$ can be determined - in fact it cannot, so the velocities are another independent variables.

8. May 16, 2012

### Bosh

Re: Am I missing something fundamental in the switch from Lagrangians to Hamiltonians

Mr. Vodka:

If you look at how you derive the Euler-Lagrange equations in the Lagrangian formalism, you don't vary q and $\dot{q}$ independently. What you do is you vary the path q(t), and that creates variations in q and $\dot{q}$ that are related to each other through $\delta \dot{q} = \frac{d}{dt} \delta q$.

That the two variables are related through the solution as you say is what happens when you derive Hamiltonian mechanics from a variational principle. But the modified Hamilton's principle you use for that (where you vary both the path in q AND the path in the p's) is slightly different from the Hamilton's principle (where you just vary the path q(t)).

Just like the ultimate justification for the regular Hamilton's principle is that the Euler-Lagrange equations reduce to Newton's laws, I think the justified for the MODIFIED Hamilton's principle is that it provides Hamilton's equations, which you can get from the Euler-Lagrange equations, which in turn reduce to Newton's laws. And I can completely see how the modified principle gives you Hamilton's equations, just like vanhees wrote out.

Perhaps I hadn't enunciated it clearly, but where I'm stuck is how you go from the Euler-Lagrange equations to Hamilton's equations (not through a variational principle but by doing a Lengendre transform). I think I understand the individual steps, but I'm confused by the fact that it seems like in the Lagrangian formalism you have one independent set of variables the n q's (and as a result you get n second-order diff eq's), while in the Hamiltonian formalism, you have two independent sets of variables n q's and n p's (and as a result you have 2n 1st order diff eq's).

Where do you sneak in doubling the number of in dependent variables? Transformations I'm used to preserve the dimensionality...you go from 2 ind. variables to 2 others (which seems to be the case in the thermo Legendre transformations). Is it really the case that in the Lagrangian case q and $\dot{q}$ are independent, even though if you derived the equations from a variational principle (Hamilton's principle), they wouldn't be independent?

Hope the long response doesn't turn too many people off!

p.s. @ mr. vodka: In your second point, it's only in the simplest cartesian case that you can vary q without varying p, like you say. In the general case (e.g. spherical coordinates), p depends on both q and $\dot{q}$, so you can't vary q without varying p!

9. May 16, 2012

### nonequilibrium

Re: Am I missing something fundamental in the switch from Lagrangians to Hamiltonians

It seems like you're mixing up two ideas: on one hand, the q and qdot are independent, and on the other hand, we introduce a certain restriction, namely the Euler-Lagrange equation, for which the solution is the physical solution you're looking for (the Newtonian trajectory).

It's a bit like the following simplified example, to make my point (forget about classical mechanics for this, it's just math):
We can introduce two independent variables x and y. They are independent by definition, actually. Now we might put in a new constraint f(x,y)=0. We can now solve x and y and of course then they will no longer be independent. And you see in this case that nothing magical happens: it's not that the previously independent x and y are suddenly dependent, no, it's rather sloppy notation: first x and y were simply placeholder names for two independent variables, but as soon as I wrote down f(x,y)=0, I meant "the functions $x: t \mapsto x(t)$ and $y: t \mapsto y(t)$ such that for all t f(x(t),y(t)) = 0".

The above situation, in Lagrangian mechanics, is completely similar: at first q and qdot are independent by definition (making the qdot notation indeed rather tricky, since intuitively it makes you think of the derivative with respect to time, indicating a dependence). It is only when you introduce the Euler-Lagrange equation (how it is derived is irrelevant to our cause) that q and qdot become dependent; not "magically", but because you're actually using the same names for slightly different concepts. It is only in this second step that qdot attains its physically relevant meaning of derivative wrt time (since before, there is no time variable!).

Last edited: May 16, 2012
10. May 16, 2012

### Bosh

Re: Am I missing something fundamental in the switch from Lagrangians to Hamiltonians

Hm, thanks for the reply Mr. Vodka. I'd be interested to see what other people think. I'm not sure that looking at the Lagrangian problem in q and $\dot{q}$ space is quite right. I think the variation is done in q, t space, and when you derive the condition for the action to be minimized, since the Lagrangian depends on q dot, the condition also involves qdot. I think the statement you make in parentheses at the end is not right...the time variable is in there the whole time as the parameter, just as the distance is the parameter in the bachristochrone problem (or however you spell that :) )

I think your view where you're varying both things is the correct view for a derivation of Hamiltonian mechanics from a variational principle where you're varying both q and p, and through Hamilton's equations you get equations of constraint.

Maybe I'm wrong though, would be curious if other people would weigh in on it.

Thanks for all the replies!

11. May 16, 2012

### nonequilibrium

Re: Am I missing something fundamental in the switch from Lagrangians to Hamiltonians

Sure, I'm curious myself if others agree; I'm a bachelor student myself, so I make no claim on the truth!

12. May 17, 2012

### vanhees71

Re: Am I missing something fundamental in the switch from Lagrangians to Hamiltonians

Have you read my answer to the question carefully? Again, the Hamiltonian formulation is different from the Lagrangian formulation of Hamilton's principle. In the Lagrangian formulation, the action functional is taken as a functional of position-space trajectories, i.e., as a functional of functions $q(t)$. In this functional you have $\dot{q}=\mathrm{d} q/\mathrm{d} t$. Only in writing the partial (!!!) derivatives of the Lagrangian with respect to $q$ and $\dot{q}$ you treat $\dot{q}$ as if it were an independent variable.

In the Hamiltonian formulation, you change the action functional to be the functional of phase-space trajectories $(q(t),p(t))$, and $q$ and $p$ are independent coordinates to specify points in the 6N-dimensional phase space (for N particles in three-dimensional configuration space). This is a non-trivial extension of the action principle and also of the representation of symmetries, which plays a crucial rule in the development of quantum theory.

Also in the path-integral formalism of quantum theory the starting point is always the Hamiltonian formulation. Only in special (however important) cases, the Lagrangian and the Hamiltonian path integral lead to the same quantum system, and in general a naive use of the Lagrangian path integral leads to mistakes!

13. May 18, 2012

### Bosh

Re: Am I missing something fundamental in the switch from Lagrangians to Hamiltonians

Hi Vanhees, sorry yes I've been reading all your posts carefully, I just have agreed with everything you said so I didn't comment on it.

I am completely on the same page as you that the variational principle in the Hamiltonian formalism is more general than that in the Lagrangian. But I'm trying to get at something different than the different variational principles...in the end the variational principles are just made up. I could make up any sort of variational principle I wanted. The good ones are only kept--they only have any worth--because they give Hamilton's/the Euler Lagrange equations which can be shown equivalent to Newton's laws.

Where I'm getting confused (and this is my own shortcoming) is in going from the E-L equations to Hamilton's equations. It seems like you're going from an (n+1) dimensional space (q's + t), to a (2n + 1) dim. space (q's, p's + t). So it seems like that can't be a unique transformation.

I think I'm starting to see from all your above replies (and maybe you can tell me if I'm on the right track) that I should think of the space for the Lagrangian as begin a (2n+1) dim. phase space of (q's, $\dot{q}$'s + t). The idea that the q's and dots are related is wrong because the Lagrangian can give you a value for any trajectory, physical or non-physical, so you can take any combinations of q's and $\dot{q}$'s. The E-L equations then give you a constraint connecting the q's and $\dot{q}$'s for physical trajectories. So it's no problem then to go from (2n+1) Lag. space to (2n+1) Ham. space, and then you figure out what the E-L equations for physical trajectories tell you about trajectories in q,p space. Does that sound right?

If I might ask a last, related, short question: As your derivation shows, vanhees, even in a Hamiltonian variational principle, you only require the variation of the q's to vanish at the endpoints (like for the Lagrangian variational derivation). Yet, to set up canonical transformations, you have to further impose that the momentum variations vanish. For example, for a generating function involving p:

p$\dot{q}$ - H = P$\dot{Q}$ - K + $\frac{d}{dt}F(p,Q,t)$

This is only true if F(p,Q,t) vanishes at the endpoints, which in turn is only true if p vanishes at the endpoints. So aren't you limiting the number of physical trajectories you can get out if you impose that the momenta variations vanish? If more than one variational principle gave you Hamilton's equations, wouldn't you want the most general variational principle?

It seems like since canonical transformations rely on this, and they're so powerful, it should be a point emphasized more often!

Thanks