Exact Differential Equations I was revising differential equations and came across the topic of exact differential equations. I have a doubt concerning it. Suppose the differential equation $M(x,y)dx + N(x,y)dy=0$ is exact. Then the solution is given by:
$\int Mdx +\int (N-\frac{\partial}{\partial y}\int Mdx)dy = c$. I understand that the integrand in the second term is a function of y alone and also understand the derivation of this solution. What I don't understand is the following paragraph:
My book then says "Since all the terms of the solution that contain x must appear in $\int Mdx$, its derivative w.r.t. y must have all the terms of N that contain x. Hence the general rule to be followed is: Integrate $\int Mdx$ as if y were constant. Also integrate the terms of N that do not contain x w.r.t. y. Equate the sum of these integrals to a constant."
I don't understand the justification that is provided for the general rule. Can someone please explain this?  
 A: There seemed to be a misunderstanding as people tried to explain to me why $\int Mdx +\int (N-\frac{\partial}{\partial y}\int Mdx)dy = c$ is the solution of the exact ODE, something which I had already understood perfectly. My problem was with the next statement in the book which gave a working rule that essentially said that the solution could be expressed as $\int M dx $ (y constant) $ + \int N' dy = c$ (N' are the terms of N not containing x) is the solution. After some online searches I have hence discovered the solution. The book is wrong. The rule it quotes works so often in practice that people adopt it but there are cases when it fails and we have to take recourse to $\int Mdx +\int (N-\frac{\partial}{\partial y}\int Mdx)dy = c$ to write the solution. For example the ODE $\frac{dx}{\sqrt{x^2+y^2}} +(\frac{1}{y}-\frac{x}{y\sqrt{x^2+y^2}})dy=0$ would give a wrong answer on applying the working rule and we have to take recourse to directly computing $\int Mdx +\int (N-\frac{\partial}{\partial y}\int Mdx)dy = c$.
A: I think that this is why the method to solve the exact ODE works. Your equation is exact. To solve, you want to find $F(x,y)$ such that $$\frac{\partial}{\partial x}F(x,y)=M(x,y),\; \& \frac{\partial}{\partial y}F(x,y)=N(x,y).$$
Then integrating the first equation w.r.t. $x$ we get $$F(x,y)=\int M(x,y)dx + f(y),$$ here $f(y)$ plays the role of the constant of integration. We need to verify that in effect this is true. I mean, we need to verify that we can choose the constant of integration as a function of $y$. But since your equation is exact, this is the case. This is as follows: we want that
$$\begin{align*}\frac{\partial}{\partial y}F(x,y)&=N(x,y)\\
\frac{\partial}{\partial y}\int M(x,y)dx + \frac{\partial}{\partial y}f(y)&=N(x,y)\\
\frac{\partial}{\partial y}f(y)&= N(x,y)-\frac{\partial}{\partial y}\int M(x,y)dx.\end{align*}$$
Now,
$$
\begin{align*}
\frac{\partial}{\partial x}\left(N(x,y)-\frac{\partial}{\partial y}\int M(x,y)dx\right)&= \frac{\partial}{\partial x}N(x,y) - \frac{\partial}{\partial x}\frac{\partial}{\partial y}\int M(x,y)dx\\
&= \frac{\partial}{\partial x}N(x,y) - \frac{\partial}{\partial y}\frac{\partial}{\partial x}\int M(x,y)dx\\
&=\frac{\partial}{\partial x}N(x,y) - \frac{\partial}{\partial y}M(x,y)\\
&= 0,
\end{align*}$$
since your EDO is exact. In other words $\frac{\partial}{\partial y}f(y)$ is constant w.r.t $x$ and (by integration w.r.t. $y$) $f$ depends only of $y$. Therefore
the solution is given as you say. I think that the explanation that you quote is equivalent to the explanation of why $f$ depends only of $y$ or, rather, who is $f$.
A: I believe that with exact differential equation you mean that there is some function $U$ such that
$$
dU(x,y) = M(x,y)dx+N(x,y)dy,
$$
or e.g. the case when $M_y = N_x$ in the simply connected domain of $\mathbb R^2$, which is sufficient for $U$ to exist. Then all solutions clearly are described as $U(x,y) = c$ and the only question is how to find $U$. 
Using the theory of curve integrals,
$$
U(x,y) = U(x_0,y_0)+\int\limits_\gamma M(x,y)dx+N(x,y)dy
$$
where $\gamma$ is any (piecewise-smooth) path from $(x_0,y_0)$ to $(x,y)$. The most simple one is to take $\gamma = AB\cup BC$ where $A = (x_0,y_0), B = (x,y_0)$ and $C = (x,y)$. Then your integral is decomposed into two integrals since $dx|_{BC} = 0$ and $dy|_{AB} = 0$. Then the formula you wrote just follows from the theory of curve integrals. 
