Work done on a spring and elastic potential energy

Stretch or compress a spring and let go, and it snaps back — clearly the spring has "stored" the work you did on it, ready to be released as motion. That stored work is elastic potential energy, and working out how it builds up as a spring is deformed is one of the cleanest applications of the variable-force work integral in the whole Work, Energy and Power unit. Unlike a constant force, the spring pushes back harder the more you deform it, so the work done is not simply force times distance — it is an integral, and getting that integral right delivers the famous U=12kx2U = \tfrac12 kx^2 result. This article derives that formula from Hooke's law, shows it in a spring-mass energy exchange, and works two number problems so the quadratic dependence on xx becomes second nature.

The core insight

A spring stretched or compressed by xx from its natural length stores elastic potential energy U=12kx2U = \tfrac12 kx^2, obtained by integrating the linearly growing Hooke's-law force F=kxF = kx over the displacement, and this energy converts to and from kinetic energy as the spring-mass system oscillates.

The core idea

Hooke's law fixes the force. An ideal spring resists being stretched or compressed by a displacement xx from its natural (unstretched) length with a restoring force of magnitude

F=kxF = kx

where: kk is the spring constant (or force constant, SI unit N/m\text{N/m}), a measure of the spring's stiffness, and xx is the displacement from the natural length. This restoring force always opposes the deformation — pulling back when stretched, pushing back when compressed — and it grows linearly, starting from zero at the natural length.

The force is not constant, so the work is an integral. To stretch or compress the spring by xx, an external agent must supply, at every instant, a force that just balances kxkx. Because this applied force keeps growing as the deformation proceeds, the work done cannot be written as (force)×\times(distance); instead it is the area under the force-versus-displacement graph, found by integrating:

W=∫0xkx′ dx′=12kx2W = \int_0^x kx'\,dx' = \frac{1}{2}kx^2

where: x′x' is a dummy variable running from 00 to the final displacement xx. This work, done against the spring's restoring force, is stored in the spring as elastic potential energy:

U=12kx2U = \frac{1}{2}kx^2

Sign and symmetry. Because UU depends only on x2x^2, the formula holds identically whether the spring is stretched (x>0x > 0) or compressed (x<0x < 0) — a compressed spring stores exactly as much energy as a stretched one of the same magnitude of deformation, and UU is always positive.

Conservative force, definite energy. The spring force is a conservative force, just like gravity: the work done against it depends only on the initial and final extensions, never on the path taken to reach them. That path-independence is precisely what allows a definite potential energy to be assigned to each extension xx.

Energy exchange in a spring-mass system. When a compressed or stretched spring attached to a mass is released, the total mechanical energy E=K+UE = K + U stays constant if there is no friction: as the spring relaxes toward its natural length, stored elastic potential energy UU converts into kinetic energy KK of the mass, and the reverse happens as the mass compresses or stretches the spring further.

Figure
Force versus extension graph for a spring showing the linear line F equals kx and the triangular shaded area under it equal to the stored energy one half k x squared
Work done stretching a spring — area under F = kx extension x force F F = kx x kx area = U = ½kx²
Derivation ADeriving elastic potential energy from Hooke's law

The goal is to show, starting from nothing more than Hooke's law F=kxF = kx and the definition of work as an integral, why the energy stored in a stretched or compressed spring is U=12kx2U = \tfrac12 kx^2 and not the naive U=FxU = Fx a student might guess by mistaking the spring for a constant force.

Step 1. Write the applied force needed to stretch the spring quasi-statically (slowly enough that acceleration is negligible) by a small further amount at extension x′x'. At every instant the applied force must equal the spring's restoring force in magnitude, so the applied force at extension x′x' is F(x′)=kx′F(x') = kx' — it is not fixed, it grows as x′x' grows from 00 up to the final value xx.

Step 2. Recall that work for a variable force is the integral of force with respect to displacement, not force times displacement. The total work done in stretching the spring from its natural length to extension xx is W=∫0xF(x′) dx′=∫0xkx′ dx′W = \int_0^x F(x')\,dx' = \int_0^x kx'\,dx'.

Step 3. Evaluate the integral. Since kk is constant, ∫0xkx′ dx′=k[x′22]0x=k(x22−0)=12kx2\int_0^x kx'\,dx' = k\left[\dfrac{x'^2}{2}\right]_0^x = k\left(\dfrac{x^2}{2} - 0\right) = \dfrac{1}{2}kx^2.

Step 4. Identify this work as the stored energy. Because the spring force is conservative, all of this work is recoverable — none is lost — so it equals the elastic potential energy: U=12kx2U = \dfrac12 kx^2. The factor 12\tfrac12 is not arbitrary; it is exactly the geometric fact that the area of the triangle under the straight line F=kxF = kx, from 00 to xx, is half of base times height, i.e. half of x×kxx \times kx.

Worked example

A spring with force constant k=400 N/mk = 400\ \text{N/m} is compressed by 0.1 m0.1\ \text{m} from its natural length. Find (a) the elastic potential energy stored, and (b) the maximum speed with which a 2 kg2\ \text{kg} block attached to the spring flies off if the spring is released on a frictionless horizontal surface, starting from rest at maximum compression.

Step 1. Find the stored elastic potential energy using U=12kx2U = \tfrac12 kx^2 at x=0.1 mx = 0.1\ \text{m}: U=12(400)(0.1)2=12(400)(0.01)=2 JU = \tfrac12(400)(0.1)^2 = \tfrac12(400)(0.01) = 2\ \text{J}.

Step 2. Apply conservation of mechanical energy as the spring relaxes to its natural length. On a frictionless surface, all of this stored energy converts into kinetic energy of the block: 12mv2=U=2 J\tfrac12 mv^2 = U = 2\ \text{J}.

Step 3. Solve for the speed: v2=2×22=2v^2 = \dfrac{2 \times 2}{2} = 2, so v=2≈1.41 m/sv = \sqrt{2} \approx 1.41\ \text{m/s}.

The block leaves the spring with elastic potential energy U=2 JU = 2\ \text{J} converted entirely into a maximum speed of about 1.41 m/s1.41\ \text{m/s}.

Competitive stretch

A spring stores 4.5 J4.5\ \text{J} of elastic potential energy when stretched by 0.3 m0.3\ \text{m}. Find its spring constant, and the extension at which it would store twice this energy. Using U=12kx2U = \tfrac12 kx^2: 4.5=12k(0.3)2=12k(0.09)4.5 = \tfrac12 k(0.3)^2 = \tfrac12 k(0.09), so k=4.5×20.09=100 N/mk = \dfrac{4.5 \times 2}{0.09} = 100\ \text{N/m}. For twice the energy, U′=9 JU' = 9\ \text{J}: 9=12(100)x′2  ⟹  x′2=0.18  ⟹  x′=0.18≈0.424 m9 = \tfrac12(100)x'^2 \implies x'^2 = 0.18 \implies x' = \sqrt{0.18} \approx 0.424\ \text{m}. Doubling the stored energy required the extension to grow by a factor of only 2≈1.41\sqrt2 \approx 1.41, not by a factor of 22 — the direct fingerprint of the quadratic (x2x^2) dependence of UU.

Common traps

  • Treating the spring force as constant during extension and writing U=FxU = Fx instead of the correct U=12kx2U = \tfrac12 kx^2 — the missing factor of 12\tfrac12 comes from the force growing linearly from zero, not staying at its final value throughout.
  • Forgetting that UU depends on x2x^2, so it is always positive for both stretching and compression — a common error is assuming a compressed spring stores "negative" energy.
  • Assuming energy scales linearly with extension; because of the square, doubling the extension actually quadruples the stored energy, while doubling the energy only multiplies the extension by 2\sqrt2.
  • Ignoring the natural (unstretched) length as the reference point — xx must always be measured as displacement from the natural length, never from some arbitrary starting position.

Ask the tutor: Want to practise more spring-energy problems, including ones that combine gravitational and elastic potential energy on an incline?

Why is there a factor of one half in U equals one half k x squared, and not just U equals kx?

Because the spring's restoring force is not constant while you stretch it — it grows from 00 up to kxkx as the extension increases from 00 to xx. Work done by a varying force is the area under the force-versus-displacement graph, and for a straight line through the origin that area is a triangle: half of base times height, i.e. half of xx times kxkx, giving 12kx2\tfrac12 kx^2. Using U=FxU = Fx would be treating the force as if it were already at its maximum value kxkx for the entire displacement, which overcounts the work by exactly a factor of two.

Does it matter whether the spring is stretched or compressed when calculating elastic potential energy?

Not for the amount of energy stored — only the magnitude of the displacement from the natural length matters, because U=12kx2U = \tfrac12 kx^2 depends on x2x^2, which is positive whether xx is positive (stretch) or negative (compression). Physically this makes sense: pulling a spring out by 5 cm5\ \text{cm} and pushing it in by 5 cm5\ \text{cm} both require the same amount of work against a restoring force of the same magnitude at every step, so both store exactly the same amount of energy for that 5 cm5\ \text{cm} of deformation.

How is this different from gravitational potential energy, and why can we still call the spring force conservative?

Gravitational potential energy near Earth's surface is U=mghU = mgh, which is linear in displacement hh because the gravitational force mgmg is constant. Elastic potential energy is U=12kx2U = \tfrac12 kx^2, which is quadratic in xx because the spring force kxkx itself grows with displacement. Despite this difference in form, both forces are conservative: in each case the work done depends only on the initial and final positions, not on the path or speed of the motion, which is exactly why a definite potential energy function can be written down for each.

Before this

Where this leads