\subsection{Work as a Line Integral}

This subsection develops work from the local relation between force and an infinitesimal displacement. In AP mechanics, this gives a clean calculus-based way to handle variable forces and to track when a force helps, opposes, or does no work on the motion.

\dfn{Infinitesimal work and total work along a path}{Let a particle move along a path $C$. Let $d\vec{r}$ denote an infinitesimal displacement vector of the particle, let $ds=|d\vec{r}|$ denote the corresponding infinitesimal path length, and let $\vec{F}$ denote the force acting on the particle at that location.

The \emph{infinitesimal work} done by the force during that displacement is
\[
dW=\vec{F}\cdot d\vec{r}.
\]

If $\hat{t}$ denotes the unit tangent to the path and $F_{\parallel}=\vec{F}\cdot \hat{t}$ denotes the component of the force parallel to the motion, then
\[
dW=F_{\parallel}\,ds.
\]

Therefore the \emph{total work} done by the force as the particle moves along the path $C$ is
\[
W=\int_C \vec{F}\cdot d\vec{r}=\int_C F_{\parallel}\,ds.
\]}

This definition of work is the foundation for the work-energy theorem (Section 3.2) and the potential-energy formalism (Section 3.3).

\thm{Line-integral form of work and the constant-force special case}{Let a particle move from an initial point to a final point along a path $C$ under a force $\vec{F}$. Then the work done by that force is
\[
W=\int_C \vec{F}\cdot d\vec{r}.
\]
Only the component of $\vec{F}$ parallel to the instantaneous displacement contributes, so equivalently
\[
W=\int_C F_{\parallel}\,ds.
\]

If the force is constant in magnitude and direction, then
\[
W=\vec{F}\cdot \Delta \vec{r},
\]
where $\Delta \vec{r}$ is the total displacement from the initial point to the final point. In particular, if the motion is along a straight line parallel to the constant force, then
\[
W=F\,\Delta s.
\]}

\nt{Work is positive when the force has a component in the same direction as the displacement, negative when that component is opposite the displacement, and zero when the force is perpendicular to the displacement. For a general force, the value of $W=\int_C \vec{F}\cdot d\vec{r}$ can depend on the path $C$, not just on the endpoints. In AP problems, this often appears when the force changes with position or when different paths make the parallel component $F_{\parallel}$ different. Typical zero-work cases include a normal force on motion along a surface or a centripetal force in uniform circular motion, because those forces are perpendicular to the instantaneous displacement.}

\wc{Holding something still does no work}{If you hold a heavy object stationary, you expend biological energy but do \emph{zero mechanical work} because $\Delta\vec{r}=\vec{0}$. Work requires both a force \emph{and} a displacement along that force: $W=\int\vec{F}\cdot d\vec{r}$.}

\pf{Why the line integral gives total work}{Break the path into many small displacement vectors $\Delta \vec{r}_1,\Delta \vec{r}_2,\dots,\Delta \vec{r}_n$. Over each small segment, the work is approximately
\[
\Delta W_k\approx \vec{F}_k\cdot \Delta \vec{r}_k.
\]
Summing over the path gives
\[
W\approx \sum_{k=1}^n \vec{F}_k\cdot \Delta \vec{r}_k.
\]
In the limit as the segments become infinitesimal, this Riemann sum becomes
\[
W=\int_C \vec{F}\cdot d\vec{r}.
\]
If $\vec{F}$ is constant, then it can be taken outside the integral:
\[
W=\vec{F}\cdot \int_C d\vec{r}=\vec{F}\cdot \Delta \vec{r}.
\]}

\qs{Worked example}{A cart moves along a straight horizontal track from $x_i=0$ to $x_f=5.0\,\mathrm{m}$. Let $x$ denote the cart's position coordinate, and let the applied force on the cart be
\[
\vec{F}(x)=(6.0-2.0x)\hat{\imath}\,\mathrm{N}.
\]
Find the work done by this force on the cart over the interval from $x=0$ to $x=5.0\,\mathrm{m}$. State where the force does negative work.}

\sol Because the motion is along the $x$-axis, the displacement element is
\[
d\vec{r}=dx\,\hat{\imath}.
\]
Therefore,
\[
dW=\vec{F}\cdot d\vec{r}=[(6.0-2.0x)\hat{\imath}]\cdot (dx\,\hat{\imath})=(6.0-2.0x)\,dx.
\]
So the total work is
\[
W=\int_0^{5.0} (6.0-2.0x)\,dx.
\]
Evaluate the integral:
\[
W=\left[6.0x-x^2\right]_0^{5.0}.
\]
Substitute the limits:
\[
W=(6.0)(5.0)-(5.0)^2-\left[(6.0)(0)-0^2\right]=30.0-25.0=5.0\,\mathrm{J}.
\]
Thus the force does
\[
5.0\,\mathrm{J}
\]
of net work on the cart.

To identify where the force does negative work, find where the force component along the motion becomes negative:
\[
6.0-2.0x<0.
\]
This occurs when
\[
x>3.0\,\mathrm{m}.
\]
So from $x=3.0\,\mathrm{m}$ to $x=5.0\,\mathrm{m}$, the force points opposite the displacement and does negative work. From $x=0$ to $x=3.0\,\mathrm{m}$, it does positive work.
