From khan academy:
consider the following FO differential equation:
$$
y\cos(x)+2xe^y+(\sin(x)+x^2e^y-1)y' = 0
$$
The instructor has given the following solution to this differential equations, stating it is an an exact one:
$$
y\sin(x)+x^2e^y-y=C
$$
Note that it follows from the latter and from the statement of the problem that $y$ is a function of $x$. For any chosen constant $C$, there must be a unique $x$ corresponding to each value of $y$, and the other way round.
Now, at some point he states that we check the equation for being an exact one by taking the partial derivative of the first sum with respect to $x$: $$ \frac{\partial}{\partial x} (y\cos(x)+2xe^y) $$ He further states that we treat $y$ as a constant for this purpose.
How may this ever make sense??? $y$ is deterministic and depends on $x$, and it's going to change when we change $x$. Holding it constant is just like dividing by zero. Where is my misunderstanding?
Sorry for the mega late update on this. I'd like to point out that Allawonder's answer has many useful insights of it but I still would like to expand a bit. Just to make myself clear, I'd like to first revisit the source of my confusion w.r.t the problem at hand.
Namely, I didn't understand: 1) in course of solving the differential equation at hand, we are looking for a function $y = f(x)$ whereby $(x,y)$ is an infinite sets of pairs satisfying this function/equation. What I want to say is that $x$ and $y$ are related: $y$ depends on $x$ and vice versa. 2) Then, at some point, for reasons that @Allawonder has described nicely, we differentiate $f(x,y)$ w.r.t $x$, holding $y$ constant. What I couldn't realiaze is how we can possibly hold $y$ constant if it is related to $x$ by the very fact that we are looking for a function $y=f(x)$ where the both variables are clearly related.
I think, what @Allawonder didn't mention is the concept of implicit differentiation which I guess is the key to understanding here.
Let a function $$z = f(x,y) = -(x^2+y^2)$$ be given. This would look something like this: ClickToSee (sorry, I am not yet allowed to embed pictures)
For such a function, it makes sense to differentiate w.r.t $x$ holding $y$ constant, and vice versa. I.e., very simply, we are looking at how $f(x,y)$ changes if we are only changing $x/y$. But we are not quite there yet.
Let us now take a look at a level of this function. In other words, let $$f(x,y) = -(x^2+y^2) = k = 3$$ Graphically, it is like cutting our 3-dimensional surface with a horizontal plane, and considering all the points at the intersection of the plane and the surface. Graphically, it would look something like this: CutSurface You see that this set of points, if we look at it from above, represents the familiar circle, which is described in two dimensions by $$f(x,y) = -(x^2+y^2) = k$$
For such function, we may first notice that, although both $x$ and $y$ appear at the left hand side, they are related. If $x$ changes, $y$ has to change to keep the function equal to $k$. For such expression, implicit differentiation is taking derivative w.r.t to a variable of the LHS with the knowledge that both variables are dependent now. Interestingly, this is not the end.
Let us take a derivative of $$-(x^2+y^2) = k$$ w.r.t $x$: $$\frac{\partial(-(x^2+y^2))}{\partial(x)}=2x + 2y*\frac{\partial y}{\partial x}=\frac{\partial f(x,y)}{\partial x} + \frac{\partial f(x,y)}{\partial y}*\frac{\partial y}{\partial x}$$ where the first term $2x$ is just the derivative of $z=f(x,y)=-(x^2+y^2)$ holding $y$ constant, and $2y$ is the partial derivative of $z=f(x,y)=-(x^2+y^2)$ holding $x$ constant. Once again in words: an implicit derivative of a (single-variate) function $f(x,y) = k$ is the derivative of the (multi-variate) function $z=f(x,y)$ w.r.t $x$ holding $y$ constant plus the derivative of the (same) (multi-variate) function $z=f(x,y)$ w.r.t $y$ holding $x$ constant times the derivative of $y$ w.r.t $x$. I think, that's where we see the link between single-variate and two-variate calculus in this case. Because we see how the implicit derivative of a single-variate function is represented by the partial derivatives of the multi-variate function, the level of which the single-variate function represents $(-(x^2+y^2) = k$ is a level of $z = -(x^2+y^2)$. Probably, this is very intuitive for non-newbies, but was kind of discovery for me.
We then use the fact that the implicit derivative contains the term $$\frac{\partial y}{\partial x}$$ to solve the differential equation as Allawonder has nicely described. I.e., when initially solving such a differential equation, we suppose that it by coincidence represents an implicit derivative of a function. Hope this will be helpful for anyone facing the same confusion as I did.