Sub topic 9
Work done by a variable force
This chapter assumes you can compute work for a constant force with W = F d cos θ and can evaluate a simple definite integral such as ∫x² dx. It also assumes you know what kinetic energy is and how the work-energy theorem, W_net = ΔK, links work to speed. If any of these is shaky, review the earlier chapters first.
Why the constant-force formula stops working
W = F d cos θ has a hidden assumption. It uses one value of F for the whole displacement. Many real forces do not behave that way:
- A spring pulls harder the more you stretch it.
- Gravity weakens as a rocket climbs away from Earth.
- A person pushing a crate may push harder at the start and ease off later.
- Air drag grows with speed, so it changes as an object accelerates.
If you plug a single "typical" force into W = F d, you get an answer only when you chose that typical value correctly. The fix is to split the path into pieces short enough that the force is almost constant on each piece. Then add up the pieces.
From slices to an integral
Consider a force that points along the x-axis and depends on position, F(x). Move the object from x = a to x = b. Divide the path into many small steps of width Δx. On one step, the force is nearly constant, so the work is approximately
ΔW ≈ F(x) Δx
Add the steps and let Δx shrink toward zero:
W = ∫ from a to b of F(x) dx
Here F(x) is the component of force along the direction of motion. If the force makes an angle with the path, the integrand is F cos θ, where both F and θ may change along the way. The result is still a number in joules.
Two readings of this formula are worth keeping:
- Algebraic reading. Find an antiderivative of F(x) and evaluate it at the endpoints.
- Geometric reading. The work equals the area between the F-versus-x curve and the x-axis, between a and b.
The geometric reading is why a constant force gives W = F d. The area under a flat line is a rectangle with height F and width d.
Worked example 1: a polynomial force
A force F(x) = 3x² (in newtons, with x in meters) pushes an object along the x-axis from x = 0 to x = 2 m.
W = ∫ from 0 to 2 of 3x² dx = [x³] from 0 to 2 = 8 − 0 = 8 J
Compare this with the shortcut of using the force at the end, F(2) = 12 N, over 2 m. That gives 24 J, three times too large. The force starts at zero and grows quickly, so most of the displacement happens at low force. Using the final value overestimates the work.
Worked example 2: area under a graph
A force rises linearly from 0 N at x = 0 to 20 N at x = 4 m, then stays at 20 N until x = 10 m. The area has two parts:
- Triangle from 0 to 4 m: ½ × 4 × 20 = 40 J
- Rectangle from 4 to 10 m: 6 × 20 = 120 J
Total work: 160 J.
For a straight-line force, the average force is the mean of the endpoint values. For the first segment that is (0 + 20)/2 = 10 N, and 10 N × 4 m = 40 J, which matches the triangle. This shortcut works only when the force changes linearly with position. For F = 3x² above, the mean of the endpoint forces is (0 + 12)/2 = 6 N, which gives 12 J instead of 8 J.
Signed area: when the force changes direction
The integral counts area above the x-axis as positive work and area below as negative work. Below the axis means the force component points opposite to the +x direction.
Take F(x) = 8 − 4x (newtons) from x = 0 to x = 3 m. The force is +8 N at the start, drops to zero at x = 2 m, and is −4 N at x = 3 m.
- From 0 to 2 m: ∫(8 − 4x) dx = [8x − 2x²] = 16 − 8 = +8 J
- From 2 to 3 m: the antiderivative at 3 is 24 − 18 = 6, and at 2 it is 8, so the work is 6 − 8 = −2 J
- Total: +8 − 2 = +6 J
If you want the total area as a geometric size, you would add the absolute values, 10. That is not the work. Work is the signed sum, 6 J.
Numerical integration
When F(x) comes from a measurement, or when its antiderivative is awkward, approximate the integral. The trapezoid rule treats the curve on each small step as a straight line and adds up the trapezoid areas. This is the same "average of endpoint forces times width" idea, applied only to short steps where it is accurate.
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 spring force is linear, so the trapezoid rule is exact here. Try the function on the examples above:
def work_numeric(force_fn, a, b, n=1000):
h = (b - a) / n
return sum(
(force_fn(a + i * h) + force_fn(a + (i + 1) * h)) / 2 * h
for i in range(n)
)
print(round(work_numeric(lambda x: 3 * x**2, 0.0, 2.0), 3)) # 8.0 (approximately; curved force)
print(round(work_numeric(lambda x: 8 - 4 * x, 0.0, 3.0), 3)) # 6.0 (exact; linear force)For the curved force 3x², the trapezoid rule overestimates slightly, because a straight chord lies above a curve that bends upward. With n = 1000 the error is tiny (about 0.00002 J) and disappears when rounded to three places. With n = 4 it would be noticeable. Increase n and watch the result converge on 8.
Working from a table of measurements
Suppose you pull a cart with a force sensor and record these readings:
| Position x (m) | Force F (N) |
|---|---|
| 0.0 | 0 |
| 0.5 | 12 |
| 1.0 | 20 |
| 1.5 | 24 |
| 2.0 | 25 |
The positions need not be evenly spaced. Apply the trapezoid rule to each interval using its own width:
xs = [0.0, 0.5, 1.0, 1.5, 2.0]
fs = [0.0, 12.0, 20.0, 24.0, 25.0]
work = sum(
(fs[i] + fs[i + 1]) / 2 * (xs[i + 1] - xs[i])
for i in range(len(xs) - 1)
)
print(work) # 34.25The result is 34.25 J. The sensor gives no information between readings, so this is an estimate, and its accuracy depends on how smoothly the force varies between points.
Connecting to kinetic energy
The work-energy theorem holds for variable forces too. The net work, however it is computed, equals the change in kinetic energy. This is often the quickest way to find a speed when the force changes during the motion. Kinematics with v² = v₀² + 2ad needs a constant acceleration, so it cannot be used here.
A 2.0 kg block starts at rest on a frictionless surface. A force F(x) = 6x (N) pushes it from x = 0 to x = 3 m.
- Work: W = ∫ 6x dx from 0 to 3 = 3x² evaluated from 0 to 3 = 27 J
- Work-energy theorem: 27 = ½(2.0)v² − 0, so v² = 27 and v ≈ 5.2 m/s
import math
def work_numeric(force_fn, a, b, n=1000):
h = (b - a) / n
return sum(
(force_fn(a + i * h) + force_fn(a + (i + 1) * h)) / 2 * h
for i in range(n)
)
m = 2.0
w = work_numeric(lambda x: 6 * x, 0.0, 3.0)
v = math.sqrt(2 * w / m) # starts from rest
print(round(w, 3), round(v, 2)) # 27.0 5.2If friction or other forces also act, include their work in the net work. For instance, a constant friction force of 4 N opposing the motion does −4 × 3 = −12 J, so the net work becomes 15 J and the speed drops to √15 ≈ 3.87 m/s.
Edge cases and common errors
- Force depends on time, not position. If you are given F(t), you cannot integrate F dx directly. Either find x(t) and convert, or use the power relation: W = ∫ F v dt. Treating t as if it were x gives a number with the wrong meaning.
- Reversing direction. If an object moves forward and then backward through the same positions under a force that depends only on position, the forward and backward contributions cancel. Net work over the round trip is zero. Integrating from b to a gives the negative of integrating from a to b. This pattern is the signature of conservative forces, such as springs and gravity.
- Friction is different. Friction depends on the direction of motion, not only on position. It opposes the motion on the way out and on the way back, so its work adds up as negative both times and does not cancel.
- Only the component along the path counts. If a force of constant size pulls at a changing angle, the integrand is F cos θ(x), not F.
- Units. Convert centimeters to meters and kilonewtons to newtons before integrating. A common slip is using x = 10 cm as 10 in a formula like ½kx² with k in N/m. Use 0.10 m.
- Evaluating at the wrong point. The integral is not F(b) × (b − a), and it is not F(a) × (b − a).
- Mixing signs when you add areas. Regions below the axis subtract. Check whether your graph crosses zero.
- Numerical step size. If the force changes sharply, a coarse grid can miss the change. Halve the step size and check whether the answer moves. If it does, keep refining.
Summary of the method
- Identify the force component along the displacement, as a function of position.
- Set the limits a and b from the start and end positions.
- Integrate, find the area, or sum numerically.
- Keep the sign: positive area is positive work and negative area is negative work.
- Check units, then use the result in W_net = ΔK if you need a speed.
Exercise
A force F(x) = 2x + 1 (N, with x in m) acts on a 0.50 kg cart that starts at rest at x = 0. What is the cart's speed at x = 4 m? Assume no other horizontal forces.
Show answer
W = ∫ from 0 to 4 of (2x + 1) dx = [x² + x] from 0 to 4 = 16 + 4 = 20 J. Starting from rest, W = ½mv², so 20 = ½(0.50)v², which gives v² = 80 and v ≈ 8.9 m/s.
Exercise
A force measured along a path is 0 N at x = 0, 10 N at x = 2 m, and 10 N at x = 5 m, with the force rising linearly on the first section and constant on the second. Find the work done from x = 0 to x = 5 m. Then say why using the average of the endpoint forces (5 N) over 5 m gives the wrong answer.
Show answer
Triangle from 0 to 2 m: ½ × 2 × 10 = 10 J. Rectangle from 2 to 5 m: 3 × 10 = 30 J. Total: 40 J. The endpoint average is 5 N, and 5 × 5 = 25 J, which is wrong because the force is not linear over the whole path. It rises for the first part and is flat afterward, so the shortcut applies only within each linear section.
Exercise
A force F(x) = 12 − 3x (N) acts along the x-axis. Find the work from x = 0 to x = 6 m, and explain what the sign of the result tells you about the two parts of the motion.
Show answer
W = ∫ from 0 to 6 of (12 − 3x) dx = [12x − 1.5x²] from 0 to 6 = 72 − 54 = 18 J. The force is zero at x = 4 m. From 0 to 4 m the work is 48 − 24 = +24 J. From 4 to 6 m the work is 18 − 24 = −6 J. The positive part is larger, so the net work is +18 J. The object gains kinetic energy on the first part and loses some of it on the second.