Work is done on an object when energy is transferred to the object. In other words, work is done when a force acts on a body that undergoes a displacement from one position to another. By definition, the work done by a force is the integral of the force with respect to the displacement along its path. Forces can vary as a function of position, and displacements can occur along various paths between two points. The magnitude of a force multiplied by the cosine of the angle that the force makes with a given direction is the component of the force in that direction.
The components of a vector can be positive, negative, or zero, depending on whether the angle between the vector and the component direction is between 0° and 90°, 90° and 180°, or equal to 90°, respectively. As a result, the work done by a force can be positive, negative, or zero, depending on whether the force is generally in the direction of the displacement, opposite to the displacement, or perpendicular to the displacement, respectively. The maximum work is done by a given force when it is along the direction of the displacement.