# Integrating factor with linear differential equations

I've been doing this problem and I'm a little lost on where i am.

$$\frac{1}{x} \frac{dy}{dx} - \frac{2y}{x^2} = x\cos(x) ; x>0$$

So far I think (not sure if right) found integrating factor of: $$I(x) = -2\ln(x)$$

then i found my final answer (which does not look right of:)

$$\int \frac{(\cos x-x\sin x)(-x^2)}{e^{x^2}} \, dx$$

anyone know what I'm doing wrong? or if its magically correct?

$$\dfrac{dy}{dx}-\dfrac{2}{x}y = x^2\cos x$$ The integrating factor $$I(x) = \mathrm{e}^{-\int \frac{2}{x}dx} = \mathrm{e}^{-2\ln x} = \mathrm{e}^{\ln \left(x^{-2}\right)} = \dfrac{1}{x^2}$$
$$\dfrac{d}{dx}\left(yI(x)\right) = \int x^2\cos x \cdot I(x) dx +\lambda= \int \cos x dx +\lambda$$
So the problem was most likely how you exponentiation of the integrating factor. Then you most likely integrated the $x \cos x$ first with multiplying the integrating factor under the integral sign.
• Could you confirm my final answer of: $$y=x^2sin(x)+C$$ – user176330 Sep 19 '14 at 4:11
• Almost since you have to multiply your constant by $x^2$. :) – Chinny84 Sep 19 '14 at 6:26
• I think you used an integral too soon, or you have to get rid of the derivative on the left side of your last equation. It seems that $\frac{d}{dx}(yI(x))=x^{2}\cos(x)I(x)$. Then you get OP's solution (almost). – DisintegratingByParts Sep 20 '14 at 1:49