Solving $\frac{dy}{dx} = xy^2$ This problem appears to be pretty simple to me but my book gets a different answer.
$$\frac{dy}{dx} = xy^2$$
For when y is not 0
$$\frac{dy}{y^2} = x \, dx$$
$$\int \frac{dy}{y^2} = \int x \, dx$$
$$\frac{-1}{y^1} = \frac{x^2}{2}$$ 
$$\frac{-2}{x^2} = y$$ 
Is there anything wrong with this solution? It is not what my book gets but it is similar to how they do it in the example.
 A: Your mistake is here. You should have
$$\int \frac{dy}{y^2} = \int y^{-2}dy = -y^{-1}$$
and not $$\int \frac{dy}{y^2} = \frac{-1}{y^{-1}}$$.
A: When you apply indefinite integration, you need to add a "${}+C\,$" (or whatever letter you want) at the end; this is rather infamous for tripping up students. In your problem this gives
$$-\frac{1}{y}=\frac{x^2}{2}+C~~\implies~~ y=\frac{1}{-(x^2/2+C)}=\frac{2}{-x^2-2C}.$$
If we write $K=-2C$ (or again, any old letter), we can write this simply as $\displaystyle\frac{2}{K-x^2}$.
The reason we have "plus a constant" at the end is to prevent erroneous derivations like this:
$$\frac{d}{dx}f(x)=\frac{d}{dx}\big(f(x)+1\big)\implies f(x)=f(x)+1\implies 0=1.$$
In other words, antidifferentiation will only find the antiderivative you want up to addition by an unknown constant. (However with some initial conditions this constant, or constants as it may be in more complicated problems, may be computed exactly.)
Note that it is only necessary to write an add-a-constant to one side of an equation, because for example something like $f(x)+A=g(x)+B$ can be written instead as $f(x)=g(x)+C$ with our constant $C=B-A$.
A: Continuing from what you did, we have
$$\int \frac{dy}{y^2} = \int x\,dx$$
$$-\frac{1}{y} + C_2= \frac{x^2}{2}+C_1$$
Where $C_1$ and $C_2$ are constants of integration.  Letting $C_3=C_1-C_2$
$$-\frac{1}{y} + C_2= \frac{x^2}{2}+C_1=-\frac{1}{y}= \frac{x^2}{2}+C_3$$
Solving for $y$, we have:
$$-\frac{1}{y}= \frac{x^2}{2}+C_3= \frac{x^2+2C_3}{2} \implies -y=\frac{2}{x^2+2C_3} \\
\implies y=\frac{2}{2C_3-x^2}$$
Letting $2C_3=K$
$$y=\frac{2}{2C_3-x^2}=\frac{2}{K-x^2}$$
