Differential equation $2xy \frac{dy}{dx}-y^2+x=0$ I've been doing some exam tasks and I've come along this equation $$2xy \frac {dy}{dx}-y^2+x=0$$ 
that I dont know how to solve. I probably need some substitution in here but I just can't see it.
 A: Hint: $$\left(\frac{y^2}x\right)'=\frac{2xyy'-y^2}{x^2}$$
A: A more standard interpretation: if you divide by $2xy$ you get
$$
y'-\frac{1}{2x}y+\frac{1}{2}y^{-1}=0
$$
that is crearly a Bernoulli equation.
A: Here is an alternate solution using Lie theory.  Your DEQ is invariant to an element of the Lie group family 
$$
G(x,y)=(\lambda x, \lambda^\beta y), \lambda_o =1
$$
with $x'=\lambda x$, $y'=\lambda^\beta y$, $dx'=\lambda dx$, $dy'=\lambda^\beta dy$, and $\dot{y}'=\frac{dy'}{dx'}=\lambda^{\beta -1}\frac{dy}{dx}=\lambda^{\beta -1}\dot{y}$.  Applying this group to the DEQ
$$
2xy\dot{y}-y^2+x=0
$$
yields
$$
2\lambda^1 x \lambda^\beta y \lambda^{\beta -1}\dot{y} - \lambda^{2\beta}y^2 +\lambda^1 x=0
$$
For invariance, $\beta =\frac{1}{2}$.  Two of the non-trivial stabilizers for this group are $$\mu=\frac{y}{x^\beta}=\frac{y}{x^\frac{1}{2}}$$ and $$\nu=\frac{\dot{y}}{x^{\beta -1}}=x^\frac{1}{2}\dot{y}$$  The DEQ will "fall apart" into these stabilizers if you divide it by $x$.
$$
2\bigg(\frac{y}{x^\frac{1}{2}}\bigg)(x^\frac{1}{2}\dot{y})-\bigg(\frac{y}{x^\frac{1}{2}}\bigg)^2+1=0
$$
$$
2\mu\nu-\mu^2+1=0
$$
$$
\nu=\frac{\mu^2 -1}{2\mu}
$$
and 
$$
x\frac{d\mu}{dx}=\nu-\beta \mu=\frac{\mu^2 -1}{2\mu} - \frac{1}{2}\mu=\frac{-1}{2\mu}
$$
This separation of variables is a result of group invariance.
$$
2\mu d\mu=-\frac{dx}{x}
$$
$$
\mu^2=-\ln x+\ln C=\ln\frac{C}{x}
$$Substituting for $\mu$ yields the solution.
$$
y=\sqrt{x\ln\frac{C}{x}}
$$This isn't the most direct method, nor would I use it in place of a simple substitution in an exam situation, but applied Lie theory is dandy stuff and I like to beat the drum when I can.
A: Another approach is to notice that $(y^2)' = 2yy'$ so you can turn your ODE into the form
$$x(y^2)'-y^2 + x = 0.$$
Let $z=y^2$ to get
$$xz'-z+x = 0.$$
Dividing through by $x^2$ gives
$$\frac{1}{x}z' - \frac{1}{x^2} z = -\frac{1}{x}.$$
We can recognize the left hand side as being nothing more than $\left(\dfrac{z}{x}\right)'$ so
$$\left(\frac{z}{x}\right)' = -\frac{1}{x}.$$
(Note here that I more or less used an integrating factor trick.) From here, the answer is not hard to obtain.
A: Define
$t=\ln x,u=y^2$.
Then the original differential equation is simplified by
$$\frac{du}{dt}-u+e^t=0,$$
of which the solution is
$-te^t+Ce^t$,
where C is an arbitrary constant. Thus the solution of the original equation is
$\sqrt{(C-\ln x)x}$.
A: By method of variation of constants
$$2xy \frac{dy}{dx}-y^2+x=0\\
2x\bar{y}\frac{d\bar{y}}{dx}=\bar{y}^2\\
\frac{1}{\bar{y}}d\bar{y}=\frac{1}{2x}dx$$
after integration we get
$$\ln|\bar{y}|=\frac{1}{2}\ln|x|+\ln|c|\\
$\bar{y}=c\sqrt{x}$$
so by variation of constant(for non homogeneous part)
$$y(x)=c(x)\sqrt{x}$$
After differentiation
$$\frac{dy}{dx}=c'(x)\sqrt{x}+\frac{1}{2}\frac{c(x)}{\sqrt{x}}$$
After subtituting this in your differential equation we get
$$2c(x)c'(x)x^2=-x\\
c'(x)c(x)=-\frac{1}{2x}$$
After integration we get
$$c^2(x)=-\ln|x|+ln|A|\\
c(x)=\sqrt{\ln\left|\frac{A}{x}\right|}$$
So
$$y(x)=\sqrt{x}\sqrt{\ln\left|\frac{A}{x}\right|}=\sqrt{x\ln\left|\frac{A}{x}\right|}$$
