What method should be used to solve the following differential equation? I have the differential equation:
$$y^{2}dy = x\left ( x dy - y dx \right ) e^{\frac{x}{y}}$$
and I need to solve for a general solution. I'm getting stuck trying to solve for a general solution, as there is no definite Substitution that seems appropriate, and solving for $dy/dx$ is harder that I first thought.
What method should be applied to solve for $Y$ with independent variable $x$?
 A: 
We call a first order differential equation in the following form homogeneous:
  $$y'=F\left(\frac{y}{x}\right)$$
  Using the change of variable $y=vx$, it becomes a separable differential equation.

Let's try and get your ODE in that form:
$$y^2 y'=x^2 e^{x/y} y'-xye^{x/y}$$
$$(y^2-x^2 e^{x/y})y'=-xye^{x/y}$$
$$y'=\frac{xye^{x/y}}{x^2 e^{x/y}-y^2}$$
Dividing both the numerator and denominator of the RHS by $x^2$, we obtain what we want:
$$y'=\frac{\frac{y}{x}e^{x/y}}{e^{x/y}-\left(\frac{y}{x}\right)^2}$$
Let's now apply the proposed substitution:
$$v+xv'=\frac{ve^{1/v}}{e^{1/v}-v^2} \iff v'=\frac{v^3}{x(e^{1/v}-v^2)} \tag{1}$$
Equation $(1)$ is clearly separable, as expected from our change of variable:
$$\int \frac{e^{1/v}-v^2}{v^3}~dv=\int \frac{1}{x}~dx$$
Integrating the RHS is easy. You can proceed with the left hand side by substituting $u=e^{1/v}$, and you should end up with a neat solution.
A: Here's an alternative method, where we 'convert' the ODE into an exact equation using an integrating factor, and then find the general solution.

We can easily write the equation in the following form:
$$M(x,y)~dx+N(x,y)~dy=0$$
Where $M(x,y)=xye^{x/y}$ and $N(x,y)=y^2-x^2 e^{x/y}$. Let's test if this equation is exact:
$$\frac{\partial M}{\partial y}=xe^{x/y}-\frac{x^2 e^{x/y}}{y}$$
$$\frac{\partial N}{\partial x}=-\frac{x^2 e^{x/y}}{y}-2xe^{x/y}$$
This is not an exact equation, since $\dfrac{\partial M}{\partial y}\neq \dfrac{\partial N}{\partial x}$. Therefore, we must find an integrating factor to make the equation exact.

Since $\dfrac{\frac{\partial N}{\partial x}-\frac{\partial M}{\partial y}}{M}$ is a function of $y$ only, we know that we can assume that the integrating factor is in the form $\mu(y)$. It can be shown that the integrating factor in the above case is given by:
$$\mu(y)=\exp\left(\frac{\frac{\partial N}{\partial x}-\frac{\partial M}{\partial y}}{M}\right)$$
We thus find $\mu(y)=\dfrac{1}{y^3}$.

We now have an exact equation (Easily verifiable):
$$\frac{xe^{x/y}}{y^2}~dx+\frac{y^2-x^2 e^{x/y}}{y^3}~dy=0 \tag{1}$$
We thus know that there is some function $\psi(x,y)$ such that:
$$\begin{cases} \frac{\partial \psi(x,y)}{\partial x}=\frac{xe^{x/y}}{y^2} \\ \frac{\partial \psi(x,y)}{\partial y}=\frac{y^2-x^2 e^{x/y}}{y^3} \end{cases} \tag{2}$$
The solution will be given by $\psi(x,y)=C$, where $C$ is an arbitrary constant.

To find this function $\psi(x,y)$, we can integrate $\frac{\partial \psi(x,y)}{\partial x}$ with respect to $x$:
$$\psi(x,y)=\int \frac{xe^{x/y}}{y^2}~dx=\frac{e^{x/y} (x-y)}{y}+g(y) \tag{3}$$
Where $g(y)$ is an arbitrary function of $y$. We can find $g(y)$ by evaluating the partial derivative of $\psi(x,y)$ with respect to $y$, and then substituting it into the second equation of $(2)$.
