Simple Harmonic Motion

The smoothest motion in physics — this spring and pendulum simulator is the regular-motion counterpart to our chaotic double pendulum. Release a mass on a spring or a simple pendulum and watch it draw its own sine wave in real time, trading kinetic and potential energy back and forth. Turn on the ideal-sine overlay to see exactly where a wide-swinging pendulum stops being "simple." It all runs on your device.

You are in the Physics lab.

Drag the mass to set its amplitude
Period (measured)—
Ideal period T1.81 s
Frequency0.55 Hz
Amplitude A—
Kinetic KE—
Potential PE—
The period doesn't care about the amplitude. An ideal oscillator takes exactly the same time to complete a big swing as a small one — a property called isochronism. A mass on a spring obeys T = 2π√(m/k) and a small-angle pendulum obeys T = 2π√(L/g), and neither formula contains the amplitude. Drag the mass out further and the measured period barely moves for the spring; push a pendulum to a wide angle and watch the real period grow past the ideal — the point where "simple" harmonic motion stops being simple.

Reading the simulation

What the moving mass, the sine trace and the two energy bars are telling you.

1

The mass and its sine trace

The top panel is the oscillator itself — a mass on a spring, or a pendulum bob if you switch systems. Drag it out to set the amplitude and let go. As it swings, the lower panel scrolls a live displacement-versus-time graph: the height of the trace is how far the mass sits from equilibrium at that instant, and for a proportional restoring force it draws a clean sine wave. The blue dot at the right edge is the present moment.

2

The KE ↔ PE energy bars

The two vertical bars track how energy sloshes between forms while the total stays fixed. The KE bar is kinetic energy — tallest as the mass races through equilibrium — and the PE bar is potential energy, tallest at the turning points where the mass pauses. Watch one bar empty as the other fills; the readouts below print the same two numbers in joules, alongside the amplitude.

3

Ideal versus measured period

The dashed line is the ideal sine the formula predicts, and the readout shows the measured period beside the ideal T. For a mass on a spring they agree at any amplitude. Switch to the pendulum and push it to a wide angle: because the restoring force follows sin θ rather than θ, the real swing lags the dashed ideal and the measured period grows past 2π√(L/g) — the moment "simple" harmonic motion stops being simple.

How It Works

A restoring force pulling toward equilibrium, integrated step by step, drawing a sine wave as it goes.

1

A restoring force

Displace the mass and something pulls it back toward equilibrium. For a spring that force is −k·x, exactly proportional to the displacement; for a pendulum it is −(g/L)·sin θ. Because the pull grows with distance, the mass overshoots equilibrium, is pulled back again, and oscillates forever in the absence of friction.

2

It draws a sine wave

The simulator advances the state with fourth-order Runge–Kutta at a small fixed time step. As it runs, the bottom panel plots displacement against time — and for a proportional restoring force that plot is a pure sinusoid, x(t) = A·cos(ωt), with angular frequency ω = √(k/m) for the spring or √(g/L) for the pendulum.

3

Ideal versus real

The dashed line is the ideal sine the formula predicts. For the spring the real motion sits exactly on it. For the pendulum it matches at small angles, but as the swing widens sin θ falls below θ, the restoring force weakens, and the real curve visibly lags the ideal — the small-angle approximation breaking down before your eyes.

What is simple harmonic motion?
Simple harmonic motion (SHM) is the back-and-forth motion of a system whose restoring force is proportional to how far it has been displaced from equilibrium and always points back toward it. A mass on an ideal spring is the classic example. The result is a smooth oscillation whose position traces a sine wave in time, with a period that does not depend on the amplitude.
What is the period of a mass on a spring?
For a mass m on a spring of stiffness k, the period is T = 2π√(m/k). Heavier masses and softer springs oscillate more slowly. The period is independent of the amplitude, so pulling the mass further from equilibrium does not change how long each swing takes.
Does amplitude change the period of an oscillator?
For ideal simple harmonic motion, no. A mass on an ideal spring keeps exactly the same period whether you release it from a small or a large displacement — a property called isochronism. A real pendulum only obeys this at small angles; at large swings its period grows noticeably longer than the ideal formula predicts.
Why is a pendulum only approximately simple harmonic?
A pendulum's restoring force is proportional to sin(θ), not θ. For small angles sin(θ) ≈ θ, so the motion is very close to simple harmonic with period T = 2π√(L/g). As the swing angle grows, sin(θ) falls below θ, the restoring pull weakens, and the real period lengthens and departs from the ideal sine — which you can watch happen with the ideal-sine overlay in this simulator.

Teaching or blogging about physics? You can embed this on your own site free — one line of code, no sign-up.

Classroom activity

A ready-to-assign lab using the simulation above. Free to use — nothing to install or sign up for, and no student data leaves the browser.

High school, College10–20 minInteractive simulation

Learning objectives

  • Identify the restoring force behind simple harmonic motion.
  • Relate period to mass and spring constant.
  • Describe the exchange between kinetic and potential energy.

Variables to change

  • Mass
  • Spring constant
  • Amplitude

Procedure

  1. Set a mass on a spring and measure the period.
  2. Increase the mass and measure the period again.
  3. Increase the spring constant (stiffer spring) and measure the period.
  4. Watch where the speed is greatest and where it is zero.

Observations

Record period versus mass and spring constant, and note where kinetic and potential energy peak.

Questions

  1. What provides the restoring force in a mass–spring system?
  2. How does increasing mass affect the period?
  3. How does a stiffer spring (larger k) affect the period?
  4. Where is the mass moving fastest? Where is it momentarily at rest?
  5. Does amplitude affect the period in ideal SHM?

Explanation

Simple harmonic motion arises from a restoring force proportional to displacement (F = -kx). The period T = 2π√(m/k) grows with mass and shrinks with stiffness, and energy shifts continually between kinetic (at center) and potential (at the extremes).

Answer key (for instructors)
  • 1. The spring force, F = -kx, always directed back toward equilibrium.
  • 2. The period increases; T = 2π√(m/k).
  • 3. The period decreases — stiffer springs oscillate faster.
  • 4. Fastest at equilibrium (maximum kinetic energy); at rest at the extremes (maximum potential energy).
  • 5. No — the period is independent of amplitude for ideal simple harmonic motion.

Educators: link or embed this simulation freely in your LMS or course guide.

Add This Simple Harmonic Motion to Your Website

Put the Simple Harmonic Motion on your own page — free, no sign-up, no watermark. It runs entirely in your visitors' browsers. Copy the snippet and paste it into your page's HTML.

The credit line under the widget links back to LK Forge — please keep it so others can find it too.