Explain solution RD Sharma class 12 Chapter 21 Differential Equation exercise 21.10 question 37 subquestion (vii)

Answer:  \begin{aligned} & y=\sin x\\ & \end{aligned}

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} & \\ & \end{aligned}

$=e^{\int \frac{1}{x}} d x \\$

$=e^{\log |x|}$                       ${\left[\int \frac{1}{x} d x=\log |x|+C\right]} \\$

$=x$                         ${\left[e^{\log e^{x}}=x\right]}$

Hence, the solution is

\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(i) \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} \ldots(i i)$

Now   \begin{aligned} &y\left(\frac{\pi}{2}\right)=1 \text { when } x=\frac{\pi}{2}, y=1 \\ & \end{aligned}

$\quad=1=\sin \frac{\pi}{2}+\frac{C}{\frac{\pi}{2}} \\$

$\quad=1=1+\frac{2 C}{\pi} \quad\left[\sin \frac{\pi}{2}=1\right]$

\begin{aligned} &=\frac{2 C}{\pi}=0\\ & \end{aligned}

$=C=0\\$

Substituting in (ii)

$=y=\sin x+(0) \frac{1}{x}\\$

$=y=\sin x+0\\$

$=y=\sin x$