Let $A(x)$ and $B(x)$ be solutions to homogeneous linear ODEs with polynomial coefficients, i.e., $A(x)$ satisfies $$p_KA^{(K)} + p_{K-1}A^{(K-1)} + \cdots + p_1A' + p_0A=0$$ and $B(x)$ satisfies $$q_LB^{(L)} + q_{L-1}B^{(L-1)} + \cdots + q_1B' + q_0B = 0,$$ for polynomials $\{p_i(x)\}$ and $\{q_i(x)\}$.

Suppose $B$ is non-vanishing in a neighborhood of zero and define $F(x) = \frac{A(x)}{B(x)}$. I'd like to find an ODE with polynomial coefficients (in terms of the $p_i$ and $q_i$) that $F(x)$ satisfies. In most cases, it will necessarily be nonlinear. Because I won't know $A(x)$ and $B(x)$ a priori, the ODE must be only in terms of $F$, $\{p_i\}$, and $\{q_i\}$. I'm treating the functions as generating functions and so I'm only concerned with formal power series solutions and not with actual convergence.

In the case where $K=1$ and $L=1$, one can proceed as follows. Suppose $$p_1A' + p_0A=0\qquad\text{and}\qquad q_1B' + q_0B=0.$$ Then $$A' = -\frac{p_0}{p_1}A\qquad\text{and}\qquad B' = -\frac{q_0}{q_1}B.$$

Now, $$F' = \frac{A'B - AB'}{B^2} = \frac{-\frac{p_0}{p_1}AB + \frac{q_0}{q_1}AB}{B^2} = \left(-\frac{p_0}{p_1}+\frac{q_0}{q_1}\right)\frac{A}{B} = \left(-\frac{p_0}{p_1}+\frac{q_0}{q_1}\right)F$$ and so the desired ODE is $$F' - \left(\frac{p_0}{p_1} - \frac{q_0}{q_1}\right)F = 0.$$ (It just happens to be linear in this simple case.)

In the case where $A(x)=1$ (and so $F(x) =\frac{1}{B(x)}$), the same technique works by using derivatives of $F$. However, in the general I encounter terms like $\frac{A'}{B}$ that I do not know how to write in terms of $F$ and its derivatives. Even a solution that works for $K=L=2$ would be enlightening!

exactlythe solutions $F=A/B$. Are you looking for such an ODE in general, or just one that has the solutions $A/B$ and perhaps many others? (I very much doubt that the stronger version will work.) $\endgroup$