Exact Differential Equations: Why does this working rule work? Let $M$ and $N$ be some functions of $x$ and $y$. Consider the differential equation $$Mdx+Ndy=0.$$
Suppose that this equation is exact, meaning that $$\frac{\partial M}{\partial y}=\frac{\partial N}{\partial x}.$$ Then the author of my textbook suggests the following working rule: $$\int M\text{(treating y as a constant)} dx+ \int N\text{(taking only those terms in N that do not contain x)} dy=c$$ where $c$ is a constant of integration. I want to know why this works in general.
 A: It doesn't work, and I'd like to speak with the author of this textbook.  Take, for example, $(2x+y^2) \; dx + (2xy) \; dy = 0,$ which is exact.  Then using this method we get $(x^2 +xy^2) + (xy^2) = c$, which is wrong.  This method is some sort of poisonous meme that's been floating around and just won't die.  It's still sort of usable, but it has this problem that some terms can be repeated.  So after you apply it, you have to use some common sense and delete the repeated terms.  
A much cleaner method is to first, check of exactness.  If it is, then what you've really checked is that there is a function $f(x,y)$ whose gradient is $\langle M,N \rangle$ and the solution to the DE will be $f(x,y)=c$.  So the hunt is really for this antigradient.  Where $f_x = M$ and $f_y = N$.  Then instead of trying to unwind both equations at once (which often gives repeating terms), do them one at a time:
$$f(x,y) = \int M \; dx = \mbox{stuff} + g(y)$$ 
where the $+C$ is a function of $y$, because we're doing "partial" integration, and the arbitrary constant could have some $y$'s in it.
Now we have two versions over $f_y$.  One is $N$ and the other is the derivative with respect to $y$ of our expression above:
$$f_y = N = \frac{\partial}{\partial y} (\mbox{stuff}) + g'(y).$$
Solve this equation for $g'(y)$ and integrate to get $g(y)$.  Plug this into the expression for $f(x,y)$ and then set $f(x,y)=c$, which is the right answer.
E.g., take the equation above.  $M = 2x+y^2$, so $f(x,y) = \int 2x+y^2 \; dx = x^2+xy^2 + g(y)$.  Then
$$f_y = 2xy + g'(y) = N = 2xy.$$
So $g'(y) = 0$ and $g(y) = C.$  You can take the constant in $g$ to be zero every time, because the constant at the end absorbs it.  So the solution is
$$f(x,y) = x^2 + xy^2 = c.$$
And, really, what textbook is this?
