2.1.21.1 Solved using first_order_ode_linear

Entering first order ode linear solver

\[\begin {aligned} x^{\prime }-x \tan \left (t \right )&=4 \sin \left (t \right ) \end {aligned}\]

In canonical form a linear first order is

\begin{align*} x^{\prime } + q(t)x &= p(t) \end{align*}

Comparing the above to the given ode shows that

\begin{align*} q(t) &=-\tan \left (t \right )\\ p(t) &=4 \sin \left (t \right ) \end{align*}

The integrating factor \(\mu \) is

\begin{align*} \mu &= e^{\int {q\,dt}}\\ &= {\mathrm e}^{\int -\tan \left (t \right )d t}\\ &= \cos \left (t \right ) \end{align*}

The ode becomes

\begin{gather*} \begin {aligned} \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}t}}\left ( \mu x\right ) &= \mu p \\ \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}t}}\left ( \mu x\right ) &= \left (\mu \right ) \left (4 \sin \left (t \right )\right )\\ \frac {\mathop {\mathrm {d}}}{ \mathop {\mathrm {d}t}} \left (x \cos \left (t \right )\right ) &= \left (\cos \left (t \right )\right ) \left (4 \sin \left (t \right )\right )\\ \mathrm {d} \left (x \cos \left (t \right )\right ) &= \left (4 \sin \left (t \right ) \cos \left (t \right )\right )\, \mathrm {d} t \end {aligned} \end{gather*}

Integrating gives

\begin{align*} x \cos \left (t \right )&= \int {4 \sin \left (t \right ) \cos \left (t \right ) \,dt} \\ &=2 \sin \left (t \right )^{2} + c_1 \end{align*}

Dividing throughout by the integrating factor \(\cos \left (t \right )\) gives the final solution

\[ x = \left (2 \sin \left (t \right )^{2}+c_1 \right ) \sec \left (t \right ) \]
Direction field with Isoclines Direction field

Summary of solutions found

\[ x = \left (2 \sin \left (t \right )^{2}+c_1 \right ) \sec \left (t \right ) \]