Q:

Solve the differential equation $x \frac{dy}{dx}+3y=\frac{\sin x}{x^2}$

Solve the differential equation: 
$x \dfrac{dy}{dx}+3y=\dfrac{\sin x}{x^2}$ , where ${x} {\neq}\ 0$
$\dfrac{dy}{dx}+3\dfrac{y}{x}=\dfrac{\sin x}{x^3}$ 
I intended to solve this using substitution, but realized it doesn't seem right. Can someone please point me to the right direction? 

A:

There is a general way of solving ODEs of the form $$y' + P\left(x\right)y = Q\left(x\right)$$
Multiply both sides by an integrating factor, given as 
$$I = e^{∫ P\left(x\right)dx}$$ 
What this gives you is basically 
$$\frac{d}{dx}\left(y.e^{∫ P\left(x\right)dx}\right) = Q\left(x\right)e^{∫ P\left(x\right)dx}$$
Hence, we obtain the following closed form for $y$
$$y = \frac{∫ Q\left(x\right)e^{∫ P\left(x\right)dx}dx}{e^{∫ P\left(x\right)dx}}$$
Now , for this case, $P\left(x\right) = \frac{3}{x}$, $Q\left(x\right) = \frac{\sin x}{x^3}$
I.F  $=e^{∫ P\left(x\right)dx} = x^3$
Hence, $$y = \frac{∫ \sin \left(x\right)dx}{x^3} = \frac{-\cos \left(x\right)+C}{x^3} $$

