# solve $\frac{dy}{dx} - \frac{2y}{x+1} = x$ using integrating factor method?

I have a ODE looking like this:

$\frac{dy}{dx} - \frac{2y}{x+1} = x$

the text book solved it by replacing x with 0 and solving for the homogeneous version of above equation, getting y as:

$y = u(x)(x+1)^2$

hence

$y' = u'(x)(x+1)^2+2u(x)(x+1)$

replacing y' and y in original ODE, we can solve $u(x)$

$u'(x) = \frac{x}{(x+1)^2}$

$u(x) = ln(1+x) + \frac{1}{x+1} + C$

I attempted the problem with integrating factor method however I got different solution for $u(x)$.

I recall the formula for integrating factor method,

$u(x)=e^{\int p(x)dx}$

$y = \frac{\int g(x)u(x)dx+c}{u(x)}$

given the original ODE:

$\frac{dy}{dx} +p(x)y = g(x)$

with the ODE in prloblem, I get $u(x)$ as

$u(x) = e^{-\int \frac{2}{x+1}dx}$ = $e^{-2ln(x+1)}$ = $-2ln(x+1)$

choosing $C = 0$.

the final y was different from the textbook's answer but it's too long to write out. i know I was wrong.

Can someone show me what I was wrong with using this methodology?

• why did this question get downvoted ? at least for a reason ? – stucash Oct 18 '17 at 16:43
• No idea who downvoted or for what reason, but $(x+1)D + 2I$ is a linear operator on the vector space of polynomials, so you can view it as a problem in linear algebra, if you have studied it. – mathreadler Oct 18 '17 at 17:02
• thanks; but I am just looking for a solution using integrating factor method, which is what I got wrong. like you said we could try from LA perspective. – stucash Oct 18 '17 at 17:05
• @stucash $e^{-2\ln(x+1)}=\dfrac{1}{(x+1)^2}$ then let $\dfrac{y}{(x+1)^2}=u$ as you said. – Nosrati Oct 18 '17 at 18:08
• @mathreadler no worries thanks for helping out! you were right, I did something wrong when I moved off from $e$. it's easier to see if we put it this way, $e^{ln(x+1)^{-2}}$ = $(x+1)^{-2}$. I wrongly carried the $ln$. – stucash Oct 18 '17 at 21:42