# First Order Linear Differential Equation

I'm having trouble solving this first order linear differential equation. I know the answer (thanks Mathematica!), but I'm having trouble with the steps. The equation is,

\begin{align*} y' - \frac{1}{1+x} y = 2 \end{align*}

I know I have to use an integrating constant, which in this case has to be $\log\left(\frac{1}{1+x}\right) = -\log(1+x)$. So,

\begin{align*} -\log(1+x)y &= -2 \int \log(1+x) \\[1em] -\log(1+x)y &=-2\left((1+x)\log(1+x)-x\right) + C \\[1em] \log(1+x)y &= 2\left((1+x)\log(1+x)-x\right) + C \end{align*}

Not sure how to simplify, as the answer is

$y = C(1+x) + 2(1+x)\log(1+x)$

Or maybe my approach is wrong.

## migrated from mathoverflow.netApr 21 '16 at 18:55

This question came from our site for professional mathematicians.

• An integrating factor is $\mu(x) = (1+x)$ and the "answer" should be $y=(1+x)+C(1+x)^{-1}$... – José Hdz. Stgo. Apr 21 '16 at 18:28

Your current equation reads $$y^{\prime}-\frac1{1+x}y=2$$ First order linear of the form $y^{\prime}+p(x)y=q(x)$ so your integrating factor is $$\mu(x)=e^{\int p(x)dx}=e^{\int\frac{-dx}{1+x}}=e^{-\ln(1+x)}=\frac1{1+x}$$ then rewrite your equation as $$\frac d{dx}\left(\mu(x)y(x)\right)=\frac d{dx}\left(\frac{y}{1+x}\right)=\frac{y^{\prime}}{1+x}-\frac y{(1+x)^2}=\mu(x)q(x)=\frac2{1+x}$$ Now the differential equation has been reduced to quadrature and you can find $$\frac y{1+x}=\int\frac2{1+x}dx=2\ln|1+x|+C$$ So $$y(x)=2(1+x)\ln|1+x|+C(1+x)$$