# Classical Mechanics: Newtonian, Lagrangian, and Hamiltonian

In classical mechanics, there are three common approaches to solving problems. I’m going to solve the same situation three different ways. It’s going to be fun. Trust me.

Here is the problem. A ball is at ground level and tossed straight up with an initial velocity. The only force on the ball while it is in the air is the gravitational force. Oh, the ball has a mass of “m”.

**Newtonian Mechanics**

First, let’s get this out of the way. It wasn’t just Newton that did this stuff. Also, please don’t lecture me on “Newton’s Three Laws of Eternal Motion and the Rules of the Universe”. Yes, I think everyone spends too much time on “the three laws”.

In short, Newtonian mechanics works for cases in which we know the forces and we have a reasonable coordinate system. Yes, it’s true that we can use unreasonable coordinate systems and still have this stuff work. Also, it’s possible to deal with unknown forces (like the tension in a string with a swinging pendulum). But Newtonian mechanics works best if we know the forces.

If you know the forces (or just one force), then the following is true (in one dimension):

Honestly, I prefer to write the momentum principle -but let’s just go with this for now. Oh, in case you didn’t notice, I am using the “dot-notation” for derivatives. A single dot means:

The double dot means a second derivative (with respect to time).

Back to the tossed ball. The only force on the ball is the gravitational force. Also, I am going to use “y” for the position. This gives us:

That’s just a second order differential equation (and not a very difficult one). If I integrate both sides with respect to time, I get:

Integrating again, I get:

Boom. That’s your equation of motion for a tossed ball.

**Lagrangian Mechanics**

I’m not going to go over the whole theory behind the Lagrangian. Here is the short answer (super short). If you define something called the Lagrangian as:

Where T is the “generalized” kinetic energy and U is the potential energy, then the path a particle will take will be such that the integral over time of L is stationary (which is like minimized). When you need to find a function that minimizes an integral, you can use the Euler-Lagrange equation to get the following (in 1 dimension for simplicity):

The best part of Lagrangian mechanics is that you don’t have to use normal coordinate systems. If you have a bead moving along a wire, the coordinate system can be defined as the distance along the wire. Also, since the Lagrangian depends on kinetic and potential energy it does a much better job with constraint forces.

OK, let’s do this for the ball example. I’m going to assume the ball has a position y as measured from the ground and a velocity (y-dot). That gives the following:

To get the equation of motion, I need to first take the partial derivative of L with respect to y:

Also, I need that second term with the derivative of the partial with respect to y-dot. It doesn’t matter in this problem-but here is where I caution students to be careful of the difference between a derivative and a partial derivative.

Yes, I skipped a step in there because it was trivial. Putting this together, I get:

Now we are at the same place as the Newtonian method. I could integrate twice, but I would clearly get the same thing.

**Hamiltonian Mechanics**

I’ll be honest. I sort of suck at Hamiltonian mechanics. Oh sure-it’s super important. However, for just about every problem in classical mechanics it’s going to be easier to use either Newtonian mechanics or Lagrangian.

Then why do the Hamiltonian? The first reason is for quantum mechanics. Yes, in quantum mechanics we use the Hamiltonian operator. It’s probably a good idea to understand just what the heck that means. The second reason is statistical mechanics. The Hamiltonian turns up there too. Oh, and other places.

Let’s get started though. I am again skipping the derivation of the Hamiltonian. This is a blog post, not a textbook.

In one dimension (and for one particle) the Hamiltonian is defined as:

Yes, you have to find the Lagrangian first. Oh, the p is momentum. However, once you get the Hamiltonian you get the two following equations:

OK, let’s do this. I already have the Lagrangian. I can write the Hamiltonian as:

Since the Hamiltonian really depends on position and momentum, I need to get this in terms of y and p. Note: I am using

for the momentum. This is not always the case-it depends on your choice of coordinate system. But anyway, I will proceed. This makes the Hamiltonian:

Yes. In this case, this is the total energy. It doesn’t have to be the total energy-it just works in this case.

Now I can use the two partials to get two equations:

Here is a major point about Hamiltonian: using this method, I get two first order differential equations instead of one second order differential equation. That might be important in some cases.

In order to get the equation of motion, I’m going to take the derivative of y-dot.

Fortunately, I already have an expression for p-dot. Putting this together, I get:

Boom. Back to that same equation as in the other two methods.

The end.

*Originally published at **http://rhettallain.com** on October 31, 2018.*