Home » Blog » Solve the differential equation y′ + y tan x = sin (2x) for given initial values

Solve the differential equation y′ + y tan x = sin (2x) for given initial values

Solve the following differential equation:

    \[ y' + y \tan x = \sin (2x) \qquad \text{on} \qquad \left( -\frac{1}{2} \pi, \frac{1}{2} \pi \right) \]

with y = 2 when x = 0.


From Theorem 8.3 (page 310 of Apostol) we know that a differential equation of the form

    \[ y' + P(x)y = Q(x), \qquad \text{with} \quad f(a) = b, \]

on an interval I has solution given by

    \[ f(x) = be^{-A(x)} + e^{-A(x)} \int_a^x Q(t)e^{A(t)} \, dt \]

where

    \[ A(x) = \int_a^x P(t) \, dt. \]

In this particular case we apply the theorem with

    \[ P(x) = \tan x, \qquad Q(x) = \sin (2x), \qquad a = 0, \ b = 2. \]

This gives us

    \[ A(x) = \int_0^x \tan t \, dt = - \log (\cos x). \]

Therefore,

    \begin{align*}  f(x) &= be^{-A(x)} + e^{-A(x)} \int_a^x Q(t)e^{A(t)} \, dt \\[9pt]  &= 2 \cos x + \cos x \cdot \int_0^x \frac{\sin (2t)}{\cos t} \, dt \\[9pt]  &= 2 \cos x + \cos x \cdot \int_0^x 2 \sin t \, dt \\[9pt]  &= 2 \cos x + 2 \cos x (- \cos x + 1) \\[9pt]  &= 4 \cos x - 2 \cos^2 x. \end{align*}

Point out an error, ask a question, offer an alternative solution (to use Latex type [latexpage] at the top of your comment):