Bernoulli Differential Equation with an $xy^3$ Term Below is my solution to a differential equation. The answer that I got was different than the book's answer so I am assuming mine is wrong. I am hoping somebody can tell me where I went wrong.
Problem:
Solve the following differential equation.
\begin{eqnarray*}
\frac{dy}{dx} + y &=& xy^3 \\
\end{eqnarray*}
Answer:
Observe that this is a Bernoulli equation.
\begin{eqnarray*}
y^{-3} \frac{dy}{dx} + y^{-2} &=& x \\
z &=& y^{-2} \\
\frac{dz}{dz} &=&  -2y^{-3 } \frac{dy}{dx} \\
\frac{1}{2} \frac{dz}{dx} + z &=& x \\
\frac{dz}{dx} + 2z &=& 2x \\
\end{eqnarray*}
Now we have a linear differential equation so we look to find an integrating factor, $I$.
\begin{eqnarray*}
I &=& e ^{ \int 2 dx } = e^ {2x} \\
e^ {2x} \frac{dz}{dx} + 2e^ {2x}z &=& 2xe^{2x} \\
D( e{2x}z ) &=& 2xe^{2x} \\
e^{2x}z &=& \int 2xe^{2x} \\
\end{eqnarray*}
Now to evaluate this integral, we use integration by parts with $u = x$, $dv = 2e^{2x}dx$ and $v = e^{2x}$.
\begin{eqnarray*}
\int 2xe^{2x} &=& xe^{2x} - \int e^{2x} \,\, dx  = xe^{2x} - \frac{ e^{2x} }{2} + C_1 \\
e^{2x}z &=&  xe^{2x} - \frac{ e^{2x} }{2} + C_1 \\
\frac{e^{2x}}{y^2} &=&  xe^{2x} - \frac{ e^{2x} }{2} + C_1 \\
\frac{2}{y^2} &=&  2x - 1 + C e^{-2x} \\
\end{eqnarray*}
However, the book gets:
\begin{eqnarray*}
\frac{2}{y^2} &=&  2x - 1 + C e^{2x} \\
\end{eqnarray*}

Akiva Weinberger answered the question.
