Simple Harmonic Motion Calculator (Spring-Mass & Pendulum)

Calculate the period, frequency, and angular frequency of a spring-mass system or a simple pendulum, and visualize how displacement, velocity, and acceleration change over time. Learn the physics of oscillation from spring constant and mass, or pendulum length and gravity.

What Is Simple Harmonic Motion (Spring-Mass & Pendulum)?

Simple harmonic motion is a periodic back-and-forth motion produced by a "restoring force" that is proportional to displacement and points in the opposite direction. This tool covers the two classic examples of simple harmonic motion: a spring-mass system (governed by spring constant k and mass m) and a simple pendulum (governed by length L and gravitational acceleration g), calculating the period T, frequency f, and angular frequency ω for each.

Simply enter your values and the tool applies the standard theoretical formulas (T=2π√(m/k) for a spring-mass system, T=2π√(L/g) for a pendulum) to produce results instantly, along with a graph showing how displacement, velocity, and acceleration evolve over time. It's useful for physics coursework, lab report verification, and checking formula-based calculations by hand.

How to Use the Simple Harmonic Motion Calculator

  1. Choose a mode At the top of the page, switch between "Spring-Mass System" and "Simple Pendulum" depending on which system you want to calculate.
  2. Enter the required values For a spring-mass system, enter the spring constant k and mass m. For a pendulum, enter the length L and gravitational acceleration g.
  3. Set the amplitude or swing angle Specify the amplitude for a spring, or the initial swing angle (up to 15°) for a pendulum. This controls how the graph oscillates.
  4. Read the results and graph The period, frequency, and angular frequency are calculated automatically, and a chart shows displacement x(t), velocity v(t), and acceleration a(t) over time.
  5. Compare different values Change the mass, length, or gravity and recalculate to see how the period responds to each variable.

Tips for getting more out of it

  • A spring-mass system's period depends only on the spring constant and mass, not the amplitude. Try changing the amplitude and notice how the period stays the same on the graph.
  • The pendulum formula T=2π√(L/g) is only accurate for small swing angles (roughly under 15°). Larger angles make the real period longer than this calculated value.
  • Mass has no effect at all on a simple pendulum's period. A heavier or lighter bob on the same length string will swing with the same period.
  • Switch gravity to "Moon" to see how the same pendulum length produces a longer period than on Earth — weaker gravity means a weaker restoring force, so the swing is slower.
  • Notice on the graph that velocity is zero exactly when displacement is at its peak or trough — this visually shows the 90-degree phase difference between displacement and velocity.

Ways to Use This Simple Harmonic Motion Calculator

Physics homework and exam prep

Check your answers to spring-mass and pendulum period problems, and confirm you understand how each formula behaves.

Verifying lab experiment results

Compare a measured period from a real pendulum or spring experiment against the theoretical value to estimate experimental error.

Teaching aid for classroom demonstrations

Teachers can show students in real time how changing amplitude, mass, or gravity affects the period and the motion graph.

Rough engineering estimates

Get a quick estimate of the oscillation period when designing a simple spring mechanism or a pendulum-based device.

Simple Harmonic Motion Glossary

Simple harmonic motion (SHM)
A periodic back-and-forth motion produced by a restoring force proportional to displacement, in which the displacement traces a sine wave over time.
Restoring force
The force that pulls an object back toward its equilibrium position. For a spring this is Hooke's law (F=-kx); for a pendulum it's the tangential component of gravity.
Angular frequency (ω)
The rate of change of phase per unit time, measured in rad/s. It relates to the period T through ω=2π/T.
Period (T)
The time for one complete back-and-forth cycle, in seconds. T=2π√(m/k) for a spring-mass system, or T=2π√(L/g) for a pendulum.
Spring constant (k)
A measure of a spring's stiffness, in N/m. A larger k means more force is needed to produce the same displacement, giving a shorter period.
Simple pendulum
An idealized pendulum model consisting of a mass suspended from a massless string, swinging through a small angle.
Small-angle approximation
The approximation sinθ≈θ, valid when the swing angle θ is small. The simple pendulum period formula relies on this approximation.

Frequently Asked Questions

Solving the equation of motion m(d²x/dt²)=-kx gives an angular frequency ω=√(k/m) that contains no amplitude term. A larger amplitude means a larger displacement, but Hooke's law also makes the restoring force proportionally larger, so the acceleration scales the same way — the time for one full cycle stays constant. This property is called the "isochronism" of simple harmonic motion, and it's the same principle Galileo noticed underlying pendulum clocks.

The exact equation of motion for a pendulum contains a sinθ term, which is hard to solve directly. When θ is small, sinθ≈θ (the small-angle approximation) holds, simplifying the equation into the same form as simple harmonic motion and yielding the clean formula T=2π√(L/g). Once the swing angle exceeds roughly 15°, the gap between sinθ and θ becomes significant, and the real period grows longer than this formula predicts.

Both systems are driven by a restoring force proportional to displacement and directed opposite to it. For a spring, that's Hooke's law (F=-kx); for a pendulum under the small-angle approximation, it's the tangential component of gravity (F≈-mg/L·x). Because both share this same structure, both can be described by the same formula, angular frequency ω=√(restoring force constant / inertial term).

No. Mass appears on both sides of the pendulum's equation of motion and cancels out during derivation, so it never appears in the final formula T=2π√(L/g). This is the same property Galileo is said to have confirmed by experimenting with pendulums of different weights.

Since the period is proportional to the square root of the length, doubling the length multiplies the period by √2 (about 1.41 times). A useful shortcut: quadrupling the length exactly doubles the period.
Tool-kun

Side Note — Galileo and the Swinging Lamp

A famous story often used to introduce simple harmonic motion involves a young Galileo Galilei watching a swinging chandelier in a cathedral. Using his own pulse as a timer, he is said to have noticed that even as the swing gradually grew smaller, the time for each full swing barely changed. This observation is widely credited as an early step toward the invention of the pendulum clock and the broader mathematical description of oscillation in physics.

Spring-mass systems and pendulums look and move very differently, but mathematically both are governed by the same underlying property: a restoring force proportional to displacement (a linear, Hooke's-law-like relationship). Because of this shared structure, the theory of simple harmonic motion extends far beyond springs and pendulums — to tuning fork vibrations, LC oscillations in AC circuits, and even models of molecular bonds.

Real springs and pendulums gradually lose amplitude to friction, air resistance, and internal material damping — a phenomenon called damped oscillation. The idealized simple harmonic motion modeled by this tool assumes no energy loss. Measuring a pendulum's period to determine the local gravitational acceleration g remains a classic physics classroom experiment, offering a hands-on connection between this formula and real-world measurement.