A pendulum is a mass on a rod or a string that swings about a fixed pivot under gravity. It is the rotational counterpart of the spring mass model. The restoring action is a torque instead of a force, and the unknown is the angle θ(t) instead of a position. This page derives the pendulum equation twice. The first derivation follows Newton's second law for rotation. The second one uses the Lagrangian, which starts from energy instead of forces. Both give the same equation, and the Solution section shows what that equation predicts.
Simple Pendulum - Newtonian
Now let's look at another famous example, 'Simple Pendulum (Single Pendulum)'. Governing Law is same as other dynamic system saying "Total Force being applied to a moving body represents the motion of the body". Basic format is derived from F = ma. The only difference is that Pendulum is for rotational motion whereas F=ma is for linear movement, but the basic concept is same.
NOTE : Before look into the derivation of the equation, it would be good to have some intuitive understandings on the solution of the differential equation for this model. Check out this page and see how the solution graph changes as the parameters in the equation changes.
Following is each components of the governing equation for the simple pendulum.

As shown above, the key factor in the governing equation is Torque and you may ask "Where does this Torque come from ?". In another word, what is the source of the torque.
The source of the torque comes from the gravity from the Earth since we don't apply any additional force to the pendulum. You just lifted up the pendulum and just let it go. You didn't push the pendulum and just let it go. So the only source of the driving force is gravitational force. The gravitational force is applied in the direction as shown on the right side of illustration below.

Then how can I derive the torque from the gravitational force ?
If you just draw a couple of additional arrows as shown below, you would easily figure out the Torque from high school trigonometry.

With this understanding and the first illustration, you would get a differential equation as follows.

With a little bit of methematical touch, you would get much simpler equation as show below.

The equation shown above is the pendulum with no damping (e.g, no resistence by air and any other frictions).
Now let's look at the case where the damping gets involved. You would the differential equation with damping just by adding an additional arrow show in red below.

If you just 'READ' the illustration shown above, you would get the following differential equation.

Dividing this equation by mL2 gives the standard form d2θ/dt2 + (b/m) dθ/dt + (g/L) sinθ = 0. The sinθ term makes the equation nonlinear, so it has no solution in elementary functions. For small swings, sinθ is close to θ when θ is in radians. The error stays below 1 percent for angles under about 14 degrees. With that approximation, the undamped equation becomes d2θ/dt2 + (g/L)θ = 0. This is the spring mass equation again, with g/L in place of k/m.
Torque equals moment of inertia times angular acceleration : For a point mass on a massless rod, the moment of inertia is mL2, and gravity gives the torque -mgL sinθ. The minus sign pulls the mass back toward θ = 0.The mass cancels out : Both sides carry m, so the undamped motion depends only on g and L. A heavy bob and a light bob of the same length swing at the same rate.Small angles give simple harmonic motion : With sinθ replaced by θ, the natural angular frequency is ωn = sqrt(g/L).Damping enters as a velocity term : The damping torque -bL2dθ/dt plays the same role as the damper in the spring mass model.
Simple Pendulum - Lagrangian
The Lagrangian method reaches the same equation without drawing any force or torque. You write the kinetic energy K and the potential energy U of the system, form L = K - U, and apply the Euler-Lagrange equation to the coordinate θ. This method is most useful for systems where the forces are hard to draw, such as a double pendulum. Watch the symbols in this section. L now stands for the Lagrangian, so the length of the pendulum is written ℓ, and ω is the angular velocity dθ/dt.
The diagram below builds the Lagrangian from its two parts. The kinetic energy of the rotating mass is (1/2)mℓ2ω2. The potential energy is mgh, and the height above the lowest point is h = ℓ(1 - cosθ).

The steps below apply the recipe. The Lagrangian is written out first and then substituted into the Euler-Lagrange equation. The derivative with respect to ω gives mℓ2ω, and the derivative with respect to θ gives -mgℓ sinθ. Dividing the result by mℓ2 gives the last line.





The result is the undamped equation of the Newtonian section, with ℓ in place of L. The two methods agree because the torque -mgℓ sinθ is exactly the negative derivative of U with respect to θ. Damping does not come out of L = K - U, because friction does not store energy. To add damping in this method, you add a dissipation term to the right side of the Euler-Lagrange equation.
Energy replaces force as the starting point : The Lagrangian needs only K and U, both written in the chosen coordinate θ.The coordinate choice removes the rod force : The tension in the rod does no work along θ, so it never appears in the Lagrangian derivation.Both methods give the same equation : d2θ/dt2 = -(g/ℓ) sinθ comes out of the torque balance and out of the Euler-Lagrange equation.
Solution
Graphical solution for a simplified differential equation for this kind of undamped pendulum is in my visual note (www.slide4math.com) : solution 1, solution 2
For small swings, the linear equation has a closed-form solution. A pendulum released from rest at a small angle θ0 follows θ(t) = θ0 cos(sqrt(g/L) t). Its period is T0 = 2π sqrt(L/g), so a 1 m pendulum with g = 9.81 m/s2 swings with a period of about 2.006 s. The period does not depend on the mass, and in this approximation it does not depend on the amplitude either.
The full nonlinear equation behaves differently at large amplitude. Its period grows with the release angle. The exact value is T = 4 sqrt(L/g) K(sin2(θ0/2)), where K is the complete elliptic integral of the first kind. A useful first correction is T = T0(1 + θ02/16), with θ0 in radians. Compared with T0, the exact period is about 0.2 percent longer at 10 degrees, 1.7 percent longer at 30 degrees and 18 percent longer at 90 degrees. A numerical solver such as ode45 handles the nonlinear equation directly, after the same first-order conversion used for the spring mass model.
The small-angle period is 2π sqrt(L/g) : Only the length and gravity set the period of a small swing.Large swings are slower : The sinθ term weakens the restoring torque at large angles, so the period grows with amplitude.Damping makes the swing decay : With b > 0 the amplitude shrinks over time, in the same way as the damped spring mass model.