Example 3. Solve the equation $y^{\prime \prime}+y=\frac{1}{\cos x}$.
Solution. The corresponding homogeneous equation will be $y^{\prime \prime}+y=0$. Its characteristic equation $\lambda^{2}+1=0$ has imaginary roots $\lambda_{1}=-i, \lambda_{2}=i$, and the general solution of the homogeneous equation is

$$
y_{0.0}=C_{1} \cos x+C_{2} \sin x
$$

The general solution of the original equation is sought in the form

$$
y=C_{1}(x) \cos x+C_{2}(x) \sin x
$$

where $C_{1}(x)$ and $C_{2}(x)$ are unknown functions of $x$. To find them, we form the system

$$
\left\{\begin{aligned}
\cos x \cdot C_{1}^{\prime}+\sin x \cdot C_{2}^{\prime}(x) & =0 \\
-\sin x \cdot C_{1}^{\prime}(x)+\cos x \cdot C_{2}^{\prime}(x) & =\frac{1}{\cos x}
\end{aligned}\right.
$$

Solving this system for $C_{1}^{\prime}(x)$ and $C_{2}^{\prime}(x)$:

$$
C_{1}^{\prime}(x)=-\operatorname{tg} x, \quad C_{2}^{\prime}(x)=1
$$

By integration, we find

$$
C_{1}(x)=\ln |\cos x|+\widetilde{C}_{1}, \quad C_{2}(x)=x+\widetilde{C}_{2}
$$

Substituting the expressions for $C_{1}(x)$ and $C_{2}(x)$ into (38), we obtain the general solution of the given equation

$$
y=\widetilde{C}_{1} \cos x+\widetilde{C}_{2} \sin x+\cos x \cdot \ln |\cos x|+x \sin x
$$

Here $\cos x \ln |\cos x|+x \sin x$ is a particular solution of the original non-homogeneous equation.