Sub topic 10
Work Done by a Spring: W = ½kx²
This chapter assumes you know vectors and components, Newton's second law, definite integrals, and the work-energy theorem from the earlier chapters. It builds on the variable-force chapter. A spring is the standard example of a force that changes with position.
Hooke's law and the sign convention
An ideal spring exerts a force proportional to its displacement from the relaxed (natural) length. Take the x-axis along the spring and put x = 0 at the relaxed length. The force the spring exerts on whatever is attached to it is
F_s = −kx
Here k is the spring constant, in newtons per metre (N/m). A stiffer spring has a larger k. The minus sign means the spring force is a restoring force. It points opposite the displacement from equilibrium. If you stretch the spring (x > 0), it pulls back (Fs < 0). If you compress it (x < 0), it pushes out (Fs > 0).
Two points about the model:
- The law is an approximation. Real springs obey it only within an elastic range. Past that range the spring deforms permanently, and the force is no longer linear in x.
- "Ideal" also means the spring has negligible mass. A massive spring has parts that move at different speeds, which adds kinetic energy to the spring itself.
Deriving the work
Work by a variable force along a line is the integral of F dx. For the force the spring exerts, moving from xi to xf:
Wspring = ∫ from xi to xf of (−kx) dx = −(½k xf² − ½k xi²) = ½k xi² − ½k x_f²
This is the general result. Three things follow from it.
- The work depends only on the endpoints, through xi² and xf². The path between them does not matter.
- The work depends on x², so the sign of the displacement does not matter. Stretching by 0.1 m and compressing by 0.1 m store the same amount of energy.
- The sign of the work depends on whether the spring is moving toward or away from its relaxed length. Moving toward x = 0 makes |x| smaller, so Wspring > 0. Moving away makes |x| larger, so Wspring < 0.
The special case in the chapter title comes from starting at the relaxed length (x_i = 0) and ending at displacement x:
- The work done by the spring is W_spring = −½kx².
- The work done by an external agent who slowly stretches or compresses the spring is W_ext = +½kx².
The title formula W = ½kx² is the second one. It is the work you do on the spring. The spring's own work has the opposite sign. Always ask which force the work belongs to.
The graphical view
You do not need calculus to get the same answer. Plot the applied force F = kx against x from 0 to x_max. The graph is a straight line through the origin. The area under it is a right triangle:
- base = x_max
- height = k·x_max
- area = ½ · base · height = ½k x_max²
This is the same result as the integral. It is also a useful check. If a problem gives you a force-versus-position graph for a spring-like device that is not a straight line, use the area, not the formula.
The area view also handles a partial stretch. The work to go from x1 to x2 is the area of a trapezoid, which equals ½k(x2² − x1²). Do not compute it as ½k(x2 − x1)². This is the most common error in this topic (see below).
Numerical check
The code below approximates the integral with the trapezoid rule and compares it with the closed form. It uses the same method as the variable-force chapter.
def work_numeric(force_fn, a, b, n=1000):
"""Approximate the work done by force_fn(x) from x=a to x=b with the trapezoid rule."""
h = (b - a) / n
return sum(
(force_fn(a + i * h) + force_fn(a + (i + 1) * h)) / 2 * h
for i in range(n)
)
k = 200.0 # spring constant, N/m
x_max = 0.10 # stretch, m
w = work_numeric(lambda x: k * x, 0.0, x_max)
print(round(w, 3)) # 1.0, matching (1/2) k x^2 = 0.5 * 200 * 0.1**2The trapezoid rule is exact for a straight line, so the result matches the formula up to floating-point rounding. For a spring that is not ideal, for example F = kx + bx³, the same function still works and the closed form no longer does.
Worked example 1: stretching from rest
A spring has k = 200 N/m. How much work does it take to stretch it 0.10 m from its relaxed length?
W_ext = ½kx² = ½(200)(0.10)² = ½(200)(0.01) = 1.0 J
The spring does −1.0 J of work during the stretch. If you then release the spring, it does +1.0 J of work as it returns to x = 0.
Worked example 2: stretching further
The same spring is already stretched 0.10 m. How much more work does it take to stretch it to 0.20 m?
Wext = ½k(xf² − x_i²) = ½(200)(0.20² − 0.10²) = 100(0.04 − 0.01) = 3.0 J
The first 0.10 m cost 1.0 J. The next 0.10 m cost 3.0 J. The force is larger over the second interval, so more work is needed. Doubling the stretch quadruples the total energy: the full 0.20 m costs ½(200)(0.04) = 4.0 J.
| Stretch x (m) | Total work ½kx² (J) | Work in this step (J) |
|---|---|---|
| 0.05 | 0.25 | 0.25 |
| 0.10 | 1.00 | 0.75 |
| 0.15 | 2.25 | 1.25 |
| 0.20 | 4.00 | 1.75 |
Each row uses steps of 0.05 m. The work per step grows linearly because the force grows linearly.
Using the spring in the work-energy theorem
The spring is one of the forces contributing to the net work. The theorem still reads Wnet = ΔK. For a block on a frictionless horizontal surface, attached to a spring and released from a stretch xi, the spring is the only force that does work. (Gravity and the normal force are perpendicular to the motion, so they do zero work.)
½k xi² − ½k xf² = ½mvf² − ½mvi²
Worked example 3: block released from a stretched spring
A 0.50 kg block sits on a frictionless table, attached to the spring (k = 200 N/m). The spring is stretched 0.10 m and the block is released from rest. How fast is the block moving when the spring reaches its relaxed length?
Here xi = 0.10 m, xf = 0, and v_i = 0.
½(200)(0.10)² − 0 = ½(0.50)v_f² − 0
1.0 = 0.25 v_f²
v_f = √4.0 = 2.0 m/s
You cannot solve this with the constant-acceleration equations, because the acceleration changes as the spring relaxes. The work-energy theorem skips that difficulty. It needs only the endpoints.
Worked example 4: spring plus friction
Now the table has kinetic friction with force 0.80 N. The spring is stretched 0.10 m and the block starts from rest. Find the speed at x = 0.
The spring does +1.0 J. Friction opposes the motion over a distance of 0.10 m, so it does −0.80 × 0.10 = −0.08 J.
W_net = 1.0 − 0.08 = 0.92 J
0.92 = ½(0.50)v² → v² = 3.68 → v ≈ 1.92 m/s
The block is slower than the frictionless case (2.0 m/s), as expected. Friction's work depends on the path length, not only the endpoints, so it cannot be folded into a spring-style formula.
import math
k = 200.0 # N/m
m = 0.50 # kg
x0 = 0.10 # m, initial stretch
f_fric = 0.80 # N, kinetic friction
w_spring = 0.5 * k * x0**2 # 1.0 J
w_fric = -f_fric * x0 # -0.08 J
w_net = w_spring + w_fric
v = math.sqrt(2 * w_net / m)
print(round(w_spring, 2), round(w_fric, 2), round(v, 2)) # 1.0 -0.08 1.92Edge cases and common errors
- Using x as the stretch from the wrong reference point. In ½kx², x is measured from the relaxed length, not from where the spring happens to be attached or from some convenient origin. If a problem says the spring is 0.30 m long and its natural length is 0.25 m, then x = 0.05 m.
- Computing ½k(Δx)² for a partial stretch. The work from x1 to x2 is ½k(x2² − x1²). These two expressions differ whenever x1 ≠ 0. For x1 = 0.10 and x_2 = 0.20 with k = 200, the correct value is 3.0 J. The wrong formula gives ½(200)(0.10)² = 1.0 J.
- Mixing up the sign. The spring does negative work when it is stretched or compressed away from equilibrium. The agent doing the stretching does positive work. State which force you are computing.
- Treating the work as dependent on direction. Compression and extension by the same amount involve the same magnitude of work, because x² is the same.
- Forgetting units. If x is given in centimetres, convert to metres first. 5 cm gives x = 0.05 m. With k in N/m, working in cm gives an answer off by a factor of 10,000.
- Applying the formula beyond the elastic limit. If the problem says the spring is nonlinear, integrate the given force law.
- Assuming the stretch force equals the spring force at all times. For the ½kx² result, the external force must balance the spring force at each instant (the stretch is slow, with negligible kinetic energy). If you pull faster, the applied force can exceed kx and part of your work goes into kinetic energy of the attached object. The spring's own work is still −½kx² either way.
Springs in series and in parallel (brief note)
Two ideal springs can be combined into an equivalent spring with one effective constant. For two springs side by side that share the same displacement, keff = k1 + k2. For two springs end to end that carry the same force, 1/keff = 1/k1 + 1/k2. The work to stretch the combination by x is then ½k_eff x². This lets you apply the formula to a combined system without new physics.
Summary of the working model
- Spring force: F_s = −kx, with x measured from the relaxed length.
- Work by the spring from xi to xf: ½k xi² − ½k xf².
- Work by an external agent stretching slowly from 0 to x: +½kx².
- Use the area under the F–x graph when the force is not linear.
- Add the spring's work to the other forces' work to get Wnet, then use Wnet = ΔK.
Exercise
A spring with k = 150 N/m has a relaxed length of 0.40 m. It is stretched to a length of 0.46 m, and then to 0.52 m. (a) How much work does an external agent do in the second stretch, from 0.46 m to 0.52 m? (b) What work does the spring do during that second stretch?
Show answer
Measure x from the relaxed length: x1 = 0.06 m and x2 = 0.12 m. (a) Wext = ½k(x2² − x_1²) = 75(0.0144 − 0.0036) = 75(0.0108) = 0.81 J. (b) The spring does the opposite amount of work, −0.81 J, because it is being stretched further from equilibrium.
Exercise
A 2.0 kg block on a frictionless horizontal surface is pressed against a spring (k = 800 N/m), compressing it 0.15 m from its relaxed length. The block is released from rest and leaves the spring when the spring reaches its relaxed length. What is the block's speed at that point?
Show answer
The spring does W = ½kx² = ½(800)(0.15)² = 9.0 J of work on the block as it relaxes (positive, since |x| decreases). The block starts at rest, so 9.0 = ½(2.0)v², giving v² = 9.0 and v = 3.0 m/s.
Exercise
A student says that stretching a spring from x = 0.10 m to x = 0.30 m takes ½k(0.20)² of work because the stretch is 0.20 m. Explain what is wrong, and give the correct expression.
Show answer
The force is not constant, and the work depends on the squares of the endpoint positions, not the square of their difference. The correct work is ½k(0.30² − 0.10²) = ½k(0.08) = 0.04k joules. The student's expression gives ½k(0.04) = 0.02k, which is half the correct value.