How can I solve $\frac {dy}{dx}=2\frac yx -1$? I tried to separate the variables, and then with an integrating factor, but to no avail
 A: Here is an approach using the integrating factor:

You have:
$$\frac{dy}{dx}-\frac{2}{x}\cdot y=-1$$
This is a first-order linear ODE because it is in the form:
$$\frac{dy}{dx}+P(x)y=Q(x)$$
The integrating factor must be:
$$\mu(x)=e^{\int P(x)~dx}=e^{\int -\frac{2}{x}~dx}=\frac{1}{x^2}$$
Thus, we have:
$$\frac{1}{x^2}\cdot \frac{dy}{dx}-\frac{2y}{x^3}=-\frac{1}{x^2}$$
You may now substitute $-\frac{2}{x^3}=\frac{d}{dx}\left(\frac{1}{x^2}\right)$ then apply the reverse product rule. From here, it should be easy to solve.
A: An alternative method to my previous answer is to notice that this is a homogeneous differential equation since it can be written in the form:
$$\frac{dy}{dx}=F\left(\frac{y}{x}\right)$$
Thus, one may substitute the following to obtain a separable ODE:
$$y=vx \iff \frac{dy}{dx}=\frac{dv}{dx}\cdot x+v$$
This change of variable gives:
$$x\frac{dv}{dx}+v=2v-1$$
$$x\frac{dv}{dx}=v-1 \tag{1}$$
Now, we see that $(1)$ is separable. Therefore, we can divide both sides by $v-1$ and integrate both sides with respect to $x$:
$$\int \frac{1}{v-1}~dv=\int \frac{1}{x}~dx$$
Can you continue?
