In short
When a force varies with position, the work done is W = \int_{x_1}^{x_2} F(x)\,dx — the area under the force–displacement graph. For a spring obeying Hooke's law (F = -kx), the work done by the spring as it stretches from 0 to x is -\frac{1}{2}kx^2, and the work done on the spring (to stretch it) is +\frac{1}{2}kx^2.
Stretch a rubber band between your fingers. Pull it a little — it resists gently. Pull it further — the resistance grows. The force the rubber band exerts on your fingers is not constant; it increases as you stretch it. If you want to know the total work you did to stretch it from relaxed to fully taut, you cannot use W = Fd — because there is no single F to plug in. The force was different at every point along the stretch.
This is the problem of variable forces, and it comes up everywhere in physics. A spring gets stiffer as you compress it. Gravity weakens as you move away from the Earth. The drag on a parachute increases as the parachute opens. In each case, the force changes with position, and you need a new way to compute work.
The solution is elegant: chop the displacement into tiny pieces, compute the work for each piece (where the force is approximately constant), and add them all up. In the limit of infinitely many infinitely small pieces, that sum becomes an integral.
From constant force to variable force
Recall the formula for work done by a constant force along a straight-line displacement:
Why: this is the special case of W = Fd\cos\theta with \theta = 0° — force and displacement in the same direction. For this article, focus on one-dimensional motion along the x-axis, where the force is along the direction of motion. The angle issues from the previous article still apply, but here the new idea is the varying magnitude.
When the force is constant, the work has a simple geometric interpretation: it is the area of a rectangle on a force–displacement graph. The height is F (constant), the width is d, and the area is F \times d = W.
Now suppose the force is not constant — it changes with position x. The force–displacement graph is no longer a flat line; it is a curve. The work is no longer a rectangle; it is the area under the curve.
Chopping the area into strips
How do you find the area under a curve? The same way you find the area of any irregular shape: approximate it with shapes whose area you know.
Divide the displacement from x_1 to x_2 into n small strips, each of width \Delta x = (x_2 - x_1)/n. Within each strip, the force does not change much (as long as the strip is narrow enough), so you can treat it as approximately constant — use the value of F at the left edge of the strip. The work done in that strip is approximately F(x_i) \cdot \Delta x, which is the area of one thin rectangle.
The total work is approximately the sum of all these rectangles:
Why: each thin rectangle approximates the area under the curve for that strip. The thinner the strips, the better the approximation — the rectangles hug the curve more closely.
Now take the limit. As n \to \infty and \Delta x \to 0, the sum becomes exact — the rectangles perfectly fill the area under the curve. That limit is the definite integral:
Why: the integral is not a new kind of mathematics — it is the old sum \sum F(x_i)\,\Delta x taken to the limit of infinitely many infinitely thin strips. The integral sign \int is an elongated "S" for "sum." The dx is the infinitesimally thin strip width.
This is the general formula for work done by a variable force along a straight line. It says: work is the area under the force–displacement curve. Positive area (force in the direction of motion) is positive work. Negative area (force opposing motion) is negative work.
The spring: the most important variable force
A spring obeys Hooke's law: the restoring force is proportional to the displacement from equilibrium and directed opposite to it.
Here k is the spring constant (in N/m) and x is the displacement from the natural length. The negative sign means the force opposes the displacement: stretch the spring (x > 0), and it pulls back (F < 0); compress it (x < 0), and it pushes out (F > 0).
Deriving the work done by a spring
Suppose you stretch a spring from its natural length (x = 0) to a displacement x. What work does the spring force do on the object attached to it?
Assumptions: The spring obeys Hooke's law (linear restoring force). The process is slow enough that the spring passes through equilibrium at each point (quasi-static). Friction is negligible.
Step 1. Write the spring force as a function of position.
Why: Hooke's law. At x = 0, the force is zero. At x = 0.1 m, the force is -0.1k — pulling back toward equilibrium. The magnitude grows linearly with displacement.
Step 2. Apply the integral formula.
Why: the force changes at every point, so you must integrate. The variable x' is the integration variable (dummy variable) to avoid confusion with the upper limit x.
Step 3. Evaluate the integral.
Why: the integral of x' is x'^2/2 — the power rule. Evaluating between 0 and x gives x^2/2 - 0 = x^2/2. The factor of -k out front comes from Hooke's law.
The negative sign is important: as you stretch the spring (x > 0), the spring force opposes the stretch, so the spring does negative work on the object. The work done by your hand to stretch it (against the spring force) is the opposite: +\frac{1}{2}kx^2. That is the elastic potential energy stored in the spring.
The geometry: a triangle on the F–x graph
The force–displacement graph of a spring (F = -kx) is a straight line through the origin. The work done to stretch the spring from 0 to x is the area of the triangle formed by the applied force line (F_{\text{applied}} = kx):
This geometric check is satisfying: the integral gives \frac{1}{2}kx^2, and the triangle area gives \frac{1}{2}kx^2. When the force–displacement graph is a straight line, the area is a triangle, and you do not need calculus — simple geometry suffices. Calculus becomes essential when the graph is a curve.
Explore the spring interactively
Drag the displacement in the figure below to see how the work stored in the spring grows quadratically — doubling the stretch quadruples the work.
The quadratic growth is the key feature. Stretch a spring twice as far and you store four times the energy. Compress it three times as far and you store nine times the energy. This is why a car's suspension springs, compressed to their limit by a pothole on a Delhi road, release a violent jolt — the energy scales as the square of the compression.
Work done by gravity at large distances
Near Earth's surface, you treat g as a constant (9.8 m/s²) and the work done by gravity over a height h is simply mgh. But gravity is not actually constant — it weakens with distance from Earth's centre according to Newton's law of gravitation:
where G is the gravitational constant, M is Earth's mass, m is the object's mass, and r is the distance from Earth's centre.
To find the work done by gravity as an object moves from distance r_1 to r_2 (both measured from Earth's centre), you must integrate. Taking the outward direction as positive, the gravitational force (directed inward) is:
Step 1. Set up the integral.
Why: the force is along the radial direction and varies as 1/r^2. This is exactly the kind of variable force that requires integration.
Step 2. Evaluate using the power rule (\int r^{-2}\,dr = -r^{-1}):
Why: the antiderivative of r^{-2} is -r^{-1}. Evaluating between limits and simplifying gives a result that depends only on the starting and ending distances — not on the path taken.
Step 3. Interpret the result.
If the object moves outward (r_2 > r_1), then 1/r_2 < 1/r_1, so W < 0 — gravity does negative work opposing the outward motion. If the object falls inward (r_2 < r_1), then W > 0 — gravity does positive work pulling it in.
Why: this is the foundation of gravitational potential energy. You will meet this formula again — rearranged as U = -GMm/r — when you study potential energy. The work–energy connection is the same: gravity's work equals the change in kinetic energy.
Connection to mgh
Near Earth's surface, where r_1 \approx R_E and r_2 = R_E + h with h \ll R_E:
So:
Why: GM/R_E^2 = g = 9.8 m/s². The integral formula reduces to the constant-gravity formula W = -mgh when the height change is small compared to Earth's radius (6400 km). The general formula and the school formula are the same physics at different scales.
This is the beauty of the integral approach: it gives you the exact answer for any height, and the familiar mgh is just the special case where you do not travel far from the surface. ISRO's Chandrayaan missions, which send spacecraft hundreds of thousands of kilometres from Earth, cannot use mgh — they need the full integral formula.
Only the component along displacement counts
So far, the examples have involved forces along the direction of motion. In general, a variable force can also change direction as the object moves along a curved path. The fully general formula for work is:
Here d\vec{s} is an infinitesimally small displacement vector along the path, and \vec{F} \cdot d\vec{s} = F\cos\theta\,ds at each point — the same dot product from the constant-force formula, but applied at every point along the path and then summed.
At each point, only the component of \vec{F} along the instantaneous direction of motion contributes to the work. The perpendicular component does not contribute — the same rule as before, but now applied continuously along a curve.
For the problems you will encounter in the JEE syllabus, three cases cover nearly everything:
- Force along x-axis, motion along x-axis: W = \int_{x_1}^{x_2} F(x)\,dx
- Gravity (constant direction) over a curved path: W = -mgh regardless of path shape, because only the vertical component of displacement matters
- Spring force along one axis: W = -\frac{1}{2}k(x_2^2 - x_1^2) for stretching from x_1 to x_2
Worked examples
Example 1: Stretching a bicycle brake cable
A bicycle brake cable behaves like a spring with spring constant k = 800 N/m. You pull the brake lever, stretching the cable from its natural length by 1.5 cm (0.015 m). How much work did you do?
Step 1. Identify the formula.
The cable obeys Hooke's law, so the work you do to stretch it from x = 0 to x is:
Why: your force opposes the spring's restoring force. The spring does work -\frac{1}{2}kx^2, so you do +\frac{1}{2}kx^2.
Step 2. Substitute the values.
Why: note how small this is — 0.09 J, about the energy of a small coin dropped from 10 cm height. Brake cables have high spring constants but tiny displacements, so the energy stored is modest.
Step 3. What force did you apply at maximum stretch?
Why: this is the force at the end of the stretch. At the beginning (x = 0), the force was zero. The average force over the stretch is F_{\text{avg}} = kx/2 = 6 N, and W = F_{\text{avg}} \times d = 6 \times 0.015 = 0.09 J — matching the integral result exactly.
Result: You did 0.09 J of work to stretch the brake cable by 1.5 cm. This energy is stored as elastic potential energy in the cable.
What this shows: Even a stiff spring stores very little energy when the displacement is small. The quadratic relationship means the first centimetre of stretch is cheap; the last centimetre (under a much larger force) is expensive.
Example 2: ISRO satellite reaching orbit
A 500 kg satellite is launched from Earth's surface (r_1 = R_E = 6.4 \times 10^6 m) to an altitude of 400 km (r_2 = 6.8 \times 10^6 m) — roughly the orbit of the International Space Station. How much work does gravity do on the satellite during this ascent? Take GM_E = 3.986 \times 10^{14} N·m²/kg.
Step 1. Apply the variable-gravity work formula.
Why: gravity varies as 1/r^2 over this distance — the satellite moves through 400 km, which is about 6% of Earth's radius. The variation in g is not negligible, so you must use the integral formula.
Step 2. Substitute values.
Why: the negative sign confirms that gravity opposes the upward motion. The rocket's engines must do at least this much positive work (plus more for kinetic energy and overcoming air resistance) to reach orbit.
Step 3. Compare with the constant-gravity approximation.
Why: the constant-gravity approximation overestimates the negative work by about 7%, because it assumes gravity stays at 9.8 m/s² the entire way up. In reality, gravity weakens as the satellite climbs, so it does slightly less negative work than mgh predicts.
Result: Gravity does approximately -1.83 \times 10^9 J of work on the satellite. The mgh approximation gives -1.96 \times 10^9 J — an overestimate of about 7%.
What this shows: For altitudes that are a small fraction of Earth's radius, mgh is a decent approximation. But for space missions, the exact integral matters — it tells ISRO's engineers exactly how much fuel the rocket needs.
Common confusions
-
"The integral is just fancy multiplication." Not quite. The integral reduces to multiplication (W = Fd) only when the force is constant. When the force changes, the integral sums infinitely many tiny contributions — each at a slightly different force value. The area interpretation makes this visible: a rectangle for constant force, a curved shape for variable force.
-
"The work done by a spring is \frac{1}{2}kx^2." Watch the sign. The work done by the spring on the object is -\frac{1}{2}kx^2 (negative, because the spring opposes the stretch). The work done on the spring by the external agent is +\frac{1}{2}kx^2. The signs are opposite because the forces are opposite.
-
"You need calculus for every variable-force problem." Not always. If the force–displacement graph is a triangle (linear force like a spring) or a trapezoid, you can find the area using geometry. Calculus is essential only when the curve has no simple geometric shape — like the 1/r^2 force of gravity.
-
"The area under the curve is always positive." The area is signed. If F(x) > 0 and the displacement is in the positive direction, the area (and work) is positive. If F(x) < 0 (force opposing motion), the area below the x-axis counts as negative. The integral handles this automatically.
-
"A constant force is not a special case of a variable force." It is. If F(x) = F_0 (constant), then \int_{x_1}^{x_2} F_0\,dx = F_0(x_2 - x_1) = F_0 \cdot d. The integral formula reduces to the rectangle formula. Every constant force is a variable force that happens not to vary.
If you can compute work using integrals for springs and gravity, and you understand the area interpretation, you have the tools you need for JEE problems. What follows is for readers who want the mathematical generalisations.
Work from arbitrary start to end
The spring formula W = -\frac{1}{2}kx^2 assumed the spring starts at its natural length (x_1 = 0). If the spring is already stretched to x_1 and you stretch it further to x_2:
Why: the integral of -kx from x_1 to x_2 gives -\frac{1}{2}k[x^2]_{x_1}^{x_2} = -\frac{1}{2}k(x_2^2 - x_1^2). The work depends on both the starting and ending positions, not just the displacement x_2 - x_1. This is because the force is position-dependent — the average force over the second centimetre of stretch is higher than over the first.
For example, stretching a spring from 0.1 m to 0.2 m takes more work than stretching it from 0 to 0.1 m — even though the displacement is the same 0.1 m — because the force is larger throughout the second stretch.
Path independence and conservative forces
The work done by gravity between two points is the same regardless of the path taken — straight up, along a winding road, or through a zigzag staircase. This makes gravity a conservative force. The integral \int \vec{F} \cdot d\vec{s} depends only on the endpoints, not on the path.
The spring force is also conservative. But friction is not — the work done by friction depends on the length of the path. A longer path means more negative work by friction, even if the start and end points are the same. This distinction between conservative and non-conservative forces is fundamental to the concept of potential energy, which you will study next.
The mathematical test: a force is conservative if and only if \oint \vec{F} \cdot d\vec{s} = 0 for every closed path. Equivalently, a force is conservative if it can be written as the negative gradient of a scalar function: \vec{F} = -\nabla U, where U is the potential energy.
The general work integral in components
In three dimensions, the work integral becomes:
This is a line integral — you integrate along the path the object actually follows. Each infinitesimal step d\vec{s} = dx\,\hat{i} + dy\,\hat{j} + dz\,\hat{k} has a different direction, and the dot product extracts the component of force along that direction.
For conservative forces, this line integral is path-independent and can be evaluated as a difference of potential energies: W = U(x_1) - U(x_2) = -\Delta U. For non-conservative forces (like friction), you must evaluate the integral along the actual path — there is no shortcut.
Where this leads next
- Kinetic Energy — the energy of motion, and its connection to the net work done on an object.
- Work-Energy Theorem — the formal proof that net work equals change in kinetic energy, derived from Newton's second law and the work integral.
- Potential Energy — how conservative forces (gravity, springs) store energy, and the connection W = -\Delta U.
- Conservation of Energy — the most powerful principle in physics, built directly on the work–energy framework.
- Spring Force — Hooke's law in depth, including the limits of linearity and what happens when springs are stretched too far.