Problem 4 If
$$
f(x)=|x-a|-|x-b|(a<b) \text {, }
$$

find the minimum value of this function.
Solution 1 (Geometric Method): By the geometric meaning of absolute value, the value of $|x-a|-|x-b|$ can be regarded as the difference in distances from point $x$ to points $a$ and $b$ on the number line. Therefore,
$$
f(x)_{\text {min }}=a-b, f(x)_{\text {max }}=-a+b .
$$

Solution 2 (Algebraic Method): Remove the absolute value and convert to a piecewise function to find the maximum and minimum values. It is easy to get,
$$
f(x)=\left\{\begin{array}{ll}
a-b, & x \leqslant a ; \\
2 x-a-b, & a < x < b ; \\
-a+b, & x \geqslant b .
\end{array}\right.
$$

By solving each segment,
When $x \leqslant a$, $f(x)_{\text {min }}=a-b$:
When $x \geqslant b$, $f(x)_{\text {max }}=-a+b$.