(N/A) force whose magnitude or direction (or both) changes with position is called a variable force. Constant forces are rare in nature; variable forces are more commonly encountered.
The figure shows a plot of a varying force $F(x)$ in one dimension versus displacement $x$.
If the displacement $\Delta x$ is very small,the force $F(x)$ can be considered approximately constant over this interval. The work done during this small displacement is equal to the area of the small rectangular strip,given by $\Delta W = F(x) \Delta x$.
The total work done is the sum of the areas of all such shaded rectangular strips from the initial position $x_i$ to the final position $x_f$,which is written as:
$W = \sum_{x_i}^{x_f} F(x) \Delta x$
If the displacement $\Delta x$ is allowed to approach zero,the number of terms in the sum increases without limit,and the sum approaches a definite value equal to the area under the curve.
Therefore,the work done over the whole path is:
$W = \lim_{\Delta x \rightarrow 0} \sum_{x_i}^{x_f} F(x) \Delta x$
$W = \int_{x_i}^{x_f} F(x) dx$
Thus,for a varying force,the work done can be expressed as the definite integral of the force with respect to displacement.