7.2 Constant and Variable Forces
The Spring That Fights Back
[Video: A close-up of a spring attached to a wall. A hand slowly pulls the free end to the right. At first the spring barely resists --- the hand moves easily. But as the spring stretches further, the resistance grows. The hand has to work visibly harder. A force sensor attached to the hand displays the force in real time: 2 N, then 5 N, then 10 N, then 20 N. The camera cuts to a graph of force versus position being drawn in real time --- a straight line climbing steadily from the origin. A narrator says: "The further you stretch, the harder the spring pulls back. The force is not constant --- it depends on where you are."]
In Section 7.1, you learned to compute work as $W = Fd\cos\theta$. That formula is clean, powerful, and --- as it turns out --- limited. It works only when the force has the same magnitude and direction the entire time the object is moving. For a constant push across a flat floor, that is fine.
But watch the spring. At the beginning of the stretch, the force you exert is small. By the end, it is large. The force changes at every point along the way. If you want the total work you did, you cannot just take the final force and multiply by the distance --- that would overcount. And you cannot just take the initial force, because that would undercount. The force is different at every position, so you need to add up contributions from every position.
You have seen this idea before. In Section 2.3, you needed to find displacement from a velocity that changed with time. You could not multiply velocity by time when the velocity was different at every instant. You had to integrate --- accumulate the velocity bit by bit. The same logic applies here, and it leads to the same mathematical tool.
Before you read on: A spring is stretched from its natural length to a distance $x$. The spring force grows linearly, reaching a maximum value $F_{\max}$ at the endpoint. Is the work done by the applied force more than, less than, or equal to $F_{\max} \cdot x$?
Commit to an answer before continuing.
Quick Recall: Work for Constant Forces
Before we generalize, make sure the foundation from Section 7.1 is solid.
Recall prompt: What is the definition of work done by a constant force? What does the cosine factor do, physically? And when is the work negative?
If those feel fuzzy, revisit Section 7.1. Everything in this section builds on that definition and extends it.
Exploration: Stretching a Spring
[Interactive: Spring Work Explorer. A spring is anchored on the left side of the screen. The student drags the free end to the right, stretching the spring from $x = 0$ to any desired extension. Two panels update in real time:
- Top panel: A force-versus-position graph. As the student drags, a data point appears at each position, and a line connects them. For the default linear spring ($F = kx$), the graph is a straight line rising from the origin. The area under the curve fills in with blue shading as the student stretches further.
- Bottom panel: A numerical readout showing the current position $x$, the current force $F(x)$, and the total work done so far (computed as the shaded area). A dashed horizontal line at the current force value extends back to $x = 0$, forming a rectangle. The rectangle's area ($F_{\text{current}} \cdot x$) is displayed alongside the actual shaded area.
Guided prompts: - "Stretch the spring to $x = 0.2$ m. Compare the shaded area (actual work) to the rectangle area ($F_{\text{current}} \cdot x$). Which is larger?" - "Stretch to $x = 0.4$ m. The rectangle area uses the final force for the entire distance. Why does this overestimate the work?" - "Now switch the force model to 'constant force' using the dropdown. Stretch to any position. What shape is the shaded area now? Does the rectangle agree with it?" - "Switch back to the spring. What geometric shape is the shaded area under the line $F = kx$? Can you compute it without calculus?"]
Here is what you should notice. For a constant force, the force-versus-position graph is a horizontal line. The area under it is a rectangle: base times height, which is $F \cdot d$. That is exactly the work formula from Section 7.1.
For the spring, the force-versus-position graph is a line that rises from zero. The area under it is a triangle, not a rectangle. The triangle's area is $\frac{1}{2} \cdot \text{base} \cdot \text{height} = \frac{1}{2} x \cdot F_{\max}$. That is less than the rectangle $F_{\max} \cdot x$.
The rectangle overestimates because it pretends the force was at its maximum value for the entire stretch. But in reality, the force started at zero and built up gradually. The triangle captures what actually happened.
Pause and think: If the force-versus-position graph were a curve that bowed upward (like $F = kx^2$), would the area be more or less than the triangle?
From Rectangles to Integrals: The Same Idea, Three Ways
The key insight is that work is the area under the force-versus-position curve. Let's see why this is true, and why it leads directly to an integral.
Way 1: Discrete accumulation
Suppose the force is not constant, but you break the total displacement into many tiny pieces. Over a tiny displacement $\Delta x$, the force is approximately constant --- it does not change much over such a small distance. The work done during that tiny piece is approximately:
$$\Delta W \approx F(x) \cdot \Delta x$$
The total work is the sum of all these tiny contributions:
$$W \approx \sum F(x_i) \cdot \Delta x_i$$
This is the same Riemann-sum reasoning you used in Section 2.3 to find displacement from a changing velocity. There, you summed $v(t_i) \cdot \Delta t_i$. Here, you sum $F(x_i) \cdot \Delta x_i$. The structure is identical --- only the labels on the axes have changed.
Way 2: Graphical area
Each term $F(x_i) \cdot \Delta x_i$ is the area of a thin rectangle on the $F$-vs-$x$ graph: height $F(x_i)$, width $\Delta x_i$. The sum of all these rectangles approximates the total area under the curve. As the rectangles get thinner ($\Delta x \to 0$), the approximation becomes exact.
Way 3: The integral
Taking the limit as $\Delta x \to 0$ turns the sum into an integral:
$$\boxed{W = \int_{x_i}^{x_f} F(x) \, dx}$$
This is the general definition of work for a force that varies with position along a straight-line path. The integral accumulates the force over every infinitesimal displacement from the initial position $x_i$ to the final position $x_f$.
Three representations. One idea. The discrete sum, the graphical area, and the integral are not three different concepts --- they are three descriptions of the same accumulation process.
The General Formula
For a force that may vary in both magnitude and direction along a curved path, the fully general definition of work is:
$$W = \int_{\text{path}} \vec{F} \cdot d\vec{r}$$
This is a line integral. The dot product $\vec{F} \cdot d\vec{r}$ selects the component of force along the direction of motion at each point, and the integral accumulates these contributions over the entire path.
For the cases in this course, we will most often work in one dimension, where the formula simplifies to:
$$W = \int_{x_i}^{x_f} F(x) \, dx$$
And here is the important point: the constant-force formula is a special case. If $F$ is constant, you can pull it out of the integral:
$$W = \int_{x_i}^{x_f} F \, dx = F \int_{x_i}^{x_f} dx = F(x_f - x_i) = Fd$$
That is $W = Fd$ from Section 7.1. The integral reduces to multiplication when the integrand is constant --- just as it did in Section 2.2 when constant acceleration made $v(t) = v_0 + at$ a simple formula instead of an integral.
The integral formula is the general tool. The multiplication formula is the easy version. You have not lost anything from Section 7.1. You have gained a framework that handles every case, including the ones where multiplication fails.
Worked Example: Work Done on a Spring
A spring has spring constant $k = 200$ N/m. You stretch it from its natural length ($x = 0$) to an extension of $x = 0.3$ m. How much work do you do?
Setting up the physics
The spring exerts a restoring force $F_{\text{spring}} = -kx$ (Hooke's law). The minus sign indicates that the spring pulls back toward equilibrium. But you are applying a force to stretch it, so the force you exert is $F_{\text{applied}} = +kx$ (equal and opposite to the spring's force, assuming a slow, quasi-static stretch with negligible acceleration).
Computing the work
$$W = \int_0^{0.3} kx \, dx = k \int_0^{0.3} x \, dx = 200 \cdot \frac{x^2}{2}\Big|_0^{0.3}$$
$$W = 200 \cdot \frac{(0.3)^2}{2} = 200 \cdot \frac{0.09}{2} = 200 \cdot 0.045 = 9.0 \text{ J}$$
Sanity check
The maximum force is $F_{\max} = kx = 200 \times 0.3 = 60$ N. The overestimate $F_{\max} \cdot x = 60 \times 0.3 = 18$ J. Our answer of 9.0 J is exactly half of that. This makes sense: the $F$-vs-$x$ graph is a triangle, and a triangle has half the area of the enclosing rectangle. The factor of $\frac{1}{2}$ in $W = \frac{1}{2}kx^2$ is the geometric signature of a linearly increasing force.
Faded Example: Work Done by a Position-Dependent Force
A force $F(x) = 6x^2$ (in newtons, with $x$ in meters) acts on an object as it moves from $x = 1$ m to $x = 3$ m. Find the work done.
Step 1: Write the integral.
$$W = \int_1^3 F(x) \, dx = \int_1^3 6x^2 \, dx$$
Step 2: Evaluate.
Your turn: What is the antiderivative of $6x^2$? Evaluate the definite integral.
Check your answer
The antiderivative of $6x^2$ is $6 \cdot \frac{x^3}{3} = 2x^3$. $$W = 2x^3 \Big|_1^3 = 2(27) - 2(1) = 54 - 2 = 52 \text{ J}$$Step 3: Sanity check.
Your turn: The force at $x = 1$ m is 6 N. The force at $x = 3$ m is 54 N. The distance is 2 m. Is the answer of 52 J consistent with these values? Would $F_{\max} \cdot d = 54 \times 2 = 108$ J be an overestimate or underestimate?
Check your answer
The product $F_{\max} \cdot d = 108$ J is an overestimate because the force was not 54 N for the entire distance --- it started at 6 N and grew. The average force must be somewhere between 6 N and 54 N. In fact, $W / d = 52 / 2 = 26$ N, which is the effective average force over the interval. This lies between the endpoint values, as expected.Returning to the Prediction
At the start, you were asked whether the work done stretching a spring from $0$ to $x$ is more than, less than, or equal to $F_{\max} \cdot x$.
You now have the full answer. The work is:
$$W = \int_0^x kx' \, dx' = \frac{1}{2}kx^2 = \frac{1}{2}F_{\max} \cdot x$$
The work is exactly half of $F_{\max} \cdot x$. The product $F_{\max} \cdot x$ overestimates by a factor of two because it treats the maximum force as if it acted over the entire stretch. In reality, the force started at zero and built up linearly. The integral accounts for this buildup; simple multiplication does not.
[Video: Animation of the force-versus-position graph for a spring. A rectangle with height $F_{\max}$ and width $x$ is drawn, representing the overestimate. The triangle underneath the $F = kx$ line is shaded, representing the actual work. The triangle is exactly half the rectangle. A narrator says: "The integral gives you the area under the curve --- the triangle. Multiplication gives you the whole rectangle. When the force varies, only the integral tells the truth."]
Connection: Integration as Accumulation --- Again
This is not a new mathematical idea. It is the same idea you met in Section 2.3, wearing different clothes.
| Section 2.3 | Section 7.2 |
|---|---|
| Velocity $v(t)$ varies with time | Force $F(x)$ varies with position |
| Displacement $= \int v(t) \, dt$ | Work $= \int F(x) \, dx$ |
| Area under the $v$-vs-$t$ curve | Area under the $F$-vs-$x$ curve |
| Constant velocity: $\Delta x = v \cdot t$ (rectangle) | Constant force: $W = F \cdot d$ (rectangle) |
| Variable velocity: must integrate | Variable force: must integrate |
The physical quantities are different --- displacement versus work, velocity versus force --- but the mathematical structure is identical. In both cases, you are accumulating a quantity that changes along the way. In both cases, the integral is the tool that handles the variation. And in both cases, the simple multiplication formula is the special case where the integrand happens to be constant.
If you are comfortable with the idea that $\int v(t) \, dt$ gives displacement when velocity varies, then $\int F(x) \, dx$ giving work when force varies should feel like a natural extension. The integral is not a new trick. It is the same trick applied to a new situation.
Worked Example: Work from a Force Graph
Not every problem hands you a formula for $F(x)$. Sometimes you are given a graph of force versus position and asked to find the work. The strategy is the same: work is the area under the curve.
Problem: A force acts on an object as it moves from $x = 0$ to $x = 6$ m. The $F$-vs-$x$ graph is shown below:
- From $x = 0$ to $x = 2$ m: $F = 10$ N (constant).
- From $x = 2$ to $x = 4$ m: $F$ decreases linearly from 10 N to 0 N.
- From $x = 4$ to $x = 6$ m: $F = 0$ N.
Solution:
Break the area into regions:
- Region 1 ($0$ to $2$ m): A rectangle. Area $= 10 \times 2 = 20$ J.
- Region 2 ($2$ to $4$ m): A triangle. Area $= \frac{1}{2} \times 2 \times 10 = 10$ J.
- Region 3 ($4$ to $6$ m): No force, no area. Work $= 0$ J.
Total work: $W = 20 + 10 + 0 = 30$ J.
No calculus was needed here --- just geometry. Rectangles and triangles are enough when the graph is made of straight-line segments. This is exactly how you found displacement from piecewise-linear velocity graphs in Section 2.4.
Pause and think: What if the force were negative in Region 3 (say, $F = -5$ N from $x = 4$ to $x = 6$ m)? How would you handle the area below the axis?
Check your answer
Area below the $x$-axis counts as **negative work**. The rectangle below the axis has area $5 \times 2 = 10$, but because the force is negative, the work in that region is $-10$ J. The total work would be $20 + 10 + (-10) = 20$ J. Negative area means the force is opposing the motion, taking energy away from the object rather than adding it.Practice
Layer 1: Concrete
A spring with spring constant $k = 400$ N/m is compressed from its natural length by 0.15 m.
(a) Write the integral that gives the work done by the applied force during the compression.
(b) Evaluate the integral.
(c) If the spring were compressed twice as far (0.30 m), would the work be twice as large?
Check your answer
**(a)** When compressing the spring, the applied force acts in the negative $x$ direction. Taking the displacement from $x = 0$ to $x = -0.15$ m, the applied force magnitude is $F = k|x|$, and the work is: $$W = \int_0^{0.15} kx \, dx$$ (Here we use the magnitude of compression and treat the work as positive, since the applied force is in the direction of displacement.) **(b)** $W = 400 \cdot \frac{x^2}{2}\Big|_0^{0.15} = 400 \cdot \frac{0.0225}{2} = 400 \cdot 0.01125 = 4.5$ J. **(c)** At 0.30 m: $W = \frac{1}{2}(400)(0.30)^2 = \frac{1}{2}(400)(0.09) = 18$ J. This is **four times** the work, not twice. Doubling the compression quadruples the work because $W \propto x^2$. The relationship is quadratic, not linear.Layer 2: Pattern
A force $F(x)$ acts on an object moving from $x = 0$ to $x = 8$ m. The $F$-vs-$x$ graph consists of straight-line segments:
- From $x = 0$ to $x = 3$ m: $F$ increases linearly from 0 to 12 N.
- From $x = 3$ to $x = 5$ m: $F = 12$ N (constant).
- From $x = 5$ to $x = 8$ m: $F$ decreases linearly from 12 N to 0 N.
(a) Find the work done in each segment.
(b) Find the total work.
(c) What would the work be if the force were constant at 12 N for the entire 8 m? By what factor does the varying force reduce the work compared to this constant-force case?
Check your answer
**(a)** - Segment 1 (triangle): $W_1 = \frac{1}{2}(3)(12) = 18$ J. - Segment 2 (rectangle): $W_2 = (12)(2) = 24$ J. - Segment 3 (triangle): $W_3 = \frac{1}{2}(3)(12) = 18$ J. **(b)** Total: $W = 18 + 24 + 18 = 60$ J. **(c)** Constant force: $W_{\text{const}} = 12 \times 8 = 96$ J. The ratio is $60 / 96 = 0.625$. The varying force does about 63% of the work that the maximum constant force would do. The "missing" work corresponds to the corners of the rectangle that lie above the trapezoidal graph.Layer 3: Structure
Why does the work done by a spring force depend on $x^2$ rather than $x$?
Check your answer
The spring force is $F = kx$ --- it is proportional to $x$ (first power). When you integrate a first-power function to find the area under the curve, the result is a second-power function: $$W = \int_0^x kx' \, dx' = \frac{1}{2}kx^2$$ The $x^2$ comes directly from the integration. Physically, this makes sense: as you stretch the spring further, not only are you covering more distance, but the force at every new position is also larger. Both the force and the distance are growing, so the work grows faster than either one alone. It is the product of a growing force over a growing distance, and that double-growth produces a quadratic relationship. Compare this to a constant force $F$, where the work is $W = Fx$. Only the distance grows; the force stays the same. That gives a linear relationship. The spring's quadratic dependence is the mathematical consequence of a linearly increasing force. More generally, if $F(x) = cx^n$, then $W = \int_0^x cx'^n \, dx' = \frac{c}{n+1}x^{n+1}$. The power in the work formula is always one higher than the power in the force formula, because integration raises the exponent by one. The spring is the $n = 1$ case.Layer 4: Transfer
In economics, the consumer surplus for a good is defined as the area between the demand curve $P(q)$ (price as a function of quantity) and the market price $P_0$, integrated from $q = 0$ to the equilibrium quantity $q^*$:
$$\text{Consumer surplus} = \int_0^{q^*} \bigl[P(q) - P_0\bigr] \, dq$$
How is the mathematical structure of consumer surplus the same as the mathematical structure of work? What plays the role of "force" and what plays the role of "displacement"?
Check your answer
The structural mapping is: | Physics (Work) | Economics (Consumer Surplus) | |:---|:---| | Force $F(x)$ | Price premium $P(q) - P_0$ | | Position $x$ | Quantity $q$ | | Work $= \int F(x) \, dx$ | Consumer surplus $= \int [P(q) - P_0] \, dq$ | | Area under the $F$-vs-$x$ curve | Area between the demand curve and the price line | | Force varies with position | Willingness to pay varies with quantity | In both cases, a quantity that varies along one axis is integrated over an interval on the other axis. The result is an accumulated total --- total energy transfer in physics, total benefit to consumers in economics. The parallel goes deeper. Just as using $F_{\max} \cdot d$ would overestimate the work done by a varying force, using the maximum willingness to pay for all units would overestimate the consumer surplus. In both cases, the integral is needed because the "rate" (force or price premium) changes along the way. This is the power of integration as a general concept: it is the universal tool for accumulating a quantity that varies continuously. The same mathematical structure appears across physics, economics, biology, engineering --- anywhere a changing rate must be totaled.Reflection
Think about what you learned in this section, then consider these questions.
What do "work by a constant force" and "work by a variable force" have in common?
In both cases, work is the accumulation of force over displacement. In both cases, it corresponds to the area under the $F$-vs-$x$ curve. The only difference is the shape of that area. For a constant force, the area is a rectangle and the integral collapses to multiplication. For a variable force, the area has a more complex shape and the integral must be evaluated explicitly. But the definition --- $W = \int F \, dx$ --- covers both cases simultaneously. The constant-force formula is not a separate idea. It is the easy special case of a single, general idea.
You might also reflect on this: how many times have you now seen the pattern "simple formula is a special case of an integral"? In Section 2.2, $\Delta x = v \cdot t$ was the special case of $\Delta x = \int v \, dt$. In Section 2.3, you saw the general integral version. Now, $W = Fd$ is the special case of $W = \int F \, dx$. The pattern will keep appearing because it is how physics grows --- from simple cases to general frameworks, connected by calculus.
Looking Ahead
You now know how to compute work for any force, whether constant or varying with position. The integral $W = \int F \, dx$ is the general tool, and the area under the force-versus-position curve is its visual representation.
But computing work is not the end goal --- it is the setup. The real payoff comes in the next section, where we ask: what does work accomplish? If a net force does work on an object, what changes about the object's motion?
The answer is the work-kinetic energy theorem: the net work done on an object equals the change in its kinetic energy. This theorem transforms the integral you just learned into a powerful shortcut. Instead of tracking forces and accelerations through every instant of motion, you will be able to connect the start and end of a process with a single equation. The calculus you practiced here --- integrating force over displacement --- is exactly what drives the derivation.