Find the general solution of the differential equation $\frac{dy}{dx} - y = \cos x$.
Answer & explanation
Correct answer: option 2
The correct answer is Option (2) → $y = \left( \frac{\sin x - \cos x}{2} \right) + Ce^x$ ##
Given differential equation is of the form
$\frac{dy}{dx} + Py = Q, \text{ where } P = -1 \text{ and } Q = \cos x$
Therefore, $\text{I.F.} = e^{\int -1 \, dx} = e^{-x}$
Multiplying both sides of equation by I.F., we get:
$e^{-x} \frac{dy}{dx} - e^{-x}y = e^{-x} \cos x$
$\text{or } \frac{d}{dx}(y e^{-x}) = e^{-x} \cos x$
On integrating both sides with respect to $x$, we get:
$y e^{-x} = \int e^{-x} \cos x \, dx + C \quad \dots(1)$
Let $I = \int e^{-x} \cos x \, dx$
$= \cos x \left( \frac{e^{-x}}{-1} \right) - \int (-\sin x) (-e^{-x}) \, dx$
$= -\cos x e^{-x} - \int \sin x e^{-x} \, dx$
$= -\cos x e^{-x} - \left[ \sin x (-e^{-x}) - \int \cos x (-e^{-x}) \, dx \right]$
$= -\cos x e^{-x} + \sin x e^{-x} - \int \cos x e^{-x} \, dx$
$\text{or } I = -e^{-x} \cos x + \sin x e^{-x} - I$
$\text{or } 2I = (\sin x - \cos x) e^{-x}$
$\text{or } I = \frac{(\sin x - \cos x) e^{-x}}{2}$
Substituting the value of $I$ in equation (1), we get
$y e^{-x} = \left( \frac{\sin x - \cos x}{2} \right) e^{-x} + C$
$\text{or } y = \left( \frac{\sin x - \cos x}{2} \right) + Ce^x$
which is the general solution of the given differential equation.