Example 1 Given $\sin x + \cos x = \frac{1}{5}$, and $0 \leqslant x < \pi$. Then the value of $\tan x$ is $\qquad$
(1993, Sichuan Province High School Mathematics Competition)
Solution: Since $\sin x + \cos x = 2 \cdot \frac{1}{10}$, then $\sin x$, $\frac{1}{10}$, and $\cos x$ form an arithmetic sequence. Therefore, we set
$$
\left\{\begin{array}{l}
\sin x = \frac{1}{10} - d, \\
\cos x = \frac{1}{10} + d.
\end{array}\right.
$$

where $-\frac{7}{10} \leqslant d \leqslant \frac{1}{10}$.
Substituting (1) and (2) into $\sin^2 x + \cos^2 x = 1$, we get
$$
\left(\frac{1}{10} - d\right)^2 + \left(\frac{1}{10} + d\right)^2 = 1.
$$

Solving for $d$, we get $d = -\frac{7}{10}$.
Substituting into (1) and (2), we get
$$
\sin x = \frac{4}{5}, \cos x = -\frac{3}{5}.
$$

Therefore, $\operatorname{tg} x = -\frac{4}{3}$.