Skip to main content

Simple Harmonic Motion Calculator: Spring & Pendulum Period

Analyze ideal Simple Harmonic Motion for mass-spring systems and simple pendulums. Calculate angular frequency, period, and frequency. Optionally evaluate displacement, velocity, and acceleration at any time. Compare up to 3 scenarios.

Last Updated: February 13, 2026

The period of a simple pendulum doesn't depend on amplitude or on the mass of the bob. Both facts surprise people the first time they see them. T = 2π√(L/g). L is the only geometric parameter. Mass cancels because gravity supplies the restoring force in proportion to mass, so F/m drops out. Amplitude doesn't appear because at small angles, sin θ ≈ θ, the linearization that turns the nonlinear pendulum equation into simple harmonic motion. The same linearization is why the motion traces a cosine. Any system with F = −kx or F ≈ −(mg/L)x gives x(t) = A cos(ωt + φ). Outside that regime the period grows by about 1% per 10° of amplitude.

Linear vs. Angular Quantities: The Conversion Layer

SHM is one-dimensional, but its math comes from the geometry of a rotating reference circle. Picture a point moving uniformly on a circle of radius A at angular velocity ω. Project that point onto the x-axis, and you get x(t) = A cos(ωt + φ). The linear position of the oscillator and the angular position of the rotating reference are tied by a single conversion: x = A cos θ, where θ = ωt + φ is the angular phase.

Once you internalize the cosine picture, the rest falls into place. Velocity is the time derivative of position. v(t) = −Aω sin(ωt + φ), peaking at equilibrium where displacement crosses zero. Acceleration is the derivative of velocity. a(t) = −Aω² cos(ωt + φ) = −ω²x(t), always pointing toward equilibrium and proportional to how far away you are. These phase relationships (position and acceleration 180° out of phase, velocity 90° ahead of position) show up on every oscilloscope trace of a mass-spring system.

The maximum linear speed is v_max = Aω. The maximum linear acceleration is a_max = Aω². Both grow with amplitude in the linear sense, even though period and frequency don't. That's the whole conversion: linear quantities (x, v, a) scale with amplitude through the angular pacing variable ω.


       x(t), v(t), a(t)
          │
      +A ─┼─────────x(t) = A cos(ωt)─────────────────────────────
          │        ╱                  ╲                      ╱
          │       ╱                    ╲                    ╱
       0 ─┼──────●──────────────────────●──────────────────●───► t
          │     ╱│╲                    ╱│╲                ╱
          │    ╱ │ ╲                  ╱ │ ╲              ╱
     −A ─┼───╱──│──╲────────────────╱──│──╲────────────╱───────
          │     │                      │
          │     v(t) max here          v(t) max (neg) here
          │     (x = 0, moving +)      (x = 0, moving −)
          │
          └─────┬────────┬────────┬────────┬────────► time
               T/4      T/2     3T/4       T

  Key Points:
  ─────────────────────────────────────────────────────────────
  • Position x(t) = A cos(ωt + φ): max at t = 0, zero at T/4
  • Velocity v(t) = −Aω sin(ωt + φ): zero at t = 0, max (neg) at T/4
  • Acceleration a(t) = −ω²x(t): max (neg) at t = 0, zero at T/4
  • v leads a by 90° (quarter period); x and a are 180° out of phase
  • At x = 0: velocity maximal, acceleration zero (equilibrium)
  • At x = ±A: velocity zero, acceleration maximal (turning points)
              

Diagram caption: The three curves (position, velocity, acceleration) hold fixed phase offsets throughout the motion. Position and acceleration are anti-phase. When the mass is at +A, acceleration is −Aω², pointing back toward equilibrium. Velocity is 90° ahead. It peaks when the mass crosses equilibrium. The T/4 spacing between extrema is why "quarter-period" appears so often in SHM problems.

Period, Frequency, and Angular Frequency: Three Names for Related Things

Period T is the time for one full oscillation, in seconds. Frequency f is the number of oscillations per second, in hertz. Angular frequency ω is the rate at which the cosine's argument advances, in radians per second. They're three names for the same pacing variable. T = 1/f, and ω = 2πf = 2π/T. The 2π factor is there because one full cycle corresponds to 2π radians of phase.

Mass-Spring: T = 2π√(m/k)

For a mass m on a spring with constant k, angular frequency is ω = √(k/m). Stiffer springs (larger k) give shorter periods. Heavier masses give longer periods. Double the mass and the period grows by √2 ≈ 1.41. Quadruple the spring constant and the period halves.

Example: m = 0.5 kg, k = 200 N/m

ω = √(200/0.5) = √400 = 20 rad/s

T = 2π/20 = 0.314 s

f = 1/T = 3.18 Hz

Simple Pendulum: T = 2π√(L/g)

For a point mass on a massless string of length L, period depends only on length and gravity, not mass or amplitude (in the small-angle limit). A 1 m pendulum on Earth has T ≈ 2.0 s. On the Moon (g = 1.62 m/s²) the same pendulum has T ≈ 4.9 s.

Example: L = 0.25 m, g = 9.81 m/s²

ω = √(9.81/0.25) = √39.24 = 6.26 rad/s

T = 2π/6.26 = 1.00 s

A 25 cm pendulum on Earth has a 1-second period. The classic "seconds pendulum" (T = 2 s) is 99.4 cm long.

Pick whichever variable matches the data you're given. A datasheet for a vibrating reed lists 440 Hz. A clock's pendulum has T = 2 s. An accelerometer's spec sheet gives ω = 1257 rad/s. All three describe the same pacing. Once you have any one, the others follow algebraically.

Restoring Force vs. Centripetal Force: Different Mechanisms, Similar Math

A restoring force pulls the system back toward equilibrium and produces oscillation. F = −kx for an ideal spring, F ≈ −(mg/L)x for a small-angle pendulum. A centripetal force pulls a moving object toward a circular axis and produces curving motion. F_c = mv²/r aimed at the center. Both are central in the "directed at one fixed point" sense, and the math has a strong family resemblance.

The deepest connection is geometric. A point moving uniformly in a circle, projected onto a single axis, traces SHM exactly. The centripetal acceleration of that circling point is a_c = ω²r. The 1D shadow has acceleration a = −ω²x, which is the SHM equation with k_eff = mω². So the "restoring force" you measure on a mass-spring is, in this projection sense, just the inward component of the centripetal force on the imaginary co-rotating reference point.

The restoring-force constant k and the angular frequency ω are interchangeable through ω = √(k/m). For the pendulum, ω = √(g/L). Both produce the same cosine solution because both linear restoring force in displacement gives x(t) = A cos(ωt + φ). Different physical mechanisms (a coiled steel spring, gravitational tilt of a string), same equation.

Common mistake: Students often assume larger amplitude means longer period ("it has farther to go"). That intuition fails for SHM because v_max scales with A. The period formula contains m and k, not amplitude. Check your answer. If your period depends on A, you're outside the linear regime or you've made an algebra error.

Small-Angle and Other Approximations: Where They Break

T = 2π√(L/g) is exact only in the limit θ → 0. The pendulum equation of motion is θ'' + (g/L) sin θ = 0, which is nonlinear. Replacing sin θ with θ (the small-angle approximation) turns it into θ'' + (g/L)θ = 0, the SHM equation. That replacement is good to about 1% for amplitudes under 14°, but it deteriorates fast for larger swings.

The exact period from the elliptic integral is T = 4√(L/g) × K(sin²(θ₀/2)), where K is the complete elliptic integral of the first kind. Here's how the error grows.

Amplitude θ₀Period excess vs T₀Approximation status
+0.05%Excellent. Use SHM.
15°+0.4%Acceptable for most lab work.
30°+1.7%Borderline. Add the correction.
60°+7.3%SHM fails. Use the elliptic form.
90°+18%Don't use SHM at all.

Springs have their own approximation. Hooke's law F = −kx assumes the spring stays in its linear regime. Stretch a real spring to half its solid-coil length and k starts to climb (hardening). Compress past half and k can drop (softening) or the coils bind. Rubber bands don't even pretend to be linear. If your measured period depends on amplitude, you're outside the linear regime.

Real-World Tolerances (Orbits Aren't Circles, Pendulums Aren't Frictionless)

Damping (air resistance, friction)

Real oscillators lose energy. A pendulum in air sees drag roughly proportional to velocity. Amplitude decays exponentially: A(t) = A₀ e^(−γt). The frequency drops a touch, ω_d = √(ω₀² − γ²). For lightly damped systems (γ ≪ ω₀), ideal SHM is a fine approximation for a few cycles, but the decay is visible over tens of periods. The calculator assumes no damping.

Distributed mass (spring mass, physical pendulums)

If the spring itself has significant mass m_s, the effective oscillating mass is m_eff ≈ m + m_s/3. For physical pendulums (rigid bodies, not point masses), use T = 2π√(I/(mgd)), where I is moment of inertia about the pivot and d is the distance from pivot to center of mass. A meter stick swung from one end has T = 2π√(2L/(3g)), longer than a point-mass pendulum of the same length.

Temperature and material drift

Brass expands ~19 ppm/°C. A 1 m brass pendulum rod grows 0.019 mm per degree, so 20°C of seasonal swing shifts the period enough to lose roughly 2 seconds per day. Quality pendulum clocks use Invar (low expansion) or compensating mechanisms. Spring constants drift with temperature too, mostly through the elastic modulus of the wire.

Educational Tool, Not for Engineering Design

  • This calculator models ideal, undamped SHM. Real oscillators experience energy loss, nonlinearity, and environmental effects not captured here.
  • Pendulum formulas assume small angles (θ < 15°). For larger amplitudes, period grows and deviates from T = 2π√(L/g).
  • Spring calculations assume Hooke's law holds. Real springs have nonlinear regions, fatigue, and temperature dependence.
  • For vibration analysis in structures, machinery, or safety-critical systems, consult mechanical engineers using professional simulation tools.

Worked Example: Mass-Spring System with m = 0.500 kg, k = 80 N/m, A = 5.0 cm

Scenario: A glider on a frictionless air track has m = 0.500 kg, attached to a spring with k = 80 N/m. The glider is pulled to 5.0 cm and released. Find the period, frequency, max velocity, and max acceleration.

Step 1: Compute angular frequency.

ω = √(k/m) = √(80/0.500) = √160 = 12.65 rad/s

Step 2: Period and frequency.

T = 2π/ω = 2π/12.65 = 0.4967 s

f = 1/T = 2.013 Hz

Step 3: Maximum velocity at equilibrium.

v_max = Aω = 0.050 × 12.65 = 0.633 m/s

Step 4: Maximum acceleration at the turning points.

a_max = Aω² = 0.050 × 160 = 8.00 m/s²

Step 5: Energy check.

E = ½kA² = 0.5 × 80 × (0.050)² = 0.100 J

KE_max = ½ m v_max² = 0.5 × 0.500 × (0.633)² = 0.100 J ✓

Result: T = 0.497 s, f = 2.01 Hz, v_max = 0.633 m/s, a_max = 8.00 m/s². The total mechanical energy of 0.100 J cycles between kinetic and potential through every quarter-period.

Now compare to a 1.00 m pendulum at small vs. large angle. Small angle (θ₀ = 5°): T = 2π√(1.00/9.81) = 2.006 s. Use the elliptic correction at θ₀ = 30°: T = 2.006 × (1 + sin²(15°)/4 + ...) ≈ 2.040 s, a 1.7% increase. At θ₀ = 60° the correction grows to 7.3%, giving T ≈ 2.153 s.

Clockmaker's insight: A grandfather clock's pendulum runs at a 5° to 8° amplitude on purpose. Small enough that the small-angle approximation holds to better than 0.2%, large enough that the escapement gets enough swing energy to overcome friction in the gear train.

References

  • Halliday, Resnick & Walker, Fundamentals of Physics (11th ed., 2018), Chapter 15: Oscillations. Derivation of T = 2π√(m/k) and T = 2π√(L/g) from Newton's second law.
  • Serway & Jewett, Physics for Scientists and Engineers (10th ed., 2018), Chapter 15. Energy analysis showing E = ½kA² and KE/PE exchange.
  • Marion & Thornton, Classical Dynamics of Particles and Systems (5th ed., 2003), Chapter 3. Damped and driven oscillators, plus the elliptic-integral treatment of the large-angle pendulum.
  • Goldstein, Poole & Safko, Classical Mechanics (3rd ed., 2002), Chapter 6. Lagrangian view of small oscillations and normal modes.
  • NIST Reference on Constants. Standard gravity g = 9.80665 m/s² (exact by definition). Local g varies ±0.5% with latitude and altitude.
  • HyperPhysics (Georgia State University). hyperphysics.phy-astr.gsu.edu/hbase/shm. Interactive diagrams for mass-spring and pendulum SHM.

Fixing Common SHM Calculation Mistakes

Real questions from students stuck on spring mass corrections, amplitude independence, negative velocity signs, and period measurement technique.

What is the formula for the period of a simple pendulum?

The period of a simple pendulum is T = 2π√(L/g), where L is the length from pivot to the center of mass of the bob and g is gravitational acceleration. The result is in seconds, independent of mass and (for small angles) of amplitude. A 1.0 m pendulum on Earth (g = 9.81 m/s²) has T = 2π√(1.0/9.81) = 2.01 s. Change the bob from 50 g to 5 kg and the period stays the same. Halve the length to 0.5 m and T drops to 1.42 s, by a factor of √2. The formula assumes the bob is a point mass, the rod is massless, and the swing angle stays under about 15°. Past that, the small-angle approximation sin(θ) ≈ θ breaks down. A 30° swing has a period about 1.7% longer than the formula predicts. Real pendulums also lose energy to air drag and pivot friction, so amplitude decays even though period stays nearly constant. That decoupling of period from amplitude is what made pendulum clocks accurate timekeepers from 1656 (Huygens) until quartz oscillators replaced them.

My professor keeps saying 'period doesn't depend on amplitude'—but when I swing a pendulum really wide, it clearly takes longer. Who's wrong?

You're both right in different regimes. The formula T = 2π√(L/g) is a small-angle approximation valid for θ < 15°. At 30° amplitude, the true period is about 2% longer; at 90° it's 18% longer. The restoring force F = −mg sin(θ) isn't linear in θ for large angles, breaking the SHM assumption. For homework problems, use the small-angle formula. For precision timing (like grandfather clocks), keep swings small.

I calculated T = 1.26 s for my mass-spring system but measured 1.42 s in the lab—where's the 12% error coming from?

Most likely the spring's own mass. The formula T = 2π√(m/k) assumes a massless spring, but real springs have mass that participates in the oscillation. Add roughly one-third of the spring mass to your oscillating mass: m_eff ≈ m + m_spring/3. If your spring weighs 150 g and your mass is 500 g, use m_eff = 500 + 50 = 550 g. That extra 10% mass increases the period by about 5%. Combined with friction and measurement error, you get 12% discrepancy.

I got a negative velocity at t = 0.25 s but the mass is above equilibrium—is that wrong or does negative mean something specific?

Negative velocity means the mass is moving in the negative x-direction, toward equilibrium from above. If x(t) = A cos(ωt) and you're at t = T/4, then v(t) = −Aω sin(ωt) = −Aω sin(π/2) = −Aω. The minus sign tells you direction: the mass just passed through the positive peak and is heading down. Velocity is zero at the extremes (±A) and maximum in magnitude when crossing equilibrium. Your negative result is correct.

The problem says 'a spring with k = 200 N/m compressed 5 cm'—do I use negative 5 cm in the formula?

For period and frequency calculations, sign doesn't matter—amplitude A = 0.05 m regardless of whether the spring starts compressed or stretched. For position at time t, sign encodes where you start: x(0) = +A means released from stretched position, x(0) = −A means released from compressed. If the problem says 'compressed and released,' use x(t) = −A cos(ωt) or equivalently x(t) = A cos(ωt + π). The period formula T = 2π√(m/k) uses only magnitudes.

Why does my calculator show f = 1.59 Hz when I entered ω = 10? I thought angular frequency was the same as frequency.

They're related but different. Angular frequency ω = 10 rad/s means the phase advances 10 radians per second. One full cycle is 2π radians, so frequency f = ω/(2π) = 10/6.28 = 1.59 Hz. Conversely, ω = 2πf. The confusion comes from textbooks using 'frequency' loosely. When you see 'frequency' in physics problems, check units: Hz means f, rad/s means ω. The period T = 2π/ω = 1/f works either way.

I'm trying to find when the mass passes through equilibrium—how do I solve cos(ωt) = 0 for the first three times?

Cosine equals zero at π/2, 3π/2, 5π/2, ... (odd multiples of π/2). So ωt = π/2 gives t₁ = π/(2ω). For ω = 5 rad/s, t₁ = π/10 = 0.314 s, t₂ = 3π/10 = 0.942 s, t₃ = 5π/10 = 1.571 s. Each crossing happens at half-period intervals after the first: T/4, 3T/4, 5T/4, ... If starting from equilibrium (sine function), zeros occur at 0, π/ω, 2π/ω, ... which is 0, T/2, T, ...

The answer key says v_max = 2.5 m/s but I got 2.5 using v_max = Aω and also v_max = √(kA²/m). Are both formulas correct?

Yes, they're identical. Starting from v_max = Aω and using ω = √(k/m): v_max = A√(k/m). Square both sides: v²_max = A²(k/m). Multiply by m: mv²_max = kA². This is energy conservation: ½mv²_max = ½kA², so all kinetic energy at equilibrium equals all potential energy at the extremes. Use whichever form has the variables you know—they're mathematically equivalent.

My pendulum's measured period changes depending on where I start the timer—at the bottom vs at the edge. Which is correct?

Start timing when the pendulum passes through equilibrium (bottom), not at the turning points. At equilibrium, the bob moves fastest and crosses the reference point quickly, giving precise timing. At the edges, it moves slowly and reverses direction, making it hard to pinpoint the exact turnaround. Time 10 or 20 complete swings and divide—this averages out reaction time error. Professional measurements use photogate sensors triggered at equilibrium.

I need to design a spring so a 2 kg mass oscillates at exactly 1 Hz—how do I work backwards to find k?

Rearrange the period formula. f = 1 Hz means T = 1 s. T = 2π√(m/k), so √(m/k) = T/(2π) = 1/6.28 = 0.159. Square it: m/k = 0.0253. Rearrange: k = m/0.0253 = 2/0.0253 = 79.0 N/m. Verify: T = 2π√(2/79) = 2π × 0.159 = 1.00 s ✓. Alternatively, use k = m(2πf)² = 2 × (2π × 1)² = 2 × 39.5 = 79.0 N/m directly.

My physics textbook uses A sin(ωt) but my engineering textbook uses A cos(ωt)—which is the 'official' SHM equation?

Both are correct—they differ only by a phase shift of π/2. x = A cos(ωt) = A sin(ωt + π/2). Physics textbooks often use cosine because it naturally describes 'released from maximum displacement' (x₀ = A, v₀ = 0). Engineering texts sometimes prefer sine for signal processing conventions. The key is consistency: pick one and stick with it. If your initial condition is x₀ = 0, v₀ = +Aω, use sine. If x₀ = A, v₀ = 0, use cosine.