Function as a "constant of integration" I'm reading a book Differential Equations with Applications and Historical Notes, 3rd edition, specifically section 8 about exact equations. The author is trying to prove that iff $\partial M/\partial y = \partial N/\partial x$ then equation
\begin{equation}
M(x,y)dx + N(x,y)dy = 0
\end{equation}
is exact differential equation.
At some point we integrate equation
\begin{equation}
\frac{\partial f(x,y)}{\partial x} = M(x,y)
\end{equation}
to get
\begin{equation}
f(x, y) = \int M(x,y)dx + g(y)
\end{equation}
The author states that function $g(y)$ appears as a constant of integration because if we take derivative of both sides with respect to $x$, $g(y)$ would disappear because it doesn't depend on $x$.
That's the part that I have trouble with, $y$ is a dependent variable and $x$ is independent variable so wouldn't derivative of $g(y)$ with respect to $x$ be
\begin{equation}
\frac{d\,g(y)}{dy} \frac{dy}{dx}
\end{equation}
and not $0$ ?
 A: This is a common poorly written part in differential equations textbooks, because they don't want to spend time discussing differential forms.
At this point we forget that $y$ depends on $x$. Of course then the equation $M(x,y)dx+N(x,y)dy=0$ looks weird, and indeed it's wrong. What is meant there is that if we have a dependence of $x$ and $y$, a curve on $x$-$y$ plane, denoted $\gamma$, then the pullback of $M(x,y)dx+N(x,y)dy$ on $\gamma$ is $0$. For example, if we can parametrize $\gamma$ by $x$ (i.e. we can write $y$ as a function of $x$), then this condition says $\frac{dy}{dx} = -\frac{M(x,y)}{N(x,y)}$. That's why we want to find such $\gamma$.
The exactness condition means that $df=M(x,y)dx+N(x,y)dy$. Then the level sets of $f$, $\{(x,y)|f(x,y)=c\}$, give us such $\gamma$'s. Note that exactness follows from closeness on simply connected domains.
So, one can separate this problem into two stages, where $x$ and $y$ are independent, and then were we look for a required dependence.
Alternatively, instead of using differential forms, one can think of $(N,M)$ as a vector field on $x$-$y$ plane perpendicular to $\gamma$'s, the level sets of $f$, gradient of which is $(N,M)$.
A: I don't know why we didn't cover this in intro multi-variable or ODE courses, but there's some important vector identities that help a lot and are absolutely necessary in applications.
$df=\nabla f  \cdot d\vec{s}$ is at the heart of an Exact Differential Equation, and applicable in any coordinate system. In fact, this can be used to derive the gradient in an arbitrary coordinate system.
$\nabla f \cdot d\vec{s}=(\frac{\partial f}{\partial x}\hat{i}+\frac{\partial f}{\partial y}\hat {j})\cdot (dx \hat {i}+dy\hat{j})=\frac{\partial f}{\partial x}dx + \frac{\partial f}{\partial y}dy$. Then by Fubini's Theorem, $\frac{\partial ^2 f}{\partial x \partial y}=\frac{\partial ^2 f}{\partial y \partial x}$, i.e the order of partial differentiation yields the same result, we have a test for exactness.
Closely related,  $\nabla \times \vec{E} \iff \vec{E}=\nabla V$. If the curl of a vector field is $0$, then it can be represented as the gradient of some scalar function. Then by Stoke's Theorem the field is conservative, has the same value when integrated between two points regardless of path. This also implies the line integral along a closed path is zero.
This analysis naturally poses the matter in terms of multiple independent variables, and allows a natural way to generalize to 3 independent variables.
