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?