AP · Physics C: Mechanics · Work by Variable Forces

Work by a Variable Force

15 min readUpdated November 30, 2026FreeAP Physics C: Mechanics, Work, Energy and Power

The work done by a force that changes along a path is the integral W=∫F⃗⋅dr⃗W = \displaystyle\int \vec{F} \cdot d\vec{r}: add up the dot product of the force with each small displacement. In one dimension this is ∫x1x2F(x) dx\displaystyle\int_{x_1}^{x_2} F(x)\,dx, the signed area under a force–position graph, and for a spring it gives the familiar 12kx2\tfrac{1}{2}kx^2.

Quick check

  1. A constant 5.0 N force pushes a box 3.0 m in the direction of the force. How much work does it do?Show answerHide answer

    W=Fd=(5.0)(3.0)=15W = Fd = (5.0)(3.0) = 15 J.

  2. Evaluate ∫023x2 dx\displaystyle\int_0^2 3x^2\,dx.Show answerHide answer

    [x3]02=8\left[x^3\right]_0^2 = 8.

  3. A spring pulls harder the more you stretch it. Is the work to stretch it 2 cm the same for the first 2 cm and the next 2 cm?Show answerHide answer

    No. The force is larger during the second 2 cm, so more work is needed.

Know these already? Jump to the practice questions

What you'll be able to do

  • Calculate the work done by a force given as a function of position by integrating.
  • Use the dot product to find work from force and displacement vectors.
  • Derive the work done on and by a spring, including 12kx2\tfrac{1}{2}kx^2.
  • Determine work as the signed area under a force–position graph or table.

Key terms

Work

The energy transferred to an object by a force acting over a displacement: W=∫F⃗⋅dr⃗W = \int \vec{F}\cdot d\vec{r}, in joules. It is positive when the force has a component along the displacement and negative when the component is opposite.

In plain English
How much a force adds to, or takes from, an object's energy as it moves.
Don't write
"Work is force times distance" for a force that changes or is at an angle.

Dot product

The scalar A⃗⋅B⃗=∣A⃗∣∣B⃗∣cos⁡θ=AxBx+AyBy+AzBz\vec{A}\cdot\vec{B} = |\vec{A}||\vec{B}|\cos\theta = A_xB_x + A_yB_y + A_zB_z, where θ\theta is the angle between the vectors.

In plain English
Multiply the parts of two vectors that point the same way.
Don't write
"The dot product of two vectors is a vector."

Why is work an integral?

For a constant force along a straight path, W=Fdcos⁡θW = Fd\cos\theta (see the AP® Physics 1 note on work and the work-energy theorem). When the force changes with position, no single value of FF works for the whole path. So:

  1. Split the path into tiny displacements dr⃗d\vec{r}, each so small that the force is nearly constant over it.
  2. The work over one piece is F⃗⋅dr⃗\vec{F}\cdot d\vec{r}.
  3. Add all the pieces, which in the limit is an integral:
W=∫r⃗1r⃗2F⃗⋅dr⃗(on the AP® Physics C: Mechanics equation sheet)W = \int_{\vec{r}_1}^{\vec{r}_2} \vec{F}\cdot d\vec{r} \qquad \text{(on the AP® Physics C: Mechanics equation sheet)}

For motion along the xx-axis with force component F(x)F(x), this becomes W=∫x1x2F(x) dxW = \displaystyle\int_{x_1}^{x_2} F(x)\,dx. The limits run from the start to the end of the motion, so moving in the −x-x direction reverses the limits and the sign.

Key idea

Work by a variable force is ∫F dx\int F\,dx, never the final force times the distance.

Check yourself

The force on an object is F=(2.0 N/m) xF = (2.0\ \text{N/m})\,x. How much work does it do from x=0x = 0 to x=3.0x = 3.0 m?
Show answerHide answer

∫03.02.0x dx=[x2]03.0=9.0\int_0^{3.0} 2.0x\,dx = \left[x^2\right]_0^{3.0} = 9.0 J.

How does the dot product decide the sign of the work?

The dot product keeps only the part of the force along the displacement (the rule is Learn this):

F⃗⋅d⃗=∣F⃗∣∣d⃗∣cos⁡θ=Fx Δx+Fy Δy\vec{F}\cdot\vec{d} = |\vec{F}||\vec{d}|\cos\theta = F_x\,\Delta x + F_y\,\Delta y
Angle between force and displacementcos⁡θ\cos\thetaWork
0≤θ<90°0 \le \theta < 90°positivepositive: energy in
90°90°0zero
90°<θ≤180°90° < \theta \le 180°negativenegative: energy out

So a force perpendicular to the motion does no work. The normal force on a block sliding on a level floor and the tension in a string whirling a ball in a circle both do zero work.

The component form needs no angle: multiply matching components and add.

Check yourself

A constant force F⃗=(3.0 i^+4.0 j^)\vec{F} = (3.0\,\hat{i} + 4.0\,\hat{j}) N acts during a displacement d⃗=(2.0 i^−1.0 j^)\vec{d} = (2.0\,\hat{i} - 1.0\,\hat{j}) m. How much work does it do?
Show answerHide answer

W=(3.0)(2.0)+(4.0)(−1.0)=2.0W = (3.0)(2.0) + (4.0)(-1.0) = 2.0 J.

How do you find the work done by a spring?

Take xx as the stretch from the natural length, with stretch positive. The spring force is Fs=−kxF_s = -kx (on the sheet).

  1. Work done by the spring from x1x_1 to x2x_2: Ws=∫x1x2(−kx) dx=−12k(x22−x12)W_s = \displaystyle\int_{x_1}^{x_2} (-kx)\,dx = -\tfrac{1}{2}k\left(x_2^2 - x_1^2\right).
  2. To stretch the spring slowly, you pull with +kx+kx, so your work from 0 to xx is ∫0xkx′ dx′=12kx2\displaystyle\int_0^x kx'\,dx' = \tfrac{1}{2}kx^2.

That stored energy is Us=12kx2U_s = \tfrac{1}{2}kx^2 (on the sheet). The chain is: the force grows linearly with xx, so the force–position graph is a triangle, so the work is half of kx⋅xkx \cdot x.

Examiner's eye

Marks go to writing ∫(−kx) dx\int (-kx)\,dx with limits and showing the integration, not quoting 12kx2\tfrac{1}{2}kx^2 when a derivation is asked for.

Check yourself

A spring with k=50k = 50 N/m is stretched from 0 to 0.20 m. How much work does the spring do?
Show answerHide answer

Ws=−12(50)(0.20)2=−1.0W_s = -\tfrac{1}{2}(50)(0.20)^2 = -1.0 J: the spring takes energy from whatever stretches it.

How do you read work from a force–position graph?

Because W=∫F dxW = \int F\,dx, the work is the signed area between the FF–xx curve and the xx-axis:

  1. Area above the axis, moving in +x+x: positive work.
  2. Area below the axis, moving in +x+x: negative work.
  3. For a table of readings, assume the force changes linearly between readings and add trapezoids.

Combine the net work with the work-energy theorem, Wnet=ΔKW_{\text{net}} = \Delta K, to find a speed.

Check yourself

The force on a cart moving in +x+x is +3.0 N from x=0x = 0 to 2.0 m, then −3.0 N from 2.0 m to 3.0 m. What is the total work?
Show answerHide answer

6.0−3.0=3.06.0 - 3.0 = 3.0 J.

Worked example 1: Work by a force that depends on position

Question: A 2.0 kg object starts from rest at x=1.0x = 1.0 m on a frictionless horizontal surface. The net force on it is F(x)=(3.0 N/m2) x2F(x) = (3.0\ \text{N/m}^2)\,x^2 in the +x+x direction. Calculate (a) the work done by this force from x=1.0x = 1.0 m to x=3.0x = 3.0 m, to 2 significant figures, and (b) the object's speed at x=3.0x = 3.0 m, to 3 significant figures.

What tells you the method

The force depends on position: integrate it over xx.

  1. Step 1: Set up the integral.

    W=∫1.03.03.0x2 dxW = \displaystyle\int_{1.0}^{3.0} 3.0x^2\,dx.

    Why

    W=∫F dxW = \int F\,dx for motion along xx, with limits from start to end.

  2. Step 2: Evaluate.

    W=[x3]1.03.0=27−1.0=26W = \left[x^3\right]_{1.0}^{3.0} = 27 - 1.0 = 26 J.

    Why

    The antiderivative of 3.0x23.0x^2 is 1.0x31.0x^3.

  3. Step 3: Speed.

    12(2.0)v2=26\tfrac{1}{2}(2.0)v^2 = 26, so v=26=5.10v = \sqrt{26} = 5.10 m/s.

    Why

    The work-energy theorem: the net work equals the change in kinetic energy, and K0=0K_0 = 0.

Check it

The force runs from 3.0 N to 27 N over 2.0 m, so the work must lie between 3.0×2.0=6.03.0 \times 2.0 = 6.0 J and 27×2.0=5427 \times 2.0 = 54 J. 26 J does.

Answer

(a) 2626 J; (b) 5.105.10 m/s.

Worked example 2: Work from stretching data

Question: In a class investigation, students stretch an elastic band and record the force needed at each extension. Assume the force changes linearly between readings.

Extension (m)Force (N)
00
0.021.5
0.042.6
0.063.4
0.084.0
0.104.4

Calculate the work done stretching the band from 0 to 0.10 m, to 2 significant figures.

What tells you the method

Force against position: the work is the area under it.

  1. Step 1: Read the trend.

    The force rises with extension, but by less each step (1.5, 1.1, 0.8, 0.6, 0.4 N), so the band is not a linear spring.

    Why

    A spring with constant kk would add the same force each step, so 12kx2\tfrac{1}{2}kx^2 does not apply.

  2. Step 2: Add trapezoids.

    Each strip is 0.02 m wide: 0.02×(0.75+2.05+3.0+3.7+4.2)=0.02×13.7=0.2740.02 \times (0.75 + 2.05 + 3.0 + 3.7 + 4.2) = 0.02 \times 13.7 = 0.274 J.

    Why

    Each strip's area is its width times the mean of its two forces.

Check it

The area must lie between the triangle 12(0.10)(4.4)=0.22\tfrac{1}{2}(0.10)(4.4) = 0.22 J and the rectangle (0.10)(4.4)=0.44(0.10)(4.4) = 0.44 J. 0.274 J does; it is above the triangle because the data bow above the straight line from the origin to the last reading.

Answer

0.270.27 J.

Worked example 3: A block compressing a spring

Question: A 0.50 kg block slides at 3.0 m/s on a frictionless horizontal surface into a light spring with k=200k = 200 N/m. Take compression as positive xx. Determine (a) the work done by the spring on the block during the first 0.10 m of compression and (b) the maximum compression, each to 2 significant figures.

What tells you the method

The spring force depends on position: integrate it, then use the work-energy theorem.

  1. Step 1: Work by the spring.

    The spring pushes back with −kx-kx, so Ws=∫00.10(−200x) dx=−100(0.10)2=−1.0W_s = \displaystyle\int_0^{0.10} (-200x)\,dx = -100(0.10)^2 = -1.0 J.

    Why

    The spring force opposes the displacement, so its work is negative.

  2. Step 2: Maximum compression.

    The block stops when the spring's work equals −K0-K_0: −12kxmax⁡2=−12mv02-\tfrac{1}{2}kx_{\max}^2 = -\tfrac{1}{2}mv_0^2, so xmax⁡=v0mk=3.00.50200=0.15x_{\max} = v_0\sqrt{\dfrac{m}{k}} = 3.0\sqrt{\dfrac{0.50}{200}} = 0.15 m.

    Why

    The spring is the only force doing work, so Ws=ΔK=0−12mv02W_s = \Delta K = 0 - \tfrac{1}{2}mv_0^2.

Check it

K0=12(0.50)(3.0)2=2.25K_0 = \tfrac{1}{2}(0.50)(3.0)^2 = 2.25 J and 12(200)(0.15)2=2.25\tfrac{1}{2}(200)(0.15)^2 = 2.25 J. After 0.10 m the block keeps 2.25−1.0=1.252.25 - 1.0 = 1.25 J, so it is still moving, as it must be before 0.15 m.

Answer

(a) −1.0-1.0 J; (b) 0.150.15 m.

Your turn

Question: A spring with k=80k = 80 N/m is slowly stretched from 0.10 m to 0.30 m beyond its natural length. Calculate the work done by the person stretching it, in joules to 2 significant figures.

  1. Step 1: Set up.

    The person pulls with +kx+kx, so W=∫0.100.3080x dxW = \displaystyle\int_{0.10}^{0.30} 80x\,dx.

  2. Step 2: Your go: integrate and substitute the limits.

Show the full solutionHide the solution

Step 2. W=[40x2]0.100.30=40(0.090−0.010)=3.2W = \left[40x^2\right]_{0.10}^{0.30} = 40(0.090 - 0.010) = 3.2 J.

Answer: 3.23.2 J.

Traps

Trap

The work to stretch a spring from x1x_1 to x2x_2 is 12k(x2−x1)2\tfrac{1}{2}k(x_2 - x_1)^2.

It seems right because 12kx2\tfrac{1}{2}kx^2 uses the stretch. But that formula starts from the natural length; between two stretches the force is already large, so integrate: 12k(x22−x12)\tfrac{1}{2}k(x_2^2 - x_1^2).

In Your turn, what does 12k(x2−x1)2\tfrac{1}{2}k(x_2 - x_1)^2 give, and is it right?

12(80)(0.20)2=1.6\tfrac{1}{2}(80)(0.20)^2 = 1.6 J, which is wrong; the integral gives 3.2 J.

Trap

Any force acting on a moving object does work on it.

It seems right because the force and the motion happen together. But only the component along the displacement counts: a force perpendicular to the motion, such as the normal force on a level floor, does zero work.

A ball moves at constant speed on a horizontal circle on a string. How much work does the tension do in one revolution?

Zero. The tension is always perpendicular to the velocity, so F⃗⋅dr⃗=0\vec{F}\cdot d\vec{r} = 0 at every instant.

What's examined

On the AP® Physics C: Mechanics exam (Unit 3: Work, Energy and Power), work by a variable force can appear in multiple-choice and free-response questions. Expect to integrate a given F(x)F(x), derive spring work, take a dot product, find work as an area from a graph or data, and link it to kinetic energy.

Practice questions

  1. Recall A force F(x)F(x) acts on an object that moves along the xx-axis from x1x_1 to x2x_2. Which expression always gives the work done by the force?
  • A) ∫x1x2F(x) dx\displaystyle\int_{x_1}^{x_2} F(x)\,dx
  • B) F(x2) (x2−x1)F(x_2)\,(x_2 - x_1)
  • C) F(x2)−F(x1)F(x_2) - F(x_1)
  • D) 12[F(x1)+F(x2)](x2−x1)\tfrac{1}{2}\left[F(x_1) + F(x_2)\right](x_2 - x_1)
Show answer

Answer: A. Work is the integral of force over displacement.

Why the others are wrong:

  • B uses the final force for the whole path.
  • C is a change in force, not a work.
  • D is exact only when the force changes linearly with xx.
  1. Apply The net force on an object moving along the xx-axis is F(x)=(8.0 N/m) x−(2.0 N/m2) x2F(x) = (8.0\ \text{N/m})\,x - (2.0\ \text{N/m}^2)\,x^2. Calculate the work done by this force as the object moves from x=0x = 0 to x=3.0x = 3.0 m, in joules to 2 significant figures.
Show answer

Answer: 1818 J.

Marking points:

  • W=∫03.0(8.0x−2.0x2) dx=[4.0x2−2.03x3]03.0W = \int_0^{3.0} (8.0x - 2.0x^2)\,dx = \left[4.0x^2 - \tfrac{2.0}{3}x^3\right]_0^{3.0}.
  • W=36−18=18W = 36 - 18 = 18 J.
  1. Apply A constant force F⃗=(2.0 i^+3.0 j^)\vec{F} = (2.0\,\hat{i} + 3.0\,\hat{j}) N acts on an object during a displacement d⃗=(4.0 i^−2.0 j^)\vec{d} = (4.0\,\hat{i} - 2.0\,\hat{j}) m. How much work does the force do?
  • A) 16 J
  • B) 14 J
  • C) 2.0 J
  • D) 8.0 J
Show answer

Answer: C. W=(2.0)(4.0)+(3.0)(−2.0)=8.0−6.0=2.0W = (2.0)(4.0) + (3.0)(-2.0) = 8.0 - 6.0 = 2.0 J.

Why the others are wrong:

  • A multiplies the magnitudes, ∣F⃗∣∣d⃗∣|\vec{F}||\vec{d}|, and ignores the angle.
  • B drops the negative sign of the yy product.
  • D uses only the xx-components.

In a class investigation, a force sensor and a motion sensor record the net force on a 0.50 kg cart moving in the +x+x direction. The cart has a speed of 2.0 m/s at x=0x = 0. Assume the force changes linearly between readings. The table is for questions 4 and 5.

Position (m)Net force in +x+x (N)
04.0
1.04.0
2.00
3.0−2.0
4.0−2.0
  1. Exam-style Calculate the net work done on the cart from x=0x = 0 to x=4.0x = 4.0 m, in joules to 2 significant figures.
Show answer

Answer: 3.03.0 J.

Marking points:

  • Positive area: 4.0+2.0=6.04.0 + 2.0 = 6.0 J from 0 to 2.0 m.
  • Negative area: −1.0−2.0=−3.0-1.0 - 2.0 = -3.0 J from 2.0 m to 4.0 m.
  • Net work: 6.0−3.0=3.06.0 - 3.0 = 3.0 J.
  1. Exam-style What is the cart's speed at x=4.0x = 4.0 m?
  • A) 3.5 m/s
  • B) 4.0 m/s
  • C) 5.3 m/s
  • D) 6.3 m/s
Show answer

Answer: B. K0=12(0.50)(2.0)2=1.0K_0 = \tfrac{1}{2}(0.50)(2.0)^2 = 1.0 J, so K=1.0+3.0=4.0K = 1.0 + 3.0 = 4.0 J and v=2(4.0)/0.50=4.0v = \sqrt{2(4.0)/0.50} = 4.0 m/s.

Why the others are wrong:

  • A leaves out the starting kinetic energy.
  • C counts only the positive area.
  • D adds the negative area as if it were positive.
  1. Apply How does the work needed to stretch a spring from 0.20 m to 0.40 m compare with the work needed to stretch it from 0 to 0.20 m?
  • A) It is the same.
  • B) It is twice as much.
  • C) It is half as much.
  • D) It is three times as much.
Show answer

Answer: D. 12k(0.402−0.202)=12k(0.12)\tfrac{1}{2}k(0.40^2 - 0.20^2) = \tfrac{1}{2}k(0.12), three times 12k(0.04)\tfrac{1}{2}k(0.04).

Why the others are wrong:

  • A treats the spring force as constant.
  • B assumes the work is proportional to the stretch, not its square.
  • C reverses the comparison: the force is larger in the second interval.

Key points

Recall, then reveal

Say the main points from memory first, then check them.

Show key pointsHide key points
  • Work by a variable force is W=∫F⃗⋅dr⃗W = \int \vec{F}\cdot d\vec{r}; along a line, ∫F(x) dx\int F(x)\,dx.
  • The dot product keeps only the component along the motion: FxΔx+FyΔyF_x\Delta x + F_y\Delta y.
  • A spring does −12k(x22−x12)-\tfrac{1}{2}k(x_2^2 - x_1^2) of work; stretching it from rest length to xx takes 12kx2\tfrac{1}{2}kx^2.
  • Work is the signed area under a force–position graph; trapezoids handle data.
  • Net work equals the change in kinetic energy.

Keep learning

Explore AP Physics C: Mechanics tutoring →

View the full Physics C: Mechanics syllabus →

More in this unit

Work, Energy and Power

All Work by Variable Forces notes

Part of Novark's AP Physics C: Mechanics notes