Is there a closed form solution for this first order ODE?
$(at+bx(t)+c)x'(t)+(pt+qx(t)+r)=0$, where $a$, $b$, $c$, $p$, $q$, $r$ are constants with $a^{2}+b^{2}+c^{2} \neq 0$.
I tried some variable subtitution, but I don't see a clear way to solve this problem.
Assuming $\frac{p}{a} \neq \frac{q}{b}$:
Using $x$ instead of $x(t)$ $$x'(t)=-\frac{pt+qx+r}{at+bx+c}$$ Assuming $t=T-T_0$ and $x=X-X_0$ (Again $X$ is a function), $$ \frac{dX}{dT}=-\frac{p(T-T_0)+q(X-X_0)+r}{a(T-T_0)+b(X-X_0)+c} $$$$ \frac{dX}{dT}=-\frac{pT+qX+(r-pT_0-qX_0)}{aT+bX+(c-aT_0-bX_0)}$$ To make the constant term zero in both numerator and denominator consider, $$r = pT_0 + qX_0$$$$c = aT_0 + bX_0$$ Therefore, $$ \frac{dX}{dT}=-\frac{pT+qX}{aT+bX}$$ Assume that $X=TF$, $\frac{dX}{dT} = F+T\frac{dF}{dT}$ $$ \therefore F+T\frac{dF}{dT} = -\frac{pT+qTF}{aT+bTF} $$$$ \therefore F+T\frac{dF}{dT} = -\frac{p+qF}{a+bF} $$$$ \therefore T\frac{dF}{dT} = -\left(\frac{p+qF}{a+bF} + F\right) $$$$ \therefore T\frac{dF}{dT} = -\frac{p+(q+a)F+bF^2}{a+bF} $$$$ \therefore \frac{a+bF}{p+(q+a)F+bF^2}\ dF = -\frac{1}{T}\ dT $$ Now integrate both sides, you will get F as a function of T. By previous assumption $F = \frac{X}{T}$. Then finally substitute $T = t+T_0$ and $X = x+X_0$. The value of $T_0$ and $X_0$ can be calculated by $r = pT_0 + qX_0$ and $c = aT_0 + bX_0$.
As pointed out by @Rhcpy99, this method doesn't work when $\frac{p}{a}=\frac{q}{b}$
For $\frac{p}{a}=\frac{q}{b}$:
Let $$k=\frac{p}{a}=\frac{q}{b}$$ $$\therefore x'(t)=-\frac{akt+bkx+r}{at+bx+c}$$ $$\therefore x'(t)=-\frac{akt+bkx+ck+(r-ck)}{at+bx+c}$$ $$\therefore x'(t)=-k-\frac{(r-ck)}{at+bx+c}$$ Let,(Thank you to @Dylan for suggesting this substitution) $$u=at+bx+c$$ $$\therefore \frac{du}{dt} = a + b\frac{dx}{dt} $$ $$\therefore \frac{dx}{dt} = \frac{1}{b}\frac{du}{dt} -\frac{a}{b}$$ Substituting in the equation, $$ \frac{1}{b}\frac{du}{dt} -\frac{a}{b} = -k-\frac{(r-ck)}{u} $$ $$ \therefore \frac{du}{dt}= a-bk-\frac{b(r-ck)}{u} $$ $$ \therefore \frac{du}{dt}= \frac{(a-bk)u+b(r-ck)}{u} $$ $$ \therefore \frac{u}{(a-bk)u+b(r-ck)}{du}= dt $$ And then integrate on both sides.