Sub topic 5
Elastic potential energy of a spring: U = kx²/2
This chapter derives the energy stored in an ideal spring and shows how to use it. It assumes you know Newton's laws, the work done by a constant force, kinetic energy as ½mv², basic algebra, and sign conventions for one-dimensional vectors. You also need the idea of a conservative force from the previous chapters. A spring is the standard second example of one, after gravity.
What an ideal spring does
An ideal spring obeys Hooke's law. If you measure the displacement x from the spring's relaxed (natural) length, the spring pushes or pulls back with the force
F = −kx
The spring constant k is measured in N/m. A stiffer spring has a larger k. The minus sign says the force opposes the displacement. Stretch the spring (x > 0) and it pulls back. Compress it (x < 0) and it pushes out.
Two assumptions are built into this model:
- The spring is massless, so none of the energy goes into moving the coils.
- The deformation is small enough to stay in the linear Hooke region. Past that, the real force curve bends, and the formulas here no longer apply.
Deriving U = ½kx²
The spring force depends on position, so the constant-force formula W = Fd does not work. You need the integral of force over displacement. The work done by the spring as its end moves from xi to xf is
Wspring = ∫ (−kx) dx, from xi to xf = ½k xi² − ½k x_f²
This result depends only on the endpoints. The path between them does not matter, and the work around any closed loop is zero. That is the test for a conservative force. For a conservative force, the potential energy change is the negative of the work it does:
ΔU = −Wspring = ½k xf² − ½k x_i²
Choosing U = 0 at the relaxed position, x = 0, gives
U(x) = ½ k x²
You can also read this as an area. If you slowly stretch a spring from 0 to x, the force you apply grows linearly from 0 to kx. The work you do is the area of a triangle with base x and height kx, which is ½·x·kx = ½kx². That work is what the spring stores.
Properties worth remembering
- U is never negative, because x is squared. The spring stores the same energy for a stretch of 0.10 m as for a compression of 0.10 m.
- U grows with the square of the deformation. Doubling x quadruples the stored energy.
- Only the deformation matters, not the spring's total length. If a spring has a natural length of 0.30 m and is now 0.35 m long, then x = 0.05 m.
- The zero of U is not a free choice here. The formula ½kx² assumes U = 0 at the relaxed length. You can still add a constant, but you should do so deliberately (see the vertical spring section below).
Worked example: a block launched by a spring
A 0.50 kg block rests against a spring with k = 200 N/m, compressed by 0.10 m, on a frictionless horizontal surface. The block is released. How fast does it move once it leaves the relaxed spring?
Only the spring does work on the block in the horizontal direction. Gravity and the normal force are vertical and cancel. So mechanical energy is conserved:
- Initial state: the block is at rest, so K = 0, and U = ½(200)(0.10)² = 1.00 J.
- Final state: the spring is relaxed, so U = 0, and K = ½mv².
Setting the two equal gives ½kx² = ½mv², so v = x·√(k/m).
import math
m = 0.50 # block mass in kg
k = 200.0 # spring constant in N/m
x = 0.10 # compression in m
# (1/2)*k*x**2 = (1/2)*m*v**2 on a frictionless surface
v = x * math.sqrt(k / m)
print(f"Speed leaving the spring: {v:.2f} m/s")The output is 2.00 m/s. A sanity check on the units: √(k/m) has units of √((N/m)/kg) = 1/s, and multiplying by x in metres gives m/s.
Energy at intermediate positions
You do not have to wait for the spring to relax. At any compression x between 0.10 m and 0, the total energy is still 1.00 J, so
½mv² = ½k(x₀² − x²)
where x₀ = 0.10 m is the starting compression. The next script tabulates the exchange for the same block.
import math
m = 0.50
k = 200.0
x0 = 0.10
E = 0.5 * k * x0**2 # total mechanical energy in J
for x in [0.10, 0.075, 0.05, 0.025, 0.0]:
U = 0.5 * k * x**2
K = E - U
v = math.sqrt(2 * K / m)
print(f"x={x:.3f} m U={U:.3f} J K={K:.3f} J v={v:.3f} m/s")The table shows the pattern:
| Compression x (m) | U (J) | K (J) | Speed (m/s) |
|---|---|---|---|
| 0.100 | 1.000 | 0.000 | 0.00 |
| 0.050 | 0.250 | 0.750 | 1.73 |
| 0.000 | 0.000 | 1.000 | 2.00 |
At x = 0.05 m, the spring is half compressed but has given up three quarters of its energy. This follows from the x² dependence. The block gains speed fastest near the start, when the spring force is largest.
Springs and gravity together: a block dropped onto a spring
A common problem combines both kinds of potential energy. A 2.0 kg block is dropped from 0.50 m above a vertical spring with k = 800 N/m. How far does the spring compress at the lowest point?
Take the initial state to be the block at rest at its release height. Take the final state to be the block momentarily at rest at maximum compression x below the spring's top. The block has fallen a total height of h + x. Its kinetic energy is zero at both ends. Gravitational energy lost equals spring energy gained:
mg(h + x) = ½kx²
Rearranged, this is a quadratic: ½kx² − mgx − mgh = 0. Its positive root is
x = [mg + √((mg)² + 2kmgh)] / k
import math
m = 2.0 # kg
k = 800.0 # N/m
h = 0.50 # free-fall height above the spring in m
g = 9.81
mg = m * g
x = (mg + math.sqrt(mg**2 + 2 * k * mg * h)) / k
print(f"Maximum compression: {x:.4f} m")
# Check: gravitational energy lost should equal spring energy stored.
print(f"m*g*(h+x) = {mg * (h + x):.3f} J")
print(f"k*x**2/2 = {0.5 * k * x**2:.3f} J")The compression is about 0.1830 m, and both energies come to about 13.4 J. Two points are easy to miss:
- The block keeps falling while it compresses the spring, so the gravitational term includes x. Leaving it out is the most common mistake in this problem.
- The quadratic has two roots. The negative root would mean the spring stretched upward, which is not physical here. Keep the positive one.
A vertical spring and the shifted equilibrium
When a mass hangs from a vertical spring, gravity changes where the spring settles. At equilibrium the spring force balances the weight, so the spring is stretched by
d = mg/k
Take y as the displacement from the relaxed length, measured downward. The total potential energy is U = ½ky² − mgy (gravitational energy falls as y grows). Completing the square gives
U = ½k(y − d)² − ½kd²
The second term is a constant. Energy differences are what matter, so you can measure the displacement from the new equilibrium, y′ = y − d, and write U = ½ky′² with no gravity term at all. This is why a mass on a vertical spring oscillates exactly as it would horizontally, only about a lower center. It is also a useful shortcut. For problems that stay within the spring's range, the choice between "spring plus gravity" and "spring from the shifted equilibrium" is a bookkeeping choice, and both give the same answer.
Common errors
- Using the spring's length as x. The x in ½kx² is the change from the relaxed length. A spring of length 0.35 m has x = 0.35 − L₀.
- Forgetting to square x. U = ½kx is dimensionally wrong. It has units of N, not J.
- Mixing units. If x is in centimetres, convert to metres before using k in N/m. A 5 cm compression is 0.05 m, and the energy is 100 times smaller than a mistaken x = 5 would suggest.
- Squaring the difference. The energy change from x₁ to x₂ is ½k(x₂² − x₁²), not ½k(x₂ − x₁)². For example, with k = 200 N/m, going from x = 0.10 m to x = 0.20 m takes 200·0.5·(0.04 − 0.01) = 3.0 J, not 1.0 J.
- Treating the spring's energy as the total. The block's kinetic energy, gravity, or friction can enter the same energy balance. Account for each term in both the initial and final states.
- Using the formula past the elastic limit. If the spring is stretched until it deforms permanently, some energy goes into the material and ½kx² underestimates the work you did.
Connection to force
Because the force is the negative slope of the potential energy, you can recover Hooke's law from U:
F = −dU/dx = −d(½kx²)/dx = −kx
The next chapters develop this relation. For now, notice that the parabola in the diagram is steepest at its edges, where the force is largest, and flat at x = 0, where the force is zero. That flat bottom is the equilibrium point.
Exercise
A spring with k = 400 N/m is compressed 0.060 m from its relaxed length. (a) How much energy does it store? (b) How much extra work is needed to compress it from 0.060 m to 0.120 m?
Show answer
(a) U = ½kx² = ½(400)(0.060)² = 0.72 J. (b) The energy at 0.120 m is ½(400)(0.120)² = 2.88 J, so the extra work is 2.88 − 0.72 = 2.16 J. Doubling the compression quadruples the energy, and the added work is three times the original energy.
Exercise
A 0.25 kg cart on a frictionless horizontal track is attached to a spring with k = 50 N/m. The spring is stretched 0.20 m and the cart is released from rest. What is the cart's speed when the spring is stretched by 0.10 m?
Show answer
The total energy is ½(50)(0.20)² = 1.00 J. At x = 0.10 m, U = ½(50)(0.10)² = 0.25 J, so K = 1.00 − 0.25 = 0.75 J. Then v = √(2K/m) = √(2·0.75/0.25) = √6 ≈ 2.45 m/s.
Exercise
A hanging mass of 0.40 kg stretches a vertical spring by 0.050 m when it settles at rest. What is k, and what is the elastic energy stored at that equilibrium position? (Use g = 9.81 m/s².)
Show answer
At equilibrium kd = mg, so k = mg/d = 0.40·9.81/0.050 = 78.5 N/m. The stored elastic energy is ½kd² = ½(78.5)(0.050)² ≈ 0.098 J. This is less than the gravitational energy mgd = 0.196 J lost while the mass descended. The other half has gone into the oscillation of the mass, which would continue if it were released from the relaxed length, or into heat if the motion is damped.