Example 5. Integrate the linear equation

$$
y^{\prime}-y \operatorname{th} x=\frac{1}{2}
$$
Solution. We apply the method of variation of arbitrary constant. First, we solve the linear homogeneous equation

$$
\begin{gathered}
y^{\prime}-y \operatorname{th} x=0 \\
\frac{d y}{y}=\operatorname{th} x d x, \ln y=\int \operatorname{th} x d x=\ln \operatorname{ch} x+\ln C \\
y=C \operatorname{ch} x
\end{gathered}
$$

We seek the solution of the non-homogeneous equation in the form

$$
y=C(x) \operatorname{ch} x
$$

Differentiating, we find

$$
y^{\prime}=C^{\prime}(x) \operatorname{ch} x+C(x) \operatorname{sh} x
$$

Substituting (C) and (D) into equation (A), we get:

$$
\begin{gathered}
C^{\prime}(x) \operatorname{ch} x+C(x) \operatorname{sh} x-C(x) \operatorname{ch}(x) \text { th }(x)=\frac{1}{2} \\
C^{\prime}(x) \operatorname{ch} x=\frac{1}{2}, C^{\prime}(x)=\frac{1}{2 \operatorname{ch} x}
\end{gathered}
$$

from which

$$
C(x)=\frac{1}{2} \int \frac{1}{\operatorname{ch} x} d x=\int \frac{1}{e^{x}+e^{-x}} d x=\int \frac{e^{x}}{e^{2 x}+1} d x
$$

Performing the substitution

$$
e^{x}=t, e^{x} d x=d t
$$

we find

$$
\int \frac{e^{x}}{e^{2 x}+1} d x=\int \frac{d t}{1+t^{2}}=\operatorname{arctg} t=\operatorname{arctg} e^{x}+C
$$

Thus,

$$
C(x)=\operatorname{arctg} e^{x}+C
$$

Substituting (E) into (C), we get

$$
y=\operatorname{ch} x\left[\operatorname{arctg} e^{x}+C\right]
$$