# The pendulum

## History

• dynamics as a study of time, but no good tools yet for measuring time.

• Galileo, 1602, bored, chandelier swinging in Pisa
• isochronism conjecture
• period independent of mass
• Christiaan Huygens, 1656, first pendulum clock
• Tautochrone as proof that the period varies.

## Derivations

Imagine a heavy bob hung from a central pivot by very light and thin but rigid steel connecting rod. Using our hand to apply a little force to the bob, we start the bob swinging back and forth in a regular periodic motion. This is a pendulum.

In the absence of friction and drag, a pendulum of length $$r$$ swings in a periodic motion over time ($$t$$), driven only by gravity after its initial release. The total mass of the pendulum $$m$$ is concentrated in the bob at its end. As the pendulum swings, the angle between the pendulum and straight-down is $$\theta$$. We would like to find an equaation for the motion of the pendulum, as represented by changes in the angle $$\theta(t)$$ over time.

The difficulties in derivation of the pendulum equation appear because of the constraint the connecting rod imposes on the motion of the bob. Newton’s laws do not provide an immediate explanation of how to account for this constraint in the equation’s for the bob’s motion. What follows are 4 different derivations of the simple pendulum’s governing equation.

1. Arclength force balance
2. Regular force balance
3. Conservation of energy
4. Lagrangian

Each invokes a differrent mechanism to account for the motion constraint.

### Arclength derivation

We know a pendulum swings follows a portion of a circular arc centered at the pendulum’s pivot. The length of this arc $$s = \theta r$$ where $$r$$ is the pendulum length and $$\theta$$ is the angle at a given time. Gravity exerts a force to shrink arclength. The gravitational force is $$mg$$, so the component of the force parallel to change in arclength is $$m g \sin \theta$$. By Euler’s formula, $$F=ma$$, where $$a$$ is the acceleration of the change in arclength. Substituting, $- mg \sin \theta = m \ddot{s} = m r \ddot{\theta},$ so after factoring out common non-zero terms, $\ddot{\theta} = -\frac{g}{r} \sin \theta.$ This derivation is short and quite slick. However, it makes an assumption that Newton’s second law applies to the curved motion of $$s$$ just as it does to straight-line motion – an assummption we have not justified.

### Newton’s second law (with a classic mistake and correction)

Newton’s second law of motion says the acceleration at any time is equal to the force per unit mass applied to it ($$\vec{a} = \vec{F}/m$$), or $m \frac{d^2\vec{p}}{dt^2} = \sum_i F_i.$ Here, all the variables $$\vec{p}$$, $$\vec{a}$$, and $$\vec{F}$$ are vectors.

Suppose we apply this to the pendulum. Looking at the diagram above, there appear to be two forces acting on the pendulum. There is a force from gravity, $$F_g$$, pulling the pendulum straight down, and there is a force from the suspending rod $$F_r$$ that always pulls toward the pivot. We do not know how large $$F _ r$$ is, but we know it should be strong enough to keep the end of the pendulum at constant distance $$r$$ from the pivot of the pendulum. Call this unknown force $$k$$. The total force is represented by $\begin{gather*} \vec{F} = \vec{F}_g + \vec{F}_r = \begin{pmatrix} 0 \\-mg \end{pmatrix} + k \begin{pmatrix} -\sin \theta \\ \cos \theta \end{pmatrix} \end{gather*}$ To make sure the length of the pendulum stays constant, we would need $$\vec{F}$$ to be perpendicular to the pendulum. Mathematically, two vectors are perpendicular if and only if their dot-products are $$0$$, so we must have $\vec{F} \cdot (-\sin \theta, \cos \theta ) = 0,$ $k \sin^2 \theta + k \cos^2 \theta - mg \cos \theta = 0,$ $k = mg \cos \theta.$ Plugging this back into our formulation of the forces $$\vec{F}$$, $\begin{gather*} \vec{F} = -m g \begin{pmatrix} \cos \theta \sin \theta \\ 1 - \cos \theta \cos \theta \end{pmatrix} = -m g \begin{pmatrix} \cos \theta \sin \theta \\ \sin^2 \theta \end{pmatrix} \end{gather*}$

The force is represented in polar coordinates, so we should also express the acceleration in polar coordinates. In polar coordinates, $\begin{gather*} \begin{pmatrix} x \\ y \end{pmatrix} = \begin{pmatrix} r \sin \theta \\ r - r \cos \theta \end{pmatrix} \end{gather*}$ Differentiating with respect to time and observing that the radius $$r$$ is constant, $\begin{gather*} \begin{pmatrix} \ddot{x} \\ \ddot{y} \end{pmatrix} = \begin{pmatrix} - \dot{\theta}^2 r \sin \theta + \ddot{\theta} r \cos \theta \\ \dot{\theta}^2 r \cos \theta + \ddot{\theta} r \sin \theta \end{pmatrix} \end{gather*}$ Substituting into Newton’s second law now, the pendulum’s motion should be governed by the equation $$F/m = a$$ is given by $\begin{gather*} -g \begin{pmatrix} \cos \theta \sin \theta \\ \sin^2 \theta \end{pmatrix} = \begin{pmatrix} - \dot{\theta}^2 r \sin \theta + \ddot{\theta} r \cos \theta \\ \dot{\theta}^2 r \cos \theta + \ddot{\theta} r \sin \theta \end{pmatrix} \\ -\frac{g}{r} \begin{pmatrix} \sin \theta \\ \sin \theta \end{pmatrix} = \begin{pmatrix} \ddot{\theta} - \dot{\theta}^2 \frac{\sin \theta}{\cos \theta} \\ \ddot{\theta} + \dot{\theta}^2 \frac{\cos \theta}{\sin \theta} \end{pmatrix} \end{gather*}$ Now, however, we have reached a problem. The same kind of problem that natural scientists encountered before 1659.

Mathematically, we are trying to solve for one unknown function $$\theta(t)$$, the angle of the pendulum over time. However, we have two different equations to solve – usually, two equations can not be solved simultaneously for one unknown. We might be able to resolve this if we could show both equations were really the same, but in this case they are not. Subtracting one from the other, we find that we must have $\dot{\theta}^2 \left( \frac{\sin \theta}{\cos \theta} + \frac{\cos \theta}{\sin \theta} \right) = 0.$ The only solutions are pendulums that are at a constant angle (any constant angle) and don’t move ($$\dot{\theta} = 0$$). Obviously, this does not agree with reality – our equations are predicting pendulums can not move, but clearly they actually move rather regularly.

This sort of issue stumped people for a while, but the problem was eventually resolved by Christian Huygens.
Physically, what did our derivation yield? Well, the force exerted on the pendulum must provide all the accelerations needed. There appear to be two components in the acceleration: one is the angular acceleration, with $$\ddot{\theta}$$. The other depends on the angular velocity, $$\dot{\theta}$$. But our model of the forces does not depend in any way on the speed of the pendulum. Which is the correct answer? Should there be a component of force that depends on the speed of the pendulum rather than gravity?

Thought Experiments

1. It takes only a second of spinning a pendulum to convince us that it’s harder to hold on to the pendulum the faster it moves.

2. If we take the pendulum into space, there would be no significant gravity ($$g=0$$), so the left hand side of our formula would disappear. Would the pendulum rod exert a force on the pendulum? Yes. There must still have to be force that keeps the pendulum moving in a circle rather than a straight line.

Thus, the forces SHOULD depend on the speed of the pendulum also. Christian Huygens formalized this idea around 1660 by creating the idea of centripetal force – the force exerted on an object necessary to keep it in a circular orbit when no other forces are being applied to the system. This force $$\vec{F} _ {c}$$ was proportional to the mass and the square of the velocity, but inversely proportional to the radial distance : $$|\vec{F} _ {c}| = m v^2 / r$$. In vector-form for our pendulum equation, the centripetal force $\vec{F} _ {c} = m r \dot{\theta}^2 \begin{pmatrix} -\sin \theta \\ \cos \theta \end{pmatrix}$ The total force on the pendulum is thus $\begin{gather*} \vec{F} = \vec{F} _ g + \vec{F} _ r + \vec{F} _ {c}= \begin{pmatrix} 0 \\-mg \end{pmatrix} + m g \cos \theta \begin{pmatrix} -\sin \theta \\ \cos \theta \end{pmatrix} + m r \dot{\theta}^2 \begin{pmatrix} -\sin \theta \\ \cos \theta \end{pmatrix} \end{gather*}$ Substituting into Newton’s law, $\begin{gather*}\begin{pmatrix} - \dot{\theta}^2 r \sin \theta + \ddot{\theta} r \cos \theta \\ \dot{\theta}^2 r \cos \theta + \ddot{\theta} r \sin \theta \end{pmatrix} = \begin{pmatrix} 0 \\-mg \end{pmatrix} + m g \cos \theta \begin{pmatrix} -\sin \theta \\ \cos \theta \end{pmatrix} + m r \dot{\theta}^2 \begin{pmatrix} -\sin \theta \\ \cos \theta \end{pmatrix} \\ \begin{pmatrix} \ddot{\theta} r \cos \theta \\ \ddot{\theta} r \sin \theta \end{pmatrix} = \begin{pmatrix} 0 \\-g \end{pmatrix} + g \cos \theta \begin{pmatrix} -\sin \theta \\ \cos \theta \end{pmatrix}\end{gather*}$ The first component gives $\ddot{\theta} r \cos \theta = - g \cos \theta \sin \theta$ $\ddot{\theta} = - \frac{g}{r} \sin \theta$ The second component gives $\ddot{\theta} r \sin \theta = -g + g \cos^2 \theta$ $\ddot{\theta} r \sin \theta = -g (1 - \cos^2 \theta)$ $\ddot{\theta} r \sin \theta = -g \sin^2 \theta$ $\ddot{\theta} = -\frac{g}{r} \sin \theta$ Thus, after simplifying either of the two components, we get the same equation: $\ddot{\theta} = - \frac{g}{r} \sin \theta.$

### Conservation of Energy

Consider the pendulum with pivot at $$(0,r)$$, where $$r$$ is the length of the pendulum. The position of the end of the pendulum is given by $$(x,y) = (r \sin \theta,r-r \cos \theta )$$. The law of conservation of energy states that if there is no friction or lose of energy, then the potential energy plus the kinetic energy of a system must be conserved. The potential energy $$P$$ of a pendulum is proportional to how high it is ($$y$$), the mass of the pendulum ($$m$$), and the acceleration of gravity ($$g$$): $$P=mgy$$. The kinetic energy $$K$$ of a pendulum is one half of the mass times velocity squared: $$K = m v^2 /2$$, where $$v$$ is the velocity. The total energy $E = P + K = mg y + m v^2/2.$ The velocity of the end of the pendulum, $v = (\dot{x},\dot{y}) = (r \dot{\theta} \cos \theta,r \dot{\theta} \sin \theta )$ $v^2 = v \cdot v = r^2 \dot{\theta}^2 \cos^2 \theta +r^2 \dot{\theta}^2 \sin^2 \theta = r^2 \dot{\theta}^2$ When we substitute, we find the energy $E = m g (r-r \cos \theta) + m r^2 \dot{\theta}^2/2 .$ Since the energy is conserved over time, the total energy never changes, and it’s time derivative must vanish. Differentiating, $\dot{E} = 0 = m g \dot{\theta} r \sin \theta + m r^2 \dot{\theta} \ddot{\theta}$ Factoring the right-hand side, $0 = m r \dot{\theta} \left( g \sin \theta + r \ddot{\theta} \right)$ Since the angular velocity is not zero, we must have $\ddot{\theta}= -\frac{g}{r} \sin \theta .$

This derivation requires

1. faith in the concept of the “conservation of energy”
2. an understanding of what potential energy and kinetic energy are.

### Lagrangian

$\begin{gather*} \mathscr{L} = K - P \\ K = \frac{1}{2} m v^2 = \frac{1}{2} m r^2 \dot{\theta}^2 \\ P = m g h = m g ( r - r \cos \theta ) \\ \mathscr{L} = \frac{1}{2} m r^2 \dot{\theta}^2 - m g ( r - r \cos \theta ) \end{gather*}$ $\begin{gather*} \\ 0 = \frac{\delta \mathscr{L}(\theta, \dot{\theta})}{\delta \theta} = \frac{\partial \mathscr{L}}{\partial \theta} - \frac{d}{dt} \frac{\partial \mathscr{L}}{\partial \dot{\theta}} \\ 0 = -m g r \sin \theta - m r^2 \ddot{\theta} \\ \ddot{\theta} = -\frac{g}{r} \sin \theta \end{gather*}$

In rectangular coordinates with an explicit length constraint,

$\begin{gather*} K = \frac{1}{2} m v^2 = \frac{1}{2} m (\dot{x}^2 + \dot{y}^2) \\ P = m g h = m g y \\ \mathscr{L} = \frac{1}{2} m ( \dot{x}^2 + \dot{y}^2 ) - m g y + \frac{1}{2} m \lambda (x^2 + y^2 - r^2) \end{gather*}$ $\begin{gather*} \begin{bmatrix} 0 \\ 0 \end{bmatrix} = \begin{bmatrix} m \lambda x - m \ddot{x} \\ mg + m \lambda y - m \ddot{y} \end{bmatrix} \end{gather*}$ $\begin{gather*} \begin{bmatrix} 0 \\ 0 \end{bmatrix} = \begin{bmatrix} \lambda x - \ddot{x} \\ g + \lambda y - \ddot{y} \end{bmatrix} \\ \lambda = - \frac{ \left(g y + \dot{x}^2 + \dot{y}^2 \right) }{r^2} \\ 0 = gx + \ddot{x} y - \ddot{y} x \end{gather*}$ This equation is implicit, and so, does not immediately yield our familiar interpretation. But if we switch back to our standard polar coordinates, we should be able to recover the standard equation for pendulum motion that we’ve seen above. We change to polar coordinates by letting $$x(t) := \rho(t) \sin(\theta(t))$$ and $$y(t) = \rho(t) \cos(\theta(t))$$. Inforcing our constraint that $$x^2 + y^2 = r^2$$, $$\rho(t) = r$$, independent of time. After substituting and simplifying, we find $\begin{gather*} 0 = r \left(g \sin{(\theta)} + r \ddot{\theta} \right) \end{gather*}$

## Fitting to video data

Consider this youtbue video. It has a nice little demonstration of a pendulum swinging in front of a green screen. We can actually treat this video as data and attempt to fit our nonlinear pendulum equation to the motion we observe. Although the video is common resolution, and the data extraction is rather messy, we can see very nice agreement between the video and our Newtonian mechanics model of pendulum motion.

After downloading the video, the first step is to crop out the 20 seconds of nice pendulum motion from the other content (I used “avidemux” to do this). Then we convert all the frames of the video file into sequentially named image files. The video has 25 frames per second, so this leads to around 500 images. (I used mplayer to save each of these frames as a png file).

Now, once we have images for the individual frames, we can focus on data extraction. There are probably some very slick ways to do this (I’d be happy to hear about better methods). Here’s the naive method I used. First, I created an image mask to blank out all the parts of the image other than the swinging pendulum. If the bob at the end of the pendulum is as curved as it appears, the angle at which it reflects light can change as it swings. To avoid such complicating artifacts, I masked it out as well, so that only thing that would be changing from frame to frame is a segment of string between the pivot and to bob. The mask ended up looking like a trivial-pursuit pie piece with a middle strip corresponding to the brown pendulum support partially removed because of extra noise I found in the video. Then, I did a little editing and merging of two frames to remove the pendulum all together and create a baseline image of what a frame would look like if the pendulum string and bob were completely removed. By calculating the difference between this baseline image and an actual video frame, I can determine what pixels of the frame have changed compared to those of the baseline. Since the mask zeros out all other movement accept the pendulum string, we hypothosize that these pixels that are changing correspond to the pendulum string. To reduce noise, we only count pixels that have changed significantly compared to the background. The coordinates of these changed pixels become our data. Fit a least squares line through the points and use the arctan function to turn the slope into an angle.

And there we have it. For each frame, we have a time and a pendulum angle. Apply our model fitting routine to estimate the initial angle, angular velocity, and pendulum length. On first pass we can get a reasonable fit, but we discover (not surprisingly) that the amplitude of the pendulum’s swing is slowly decreasing and our simple model can not capture this. The simplest fix is to include a damping term proportional to the pendulum’s angular velocity, so

$\ddot{\theta} = -\frac{g}{r} \sin \theta -d \theta.$

After this one modification, we fit our pendulum equation to these observations and find a very good match if the length is 42.8 cm long and the damping coefficient is 0.0280.

We can see from that fit that there are probably 3 outliners where our least-squares approximations to the pendulum position was off, but even then, the coefficient of determination suggests less than a tenth of a percent of the data is unexplained by the model. Given the crudeness of the original video and our methods, this is an excellent fit.

A side-by-side animation of video and simulated model using our best parameter fits.

# Exercises

1. Suppose that instead of swinging sideways, we swing our pendulum in a circle. Can you derive a relationship between the pendulum’s speed and angle?

2. In class, we figured out using conservation-of-energy that an un-damped pendulum obeys the equation $\ddot{\theta} = - \frac{g}{r} \sin \theta.$

1. Rewrite the pendulum equation as a system of two first-order ordinary differential equations.

2. Suppose a $$3/7$$th-of-a-meter long pendulum starts with no velocity at an initial position of $$\pi/4$$ radians. Modify the exponential-growth code to calculate the angle and angular velocity over the first $$40$$ seconds. Show the solution with a plot of each time-series, with curves and axes clearly labelled.

3. What is the approximate period of this pendulum?