Differential Equations

Solve the differential equation $\;\;$ $\dfrac{dy}{dx} + 2\; y = \sin x$


The given differential equation is $\;\;$ $\dfrac{dy}{dx} + 2\; y = \sin x$ $\;\;\; \cdots \; (1)$

This is a linear differential equation in the form $\;$ $\dfrac{dy}{dx} + P\left(x\right)y = Q \left(x\right)$

Here $P \left(x\right) = 2$; $Q \left(x\right) = \sin x$ $\;\;\; \cdots \; (2)$

Integrating Factor (I.F) $= e^{\int P \left(x\right) \; dx}$

i.e. $\text{I.F} = e^{\int 2 \; dx} = e^{2x}$ $\;\;\; \cdots \; (3)$

According to the general solution,

$y \; e^{\int P \left(x\right) \; dx} = \displaystyle \int Q \left(x\right) \; e^{\int P \left(x\right) \; dx} \; dx$

$\therefore$ $\;$ In view of equations $(2)$ and $(3)$, the general solution of equation $(1)$ is

$y \; e^{2x} = \displaystyle \int \sin x \; e^{2x} \; dx$ $\;\;\; \cdots \; (4)$

$\begin{aligned} \text{Now } \int \sin x \; e^{2x} \; dx & = \sin x \int e^{2x} \; dx - \int \left\{\int e^{2x} \times \dfrac{d}{dx} \left(\sin x\right) \right\} \; dx \\\\ & = \dfrac{e^{2x} \; \sin x}{2} - \dfrac{1}{2} \int e^{2x} \; \cos x \; dx \\\\ & = \dfrac{e^{2x} \; \sin x}{2} - \dfrac{1}{2} \left[\cos x \int e^{2x} \; dx \right. \\ & \left. \hspace{4em} - \int \left\{\int e^{2x} \times \dfrac{d}{dx} \left(\cos x\right) \right\} \; dx\right] \\\\ & = \dfrac{e^{2x} \; \sin x}{2} - \dfrac{1}{2} \left[\dfrac{e^{2x} \; \cos x}{2} + \dfrac{1}{2} \int e^{2x} \; \sin x \; dx\right] \\\\ & = \dfrac{e^{2x} \; \sin x}{2} - \dfrac{e^{2x} \; \cos x}{4} - \dfrac{1}{4} \int e^{2x} \; \sin x \; dx + c \end{aligned}$

i.e. $\left(1 + \dfrac{1}{4}\right) \displaystyle \int \sin x \; e^{2x} \; dx = \dfrac{e^{2x}}{2} \left(\sin x - \dfrac{\cos x}{2}\right) + c$

i.e. $\displaystyle \int \sin x \; e^{2x} \; dx = \dfrac{2}{5} \; e^{2x} \left(\sin x - \dfrac{\cos x}{2}\right) + c$

i.e. $\displaystyle \int \sin x \; e^{2x} \; dx = \dfrac{e^{2x} \left(2 \sin x - \cos x\right)}{5} + c$ $\;\;\; \cdots \; (5)$

$\therefore$ $\;$ In view of equation $(5)$, equation $(4)$ becomes

$y \; e^{2x} = \dfrac{e^{2x} \left(2 \sin x - \cos x\right)}{5} + c$

i.e. $y = \dfrac{1}{5} \left(2 \sin x - \cos x\right) + c e^{-2x}$ $\;\;\; \cdots \; (6)$

Equation $(6)$ is the general solution of the given differential equation.