# Solving Rational ODE's of the form (ax+by+c) dx+(ex+fy+g) dy=0.

#### Ackbach

##### Indicium Physicus
Staff member
There are essentially three cases of the rational ODE $(ax+by+c)\,dx+(ex+fy+g)\,dy=0,$ since there are two straight line expressions multiplying the differentials. We will think of this geometrically, then translate to the algebraic approach. The tricky part to these problems is keeping track of all the sub-cases. I will usually stop before getting too much into the sub-cases; the idea is that you should be able to take it from where I lead you.

Case 1. The two lines $ax+by+c=0$ and $ex+fy+g=0$ are identical (that is, they intersect at all points on the lines). Algebraically, then, we must have a constant, non-zero ratio of all the coefficients, which we'll call $k:$
\begin{align*}
a&=ke\\
b&=kf\\
c&=kg.
\end{align*}
Indeed, this is how you can recognize this case! We can re-write the ODE as
$$k\,(ex+fy+g)\,dx+(ex+fy+g)\,dy=(ex+fy+g)(k\,dx+dy)=0.$$
We can see from inspection that the straight line $ex+fy+g=0$ is a solution of the ODE, but it might not be the only one. Let us suppose that we seek other solutions (so we'll assume, for the moment, that $ex+fy+g\not=0.$) In that case, we can simply cancel the factor and obtain
\begin{align*}
k\,dx+dy&=0 \\
-k\int dx&=\int dy \\
-kx+C&=y,
\end{align*}
which is the equation of another line. So we see that there are two solutions in this case:
$$ex+fy+g=0\quad\text{or}\quad y=-kx+C,$$
where $k$ is defined as above, in terms of $a, b, c, e, f, g.$ If you have an initial value problem, and your initial value is not on the line $ex+fy+g=0,$ then you will have to choose the other solution in order to take advantage of the arbitrary constant. And that wraps up this case fairly well.

Case 2. The two lines $ax+by+c=0$ and $ex+fy+g=0$ are parallel and non-intersecting. Algebraically, we must have a non-zero $k$ such that
\begin{align*}
a&=ke\\
b&=kf\\
c&\not=kg.
\end{align*}
We can rewrite the DE as
\begin{align*}
(ax+by+c)\,dx+(ex+fy+g)\,dy&=0 \\
(kex+kfy+c)\,dx+(ex+fy+g)\,dy&=0 \\
k(ex+fy+c/k)\,dx+(ex+fy+g)\,dy&=0.
\end{align*}
Now we let $u=ex+fy,$ with $du=e\,dx+f\,dy$ and $du-e\,dx=f\,dy,$ as before. Substituting into the DE yields
\begin{align*}
k(u+c/k)\,dx+(u+g)(du-e\,dx)&=0\\
k\,u\,dx+c\,dx+u\,du-e\,u\,dx+g\,du-eg\,dx&=0\\
(ku+c-eu-eg)\,dx+(u+g)\,du&=0\\
(u(k-e)+c-eg)\,dx+(u+g)\,du&=0.
\end{align*}
From here, you can see that the DE is separable! There are way too many subcases and possibilities to consider, so I will stop here for Case 2.

Case 3: The two lines $ax+by+c=0$ and $ex+fy+g=0$ intersect at one point, call it $(x_0,y_0).$ Where is that point? We solve the two equations simultaneously:
\begin{align*}
ax_0+by_0&=-c\\
ex_0+fy_0&=-g\\
x_0&=\frac{\left|\begin{matrix}-c&b\\-g&f\end{matrix}\right|}{\left|\begin{matrix}a&b\\e&f\end{matrix}\right|}\\
&=\frac{bg-cf}{af-be}\\
y_0&=\frac{\left|\begin{matrix}a&-c\\e&-g\end{matrix}\right|}{\left|\begin{matrix}a&b\\e&f\end{matrix}\right|}\\
&=\frac{ce-ag}{af-be}.
\end{align*}
Naturally, this is only possible if $af-be\not=0,$ the condition for intersecting lines in the first place.

The idea here is to substitute a translation $t=x-x_0$ and $s=y-y_0.$ This would mean $dt=dx$ and $ds=dy,$ so that the original system becomes
\begin{align*}
\left(a\left(t+x_0\right)+b\left(s+y_0\right)+c\right)dt+\left(e\left(t+x_0\right)+f\left(s+y_0\right)+g\right)ds&=0\\
\left(a\left(t+\frac{bg-cf}{af-be}\right)+b\left(s+\frac{ce-ag}{af-be}\right)+c\right)dt+\left(e\left(t+\frac{bg-cf}{af-be}\right)+f\left(s+\frac{ce-ag}{af-be}\right)+g\right)ds&=0.
\end{align*}
Let's take a look at the constant terms for each differential (so, ignoring $t$ and $s$ for now):
\begin{align*}
a\,\frac{bg-cf}{af-be}+b\,\frac{ce-ag}{af-be}+c&=a\,\frac{bg-cf}{af-be}+b\,\frac{ce-ag}{af-be}+c\,\frac{af-be}{af-be}\\
&=\frac{abg-acf+bce-abg+acf-bce}{af-be}\\
&=0.
\end{align*}
Similarly,
\begin{align*}
e\,\frac{bg-cf}{af-be}+f\,\frac{ce-ag}{af-be}+g&=e\,\frac{bg-cf}{af-be}+f\,\frac{ce-ag}{af-be}+g\,\frac{af-be}{af-be}\\
&=\frac{beg-cef+cef-afg+afg-beg}{af-be}\\
&=0.
\end{align*}
So the constant terms all cancel! That makes the DE as follows:
$$(at+bs)\,dt+(et+fs)\,ds=0.$$
This is a homogeneous ODE, because $t$ and $s$ appear in the same powers. We perform the substitution $tu=s,$ with $ds=t\,du+u\,dt,$ and the DE becomes
\begin{align*}
(at+btu)\,dt+(et+ftu)(t\,du+u\,dt)&=0\\
(at+btu)\,dt+(et+ftu)\,t\,du+(et+ftu)\,u\,dt&=0\\
\left(at+btu+etu+ftu^2\right)dt+\left(et^2+ft^2u\right)du&=0\\
t\left(a+bu+eu+fu^2\right)dt+t^2(e+fu)\,du&=0\\
\left(a+bu+eu+fu^2\right)dt+t(e+fu)\,du&=0\\
\left(a+bu+eu+fu^2\right)dt&=-t(e+fu)\,du\\
\frac{dt}{t}&=-\frac{e+fu}{a+bu+eu+fu^2}\,du\\
\ln|t|+C&=-\int\frac{e+fu}{a+bu+eu+fu^2}\,du.
\end{align*}
This you can solve implicitly for $t.$ Alternatively, you could have done the substitution $t=us,$ with $dt=u\,ds+s\,du,$ which would probably have given you an easier solution for the independent variable. I'll stop here, as I've reduced the problem to an integral with too many sub-cases. But don't forget that once you integrate, you need to back-substitute, first to get back to $s$ and $t,$ and then un-translate to get to $x$ and $y.$

Summary. If the two lines $ax+by+c=0$ and $ex+fy+g=0$ are identical, then substitute $u=ax+by+c.$ If they are parallel and non-intersecting, substitute $u=ax+by.$ If they intersect at one point $(x_0,y_0),$ then substitute $t=x-x_0$ and $s=y-y_0$ to lead to a homogeneous equation, where either $tu=s$ or $t=su$ will render the equation separable.

Well, that concludes this note on Differential Equations!