#### Provide solution for RD Sharma maths Class 12 Chapter 21 Differential Equation Exercise 21.10 Question 37 Subquestion (vii) textbook solution.

Answer : $y=\sin x$

Give: $x \frac{d y}{d x}+y=x \cos x+\sin x, y\left(\frac{\pi}{2}\right)=1$

Hint : Using integration by parts $\int \frac{1}{1+x^{2}} d x$

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

Divide by x

\begin{aligned} &=\frac{d x}{d y}+\frac{y}{x}=\cos x+\frac{\sin x}{x} \\ &=\frac{d x}{d y}+\left(\frac{1}{x}\right) y=\cos x+\frac{\sin x}{x} \end{aligned}

This is a linear differential equation of the form

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

The integrating factor $If$  of this differential equation is

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

Hence, the solution is

\begin{aligned} &\begin{aligned} &y I f=\int Q I f d x+C \\ &=y(x)=\int\left(\cos x+\frac{\sin x}{x}\right) x d x+C \end{aligned}\\ &\begin{aligned} &=y x=\int(x \cos x+\sin x) d x+C \\ &=y x=\int x \cos x d x+\int \sin x d x+C \ldots \end{aligned} \end{aligned}

Using integration by parts

\begin{aligned} &\int x \cos x d x \\ &=x \sin x-\int \sin x d x \end{aligned}

Substituting in (i)

\begin{aligned} &=y x=x \sin x-\int \sin x d x+\int \sin x d x+C \\ &=y x=x \sin x+C \end{aligned}

Divide by x

$=y=\sin x+\frac{C}{x}$              .......(ii)

Now $y\left(\frac{\pi}{2}\right)=1 \text { when } x=\frac{\pi}{2}, y=1$

\begin{aligned} &=1=\sin \frac{\pi}{2}+\frac{C}{\frac{\pi}{2}} \\ &=1=1+\frac{2 C}{\pi}\left[\sin \frac{\pi}{2}=1\right] \\ &=\frac{2 C}{\pi}=0 \\ &=C=0 \end{aligned}

Substituting in (ii)

\begin{aligned} &=y=\sin x+(0) \frac{1}{x} \\ &=y=\sin x+0 \\ &=y=\sin x \end{aligned}