# How does Mathematica factor expression with derivatives (i.e. not polynomial)?

I was surprised Mathematica did this automatically. I have an ode and wanted to factor it. I did not think Factor will work and I need to write special code to do it. But Mathematica did it

ClearAll[y, x];
odeLHS = y'[x]*y[x]*y''[x] + y'[x]^2*y[x] + y'[x]*y[x]


We see by looking at the above that $$y y'$$ is a factor. So

List @@ Factor[odeLHS]


So it broke the ode into 3 products which is what I wanted. But how did it do it since it is not a polynomial.

Only reference I found is in the help, under Advanced Uses it says

Some non-polynomial expressions can be factored:

But some is not very clear to me. On what basis does it do it? Could one predict beforehand if Factor will work or not on an expression? How did Factor work on non-polynomials?

btw, in Maple, the factor() command does not work on this since not polynomial., and I had to write special code to factor on an ode. So this is much easier in Mathematica to do.

V 13.2

• Have you tried PolynomialQ[odeLHS, Variables[odeLHS]]? And perhaps Variables[odeLHS]? Commented Jan 29, 2023 at 2:43

Seems that Factor has just treated those derivatives as new variables. This can be verified with:
odeLHS /. Derivative[n_][y_] :> Symbol[ToString@y <> ToString@n] // Factor