When several bodies move independently along the same line, time should be recorded from the same initial instant for all bodies and displacements measured from the same origin and in the same direction. This implies that a single clock and a single measuring tape should be used.
Consider two bodies A and B moving along the same straight line. At any instant their position coordinates are XA and XB, respectively. This implies that A is at a distance XA with respect to origin O and B is at a distance XB with respect to the same origin O. This implies that the distance is measured with respect to the fixed point O which is the origin. The relative position coordinate of B with respect to A is
XB/A = XB – XA. When both A and B are moving we take the distance at a particular instant. Differentiating relative distance XB/A with respect to time we get relative velocity VB/A. By differentiating we get VB/A = VB – VA.
Coming to the sign convention, regardless of the position of the origin O, with respect to the positions of A and B, a positive sign for XB/A means that B is to the right of A, and a negative sign means that B is to the left of A. A positive sign of VB/A means that when B is observed from A the motion of B is in the positive direction, i.e. rightward direction. A negative sign of VB/A means that when B is observed from A, the motion of B is in the negative direction, i.e. leftward direction.
This concept can be applied to determine the relative distance and relative velocity. Relative velocity is obtained by differentiating relative distance with respect to time.