Work as Area Under a Force Graph found work as the area under a force–position graph, using triangles and rectangles. With Evaluating Integrals with FTC Part 2 you can find that area for any force you can write as a formula.
Key idea
The work done by a force $F(x)$ along the $x$-axis from $x_1$ to $x_2$ is $$W = \int_{x_1}^{x_2} F(x)\,dx,$$ the signed area under the $F$–$x$ curve, in joules (N·m). For a spring stretched by an outside force $F = kx$: $W = \tfrac{1}{2}k\left(x_2^2 - x_1^2\right)$.
Why it works
Over a short step $\Delta x$ the force hardly changes, so the work on that step is about $F(x)\Delta x$, the area of a thin rectangle. The total is the sum of those pieces, $\sum F(x_i)\Delta x$, a Riemann sum. Making the steps thinner turns the sum into the integral. When $F$ is constant, the integral is just $F\,\Delta x$, the rule you already know.
Worked example: Stretching a spring
How much work does it take to stretch a spring with $k = 200\ \text{N/m}$ from $0.10\ \text{m}$ to $0.30\ \text{m}$ past its natural length?
- The pull needed is $F = kx$, which grows as you stretch.
- $$W = \int_{0.1}^{0.3} 200x\,dx = 100\left(0.3^2 - 0.1^2\right) = 100(0.08) = 8\ \text{J}$$
Answer: $8\ \text{J}$.
Worked example: A force that grows like $x^2$
A force $F(x) = 3x^2 + 2$ (N, with $x$ in m) pushes a crate from $x = 0$ to $x = 2\ \text{m}$. Find the work.
- $W = \int_0^2 (3x^2 + 2)\,dx = \left[x^3 + 2x\right]_0^2$.
- $W = 8 + 4 = 12\ \text{J}$.
Answer: $12\ \text{J}$.
Common mistake
Multiplying the force by the distance when the force changes along the way. For the spring above, the force at the end is $60\ \text{N}$, and $60 \times 0.2 = 12\ \text{J}$, half again too much; the force at the start gives $4\ \text{J}$, too little. Neither end represents the whole trip. Check with the graph: $F\Delta x$ is a rectangle, and it only matches the true area when the graph is flat.
The sign matters. The spring's own force on your hand is $-kx$, so while you stretch it, the spring does $-8\ \text{J}$ of work on you as you do $+8\ \text{J}$ on it. Always say which force's work you mean.
Worked example: A repulsion that fades
Two magnets repel with $F(x) = 4/x^2$ (N, m). As one slides from $x = 1\ \text{m}$ to $x = 2\ \text{m}$, how much work does the repulsion do on it?
- $W = \int_1^2 \dfrac{4}{x^2}\,dx = 4\left[-\dfrac{1}{x}\right]_1^2 = 4\left(1 - \dfrac{1}{2}\right)$.
- $W = 2\ \text{J}$, positive because the force and the motion point the same way.
Answer: $2\ \text{J}$.