The solution of the differential equation $\frac{\mathrm{d} y}{\mathrm{~d} x}+\frac{y}{x}=\sin x$ is
The solution of the differential equation $\frac{\mathrm{d} y}{\mathrm{~d} x}+\frac{y}{x}=\sin x$ is
$x y+\cos x=\sin x+\mathrm{c}$, where $\mathrm{c}$ is a constant of integration.
$x(y+\cos x)=\sin x+\mathrm{c}$, where $\mathrm{c}$ is a constant of integration.
$y(x+\cos x)=\sin x+\mathrm{c}$, where $\mathrm{c}$ is a constant of integration.
$x y+\sin x=\cos x+c$, where $\mathrm{c}$ is a constant of integration.
Solution
For given linear differential equation,
$\text { I.F. }=\mathrm{e}^{\int \frac{1}{x} d x}=\mathrm{e}^{\log x}=x$
$\therefore \quad$ The required solution is
$y x=\int x \sin x \frac{\mathrm{d} y}{\mathrm{~d} x}$
$\begin{aligned} & \therefore \quad y x=-x \cos x+\int \cos x \mathrm{~d} x \\ & \therefore \quad y x=-x \cos x+\sin x+\mathrm{c} \\ & \therefore \quad x(y+\cos x)=\sin x+\mathrm{c}\end{aligned}$