solving $y'-x^2y+y^2=2x$ Find a general solution to the equation 
$$y'-x^2y+y^2=2x$$
I managed to guess a solution $y=x^2$
$$(x^2)'-x^2\cdot x^2+(x^2)^2=2x-x^4+x^4=2x$$
To get the general solution I tried plugging $y=z(x)+x^2$ into the equation, which gives
$$z'+x^2z+z^2=0$$
The equation is not exact
$$dz+(x^2z+z^2)dx=0$$
and I failed in the search for an integrating factor. Moreover, the solution in Wolfram is not so welcoming. Maybe there is some implicit solution...
 A: Set $z=\frac1u$ and you get the linear DE
$$
-u'+x^2u+1=0.
$$
The full, one-step parametrization is $y(x)=x^2+\frac1{u(x)}$, as is usual for Riccati-equations with one known solution.
As the integrating factor is $\exp(-\frac{x^3}3)$, the resulting solution will not be simpler than the one found via WA.
A: Making the variable change
$$
y = \frac{z'}{z}
$$
we get at
$$
\frac{z''-x \left(x z'+2 z\right)}{z} = 0
$$
or
$$
z''-x \left(x z'+2 z\right) = 0
$$
which is linear
A: After $\frac{dz}{dx}+z^2+x^2z=0$, it's in the form $\frac{dy}{dx}+P(x)y=Q(x)y^n$, which you solve with:
$$(1-n)y^{-n}\frac{dy}{dx}+(1-n)P(x)y^{1-n}=Q(x)(1-n)$$
With a new $P(x)$ and $Q(x)$ which are the old ones multiplied by $(1-n)$, and $u=y^{1-n}$, the equation simplifies to
$$\frac{du}{dx}+P(x)u=Q(x)$$, which is the Bernoulli Equation. Its integrating factor is $e^{\int P(x)dx}$ where you don't need to worry about the constant of integration - it's essentially multiplying both sides of the equation by $e^C$.  Using this, the equation reduces to: $$e^{\int P(x) dx}du+e^{\int P(x)dx}P(x)u dx =Q(x)e^{\int P(x) dx}dx$$
$$d(e^{\int P(x) dx}u) =Q(x)e^{\int P(x) dx}dx$$
$$e^{\int P(x) dx}u =\int Q(x)e^{\int P(x) dx}dx+C$$
Returning to your equation, $$-z^2\frac{dz}{dx}-x^2z^{-1}=1  $$ $$\frac{d(z^{-1})}{dx}-x^2z^{-1}=1  $$
$z^{-1}=u$, $P(x)=-x^2$, $Q(x)=1$
$$\left(e^{\int -x^2dx}\right)u=\int e^{\int -x^2dx} dx+C $$
$$\left(e^{\frac{-x^3}{3}}\right)u=\int e^{\frac{-x^3}{3}} dx+C $$
$$u=e^{\frac{x^3}{3}}\int e^{\frac{-x^3}{3}}dx + C e^{\frac{x^3}{3}}$$
$$z= \frac{1}{e^{\frac{x^3}{3}}\int e^{\frac{-x^3}{3}}dx + C e^{\frac{x^3}{3}}} $$
I dont' know if there is a way to solve this integral. You can check the validity of any solution to a simple differential equation on desmos: https://www.desmos.com/calculator/4tvfwgztet (It may take some time to load)
Source: Ordinary Differential Equations by Morris Tenenbaum and Henry Pollard, page 92
