TITLE: Solve the differential equation $\frac{dy}{dx}=\frac{2x+y}{y}$
QUESTION [5 upvotes]: Solve
$$\frac{dy}{dx}=\frac{2x+y}{y}$$
Let
$$\frac{dx}{dt}=y \\ \frac{dy}{dt}=2x+y$$
Plugin $\frac{dx}{dt}=y$ into $\frac{dy}{dt}=2x+y$ I get $$2x+\frac{dx}{dt}=\frac{dy}{dt}$$
Using the fact that $\frac{d^2x}{dt^2}=\frac{dy}{dt}$ I get the 2nd order system:
$$\frac{d^2x}{dt^2}-\frac{dx}{dt}-2x=0$$
Solving this I get:
$(r-2)(r+1)=0$ , so $r=2,=1$
$$x(t)=Ae^{2t}+Be^{-1t}$$
How do I get my solution in terms of $y,x$? I can't seem to integrate $\frac{dy}{dx}$ by separating variables directly.

REPLY [3 votes]: I'm a bit rusty with differential equations, so I'll just assume that we have the required number of constants of integration...
$$\begin{align}
x & = Ae^{2t} + Be^{−t}\\
y & = \frac{dx}{dt}\\
y & = 2Ae^{2t} - Be^{−t}\\
x+y & = 3Ae^{2t}\\
2x-y & = 3Be^{−t}\\
e^{2t} = \frac{x+y}{3A} & = \left(\frac{3B}{2x-y}\right)^2\\
(2x-y)^2(x+y) & = 27AB^2\\
4x^3 - 3xy^2 + y^3 & = 27AB^2
\end{align}$$
Now to check that by differentiating:
$$\begin{align}
12x^2 - 3y^2 - 6xy\frac{dy}{dx} + 3y^2\frac{dy}{dx} & = 0\\
\frac{dy}{dx}(3y^2 - 6xy) & = 3y^2 - 12x^2\\
\frac{dy}{dx} & = \frac{y^2 - 4x^2}{y^2 - 2xy}\\
& = \frac{(y - 2x)(y + 2x)}{y(y - 2x)}\\
& = \frac{y + 2x}{y}, \text{when } y \ne 2x\\
\end{align}$$
which agrees with the original equation.

Here's an alternative solution that doesn't use those parametric equations in $t$. Instead, we use a simple $y = vx$ substitution and separation of variables. 
$$\begin{align}
\frac{dy}{dx}&=\frac{2x+y}{y}\\
ydy &= (2x+y)dx\\
\\
\text{Let } y &= vx\\
dy &= vdx + xdv\\
\\
\text{Substituting, }\\
vx(vdx + xdv) &= (2x+vx)dx\\
v^2dx + vxdv - (2+v)dx &= 0\\
(v^2-v-2)dx + vxdv &= 0\\
\\
\text{Separating variables, }\\
\frac{dx}{x} + \frac{vdv}{v^2-v-2} &= 0\\
\\
\text{Splitting the right term with partial fractions, }\\
\frac{dx}{x} + \frac{1}{3}\left(\frac{(v-2)+2(v+1)}{(v-2)(v+1)}\right)dv &= 0\\
\frac{dx}{x} + \frac{1}{3}\left(\frac{dv}{v+1} + 2 \frac{dv}{v-2}\right) &= 0\\
\\
\text{Integrating, }\\
\int\frac{dx}{x} + \frac{1}{3}\left(\int\frac{dv}{v+1} + 2 \int\frac{dv}{v-2}\right) &= k\\
\log(x) + \frac{1}{3}(\log(v+1) + 2 \log(v-2)) &= k\\
3\log(x) + \log(v+1) + 2 \log(v-2) &= 3k\\
x^3(v+1)(v-2)^2 &= e^{3k} = C\\
x^3(v+1)(v^2-4v+4) &= C\\
x^3(v^3-4v^2+4v + v^2-4v+4) &= C\\
x^3(v^3-3v^2+4) &= C\\
(xv)^3-3x(vx)^2+4x^3 &= C\\
\\
\text{Replacing $vx$ with $y$, }\\
y^3-3xy^2+4x^3 &= C\\
\end{align}$$