TExcelTAD
Home › Calculus in Depth › Work

Work

In physics, work is force times distance, but only when the force is constant. Springs, gravity far from Earth and pumping a tank of water all involve forces that change along the way, or many small pieces moved different distances. The integral handles both, with the same slice-and-sum reasoning used for areas and volumes. This lesson covers variable forces, Hooke's law, pumping problems and the work needed to escape a planet's gravity.

Constant and variable forces

With a constant force FF along the direction of motion over a distance dd, W=F⋅dW = F \cdot d. In SI units force is in newtons (N), distance in metres, and work in joules (J=N⋅m\text{J} = \text{N} \cdot \text{m}).

If the force f(x)f(x) varies with position, split [a,b][a, b] into pieces of width Δx\Delta x. On each piece the force is nearly constant, so the work is about f(xi∗)Δxf(x_i^*)\Delta x. Summing and taking the limit:

W=∫abf(x) dxW = \int_a^b f(x)\,dx

Springs: Hooke's law

A spring stretched xx metres beyond its natural length pulls back with force kxkx (Hooke's law, valid for small xx). The force needed to hold it there is f(x)=kxf(x) = kx, so stretching it from aa to bb takes

W=∫abkx dx=k2(b2−a2)W = \int_a^b kx\,dx = \frac{k}{2}(b^2 - a^2)

Example. A force of 30 N stretches a spring 0.12 m. Then k=30/0.12=250 N/mk = 30/0.12 = 250\ \text{N/m}. Stretching it from 0.12 m to 0.30 m takes 125(0.09−0.0144)=9.45 J125(0.09 - 0.0144) = 9.45\ \text{J}. Note that the second 0.18 m costs far more than the first 0.12 m (1.8 J), because the force keeps growing.

Work from measured forces

A force sensor on a testing rig records the force at several positions; the work is the area under the force–displacement curve:

python · try it yourself
import numpy as np
from scipy.integrate import simpson, trapezoid

x = np.array([0.00, 0.02, 0.04, 0.06, 0.08, 0.10, 0.12])          # m
F = np.array([0.0, 41.0, 79.0, 112.0, 138.0, 152.0, 158.0])        # N (a stiffening-then-yielding part)
print(f"work (trapezoid) = {float(trapezoid(F, x=x)):.3f} J")
print(f"work (Simpson)   = {float(simpson(F, x=x)):.3f} J")
work (trapezoid) = 12.020 J
work (Simpson)   = 12.080 J

Pumping problems: different distances, same idea

To empty a tank by pumping water over its top, each thin layer of water travels a different distance. Slice the liquid into horizontal layers of thickness Δy\Delta y: for a layer at height yy,

volume≈A(y)⋅Δy,mass=ρ⋅A(y)⋅Δy,force=ρg⋅A(y)⋅Δy,distance=(outlet height−y)W=∫ρg⋅A(y)⋅(outlet height−y) dy\begin{aligned} &\text{volume} \approx A(y) \cdot \Delta y, \quad \text{mass} = \rho \cdot A(y) \cdot \Delta y, \quad \text{force} = \rho g \cdot A(y) \cdot \Delta y, \quad \text{distance} = (\text{outlet height} - y) \\ &W = \int \rho g \cdot A(y) \cdot (\text{outlet height} - y)\,dy \end{aligned}

with ρ=1000 kg/m3\rho = 1000\ \text{kg/m}^3 for water and g=9.8 m/s2g = 9.8\ \text{m/s}^2.

Example. A tank is an inverted cone (vertex down) of height 4 m and top radius 2 m, filled to a depth of 3 m. Water is pumped out over the rim. At height yy above the vertex, the radius is y/2y/2 (similar triangles), so A(y)=π(y/2)2A(y) = \pi(y/2)^2, and the layer rises 4−y4 - y:

python · try it yourself
import sympy as sp

y = sp.symbols('y', nonnegative=True)
rho, g = 1000, sp.Rational(98, 10)
A = sp.pi * (y / 2)**2
W = sp.integrate(rho * g * A * (4 - y), (y, 0, 3))
print("W =", sp.nsimplify(W), "J ≈", round(float(W) / 1000, 2), "kJ")

# Sanity check: all the water lifted from the height of its centre of mass
V = sp.integrate(A, (y, 0, 3))
y_bar = sp.integrate(y * A, (y, 0, 3)) / V
print("water volume =", V, " centre of mass at y =", y_bar)
print("ρ g V (4 - y_bar) =", sp.nsimplify(rho * g * V * (4 - y_bar)))
W = 77175*pi/2 J ≈ 121.23 kJ
water volume = 9*pi/4  centre of mass at y = 9/4
ρ g V (4 - y_bar) = 77175*pi/2

The check uses a useful fact: the work to lift a body equals its weight times the distance its centre of mass rises. Both routes give the same number.

Escaping a planet

Gravity weakens with distance: a mass mm at distance rr from the centre of a planet of mass MM feels force GMmr2\frac{GMm}{r^2}. Lifting it from the surface (r=Rr = R) to infinitely far away takes

W=∫R∞GMmr2 dr=lim⁡b→∞[−GMmr]Rb=GMmRW = \int_R^{\infty} \frac{GMm}{r^2}\,dr = \lim_{b \to \infty} \Big[-\frac{GMm}{r}\Big]_R^b = \frac{GMm}{R}

an improper integral with a finite value. Setting this equal to the kinetic energy 12mv2\frac{1}{2}mv^2 gives the escape velocity v=2GM/Rv = \sqrt{2GM/R}:

python · try it yourself
import math
from scipy.integrate import quad

G, M, R = 6.674e-11, 5.972e24, 6.371e6        # SI units, Earth
m = 1.0                                        # per kilogram
W_formula = G * M * m / R
W_numeric, _ = quad(lambda r: G * M * m / r**2, R, math.inf)
print(f"work per kg: {W_formula:.4e} J (formula), {W_numeric:.4e} J (quad)")
print(f"escape velocity ≈ {math.sqrt(2 * G * M / R) / 1000:.2f} km/s")
work per kg: 6.2560e+07 J (formula), 6.2560e+07 J (quad)
escape velocity ≈ 11.19 km/s

In software

  • Physics engines and the work-energy theorem. The work done by all forces equals the change in kinetic energy. Engines monitor total energy to detect integrator drift: an explicit Euler integrator adds energy to a spring system each step (the oscillation grows), while symplectic integrators keep it bounded (Game Physics).
  • Energy metering. Electrical energy is the integral of power over time (∫P dt\int P\,dt); smart meters and battery fuel gauges integrate sampled power just as the force-sensor example integrated force.
  • Line integrals. When the force and the path are both vectors, work becomes ∫F⋅dr\int \mathbf{F} \cdot d\mathbf{r}, a line integral, the basis of potential energy in games and robotics.

Exercises

Exercise 1: A spring

A spring has natural length 20 cm. A force of 40 N holds it at 25 cm. How much work stretches it from 25 cm to 30 cm?

Answer

3 J.

Solution
k=40/0.05=800 N/mW=∫0.050.10800x dx=400(0.01−0.0025)=3 J\begin{aligned} k &= 40 / 0.05 = 800\ \text{N/m} \\ W &= \int_{0.05}^{0.10} 800x\,dx = 400(0.01 - 0.0025) = 3\ \text{J} \end{aligned}

Exercise 2: Lifting a chain

A 10 m chain with mass 2 kg/m hangs from the top of a building. How much work pulls it all up to the top?

Answer

980 J.

Solution

A piece of length Δy\Delta y at depth yy weighs 2⋅9.8⋅Δy N2 \cdot 9.8 \cdot \Delta y\ \text{N} and rises y my\ \text{m}: W=∫01019.6y dy=19.6⋅50=980 JW = \int_0^{10} 19.6y\,dy = 19.6 \cdot 50 = 980\ \text{J}. Check: weight 196 N, centre of mass rises 5 m.

Exercise 3: Pumping a cylinder

A cylindrical tank of radius 1 m and height 5 m is full of water. Find the work to pump all of it over the top.

Answer

122 500π J≈384.8 kJ122\,500\pi\ \text{J} \approx 384.8\ \text{kJ}.

Solution
W=∫051000⋅9.8⋅π⋅12⋅(5−y) dy=9800π⋅[5y−y22]05=9800π⋅12.5=122 500πW = \int_0^5 1000 \cdot 9.8 \cdot \pi \cdot 1^2 \cdot (5 - y)\,dy = 9800\pi \cdot \Big[5y - \frac{y^2}{2}\Big]_0^5 = 9800\pi \cdot 12.5 = 122\,500\pi
python · try it yourself
import math
from scipy.integrate import quad
W = quad(lambda y: 1000 * 9.8 * math.pi * (5 - y), 0, 5)[0]
print(round(W / 1000, 1), "kJ")
384.8 kJ

Exercise 4: Halfway to infinity

What fraction of the escape energy GMmR\frac{GMm}{R} is needed to lift a mass from the surface to r=2Rr = 2R?

Answer

One half.

Solution

∫R2RGMmr2 dr=GMm(1R−12R)=GMm2R\int_R^{2R} \frac{GMm}{r^2}\,dr = GMm\Big(\frac{1}{R} - \frac{1}{2R}\Big) = \frac{GMm}{2R}.

Test yourself

For a spring with constant kk, the work to stretch it from 0 to dd is…

  1. kdkd
  2. kd2kd^2
  3. k/dk/d
  4. kd2/2kd^2/2

In a pumping problem, why do we slice horizontally?

  1. It is a convention
  2. The tank is always a cylinder
  3. All water in a thin horizontal layer travels the same distance
  4. To avoid improper integrals

Why is the work to escape Earth's gravity finite even though the distance is infinite?

  1. The force decays like 1/r21/r^2, whose integral to infinity converges
  2. Gravity stops at the atmosphere
  3. Escape velocity is infinite
  4. It is not finite