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:

W = F \cdot d

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.

Work as area under constant force curve A force-displacement graph showing a constant force F as a horizontal line. The area under the line from 0 to d is a shaded rectangle representing the work W = Fd. displacement x Force F F 0 d W = Fd
For a constant force, the work equals the area of the rectangle under the force–displacement line: height $F$ times width $d$.

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:

W \approx \sum_{i=1}^{n} F(x_i)\,\Delta x

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.

Approximating work by summing thin rectangular strips A force-displacement curve with the area underneath divided into 8 thin vertical rectangles. Each rectangle approximates the area under the curve for its strip of displacement. The sum of all rectangles approximates the total work. x F(x) x₁ x₂ Δx
Eight thin rectangles approximate the area under the force curve. Each rectangle has width $\Delta x$ and height $F(x_i)$. The sum of their areas approximates the total work. More rectangles give a better approximation.

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:

\boxed{W = \int_{x_1}^{x_2} F(x)\,dx}

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.

F_{\text{spring}} = -kx

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.

F(x) = -kx

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.

W_{\text{spring}} = \int_0^x F(x')\,dx' = \int_0^x (-kx')\,dx'

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.

W_{\text{spring}} = -k\int_0^x x'\,dx' = -k\left[\frac{x'^2}{2}\right]_0^x = -k \cdot \frac{x^2}{2}
\boxed{W_{\text{spring}} = -\frac{1}{2}kx^2}

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):

\text{Area} = \frac{1}{2} \times \text{base} \times \text{height} = \frac{1}{2} \times x \times kx = \frac{1}{2}kx^2
Work done on a spring: area of a triangle on the F-x graph A force-displacement graph for a spring showing the line F = kx (magnitude of applied force needed to stretch it). The triangular area under the line from 0 to x equals one-half k x squared, the work done by your hand to stretch the spring. displacement x Fapplied slope = k x kx W = ½kx² 0
The applied force needed to stretch the spring grows linearly: $F_{\text{applied}} = kx$. The work done is the area of the triangle: $\frac{1}{2} \times x \times kx = \frac{1}{2}kx^2$. Geometry and calculus give the same answer.

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.

Interactive: work done on a spring as a function of displacement A parabolic curve showing work W equals half k x squared versus displacement x, with k equals 200 N per m. A draggable point lets the reader explore different displacements. Doubling the displacement quadruples the work. displacement x (m) Work W (J) 0 10 20 30 40 50 0 0.1 0.2 0.3 0.4 0.5 W = ½kx² drag the red point along the axis
Drag the red point to change the displacement $x$. The spring constant is $k = 200$ N/m. Notice how the work grows as $x^2$: stretching to 0.2 m stores 2 J, but stretching to 0.4 m stores 8 J — four times as much. The bottom readout shows the ratio to the work at $x = 0.2$ m.

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:

F_{\text{gravity}} = \frac{GMm}{r^2}

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:

F(r) = -\frac{GMm}{r^2}

Step 1. Set up the integral.

W_{\text{gravity}} = \int_{r_1}^{r_2} \left(-\frac{GMm}{r^2}\right) dr = -GMm \int_{r_1}^{r_2} r^{-2}\,dr

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}):

W_{\text{gravity}} = -GMm \left[-\frac{1}{r}\right]_{r_1}^{r_2} = -GMm\left(-\frac{1}{r_2} + \frac{1}{r_1}\right) = GMm\left(\frac{1}{r_2} - \frac{1}{r_1}\right)

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.

\boxed{W_{\text{gravity}} = GMm\left(\frac{1}{r_2} - \frac{1}{r_1}\right)}

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:

\frac{1}{r_2} - \frac{1}{r_1} = \frac{1}{R_E + h} - \frac{1}{R_E} = \frac{R_E - (R_E + h)}{R_E(R_E + h)} \approx \frac{-h}{R_E^2}

So:

W_{\text{gravity}} \approx GMm \cdot \frac{-h}{R_E^2} = -\frac{GM}{R_E^2} \cdot mh = -mgh

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:

W = \int_{\text{path}} \vec{F} \cdot d\vec{s}

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:

  1. Force along x-axis, motion along x-axis: W = \int_{x_1}^{x_2} F(x)\,dx
  2. Gravity (constant direction) over a curved path: W = -mgh regardless of path shape, because only the vertical component of displacement matters
  3. 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?

Before and after: stretching a brake cable Left: cable at natural length, x equals 0, shown as a spring symbol. Right: cable stretched by 0.015 m, with a force arrow showing the applied force pulling the spring end. Before (natural length) x = 0 After (stretched 1.5 cm) F x = 0.015 m
The brake cable is stretched from its natural length (left) by 0.015 m (right). The spring symbol represents the elastic restoring force.

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:

W_{\text{you}} = \frac{1}{2}kx^2

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.

W = \frac{1}{2} \times 800 \times (0.015)^2 = 400 \times 0.000225 = 0.09 \text{ J}

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?

F = kx = 800 \times 0.015 = 12 \text{ N}

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.

Satellite moving from Earth surface to 400 km altitude A schematic showing Earth as a circle with a satellite at the surface labeled r1 equals 6400 km, and the same satellite at 400 km altitude labeled r2 equals 6800 km, with an arrow showing the outward displacement. Earth surface 400 km altitude r₁ r₂ r₁ = 6400 km r₂ = 6800 km
The satellite moves from Earth's surface ($r_1 = 6400$ km) to an altitude of 400 km ($r_2 = 6800$ km). Gravity opposes this outward motion, doing negative work.

Step 1. Apply the variable-gravity work formula.

W_{\text{gravity}} = GMm\left(\frac{1}{r_2} - \frac{1}{r_1}\right)

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.

W = 3.986 \times 10^{14} \times 500 \times \left(\frac{1}{6.8 \times 10^6} - \frac{1}{6.4 \times 10^6}\right)
\frac{1}{6.8 \times 10^6} - \frac{1}{6.4 \times 10^6} = \frac{6.4 - 6.8}{6.8 \times 6.4 \times 10^{12}} = \frac{-0.4}{43.52 \times 10^{12}} = -9.19 \times 10^{-15} \text{ m}^{-1}
W = 1.993 \times 10^{17} \times (-9.19 \times 10^{-15}) \approx -1.83 \times 10^{9} \text{ J}

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.

W_{\text{approx}} = -mgh = -500 \times 9.8 \times 4 \times 10^5 = -1.96 \times 10^9 \text{ J}

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

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:

W_{\text{spring}} = \int_{x_1}^{x_2} (-kx)\,dx = -\frac{1}{2}k\left(x_2^2 - x_1^2\right)

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:

W = \int_{\text{path}} \vec{F} \cdot d\vec{s} = \int_{\text{path}} (F_x\,dx + F_y\,dy + F_z\,dz)

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