Justus Polzin

Justus Polzin

Multivariate Polynomials mod m

I was asked about this the other day and I only talked about the univariate case in Part 3 of the MBA series. I will present the main result first and then bore you with the proof.

We will consider the polynomials to be over instead of . It makes some things slightly cleaner. We will write which is also known as the falling factorial. Let , we will write , for the induced function mod m.

Let be the ideal of polynomials in that evaluate to zero (mod m) everywhere, i.e.

Generators of
Define

Then (i.e. is generated by the s), where is the smallest integer such that divides .

Note that this generating set is not at all minimal. We will discuss this at the end.

Polynomial Bases

(Multivariate) polynomials over a commutative ring form a free -Module. If you don't know what that means, then just think of it as a vector space. So in particular, they have a basis. Let's consider univariate polynomials in for the moment. The obvious basis is the monomial basis: . But for our purposes, it turns out that another basis is more useful: These are the falling factorials from the beginning. I will call it the Newton basis. (I don't think this basis has an official name, but it is closely related to Newton's series, so I just made it up.) It is easy to see that this is a basis because the polynomials are monic and the degree is increasing by 1 from one to the next, so that we can iteratively do polynomial division with basis polynomials of lower and lower degree. That this is a basis means that every polynomial in can be uniquely written as for that can be calculated with polynomial division.

Now, consider bivariate polynomials .

Basis of bivariate Polynomials
Let be a basis for and be a basis for . Then is a basis for .
Proof: It is well known that , so we can write as where each . (Although intuitively clear, formally, this step is not quite so simple, since we only know that the are a basis when the polynomials are over not . You can treat the as an actual variable, then this works, e.g. in you can write in the standard basis , where is a completely independent variable.) Now, we can write each So overall, So is a basis.

We can inductively extend this to multivariate polynomials to get

Basis of multivariate Polynomials
Let be bases for . Then is a basis for .

Thus the Newton basis for is .

Univariate

Generators of
where is the smallest integer such that divides .

This result was already stated in Part 3 of the MBA series, but I didn't prove it and instead referred to Singmaster. We will prove it here, because the prove ourselves, because (I think) Singmaster's proof is more difficult to generalize to multiple variables.

The idea is to first show that the are zero everywhere, and then that every polynomial that is zero everywhere, is generated by the .

The are zero everywhere

Let . We will show that the from the definition is actually optimal, because we will need it later. Notice that is the product of consecutive integers. (If you think in then they could wrap around, in which case 0 is in the product, so we are done). It is a well known fact that the product of consecutive integers is divisible by , which can be proven in one line. In particular . The right-hand side being zero in means being a multiple of in , so to choose as small as possible, we want So by for .

A Polynomial that is zero everywhere is generated by the

Let , i.e. such that for all . We can write in the Newton basis:

We will show inductively that the coefficients have the given form, i.e. that actually .

For , we will consider . Obviously, , since for . So has to be zero (or a multiple of the modulus , if you think of the polynomials as being over ).

Similarly, for , we will consider . From the induction hypothesis we get that we can write as:

We have for and of course , so But this is exactly the case we discussed when finding the for the , so is a multiple of that , i.e. and can be written

When , is 1, so further are just -multiples of , and thus not needed in the generating set.

Multivariate

One idea you might have, is whether the multivariate is just the product of the univariate in each variable, but this is not true. For example, consider the polynomial that is 0 everywhere mod 16, but is not 0 mod 16. Nevertheless, the simple (but not quite as simple) generalization of the univariate case that I showed at the beginning is true.

Again, let , i.e. such that for all . Again, we can write in the Newton basis:

There very well may be a cleverer way to do this, but we are essentially going to do induction. But the details of the inductions actually require some thought. We want to follow the same logic as in the univariate case, i.e. to prove that has the correct form (in this case ) by considering . Let's look at to reverse-engineer what the induction hypothesis should look like.

If any of the , then and so the whole term is zero. This means we can restrict the sum.

The other terms are not zero in general (i.e. for any polynomial N), but since we are formulating the induction hypothesis, we can assume those have the correct form, meaning we can write them as multiples of the . We just have to be careful to exclude , since that is the term we're trying to show is zero. Over all the induction hypothesis looks like this:

has the following form:

Here is an illustration for 2 variables where . The yellow point at stands for the term that we are trying to show has the wanted form. The blue dots are the terms of the first sum, which are automatically zero when evaluating . The red dots are the terms of the second sum, which we assume have the correct form already (because we have shown that they do previously) and are thus also zero.

We're now 80% done, even though we haven't even shown that has the correct form given the form of , which we are going to do now. As we just discussed, we will consider . By our construction, the only term that is non-zero is:

Going through the same logic as in the univariate case, we want this to equal a multiple of the modulus . But this implies that is a multiple of the smallest such value which is , by the exact argument as in the univariate case.

To show this is true for all , we can e.g. do induction on . For , this is trivial. And the induction step we just proved can be easily used to show this for .

For example for 2 variables and , we have already shown it for , i.e. the the red points in the following diagram. And the induction step allows us to conclude it for all points on the boundary.

On Minimality

In the Part 3 of the MBA series, I already discussed that for the univariate case, when the modulus is a power of two, then every is not needed, because it is an -multiple of the previous , which follows from the fact that it has the same leading coefficient, as discussed there. In general, the same idea applies: If has the same leading coefficient as any of , then it is obviously a multiple of that polynomial and is not needed. At some point the leading coefficient will be 1, at which point no further polynomials are needed, because they all have leading coefficient 1. This way you can algorithmically find the minimal generating set. Of course if you were gonna store them, you wouldn't really care about the variable names, so e.g. storing and (for ) is redundant, because . In practice you would restrict the list to , but by the definition of a generating set these are still needed.