## You are here

Homefast Euclidean algorithm

## Primary tabs

# fast Euclidean algorithm

Given two polynomials of degree $n$ with coefficients from a field $K$, the straightforward Eucliean Algorithm uses $O(n^{2})$ field operations to compute their greatest common divisor. The Fast Euclidean Algorithm computes the same GCD in $O(\mathsf{M}(n)\log(n))$ field operations, where $\mathsf{M}(n)$ is the time to multiply two $n$-degree polynomials; with FFT multiplication the GCD can thus be computed in time $O(n\log^{2}(n)\log(\log(n)))$. The algorithm can also be used to compute any particular pair of coefficients from the Extended Euclidean Algorithm, although computing every pair of coefficients would involve $O(n^{2})$ outputs and so the efficiency is not as helpful when all are needed.

The algorithm can be made to work over $\mathbb{Z}$ but it is very tricky. A newer version that is easier to understand was published by Damien Stehlé and Paul Zimmerman, “A Binary Recursive Gcd Algorithm.”

Here we sketch the algorithm over $K[x]$. The basic idea is that the quotients $q_{i}$ computed by the Euclidean Algorithm can usually be computed by looking at only the first few coefficients of the polynomial; for example, if

$A(x)=a_{n}x^{n}+a_{{n-1}}x^{{n-1}}+\ldots+a_{0},\quad B(x)=b_{{n-1}}x^{{n-1}}+% \ldots+b_{0}$ |

then

$quo(A(x),B(x))=\frac{a_{n}}{b_{{n-1}}}x+\frac{b_{{n-1}}a_{{n-1}}-a_{n}b_{{n-2}% }}{b_{{n-1}}^{2}}$ |

With more detailed analysis, we can show that in fact a divide-and-conquer approach can be used to calculate the GCD. First, we remove the terms whose degree is $n/2$ or less from both polynomials $A$ and $B$. Then, we recursively compute their GCD and Euclidean coefficients. We then apply the Euclidean coefficients to $A$ and $B$, and recursively complete the Euclidean Algorithm.

## Mathematics Subject Classification

11A05*no label found*

- Forums
- Planetary Bugs
- HS/Secondary
- University/Tertiary
- Graduate/Advanced
- Industry/Practice
- Research Topics
- LaTeX help
- Math Comptetitions
- Math History
- Math Humor
- PlanetMath Comments
- PlanetMath System Updates and News
- PlanetMath help
- PlanetMath.ORG
- Strategic Communications Development
- The Math Pub
- Testing messages (ignore)

- Other useful stuff

## Recent Activity

new question: Prove a formula is part of the Gentzen System by LadyAnne

Mar 30

new question: A problem about Euler's totient function by mbhatia

new problem: Problem: Show that phi(a^n-1), (where phi is the Euler totient function), is divisible by n for any natural number n and any natural number a >1. by mbhatia

new problem: MSC browser just displays "No articles found. Up to ." by jaimeglz

Mar 26

new correction: Misspelled name by DavidSteinsaltz

Mar 21

new correction: underline-typo by Filipe

Mar 19

new correction: cocycle pro cocyle by pahio

Mar 7

new image: plot W(t) = P(waiting time <= t) (2nd attempt) by robert_dodier

new image: expected waiting time by robert_dodier

new image: plot W(t) = P(waiting time <= t) by robert_dodier