In short
A simple harmonic oscillator (displacement x(t) = A\sin(\omega t + \varphi)) has kinetic energy
potential energy
and a total energy that stays constant throughout the motion:
The total energy depends on the amplitude squared — double the amplitude and you quadruple the energy. Energy sloshes back and forth between kinetic and potential at twice the oscillation frequency, and averaged over a full cycle the two are exactly equal: \langle K\rangle = \langle U\rangle = E/2.
A child on a Dussehra-mela swing pumps their legs once, gathers speed at the bottom of the arc, and then — for a little while, before friction eats in — keeps going. At the bottom, they are moving fast; at the top of each swing they are momentarily still. The motion sheds no energy in those first few seconds (to a good approximation); it simply relocates it. At the bottom, the energy lives in the child's speed. At the top, it lives in the height they have climbed. Nothing is created, nothing is destroyed — something is merely being carried back and forth between two bank accounts.
A block on a spring on a smooth table does the same thing in a one-dimensional, mathematically cleaner way. Pull the block back by an amount A and release it. At that instant, the block is at rest — all its energy is stored in the stretched spring. It springs back, picks up speed, and at x = 0 (the equilibrium position), the spring is relaxed but the block is flying — all the energy is now kinetic. It overshoots, compresses the spring, slows down, stops at x = -A, and the energy is back in the spring. Then the whole thing reverses.
Watch the motion once and a question writes itself: is the total energy the same at every instant, or just at those two moments? The answer is yes, at every instant — and proving it requires nothing more than the solution x(t) = A\sin(\omega t + \varphi) you already have from Equation of SHM and Phase. The proof is short. The consequences — from why a pendulum clock runs at the same rate as its amplitude decays, to how the energy-method shortcut skips straight past a differential equation to a formula for the angular frequency — are large.
Writing down K and U
Take the cleanest SHM: a mass m attached to a horizontal spring of stiffness k on a frictionless table, with no other forces doing work on it. The displacement from equilibrium is x(t), the velocity is v(t) = dx/dt, and the restoring force is F = -kx (Hooke's law).
Kinetic energy — straight from the definition
By definition, the kinetic energy of a point mass moving at speed v is
There is nothing more to derive for that.
Potential energy — the work you do to stretch the spring
The spring, when stretched by an amount x, pulls back with a force kx. If you want to stretch it further by an infinitesimal amount dx, you have to do work against that pull:
Why: the spring pulls back with force kx (in the direction opposite to the stretch). To keep stretching it quasi-statically (no acceleration), you push with force +kx in the stretch direction. Your force and your displacement point the same way, so the work is positive and equal to kx \, dx.
Add up (integrate) that work as you go from the natural length (x = 0) to the final extension x:
Why: the integrand kx' is linear in x', so the integral is \tfrac{1}{2} k x^2 — the familiar triangle-under-the-line formula. This work is stored in the spring as elastic potential energy, available to be returned later.
By the work-energy theorem applied to the conservative restoring force, the potential energy of the spring — which is the work you put in — is
with U(0) = 0 chosen as the zero of potential energy (at equilibrium).
Since k = m\omega^2 for a spring-mass SHM (this is equation (1) from Equation of SHM and Phase — \omega^2 = k/m), you can equivalently write
The reason (1') is worth remembering: it holds for every SHM, not just a spring. A pendulum for small angles, a floating plank, an LC circuit — each has its own physical "spring constant" that you can fold into m\omega^2, and the potential-energy curve is always \tfrac{1}{2} m\omega^2 x^2, a parabola in x. That parabolic potential is the signature of SHM.
The total energy is constant — and equals \tfrac{1}{2} k A^2
Take the SHM solution
Step 1. Plug into the kinetic energy.
Why: v^2 is (A\omega\cos(\cdot))^2 = A^2\omega^2\cos^2(\cdot). Nothing clever — just squaring the velocity.
Step 2. Plug into the potential energy (using k = m\omega^2).
Step 3. Add them.
Step 4. Use \sin^2\theta + \cos^2\theta = 1.
Why: the Pythagorean identity \sin^2 + \cos^2 = 1 is doing all the work. The t-dependence in the two terms cancels exactly, leaving a number that depends only on the amplitude A and the oscillator constants. That cancellation is why energy is conserved for SHM — it is the algebraic content of energy conservation for this particular motion.
This is the first of this article's two big facts: the total energy of an SHM is a constant of the motion, and it equals \tfrac{1}{2} k A^2. Double the amplitude and the energy goes up by a factor of four. Tripling the amplitude triples it by nine. This quadratic dependence on amplitude is why a harder pluck of a sitar string sounds so much louder than a gentler one — the amplitude doesn't even need to double to quadruple the acoustic energy.
Kinetic energy as a function of displacement — the A^2 - x^2 form
The time-dependent form K(t) = \tfrac{1}{2} m \omega^2 A^2 \cos^2(\omega t + \varphi) is sometimes awkward. What you usually want, when solving problems, is K as a function of x — "how fast is it moving when it is here?" You can get there in one line.
Start with the total-energy equation:
Solve for K:
Why: total energy is always \tfrac{1}{2} m\omega^2 A^2 (from (2)). Subtract the potential energy \tfrac{1}{2} m\omega^2 x^2 at that displacement and what is left is kinetic. The factor A^2 - x^2 is automatically non-negative inside the motion (because the mass never goes beyond \pm A), so K \ge 0 as it must be.
Equation (3) has immediate consequences:
- At the turning points (x = \pm A): K = 0, the mass is momentarily at rest.
- At equilibrium (x = 0): K = \tfrac{1}{2} m\omega^2 A^2 = E, and all the energy is kinetic — the mass is at its maximum speed.
- The maximum speed is v_\text{max} = \omega A (take K = \tfrac{1}{2} m v_\text{max}^2 = \tfrac{1}{2} m\omega^2 A^2 and cancel).
Equation (3) also gives the speed at any displacement directly:
You will use equation (4) dozens of times on JEE problems — it is the fastest way to answer "what is the speed of the oscillator at x = A/2?" without ever touching the time variable.
Watching the energies trade — the animation
The formulas above describe three things simultaneously: a parabolic potential U(x), a horizontal constant E, and a kinetic energy K(x) that fills in the gap. As the oscillator moves, those three curves stay put but the "point" representing the current state slides along. Here it is in motion, for a spring-mass SHM with A = 2 m, \omega = 1 rad/s (so m\omega^2 = m numerically; pick m = 1 kg so the total energy is E = 2 J).
Two things to notice. First, the bars trade size perfectly — when one grows, the other shrinks by the exact same amount, so their sum is fixed. Second, the bars oscillate at twice the rhythm of the mass itself. In one full swing of the mass (from +A to -A and back), each energy completes two full cycles — zero to peak to zero to peak to zero. That is because K and U go as \cos^2 and \sin^2 of the motion's phase, and the double-angle identities \cos^2\theta = (1 + \cos 2\theta)/2 and \sin^2\theta = (1 - \cos 2\theta)/2 make the double-frequency explicit.
Averages over a cycle — equipartition, oscillator style
Ask: on average, where does the energy live? A little algebra gives a remarkable answer.
Step 1. Compute the time average of \cos^2 over one period.
Over one full period T = 2\pi/\omega:
Use the identity \cos^2\theta = \tfrac{1}{2}(1 + \cos 2\theta):
Why: \cos(2\omega t + 2\varphi) over a full period of the motion completes two full periods of itself and integrates to zero. Only the constant \tfrac{1}{2} survives.
The same argument gives \langle \sin^2 \rangle = \tfrac{1}{2}.
Step 2. Apply to K and U.
So
Averaged over a full cycle, the kinetic and potential energies are exactly equal, each carrying half the total. This is the first example of a deep result — classical equipartition — that turns up everywhere: in thermodynamics (each quadratic mode of a gas molecule gets \tfrac{1}{2} k_\text{B} T of thermal energy), in statistical mechanics, in black-body radiation before Planck fixed it. For a pure SHM, though, the result is purely algebraic: \sin^2 and \cos^2 each average to half.
Exploring the energy picture — the interactive
The formulas U(x) = \tfrac{1}{2} kx^2, E = \tfrac{1}{2} k A^2, and K(x) = E - U come alive when you can drag through them. The figure below lets you change the instantaneous position x of a harmonic oscillator (with fixed A = 2, k = 1 so E = 2) and watch the three energies update.
The energy method — deriving \omega without solving a differential equation
Here is the best part of the energy picture, the reason it is worth learning even if you already know how to solve the equation of SHM. The condition dE/dt = 0 by itself gives you the equation of motion — and for some oscillators, gives you the angular frequency faster than any other route.
Step 1. Write the total energy of a general SHM-candidate system as E = K + U, with K = \tfrac{1}{2} m v^2 and some U(x).
Step 2. Require dE/dt = 0 (energy conservation, which follows from the absence of dissipation and any time-dependent external forces).
Why: the chain rule: \frac{d}{dt} U(x(t)) = \frac{dU}{dx} \cdot \frac{dx}{dt} = \frac{dU}{dx} \cdot v.
Step 3. Divide through by v (valid when v \ne 0; at the instants v = 0 the equation holds trivially by continuity).
Why: this is Newton's second law in one dimension with a conservative force F = -dU/dx — recovered from energy conservation alone. The two viewpoints (force and energy) contain the same physics.
Step 4. For a SHM potential U(x) = \tfrac{1}{2} k x^2, dU/dx = k x, so
Step 5 — the shortcut. You do not even need to go through Newton's second law. For any system where you can write E = \tfrac{1}{2} (\text{inertial coefficient}) \cdot \dot q^2 + \tfrac{1}{2} (\text{stiffness coefficient}) \cdot q^2 for a small displacement q from equilibrium, the angular frequency is
This is the energy method for finding the frequency of any small oscillation: expand the energy to second order around the equilibrium, read off the two coefficients, divide, square-root. It is how you derive the pendulum's T = 2\pi\sqrt{L/g} in three lines (the inertial coefficient is mL^2, the stiffness coefficient is mgL; see Simple Pendulum), how you find the frequency of a floating plank rocking in a lake without ever writing Newton's law for it, how you get the LC circuit's frequency from electrical energy conservation. The energy method is the most efficient route in physics from "this is an oscillator" to "here is its frequency."
Worked examples
Example 1: A 0.5 kg block on a spring with $k = 200$ N/m
A block of mass m = 0.5 kg is attached to a horizontal spring of stiffness k = 200 N/m on a frictionless table. You pull it 0.10 m to the right and release it. Find: (a) the total energy of the oscillation, (b) the maximum speed of the block, and (c) the speed of the block when it is 0.05 m from equilibrium.
Step 1. Compute the total energy.
At the moment of release, the block is at rest (K = 0) at the maximum displacement (x = A). So all the energy is potential:
Why: at x = A, U = \tfrac{1}{2} k A^2 and K = 0, so E = U at that instant. And since E is conserved, this value of E holds for all time.
Step 2. Compute the maximum speed.
At x = 0, U = 0 so K = E entirely. Solve \tfrac{1}{2} m v_\text{max}^2 = 1.0 J:
Why: at x = 0 the spring is relaxed, so it stores no energy; all the energy is in the motion of the block. Inverting K = \tfrac{1}{2} m v^2 gives v = \sqrt{2K/m}. Or, directly from equation (4) with x = 0: v_\text{max} = \omega A = \sqrt{k/m} \cdot A = \sqrt{200/0.5} \times 0.1 = 20 \times 0.1 = 2 m/s.
Step 3. Compute the speed at x = 0.05 m.
Use equation (4):
Why: equation (4), v(x) = \omega\sqrt{A^2 - x^2}, gives the speed at any displacement without touching the time variable. At x = A/2 it gives v = \omega A \sqrt{1 - 1/4} = (\sqrt{3}/2) v_\text{max} \approx 0.866 \, v_\text{max}.
Step 4 — energy check. Verify conservation by computing K + U at x = 0.05 m.
Result: E = 1.0 J, v_\text{max} = 2.0 m/s, v(0.05 \text{ m}) \approx 1.73 m/s.
What this shows: All three quantities follow from a single input — the amplitude. The total energy, the maximum speed, the speed at any other displacement are all fixed by A (and the constants k and m). You never had to solve a differential equation or write down \sin or \cos.
Example 2: The fraction of energy that is kinetic at $x = A/\sqrt{2}$
For an SHM of amplitude A, at what displacement is the kinetic energy exactly equal to the potential energy? And at x = A/\sqrt{2}, what fraction of the total energy is kinetic?
Step 1. Write both energies in terms of E and x.
From equations (1') and (3):
Why: divide the energy expressions by E = \tfrac{1}{2} m\omega^2 A^2 to get dimensionless ratios. The whole problem collapses to a single variable x/A.
Step 2. Set K = U and solve.
Divide both sides by E:
Why: collecting the x^2/A^2 terms gives 2(x/A)^2 = 1, so x/A = \pm 1/\sqrt{2}.
Step 3. At x = A/\sqrt{2}, compute the fraction K/E.
Result: K = U at x = \pm A/\sqrt{2} \approx 0.707 A. At that displacement, the kinetic energy is exactly half of the total.
What this shows: The kinetic and potential energies are not equal at the midpoint x = A/2 — there, K/E = 1 - 1/4 = 3/4 and U/E = 1/4. The crossover happens at A/\sqrt{2}, which is farther out than you might expect. This is a favourite JEE question: "at what displacement is the kinetic energy one-third of the potential energy?" Same method — set K/U = 1/3, use K = E - U to get U = 3E/4 and then x^2/A^2 = 3/4, so x = A\sqrt{3}/2.
Common confusions
-
"The total energy is \tfrac{1}{2} m v^2 at any instant." That is only the kinetic energy. The total energy is K + U; confusing the two is the single most common mistake on SHM problems. At the centre, K = E and U = 0, so the two happen to coincide there, but nowhere else.
-
"E depends on \omega as well as A." Strictly, the formula E = \tfrac{1}{2} m\omega^2 A^2 has \omega^2 in it, so yes, doubling \omega at fixed A quadruples E. But most problems give you the mass and the spring constant (or the pendulum length and g); \omega is determined by those. The physical content is that E scales as A^2 for a given oscillator.
-
"The energies oscillate at the same frequency as the position." No — at twice the frequency. Look at \cos^2(\omega t): when \omega t goes from 0 to \pi/2, \cos^2 goes from 1 to 0 and back to a quarter of the way; when \omega t goes from 0 to \pi (a half-period of the motion), \cos^2 has completed a full cycle of its own. Writing \cos^2\theta = \tfrac{1}{2}(1 + \cos 2\theta) makes the double frequency explicit.
-
"Equation (4), v = \omega\sqrt{A^2 - x^2}, gives a direction." It gives only the speed — the magnitude of the velocity. The sign of v depends on which way the oscillator is currently moving, and that information is carried by the phase in the full time-solution v(t) = A\omega\cos(\omega t + \varphi).
-
"The zero of potential energy is fixed by the physics." No — the zero of U is a convention. Choosing U(0) = 0 at the equilibrium position is the cleanest choice, and it is what this article uses. Other choices (e.g., setting U = 0 at one turning point) shift all the U values by a constant but leave the physics — forces, accelerations, motion — unchanged.
-
"A vertical spring-mass system has a different energy formula because gravity is involved." The equilibrium shifts by mg/k, but if you measure x from the new equilibrium position, the energy about that equilibrium is still \tfrac{1}{2} k x^2 — the gravitational and spring potential energies combine to give the same parabolic well, just with a different zero. See Spring-Mass Systems for the full argument.
If you came here to understand the energy of SHM and use the formulas, you have what you need. What follows is for readers who want the connection to general conservative potentials, the phase-space picture, and an honest treatment of why the energy method gives the correct frequency.
Phase space — x and p together
An oscillator's state at any instant is specified by its position x and its momentum p = mv. Plot those two numbers on perpendicular axes, and you have the phase space of the oscillator. As time goes on, the point (x, p) moves — it traces a curve in phase space.
For SHM, that curve is an ellipse. From K + U = E with K = p^2/(2m) and U = \tfrac{1}{2} m \omega^2 x^2:
Letting p_\text{max} = \sqrt{2mE} = mA\omega (the maximum momentum) and noting that 2E/(m\omega^2) = A^2, the trajectory satisfies
which is the equation of an ellipse with semi-axes A (along x) and p_\text{max} (along p).
Every SHM draws an ellipse in phase space, and a given ellipse corresponds to a given total energy. Higher energy → larger ellipse. The trajectory goes clockwise (right-then-down-then-left-then-up) in the (x, p) plane — because from the top (x = 0, p = p_\text{max}), the oscillator moves to the right, slowing down and storing energy in the spring, reaching (x = A, p = 0) before reversing.
The area enclosed by the ellipse has a beautiful interpretation: \text{Area} = \pi \cdot A \cdot p_\text{max} = \pi \cdot A \cdot m\omega A = \pi m\omega A^2 = 2\pi \cdot \frac{E}{\omega} = E \cdot T. The product of energy and time period equals the phase-space area times 1/(2\pi) — a quantity called the action that becomes central in advanced classical mechanics and in the old quantum theory (Bohr's quantisation condition was phrased as action = integer × Planck's constant).
Any smooth potential looks like SHM near a minimum
Why is SHM so universal? Because almost every potential U(x) — for any stable system — is approximately quadratic near its minimum.
Take a smooth potential U(x) with a minimum at x = x_0 (so U'(x_0) = 0). Taylor-expand around x_0:
At the minimum, U'(x_0) = 0, so the linear term drops out. The leading correction is quadratic:
If you shift the zero of energy to U(x_0) = 0 and let q = x - x_0 be the displacement from the minimum, this becomes
This is exactly \tfrac{1}{2} k_\text{eff} q^2 with k_\text{eff} = U''(x_0). For small displacements, any stable potential is an SHM. The effective spring constant is the second derivative of the potential at the equilibrium. The effective angular frequency is
That is why SHM shows up everywhere — in the vibration of atoms in a crystal, in a ball rolling near the bottom of a bowl, in the small-angle motion of a pendulum, in the oscillation of a satellite about a Lagrange point. The Taylor expansion is relentless. Only when you push far enough that the cubic or quartic terms matter does the motion stop being SHM and become anharmonic.
Why the energy method works (the Lagrangian perspective)
In the main article you saw that dE/dt = 0 gives you the equation of motion directly. This is a special case of a much deeper result — the Euler-Lagrange equation of classical mechanics.
Define the Lagrangian L = K - U = \tfrac{1}{2} m \dot x^2 - \tfrac{1}{2} k x^2. The equation of motion is the Euler-Lagrange equation
which for this L evaluates to
i.e., \ddot x = -(k/m) x — the same equation.
The Lagrangian route generalises: for any system whose configuration can be described by one or more coordinates and whose energies depend only on those coordinates and their time-derivatives, you can write down L, apply Euler-Lagrange, and get the equations of motion. The energy method in the main article is the "when there is one coordinate and energy is conserved" corner of this much larger framework. Lagrangian mechanics is taught in full in university-level physics and is the starting point for Hamilton's equations, classical field theory, and quantum field theory.
Average over a cycle via complex exponentials — the engineer's route
The time-average computation in the main article used the identity \cos^2\theta = \tfrac{1}{2}(1 + \cos 2\theta). Electrical engineers and physicists often use a slicker version: express the sinusoid as the real part of a complex exponential, compute the average as a product of the complex number with its conjugate, and read off the \tfrac{1}{2} directly.
Write x(t) = \text{Re}[A e^{i(\omega t + \varphi)}]. Then
The \tfrac{1}{2} in \langle \cos^2 \rangle = \tfrac{1}{2} is the same \tfrac{1}{2} that turns peak voltage V_0 into RMS voltage V_0/\sqrt{2} in an AC circuit. Average power into a resistor from an AC source is \langle V^2 \rangle / R = \tfrac{1}{2} V_0^2/R = V_\text{rms}^2 / R — the same algebra, dressed in different notation. The 230 V at a wall socket in Bengaluru is the RMS value; the instantaneous peak is 230 \sqrt{2} \approx 325 V.
Where this leads next
- Equation of SHM and Phase — the derivation of x(t) = A\sin(\omega t + \varphi) from Newton's second law, and what amplitude, frequency, and phase mean.
- Spring-Mass Systems — horizontal spring, vertical spring (with the mg/k shift), springs in series and parallel, and two-spring systems — all built on the same energy picture.
- Simple Pendulum — the classic T = 2\pi\sqrt{L/g} derivation, where the small-angle approximation makes the potential quadratic and the system an SHM.
- Damped Oscillations — what happens when friction or drag removes energy from the oscillator: the amplitude decays exponentially, and so does the total energy.
- Conservation of Mechanical Energy — the general principle that SHM is the cleanest one-dimensional application of.