The function div() provides division of polynomials with remainder.
That is, for polynomials f and g, it computes q and r, such
that \(f = g \cdot q + r\) and \(\deg(r) < q\). For polynomials in one variables
with coefficients in a field, say, the rational numbers, q and r are
uniquely defined this way:

As you can see, q has a non-integer coefficient. If you want to do division
only in the ring of polynomials with integer coefficients, you can specify an
additional parameter:

>>> q,r=div(f,g,domain='ZZ')>>> q0>>> r 25*x + 10*x + 3

But be warned, that this ring is no longer Euclidean and that the degree of the
remainder doesn’t need to be smaller than that of f. Since 2 doesn’t divide 5,
\(2 x\) doesn’t divide \(5 x^2\), even if the degree is smaller. But:

In the last examples, all of the three variables x, y and z are
assumed to be variables of the polynomials. But if you have some unrelated
constant as coefficient, you can specify the variables explicitly: