We want to find the exact solution of the following ODE: $$ -4xy + x^2 - y^2 + 4x^2 \frac{dy}{dx} = 0 \quad \quad y = 2, x = 1 $$
This is my attempt: We need to match this form: $$M(x,y) + N(x,y) \frac{dy}{dx} = 0$$
Then we find $M(x,y)$ and $N(x,y)$: $$M(x,y) = -4xy + x^2 -y^2$$ $$N(x,y) = 4x^2$$
From this we get two differential equations: $$\frac{d\Psi(x,y)}{dx} = M(x,y)$$ $$\frac{d\Psi(x,y)}{dy} = N(x,y)$$
It is not important which one we solve by integrating. Here we integrate the first one. $$\Psi(x,y) = \int M(x,y) dx $$ $$= \int -4xy + x^2 - y^2 dx $$ $$= -2x^2y + \frac{x^3}{3} -xy^2 + C(y) = \Psi(x,y)$$
So far so good. From this onward I try to methods and both fail.
First ATTEMPT:
Integrating the other differential equation we get $$ 4x^2y + D(x) = \Psi(x,y)$$
comparing the two
$$ 4x^2y + D(x) = \Psi(x,y) =-2x^2y + \frac{x^3}{3} -xy^2 + C(y) $$
not sure what to do next since it is not easy to deduce the $C(y)$ and $D(x)$ from here.
Second ATTEMPT:
Now we use the OTHER differential equation: $$\frac{d\Psi(x,y)}{dy} = N(x,y)= 4x^2$$ and we use the $\Psi(x,y)$ that we found. We now need to find $C(y)$.
$$\frac{d\Psi(x,y)}{dy} = 4x^2$$ $$ -2x^2 -2xy + \frac{dC(y)}{dy}= 4x^2$$ $$ -6x^2 -2xy + \frac{dC(y)}{dy}= 0$$
integrating everything with respect to y with constant of integration K(x), we get
$$ -6x^2y -xy^2 + C(y) + K(x) = 0 $$
solve the above for $C(y)$
$$ C(y) = 6x^2y + xy^2 - K(x) $$
and substitute into $\Psi(x,y)$ to get
$$\Psi(x,y) = -2x^2y + \frac{x^3}{3} -xy^2 + 6x^2y + xy^2 - K(x) = 0 $$ $$\Psi(x,y) = \frac{x^3}{3} + 4x^2y -K(x) = 0 $$
we differentiate with respect to x
$$\frac{d\Psi(x,y)}{dx} = M(x,y)$$
$$ x^2 + 8xy - \frac{dK(x)}{dx}= -4xy + x^2 -y^2 $$ $$ y^2 + 12xy = \frac{dK(x)}{dx} $$ $$ xy^2 + 6x^2y + Q = K(x) $$
$$\Psi(x,y) = \frac{x^3}{3} + 4x^2y - xy^2 - 6x^2y + Q = 0 $$ $$\Psi(x,y) = \frac{x^3}{3} -2x^2y - xy^2 + Q = 0 $$
However I think here we get into an infinite loop because $Q$ is actually $Q(y)$ which needs to be determined using a similiar integration ... so again I don't know what to do.
The final solution $\Psi(x,y)$ does not agree with:: $$\frac{d\Psi(x,y)}{dx} = M(x,y)$$ $$\frac{d\Psi(x,y)}{dy} = N(x,y)$$
What am I doing wrong?
It does not work because the equation is not an exact DE with $M_y=N_x$. You would need to find an integrating factor.
But you can get an easier result by remarking that the terms are all quadratic or contain the derivative, so that you get the form of an homogeneous DE. Thus set $y(x)=xu(x)$ to find that $$ x^2(−4u+1−u^2+4(xu'+u))=0. $$ As that is now a separable equation, you get a solution by integrating $$ \int \frac{4\,du}{u^2-1}=\int\frac{dx}{x} $$ and making the solution explicit.
You could also treat the original equation as Riccati equation.