Companion worksheet to the course Gröbner bases and convex polytopes: between algebra, geometry, and combinatorics by Sara Veneziale. Edit the code and click Run to experiment. Note that variables are not shared between cells.
In one variable, the division algorithm is unique: given $f, g \in k[x]$, there exist unique $q, r$ with $f = qg + r$ and $\deg(r) < \deg(g)$.
Every ideal in $k[x]$ is principal:
In multiple variables, we need to choose a monomial order. Different orders give different leading terms. Let's see the three standard orders on the same polynomial. Try to find a polynomial that has a different leading order for each and one that has the same leading order for all.
The multivariate division algorithm produces $f = h_1 f_1 + \cdots + h_s f_s + r$, but the remainder $r$ depends on the order in which we divide.
Sage's built-in reduce divides by all polynomials simultaneously, so the list order doesn't matter. To see the order-dependence, we need the textbook algorithm where the break restarts from the top of the divisor list:
Let's start by computing the leading terms with respect to some order.
Let's compute the Gröbner basis of a simple ideal and verify that the remainder is now unique regardless of division order.
One of the main uses of Gröbner bases: testing whether a polynomial belongs to an ideal.
This is a key point: the same ideal has different Gröbner bases under different monomial orders. Let's see this with an example.
Let's implement Buchberger's algorithm naively, with full logging so we can follow each step.