2

Currently, I'm trying to understand the Quadratic Frobenius test on Wikipedia. I was stuck when I saw the notation:

$$ A \equiv B \mod (n, f(x))$$

Wikipedia explains like this:

The notation $A \equiv B \mod (n, f(x))$ means that $A - B = H(x) \cdot n + K(x) \cdot f(x)$ where H, K are polynomials.

I don't understand much about this notation and its properties. Can some explain this to me? I'm trying to implementing this algorithm, but this notation is way too complicated for me to do that.

I also want to know how to calculate $A \mod (n, f(x))$

The 2nd
  • 856

1 Answers1

3

$\newcommand{\l}{\pmod{n,f(x)}}$ To take a polynomial modulo $(n,f(x))$, you find the remainder when it is divided by $f(x)$, then take every coefficient modulo $n$. The result is the answer you seek. Also ,the notation $A \equiv B \pmod{n,f(x)}$ means that $A$ and $B$ give the same result when you do this i.e. $A-B$ , upon division by $f(x)$, has a remainder all of whose coefficients are divisible by $n$.


Let me take examples to clarify this.

Suppose you are trying to find $x^2+3x+10 \pmod {x+5,7}$. First, you find $x^2+3x+4 \pmod{x+5}$, which is $14$ (the quotient is $x+2$, we ignore). Now we take the remainder of this upon division by $7$, which is $0$. Thus, the answer to this question is $0$.

Next, trying to find $x^3+12x+7 \pmod{x^2+3x+7,3}$. The result is $14x+28$ when we first do $\frac{x^3+12x+7}{x^2+3x+7}$. Once we reduce every coefficient modulo $3$, we get $2x+1$ , because $14 \equiv 2 \pmod 3$ and $28 \equiv 1 \pmod 3$.

This is how one is expected to compute the remainder modulo $(n,f(x))$.

Remark : Note that one may also first reduce every coefficient by $n$ , then perform the division, then again reduce modulo $n$ for simplification.


The way to think of this , is to realize that the set $(n,f(x))$ which is described in your Wikipedia definition, is closed under addition, and multiplication by any polynomial (called as an ideal). Now, we define two elements as being equivalent modulo the ideal if their difference belongs in the ideal. This enjoys several properties you've seen usually, all of which follow from the fact that the set is an ideal.

  • If $A \equiv B \l$ , $B \equiv C \l$, then $A \equiv C \l$.

  • If $A \equiv B \l$, $C \equiv D \l$ then $AC \equiv BD \l$.

  • If $A \equiv B \l$ then for any $k$ we have $A^k \equiv B^k \l$.

Of course, if there are any properties you would specifically like of this relation, you can address them in the comments!

  • This looks good for me. But it raises me another question: Can we take every coefficient modulo $n$ first, then find the remainder when it is divided by $f(x)$? If yes, does that mean the order of $n$ and $f(x)$ in the modulo matter here? – The 2nd Mar 18 '20 at 13:38
  • You can do that, but the problem is that when you take the remainder w.r.t $f(x)$ , you will get a polynomial which you again need to reduce modulo $n$ because some coefficients of that might have gone above $n$ or below $0$. – Sarvesh Ravichandran Iyer Mar 18 '20 at 13:40
  • That seems fine for me. Thank you! – The 2nd Mar 18 '20 at 13:45