Example Solve the following initial value problem..

$\displaystyle y^{\prime\prime} + y = \sec{x}$

Answer The characteristic equation is $m^{2} + 1 = 0$. Then the characteristic roots are $m = \pm i$. Thus, the complementary solution is given by

$\displaystyle y_{c} = c_{1}\cos{x} + c_{2}\sin{x} $

. We next find the particular solution $y_{p}$. Using the method called variation of parameter, we let

$\displaystyle y_{p} = u_{1}\cos{x} + u_{2}\sin{x}. $

Then

$\displaystyle u_{1}^{\prime} = \frac{-\sin{x}\sec{x}}{\left\vert\begin{array}{r...
...begin{array}{rr}
\cos{x}&\sin{x} \\
-\sin{x}&\cos{x}
\end{array}\right\vert}. $

From this, we have

$\displaystyle u_{1}^{\prime} = -\sin{x}\frac{1}{\cos{x}} = -\tan{x},\ u_{2}^{\prime} = \cos{x}\frac{1}{\cos{x}} = 1$

Integrate this, we get

$\displaystyle u_{1} = \log{\vert\cos{x}\vert} , \ u_{2} = x \ $

Thus, we have the general solution.

$\displaystyle y = y_{c} + y_{p} = c_{1}\cos{x} + c_{2}\sin{x} + (\log{\vert\cos{x}\vert})\cos{x} + x\sin{x} $

Now applying the initial conditions $y(0) = 0, y'(0) = 1$, we get $1 = c_{1}, 1 = c_{2}$ and

$\displaystyle y = \cos{x} + \sin{x} + (\log{\vert\cos{x}\vert})\cos{x} + x\sin{x}$