<s>[INST] Solve the differential equation: $(x^2-y^2)dx+2xydy=0$. Given $(x^2-y^2)dx+2xydy=0$
My solution-
Divide the differential equation by $dx$
$\Rightarrow x^2-y^2+2xy\frac{dy}{dx}=0$
$\Rightarrow 2xy\frac{dy}{dx}=y^2-x^2$
Divide both sides by $2xy$
$\Rightarrow \frac{dy}{dx}=\frac{1}{2}[\frac{y}{x}-\frac{x}{y}]$
This is a homogenous differential equation. Substitute $y=vx$
$\Rightarrow \frac{dy}{dx}=v+x\frac{dv}{dx}$
$\Rightarrow v+x\frac{dv}{dx}=\frac{1}{2}[v-\frac{1}{v}]$
$\Rightarrow x\frac{dv}{dx}=-\frac{v^2+1}{2v}$
$\Rightarrow -\frac{2v}{v^2+1}dv=\frac{dx}{x}$
Integrating both sides
$\Rightarrow -\log|v^2+1|=\log x+\log c$
$\Rightarrow -\log|\frac{y^2}{x^2}+1|=\log xc$
$\Rightarrow -\log|\frac{x^2+y^2}{x^2}|=\log xc$
$\Rightarrow \frac{x^2}{x^2+y^2}= xc$
$\Rightarrow x= c(x^2+y^2)$
$\Rightarrow y=\pm \sqrt{xc-x^2}$
Kindly review my solution and let me know if there are other methods of solving such problems.
 [/INST] Your solution it is correct. Answering your second question, here is another slightly different solution.
If we can write the ODE as a Bernoulli equation: $y'+a(x)y=b(x)y^{\alpha}$ for some real $\alpha$ so the substitution $v=y^{1-\alpha}$ transforms the Bernoulli equation into a linear equation $\frac{1}{1-\alpha}v'+a(x)v=b(x)$ which can be solved using integrating factor.
We can re-write the ODE as
$$(x^2-y^2)dx+2xydy=0$$
$$(x^2-y^2)+2xy\frac{dy}{dx}=0$$
$$2xy\frac{dy}{dx}-y^2=-x^2$$
$$\frac{dy}{dx}-\frac{1}{2x}y=-\frac{x}{2}y^{-1}$$
Consider $a(x)=\frac{-1}{2x}$ and $b(x)=\frac{-x}{2}$ so the equation is Bernoulli and we can make the substitution $v=y^{1-(-1)}=y^{2}$ and then we can write the ODE as
$$\frac{1}{2}\frac{dv}{dx}-\frac{1}{2x}v=-\frac{x}{2}$$
$$\frac{dv}{dx}-\frac{1}{x}v=-x.$$
The equation it is linear and using your integrating factor $\mu(x)=e^{\int -\frac{1}{x}dx}=\frac{1}{x}$ we can transforms the linear equation into a separable equation.
$$\frac{d}{dx}\left(\mu(x)v\right)=-x\mu(x)$$
Integrating,
$$\frac{v}{x}=\int-1dx=-x+c$$
Thus,
$$v=-x^2+cx$$
Substitution back
$$y^2=-x^2+cx$$
Therefore, the general solution is given by
$$ y=\pm\sqrt{-x^2+cx}$$
as you said.
</s>