Just because it might not be obvious why we should multiply by [math]\displaystyle \begin{align*} x^{-3} \end{align*}[/math]...
[math]\displaystyle \begin{align*} x\,\frac{dy}{dx} - 2y &= x^2 \\ \frac{dy}{dx} - \frac{2}{x}\,y &= x \end{align*}[/math]
which is now a first order linear DE. The integrating factor is
[math] \displaystyle \begin{align*} e^{ \int{ -\frac{2}{x} \, dx } } = e^{ -2\ln{(x)} } = e^{ \ln{ \left( x^{-2} \right) } } = x^{-2} \end{align*} [/math]
so multiplying both sides of our linear DE by the integrating factor gives
[math]\displaystyle \begin{align*} x^{-2}\,\frac{dy}{dx} - 2x^{-3}\,y &= \frac{1}{x} \end{align*}[/math]
which is the same as multiplying the original equation by [math]\displaystyle \begin{align*} x^{-3} \end{align*}[/math].