Solving the differential equation $y' = x - y^2$ I know this differential equation is "unsolvable", this is my attempt at trying to solve it.
I will start by finding a formula for a general DE of the form $ y' = f(x, y) $, where $ f(x,y) $ can be written as $ g(x)+h(y) $

*

*Take the differential of both sides

$ d(y') = d(f(x, y)) $
$ y''(x)dx = \cfrac{\partial f}{\partial x}dx + \cfrac{\partial f}{\partial y}dy $


*Divide both sides by $ dx $
$ y'' = \cfrac{\partial f}{\partial x} + \cfrac{\partial f}{\partial y}\cfrac{dy}{dx} $
$ y'' - \cfrac{\partial f}{\partial y}y' = \cfrac{\partial f}{\partial x} $


*Using the definition of $ f $ we have $ \cfrac{\partial f}{\partial y} = \cfrac{\partial}{\partial y}(h(y)) = \cfrac{dh}{dy} $ and $ \cfrac{\partial f}{\partial x} = \cfrac{\partial}{\partial x}(g(x)) = \cfrac{dg}{dx} $
$ y'' - \cfrac{dh}{dy}\cfrac{dy}{dx} = \cfrac{dg}{dx} $
$ y'' - \cfrac{dh}{dx} = \cfrac{dg}{dx} $
$  y'' = \cfrac{dg}{dx} + \cfrac{dh}{dx} $


*Integrate both sides

$ \displaystyle \int y''dx = \int \cfrac{dg}{dx}dx + \int \cfrac{dh}{dx}dx $
$ y' = g(x)+h(x) + c_1 $
$ \displaystyle \int y'dx = \int (g(x)+h(x)+c_1)dx $
$ \displaystyle y(x)= \int (g(x)+h(x))dx + c_1x + c_2 $


*Now we can use this formula to solve $ y'= x - y^2 \implies g(x) = x $ and $ h(y)=y^2 $
$ \displaystyle y(x) = \int (x - x^2)dx + c_1x+c_2  = \cfrac{x^2}{2} - \cfrac{x^3}{3} + c_1x + c_2 $


*Apply the initial conditions

$ y(0) = 1 \implies (c_2 = 1) \wedge (y'(0) = 0 - y(0)^2 = -1) $
$ y'(0) = -1 \implies c_1 = -1 $
$ y(x) = \cfrac{x^2}{2} - \cfrac{x^3}{3} -x + 1 $
This function satisfies the initial conditions but doesn't solve the DE and I can't see where I went wrong. Which step above was invalid? I'm thinking it has something to do with $ \cfrac{\partial f}{\partial y} = \cfrac{\partial}{\partial y}(h(y)) = \cfrac{dh}{dy} $ and $ \cfrac{\partial f}{\partial x} = \cfrac{\partial}{\partial x}(g(x)) = \cfrac{dg}{dx} $ but I'm pretty sure that is valid.
 A: It's a subtle notation problem, leading to a misapplication of the chain rule. To begin with, note how the differential equation turned from
$$y' = g(x) + h(y)$$
to
$$y' = g(x) + h(x) + c_1.$$
The term $h(y)$ means $h(y(x))$ or $(h \circ y)(x)$. How did we remove the middle step of substituting $x$ into $y$? Adding an arbitrary constant is not sufficient!
The problem step occurs in part 3 of the proof, specifically where you go from:
$$y'' - \cfrac{dh}{dy}\cfrac{dy}{dx} = \cfrac{dg}{dx}$$
to
$$y'' - \cfrac{dh}{dx} = \cfrac{dg}{dx}.$$
At first glance, this looks to be a perfectly valid application of the chain rule... and it is, depending on how you interpret the result.
When using Leibniz notation like this, you need to think of $h$ as a variable, depending on other variables. Our definition has $h$ depending on $y$, and we assume $y$ depends on $x$. This means we can interpret $h$ as a variable depending on $x$, but the relationship between $h$ and $x$ is the function $h \circ y$, i.e. apply the $y$ function first, then apply $h$. In other words, we must interpret $\cfrac{dh}{dx}$ as $\cfrac{d(h(y(x)))}{dx}$.
Later in the proof, you interpret $\cfrac{dh}{dx}$ incorrectly as $\cfrac{d(h(x))}{dx}$. Rather than interpret $h$ as a variable, you interpret it purely as a function. You differentiate the relationship between $h$ and $y$, just using $x$ instead. This neglects the influence the relationship between $y$ and $x$ has when evaluating $h(y(x))$.
Is it confusing? Of course. Differentiation notation has always left me wanting. But, that's the way it is, and so you can lead yourself into traps like this.
A: I believe the erroneous step in your solution has to do with the manipulation of the chain rule: $$\frac{dh}{dy}\frac{dy}{dx} = \frac{dh(y(x))}{dx} \neq \frac{dh(x)}{dx}$$
So when you take the integrals with respect to $x$ on both sides you get back a similar expression as what you started with:
$$y'' - \frac{dh(y)}{dx} = \frac{dg(x)}{dx} \Rightarrow y' - h(y) = g(x) + C \Rightarrow y' = g(x) + h(y) + C$$
(the fact that we started with an expression for $y',$ differentiated, integrated, and got something different back is also a bit of a tip-off that something went a bit funny inbetween)
