YY and LMY both love mathematics. One day LMY wrote down an integer 3 and two polynomials
and
on a piece of paper.
YY noticed that 3 is a prime. Besides, he found that f(x) has a degree strictly less than g(x). And all coefficients of the two polynomials are between 0 and 2,
inclusively. His most important discovery is, that there is a polynomial
, such that
Then YY added a restriction: all coefficients of h(x) must be between 0 and 2 inclusively, and its degree must be less than g(x). Finally, he found that the polynomial
h(x) with such properties is unique.
The property that a polynomial f(x) with all its coefficients between 0 and p-1 inclusively, where p is a prime number, is called that f(x) is in the polynomial ring
defined on field Zp. Note that
. Such a polynomial ring is called Zp[x].
Then h(x) is called a multiplicative inverse of f(x), defined on the quotient ring Zp[x]/(g(x)). YY wonders if such an inverse always exists and is unique.