Work Done by a Variable Force (Spring)
Problem
A spring with k = 100 N/m is compressed by 0.5 m. Calculate the work done.
Explanation
Compressing or stretching a spring requires more force the further you push — the spring "fights back" harder. So the work done isn't a simple Force × Distance product; it requires integrating the variable force over the displacement.
The Physics
Hooke's Law says the spring force is proportional to its displacement from equilibrium:
where is the spring constant (in N/m) and is the compression (or extension). The work done against the spring as you compress it from to is:
Step-by-Step Solution
Given: , compression .
Find: The work done in compressing the spring.
Step 1 — Write the spring force.
At the force is N. At m the force is N.
Step 2 — Set up the work integral.
Step 3 — Pull the constant out and find the antiderivative.
Step 4 — Evaluate at the bounds.
Step 5 — Recognize the elastic-PE formula.
That entire calculation collapses into the famous formula:
This is also the elastic potential energy stored in the spring.
Step 6 — Sanity check via average force.
Since the force is linear in , the average force is . Multiplying by displacement :
For a constant-force problem you'd just write , but for a linear force you can use . For more complex forces you must integrate.
Answer: The work done in compressing the spring by 0.5 m is
This is also the elastic potential energy stored — and it would be released as kinetic energy if the spring were allowed to push something free.
Try It
- Adjust the spring constant widget — see the work scale linearly.
- Adjust the compression distance — work scales quadratically (), so doubling the compression quadruples the work.
- The right panel shows the force-vs-displacement graph; the shaded triangle under the line equals the work done.
- Notice the formula is exactly the area of a triangle with base and height .
Interactive Visualization
Parameters
Got your own math or physics problem?
Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.