Tutorials › Calculus II › Work to Stretch or Compress a Spring

Work and Variable Forces · Tutorial 456 of 998

Work to Stretch or Compress a Spring

Learn to set up and evaluate spring-work integrals, interpret their signs, and calculate work when motion crosses the spring’s equilibrium position.

Intermediate 10 min read

What You'll Learn

  • Define signed displacement from a spring’s equilibrium position.
  • Set up the work integral using Hooke’s law.
  • Derive the formula for work between two displacements.
  • Calculate work for stretching, compression, and motion across equilibrium.
  • Interpret positive and negative work and check the units.
  • Identify the error in using only the final displacement to calculate work.

Spring Work Depends on the Change in Displacement

An ideal spring exerts a force that points toward its equilibrium position. Stretching and compressing the spring require work, but a motion that begins and ends away from equilibrium may require less work than either endpoint value alone suggests. The key is to keep track of the spring’s signed displacement throughout the motion.

We will use Hooke’s law and the definition of work for a variable force to find the work required to move a spring from one specified displacement to another. The result applies when either endpoint is a compression, an extension, or when the motion passes through equilibrium.

Displacement and Hooke’s Law

Choose a coordinate axis along the spring, and let \(x=0\) denote its equilibrium position. A positive value of \(x\) represents extension in the positive direction; a negative value represents compression in the opposite direction. The displacement is measured from equilibrium, not from the spring’s current position.

Definition: For an ideal spring with spring constant \(k>0\), Hooke’s law gives the force exerted by the spring at displacement \(x\) as \(F_s(x)=-kx\). The negative sign means that the spring force points toward equilibrium.

The spring constant \(k\) measures stiffness. If force is measured in newtons and displacement in metres, then \(k\) has units of newtons per metre (\(\mathrm{N/m}\)). For example, at \(x=0.10\ \mathrm{m}\), a spring with \(k=100\ \mathrm{N/m}\) exerts the force \(F_s=-10\ \mathrm{N}\).

To move the spring in a controlled, sufficiently slow way, an applied force must balance the spring force at each position. Thus \(F_{\mathrm{app}}(x)=kx\). We calculate the work supplied by this applied force. This is the signed work for the specified motion: a negative value means that the spring returns energy overall rather than requiring net energy input.

Deriving the Spring-Work Formula

For a variable force \(F(x)\) acting along a displacement from \(x_i\) to \(x_f\), the work is the definite integral \(\int_{x_i}^{x_f}F(x)\,dx\). The limits retain their order: reversing the direction of motion reverses the sign of the work integral. Applying this definition to the applied force \(kx\) gives the spring-work formula.

1
Write the applied force.
At displacement \(x\), the spring force is \(-kx\), so a controlled applied force balancing it is \(kx\).
2
Integrate over the motion.
For motion from \(x_i\) to \(x_f\), work is the integral of the applied force with respect to displacement.
3
Evaluate the integral.
An antiderivative of \(kx\) is \(\frac12kx^2\); evaluating at the two endpoints gives the result.
$$ W_{\mathrm{required}} =\int_{x_i}^{x_f}kx\,dx =\left[\frac12kx^2\right]_{x_i}^{x_f} =\frac12k\left(x_f^2-x_i^2\right). $$
Theorem: For an ideal spring with constant \(k>0\), the signed work supplied in a controlled motion from displacement \(x_i\) to displacement \(x_f\) is \(\frac12k(x_f^2-x_i^2)\). The formula assumes Hooke’s law applies throughout the motion and that the applied force balances the spring force. It allows either displacement to be positive, negative, or zero.

The derivation also explains why the formula works: the force changes with position, so work is not generally the force at one endpoint multiplied by the total distance. Instead, the integral adds the force’s contribution over each small displacement. The antiderivative then reduces that accumulated work to a difference of endpoint values.

As a units check, \(kx^2\) has units \((\mathrm{N/m})(\mathrm{m}^2)=\mathrm{N\,m}=\mathrm{J}\), so the formula gives work in joules. The square applies to the signed displacement, so both positive and negative displacements produce nonnegative endpoint squares.

Worked Examples

Worked Example: Stretching a Spring from Equilibrium

A spring has constant \(k=200\ \mathrm{N/m}\). Find the work required to move it slowly from equilibrium to an extension of \(0.15\ \mathrm{m}\).

Here \(x_i=0\ \mathrm{m}\) and \(x_f=0.15\ \mathrm{m}\). Substitute into the formula:

$$ W_{\mathrm{required}} =\frac12(200\ \mathrm{N/m})\left((0.15\ \mathrm{m})^2-(0\ \mathrm{m})^2\right). $$

Calculate the squared displacements: \((0.15\ \mathrm{m})^2=0.0225\ \mathrm{m}^2\) and \((0\ \mathrm{m})^2=0\ \mathrm{m}^2\). Also, \(\frac12(200\ \mathrm{N/m})=100\ \mathrm{N/m}\). Therefore,

$$ W_{\mathrm{required}} =(100\ \mathrm{N/m})(0.0225\ \mathrm{m}^2) =2.25\ \mathrm{N\,m} =2.25\ \mathrm{J}. $$

The work is positive because the motion increases the spring’s displacement from equilibrium. As a check, differentiating the antiderivative \(\frac12(200)x^2=100x^2\) gives \(200x\), the applied force. Evaluating it at \(0.15\ \mathrm{m}\) and \(0\ \mathrm{m}\) gives \(2.25\ \mathrm{J}-0\ \mathrm{J}=2.25\ \mathrm{J}\).

Worked Example: Moving from Compression to Extension

A spring with \(k=120\ \mathrm{N/m}\) is moved from \(x_i=-0.10\ \mathrm{m}\) to \(x_f=0.20\ \mathrm{m}\). Calculate the signed work required, including the part of the motion that crosses equilibrium.

The endpoint displacements have opposite signs. Using the full interval in the formula gives

$$ W_{\mathrm{required}} =\frac12(120\ \mathrm{N/m})\left((0.20\ \mathrm{m})^2-(-0.10\ \mathrm{m})^2\right). $$

The squares are \(0.20^2=0.0400\) and \((-0.10)^2=0.0100\), both in square metres. Thus,

$$ W_{\mathrm{required}} =(60\ \mathrm{N/m})(0.0400-0.0100)\ \mathrm{m}^2 =(60\ \mathrm{N/m})(0.0300\ \mathrm{m}^2) =1.80\ \mathrm{J}. $$

We can check this result by splitting the motion at equilibrium. From \(-0.10\ \mathrm{m}\) to \(0\ \mathrm{m}\), the work is \(60(0^2-(-0.10)^2)\ \mathrm{N\,m}=-0.60\ \mathrm{J}\). From \(0\ \mathrm{m}\) to \(0.20\ \mathrm{m}\), it is \(60(0.20^2-0^2)\ \mathrm{N\,m}=2.40\ \mathrm{J}\). Adding the contributions gives \(-0.60\ \mathrm{J}+2.40\ \mathrm{J}=1.80\ \mathrm{J}\), as before. The spring assists the motion toward equilibrium during the first part; the net work is positive because the final displacement has the larger magnitude.

Worked Example: Moving Between Opposite-Side Endpoints

A spring has constant \(k=250\ \mathrm{N/m}\). Find the signed work required to move it from \(x_i=0.12\ \mathrm{m}\) to \(x_f=-0.08\ \mathrm{m}\), passing through equilibrium.

Apply the endpoint formula with the signed displacements:

$$ W_{\mathrm{required}} =\frac12(250\ \mathrm{N/m})\left((-0.08\ \mathrm{m})^2-(0.12\ \mathrm{m})^2\right). $$

The squared values are \((-0.08)^2=0.0064\) and \((0.12)^2=0.0144\), in square metres. Since \(\frac12(250\ \mathrm{N/m})=125\ \mathrm{N/m}\),

$$ W_{\mathrm{required}} =(125\ \mathrm{N/m})(0.0064-0.0144)\ \mathrm{m}^2 =(125\ \mathrm{N/m})(-0.0080\ \mathrm{m}^2) =-1.00\ \mathrm{J}. $$

For a check, split at \(x=0\). From \(0.12\ \mathrm{m}\) to equilibrium, the work is \(125(0^2-0.12^2)\ \mathrm{N\,m}=-1.80\ \mathrm{J}\). From equilibrium to \(-0.08\ \mathrm{m}\), it is \(125((-0.08)^2-0^2)\ \mathrm{N\,m}=0.80\ \mathrm{J}\). Their sum is \(-1.80\ \mathrm{J}+0.80\ \mathrm{J}=-1.00\ \mathrm{J}\), matching the formula. The negative result means the spring returns \(1.00\ \mathrm{J}\) of net work over the motion.

Interpreting the Sign

The sign of the result follows from comparing the endpoint distances from equilibrium, not simply from whether the final displacement is positive or negative. Because \(k>0\), the sign of \(W_{\mathrm{required}}\) is the sign of \(x_f^2-x_i^2\).

  • If \(|x_f|>|x_i|\), then \(W_{\mathrm{required}}>0\): the spring ends farther from equilibrium and net work is supplied.
  • If \(|x_f|<|x_i|\), then \(W_{\mathrm{required}}<0\): the spring ends closer to equilibrium and returns net work.
  • If \(|x_f|=|x_i|\), then \(W_{\mathrm{required}}=0\): the net work over the motion is zero.

For motion that crosses equilibrium, the work on each side can have a different sign. The definite integral, or the formula using both endpoints, gives the net signed work. It does not mean that every part of the motion requires positive work. If a problem asks for the separate work contributions along a specified motion, split the integral at equilibrium and evaluate each part.

A Common Endpoint Error

A frequent mistake is to use only the final displacement and calculate \(\frac12kx_f^2\), even when the spring does not start at equilibrium. For the motion from \(-0.10\ \mathrm{m}\) to \(0.20\ \mathrm{m}\) with \(k=120\ \mathrm{N/m}\), that mistake gives

$$ \frac12(120)(0.20)^2=2.40\ \mathrm{J}. $$

That is the work from equilibrium to \(0.20\ \mathrm{m}\), not the work from \(-0.10\ \mathrm{m}\) to \(0.20\ \mathrm{m}\). The initial displacement matters too. Subtract its squared value:

$$ \frac12(120)\left((0.20)^2-(-0.10)^2\right) =60(0.0400-0.0100) =1.80\ \mathrm{J}. $$

Another error is to replace signed displacement with distance travelled before integrating. The endpoints determine the limits and the sign of the integral; a crossing of equilibrium does not justify discarding the negative displacement.

Why the Formula Is Useful

The endpoint formula makes spring-work calculations efficient while preserving the correct sign. It covers stretching, compression, returning toward equilibrium, and moving from one side of equilibrium to the other without needing a new rule for each case. It also provides a quick reasonableness check: the work must be positive when the final displacement has larger magnitude, negative when it has smaller magnitude, and zero when the magnitudes match.

For any stated motion, identify the equilibrium position, express both endpoint displacements relative to it using the same coordinate direction, and substitute those signed values into \(\frac12k(x_f^2-x_i^2)\). Keep the units in the calculation and check whether the sign agrees with the change in distance from equilibrium.

Check Your Understanding

Use the spring-work formula and pay attention to signed endpoint displacements.

  1. A spring with \(k=80\ \mathrm{N/m}\) moves from equilibrium to \(x=0.25\ \mathrm{m}\). What is the required work?
  2. For \(k=150\ \mathrm{N/m}\), calculate the work from \(x=-0.10\ \mathrm{m}\) to \(x=0.10\ \mathrm{m}\). What does its sign indicate?
  3. A spring with \(k=300\ \mathrm{N/m}\) moves from \(x=-0.04\ \mathrm{m}\) to \(x=-0.09\ \mathrm{m}\). Is the work positive or negative, and what is its value?
  4. Why must the work from \(x_i\) to \(x_f\) use both endpoint displacements?
  5. For a motion that crosses equilibrium, what does the single endpoint formula calculate: net signed work or the sum of only positive work contributions?