The formula for relative motion is
Relative velocity = Velocity of object A with respect to a stationary frame - Velocity of object B with respect to the same stationary frame
This formula gives the relative velocity between two objects A and B, moving in the same or opposite directions, with respect to a stationary reference frame. It is important to note that the reference frame must be the same for both objects in order to use this formula. If the objects are moving in different reference frames, the relative motion must be calculated separately for each frame.