$2 x y+y^{2}-2 x^{2} \frac{d y}{d x}=0 ; y=2$ when $x=1$
$2 x y+y^{2}-2 x^{2} \frac{d y}{d x}=0$
$\Rightarrow 2 x^{2} \frac{d y}{d x}=2 x y+y^{2}$
$\Rightarrow \frac{d y}{d x}=\frac{2 x y+y^{2}}{2 x^{2}}$ ..(1)
Let $F(x, y)=\frac{2 x y+y^{2}}{2 x^{2}}$
$\therefore F(\lambda x, \lambda y)=\frac{2(\lambda x)(\lambda y)+(\lambda y)^{2}}{2(\lambda x)^{2}}=\frac{2 x y+y^{2}}{2 x^{2}}=\lambda^{0} \cdot F(x, y)$
Therefore, the given differential equation is a homogeneous equation.
To solve it, we make the substitution as:
y = vx
$\Rightarrow \frac{d}{d x}(y)=\frac{d}{d x}(v x)$
$\Rightarrow \frac{d y}{d x}=v+x \frac{d v}{d x}$'
Substituting the value of $y$ and $\frac{d y}{d x}$ in equation (1), we get:
$v+x \frac{d v}{d x}=\frac{2 x(v x)+(v x)^{2}}{2 x^{2}}$
$\Rightarrow v+x \frac{d v}{d x}=\frac{2 v+v^{2}}{2}$
$\Rightarrow v+x \frac{d v}{d x}=v+\frac{v^{2}}{2}$
$\Rightarrow \frac{2}{v^{2}} d v=\frac{d x}{x}$
Integrating both sides, we get:
$2 \cdot \frac{v^{-2+1}}{-2+1}=\log |x|+\mathrm{C}$
$\Rightarrow-\frac{2}{v}=\log |x|+\mathrm{C}$
$\Rightarrow-\frac{2}{\frac{y}{x}}=\log |x|+\mathrm{C}$
$\Rightarrow-\frac{2 x}{y}=\log |x|+\mathrm{C}$ ...(2)
Now, $y=2$ at $x=1$.
$\Rightarrow-1=\log (1)+C$
$\Rightarrow C=-1$
Substituting C = –1 in equation (2), we get:
$-\frac{2 x}{y}=\log |x|-1$
$\Rightarrow \frac{2 x}{y}=1-\log |x|$
$\Rightarrow y=\frac{2 x}{1-\log |x|},(x \neq 0, x \neq e)$
This is the required solution of the given differential equation.