# Why does the Hamiltonian represent something different after plugging in the solution?

so I am beginning to learn Hamiltonian mechanics. We have learned that the Hamiltonian is a function of q, p, and t. Once we have a Hamiltonian, we can use the Hamiltonian equations to derive the equations of motion. Say we have the Hamiltonian of a particle in a gravitational field:

$$H = p^2/2m + mgy$$

I can solve this and it will give me, using Hamiltons equations:

$$\dot{p} = -mg$$

$$\dot{y} = p/m$$

If I solve this out, I get that (up to a constant)

$$y = -gt^2/2$$

Now, lets say that someone arbitrarily gives me the Hamiltonian

$$H = p^2/2m - m g^2 t^2 /2$$

If I use Hamiltons equations on this Hamiltonian, my equations are totally different (because there is no y dependence, we have $$\dot{p} = 0$$). How can I change Hamilton's equations to give me back the same equations of motion? All I have done in the second case is plugged in a solution for y(t), why does it mess everything up?

Going a bit further, if I have a Hamiltonian with some explicit t dependence, how do I know whether I need to write that time dependence in terms of $$q$$ or $$p$$ or whether I can leave it as is? Because in the second Hamiltonian above, if I recognized that the second term could be written as $$mgy$$, then I could solve it with Hamiltons equations normally.

My professor said that the second Hamiltonian is totally different from the first one, and I don't really understand how they are, it seems to me that they should describe the same motion.

## 1 Answer

You might think that nothing should change if you plug $$x(t)$$ and $$p(t)$$ back into the Hamiltonian, because the Hamiltonian is a number, equal to the total energy.

That's not the right way of thinking about it. You should think of the Hamiltonian as a function $$H(x, p)$$ whose structure tells you how $$x$$ and $$p$$ change in time. For each solution $$(x(t), p(t))$$ of these equations, the number $$H(x(t), p(t))$$ is independent of time, and is equal to the energy.

To take it a bit further, for any Hamiltonian without explicit time dependence, the energy is conserved. So if you really allowed yourself to plug in solutions, you could replace every single such Hamiltonian with a constant. A single constant (like "$$3\ \text{Joules}$$") clearly isn't enough to say how a physical system behaves.

For Hamiltonians with explicit time dependence, we have a function $$H(x, p, t)$$, which give you Hamilton's equations as usual. This time dependence has nothing to do with the time dependence in a particular solution, $$H(x(t), p(t), t)$$, they mean completely different things.

• Thank you for the help! This made me wonder, what sort of functions H qualify as "Hamiltonians?" Can any function be treater as if it were a Hamiltonian, and it would jus be describing a particular model? Or is there some fundamental requirement a function must satisfy in order for it to be allowed to be treated as a Hamiltonian? The reason I ask is, in condensed matter I know you can come up with a Hamiltonian which you believe to approximately model a physics situation, so it could be essentially be anything. Does this mean any function can be treated as a Hamiltonian? – Zach Sep 28 '18 at 20:41
• @Zach That’s too vague of a question to answer. “Money can have any value. Does this mean I can treat any number as the amount in my bank account?” I’m sure you could, not sure if anyone would cash your checks. – knzhou Sep 28 '18 at 20:44
• @Zach But, plenty of Hamiltonians are physically unacceptable for structural reasons, such as leading to an explosion of infinite energy when they are not bounded below. – knzhou Sep 28 '18 at 20:45