<s>[INST] Help with a Bernoulli DE Problem:
Solve the following differential equation.
\begin{eqnarray*}
x \frac{dy}{dx} + y &=& xy^3 \\
\end{eqnarray*}
Answer:
This is a Bernoulli equation so I use the substitution $z = y^{-2}$ to
reduce it to a linear equation.
\begin{eqnarray*}
\frac{dz}{dx} &=& -2y^{-3} \frac{dy}{dx} \\
-2xy^{-3} \frac{dy}{dx} - 2y^{-2} &=& -2x \\
\frac{dz}{dz} - 2z &=& -2x \\
\end{eqnarray*}
Now, I have reduced the equation to a linear equation, so I find $I$ an
integrating factor.
\begin{eqnarray*}
I &=& e^{\int {-2 dx} } = e^{-2x} \\
e^{-2x} \frac{dz}{dx} - 2e^{-2x}z &=& -2xe^{-2x} \\
D(ze^{-2x}) &=& -2xe^{-2x} dx \\
ze^{-2x} &=& -2 \int xe^{-2x} dx \\
\end{eqnarray*}
Now I need to evaluate the following integral:
\begin{eqnarray*}
\int xe^{-2x} dx \\
\end{eqnarray*}
This can be done using integration by parts with  $u = x$ and
$dv = e^{-2x} dx$.
\begin{eqnarray*}
\int xe^{-2x} dx &=& \frac{xe^{-2x}}{-2} - \int { \frac{e^{-2x}}{-2} dx} \\
\int xe^{-2x} dx &=& \frac{-xe^{-2x}}{2} - \frac{e^{-2x}}{4} + C_1
\end{eqnarray*}
Now I substitute into the differential equation.
\begin{eqnarray*}
ze^{-2x} &=& -2 (\frac{-xe^{-2x}}{2} - \frac{e^{-2x}}{4} + C_1) \\
ze^{-2x} &=& \frac{2xe^{-2x}}{2} + \frac{2e^{-2x}}{4} + C \\
ze^{-2x} &=& xe^{-2x} + \frac{e^{-2x}}{2} + C \\
z &=& x + \frac{1}{2} + Ce^{2x} \\
y^{-2} &=& x + \frac{1}{2} + Ce^{2x} \\
y^{2} &=& \frac{1}{x + \frac{1}{2} + Ce^{2x}} \\
\end{eqnarray*}
However, the back of the book gets:
\begin{eqnarray*}
y^2 &=& \frac{1}{2x + Cx^2} \\
\end{eqnarray*}
I have good reason to believe that the back of the book is right. Could
somebody please tell me where I went wrong?
Thanks,
Bob
 [/INST] Your problem is near the top: you have written \begin{align*}
-2xy^{-3} \frac{dy}{dx} -2y^{-2} &= -2x\\
\frac{dz}{dx} - 2z &= -2x.
\end{align*} Notice that there is an $x$ in the term on the far left which you dropped when you switched to $z$. This completely changes the problem. It should be $$x \frac{dz}{dx} - 2z = -2x \,\,\,\, \implies \,\,\,\, \frac{dz}{dx} - \frac{2}{x} z = -2.$$ Now the integrating factor is $x^{-2}$ so, we see $$x^{-2} \frac{dz}{dx} - 2x^{-3}z = -2x^{-2} \,\,\,\, \implies \,\,\,\, \frac{d}{dx}[x^{-2}z] = -2x^{-2}.$$ Integrating gives $$x^{-2}z = 2x^{-1} + C \,\,\,\, \implies \,\,\,\, z = 2x+Cx^2.$$ Since $z = y^{-2}$, this ends with $$y^2 = \frac{1}{2x+Cx^2}.$$ 
</s>