5. Find the lengths of the segments determined on the axis by points $A(2)$ and $B(-5), C(-2)$ and $D(4)$. The first point denotes the beginning of the segment, and the second - its end.
Solution. Applying formula (1), we get:

$$
A B=-5-2=-7 ; C D=4-(-2)=6
$$