Let's say that when the rod is vertically downwards it has an angle of zero radians.

So the state of the system is given by the rod angle and the rod angular velocity.

The first step is to write out the kinetic and potential energy for the system.

The kinetic energy is given by 1/2 the moment of inertia

times the angular velocity squared.

Which simplifies to one half the mass times the rod length squared

times the angular velocity squared.

The potential energy is simply the energy due to gravity.

Which is equal to the negative of the mass times the rod length

times the acceleration due to gravity, time the cosine of the rod angle.

The Lagrangian is then the difference between the Kinetic and

the Potential energy.

Let's apply the Euler-Lagrange operator to the system term by term.

The partial derivative at the Lagrangian with respect to position is equal to mgl

sine theta.

Now in this case we get a scalar, but if the system had multiple degrees of

freedom we would instead get a vector whenever we take a partial derivative.

The partial derivative of the Lagrangian with respect to velocity is equal to ml

squared times the angular velocity.

And differentiating with respect to time gives

ml squared times the angular acceleration.

We get the equations of motion when we combine these two terms and

set the results to 0.

Notably, when we simplify the equations,

we see that the mass cancels out, leading to the interesting result

that if the frequency of a simple pendulum is unaffected by its mass.