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

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

Hint : To solve this equation we use $\frac{dy}{dx}+Py=Q$ where P,Q are constants.

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

Solution :

\begin{aligned} & \frac{d y}{d x}+\frac{2 y}{x}=\frac{x \cos x}{x} \\ &=\frac{d y}{d x}+\frac{2}{x} y=\cos x \\ &=\frac{d y}{d x}+P y=Q \\ &P=\frac{2}{x^{\prime}} Q=\cos x \end{aligned}

$I\, f$ of differential equation is

\begin{aligned} &\text { If }=e^{\int P d x} \\ &=e^{\int \frac{2}{x} d x} \\ &=e^{2 \log x} \\ &=e^{\log x^{2}} \\ &=x^{2} \end{aligned}

\begin{aligned} &y I f=\int \text { QIf } d x+C \\ &=y x^{2}=\int \cos x x^{2} d x+C \\ &=x^{2}(\sin x)-\int 2 \sin x d x+C \end{aligned}

\begin{aligned} &=x^{2}(\sin x)-2\left[x(\cos x)-\int 1(\cos x) d x+C\right] \\ &=x^{2}(\sin x)-2 x(\cos x)+2 \int \cos x d x+C \\ &=x^{2}(\sin x)-2 x(\cos x)-2 \sin x+C \end{aligned}

\begin{aligned} &=y x^{2}=x^{2}(\sin x)-2 x(\cos x)-2 \sin x+C \\ &=y=\frac{x^{2}(\sin x)}{x^{2}}-\frac{2 x(\cos x)}{x^{2}}-\frac{2 \sin x}{x^{2}}+\frac{C}{x^{2}} \\ &=y=(\sin x)-\frac{2(\cos x)}{x}-\frac{2 \sin x}{x^{2}}+\frac{C}{x^{2}} \end{aligned}