TITLE: Nonlinear 1st order ODE involving a rational function
QUESTION [7 upvotes]: $$y'=\frac{-6x+y-3}{2x-y-1}$$
Is there a foolproof method for tackling equations of the form $y'=\dfrac{ax+by+c}{dx+ey+f}$ ?
I've tried a few substitutions (like $y=vx$ and $v=2x-y-1$, neither of which seem to work), and I've also tried treating the equation as one would an exact equation, but the integrating factor isn't one-dimensional.

REPLY [9 votes]: There sure is!
First let's tackle an equation of the form $$\frac{\mathrm{d}y}{\mathrm{d}x}=\frac{Ax+By}{Cx+Dy}\tag{1} \quad .$$
Divide top and bottomh by $x$, on the RHS, to give $$\frac{\mathrm{d}y}{\mathrm{d}x}=\frac{A+B\left(\frac{y}{x}\right)}{C+D\left(\frac{y}{x} \right)} \quad.$$
Now let $v=\frac{y}{x} \iff y=vx \implies \underbrace{\frac{\mathrm{d}y}{\mathrm{d}x}=v+x\frac{\mathrm{d}v}{\mathrm{d}x}}_{\text{product rule}} \quad .$
Then we have $$v+x\frac{\mathrm{d}v}{\mathrm{d}x}=\frac{A+Bv}{C+Dv}$$ which is separable (I'll leave this as an exercise for you-- subtract $v$ from both sides and put everything on RHS over a common denominator).
Now, what happens if we've got an equation of the form $$\frac{\mathrm{d}y}{\mathrm{d}x}=\frac{ax+by+c}{dx+ey+f} \quad?$$
Let $$X=x-x_0, \quad  Y=y-y_0 \iff x=X+x_0, \quad y=Y+y_0 \quad $$ for some suitable constants $x_0, y_0$ (which are to be determined).
Then we have $$\frac{\mathrm{d}y}{\mathrm{d}x}=\frac{\mathrm{d}Y}{\mathrm{d}X}=\frac{a(X+x_0)+b(Y+y_0)+c}{d(X+x_0)+e(Y+y_0)+f}=\frac{aX+bY+(\color{red}{ax_0+by_0+c})}{cX+dY+(\color{green}{dx_0+ey_0+f})}.$$
We now choose $x_0, y_0$ so that the constant terms vanish.
i.e. $$\begin{cases}\color{red}{ax_0+by_0+c=0} \\ \color{green}{dx_0+ey_0+f=0}\end{cases} \tag{2}$$ which we can solve (under certain conditions) to give $x_0$ and $y_0$.
Then we have $$\frac{\mathrm{d}Y}{\mathrm{d}X}=\frac{aX+bY}{dX+eY}$$ which is of the form $(1).$