#### Need solution for RD Sharma maths Class 12 Chapter 21 Differential Equation Exercise 21.10 Question 39 textbook solution.

Answer : $y=\frac{1}{2}(\sin x-\cos x)+\frac{c}{e^{-x}}$

Give : $\frac{d y}{d x}-y=\cos x$

Hint : Using integrating factor and integration by parts

Explanation : $\frac{d y}{d x}-y=\cos x$

$\frac{d y}{d x}+(-1)y=\cos x$

This is a linear differential equation of the form

\begin{aligned} &\frac{d x}{d y}+P y=Q \\ &P=-1 \text { and } Q=\cos x \end{aligned}

The integrating factor $If$  of this differential equation is

\begin{aligned} &I f=e^{\int P d x} \\ &=e^{\int-1 d x} \\ &=e^{-\int d x} \\ &=e^{-x} \quad\left[\int d x=x+C\right] \end{aligned}

Hence, the solution is

\begin{aligned} &y I f=\int Q I f d x+C \\ &=y\left(e^{-x}\right)=\int \cos x e^{-x} d x+C \ldots(i) \end{aligned}

Using integration by parts

\begin{aligned} &I=\int \cos x e^{-x} d x=\cos x \frac{e^{-x}}{-1}-\int \sin x \frac{e^{-x}}{-1} d x+C \\ &=I=-\cos x e^{-x}-\left[\sin x \frac{e^{-x}}{-1}-\int \cos x \frac{e^{-x}}{-1} d x\right] \\ &=I=-\cos x e^{-x}+\sin x e^{-x}-\int \cos x e^{-x} d x \end{aligned}

\begin{aligned} &=I=-\cos x e^{-x}+\sin x e^{-x}-I \\ &=2 I=-\cos x e^{-x}+\sin x e^{-x} \\ &=2 I=e^{-x}(\sin x-\cos x) \\ &=I=\frac{1}{2} e^{-x}(\sin x-\cos x) \end{aligned}

Substituting in (i)

$=y e^{-x}=\frac{1}{2} e^{-x}(\sin x-\cos x)+C$

Divide by $e^{-x}$

$=y=\frac{1}{2}(\sin x-\cos x)+\frac{C}{e^{-x}}$