37. Find the minimum value of the function $\varphi(x)=|x-a|+|x-b|+$ $+|x-c|+|x-d|$, where $a<b<c<d$ are fixed real numbers, and $x$ takes arbitrary real values.

Hint. It is convenient to reason by marking the numbers $a, b, c, d$ on the number line.
37. We divide the number line by points $a, b, c, d$ into intervals and compute the value of $\varphi(x)$ on each interval. Let the number $x$ correspond to the point $M$.
a) $x \leqslant a, \varphi(x)=M A+M B+M C+M D=4 M A+3 A B+2 B C+C D$

The last three terms are constant, only the length $M A$ varies. $\varphi(x)$ takes the smallest value when $M$ coincides with $A$,

$$
\varphi(x)=3 A B+2 B C+C D
$$

b) $a \leqslant x \leqslant b, \varphi(x)=A M+M B+M C+M D=2 M B+A B+2 B C+C D$.

The last three terms are constant in magnitude. The smallest value $\varphi(x)=$ $=A B+2 B C+C D$ is obtained when $M$ coincides with $B$.

c) $b \leqslant x \leqslant c, \varphi(x)=A M+B M+M C+M D=A B+2 B C+C D$.

This is a constant value.

d) $c \leqslant x \leqslant d, \varphi(x)=M A+M B+M C+M D=2 C M+A B+2 B C+C D$.

The smallest value of the sum is obtained when $M$ coincides with $C$.

e) $x \geqslant d, \varphi(x)=M A+M B+M C+M D=4 D M+A B+2 B C+3 C D$.

The smallest value of the sum is obtained when $M$ coincides with $D$. Comparing the obtained results, we see that the smallest value

$\varphi(x)=A B+2 B C+C D=b-a+2(c-b)+d-c=d+c-b-a$ is achieved when $b \leqslant x \leqslant c$.