For example, find the gcd of $2x^5 + 4x^3 + 2x^2 + 5x+ 1$ and $x^6 + 3x^5 + 4x^3 + 3x + 1$ in $\mathbb{Z}/7\mathbb{Z}$.
Asked
Active
Viewed 139 times
-1
-
1It does matter that the modulus is a prime, otherwise things are more complicated (and some things fail). – paul garrett Mar 10 '20 at 20:48
-
https://math.stackexchange.com/questions/86265/how-to-find-the-gcd-of-two-polynomials?rq=1 – zwim Mar 10 '20 at 20:52
-
@paulgarrett Yes I forgot to mention that m is prime. I fixed it. What is the easiest way in that case besides euclidean algorithm which would be long? – leakaf Mar 10 '20 at 21:06
-
@zwim is that the easiest way? – leakaf Mar 10 '20 at 21:07
-
@leakaf Easiest by what metric? If by hand (manually) then the forward (augmented matrix) method described in the dupe links is usually the easiest. – Bill Dubuque Mar 10 '20 at 21:32
-
Well other way would be factoring each polynomial in $\mathbb Z_n$ but Berlekamp algorithm is even worse to carry on manually than EE so I would say yes. – zwim Mar 10 '20 at 21:33
1 Answers
1
Absolutely the easiest way to find the greatest common divisor of two polynomials in one variable over a finite field (so, $\mathbb Z/p$ only for $p$ prime), is the Euclidean algorithm. It may not seem intuitive, but it is actually a very efficient algorithm.

paul garrett
- 52,465
-
There is an online version here with steps https://mathsci2.appstate.edu/~cookwj/sage/algebra/Euclidean_algorithm-poly.html – zwim Mar 10 '20 at 21:31