The physics
A force does work when it moves something along its line. Only the part of the force along the motion counts.
W = F d cos θ W = F · d = Fxdx + Fydy
Work has a sign. A force along the motion does + work. A force against it does − work. A force at right angles does no work.
A force can change with x. Then the work is the area under the F–x graph. For a force that turns or grows, add up small pieces with an integral.
W = ∫ F dx in a field: W = ∫ F · dr along the road
Take a conservative force. Its work from A to B is the same on every road. Round a closed loop, it is zero. A swirling force is not conservative. Its work round a loop is not zero.
On a smooth track, the total work on a body becomes its kinetic energy. That is ½mv².