Polynomial GCD Calculator

Enter the coefficients of two polynomials to find their greatest common divisor.

Result

x - 1
1
Normalized to monic (leading coefficient 1).

How it is calculated

Each polynomial is typed as a comma-separated list of coefficients from the highest power down to the constant, so 1,0,-1 means x2 − 1. A missing power must be entered as 0. The tool runs the Euclidean algorithm: divide A by B, keep the remainder R, replace (A, B) by (B, R), and repeat until the remainder is zero. The last non-zero polynomial is the GCD. Because any constant multiple of a common divisor is also a common divisor, the result is scaled so its leading coefficient is 1 (monic). Coefficients are read as decimals, results are rounded to six places, and the loop stops after 100 steps. The output shows the polynomial and its degree; a GCD of degree 0 (just 1) means the two polynomials share no common factor.

Worked example

Take A = x2 − 1 (1,0,-1) and B = x2 − 3x + 2 (1,-3,2). Dividing A by B gives quotient 1 and remainder A − B = 3x − 3. Next, dividing B by 3x − 3 leaves remainder 0, so 3x − 3 is the last non-zero remainder. Scaling by its leading coefficient 3 gives the monic GCD x - 1, of degree 1. This matches the factorisations (x − 1)(x + 1) and (x − 1)(x − 2).

Try this example →

Common mistakes

  • Listing coefficients in ascending order. The first number must belong to the highest power; entering -1,0,1 describes −x2 + 1, not x2 − 1.
  • Skipping zero coefficients. For x3 − 1 you must type 1,0,0,-1; typing 1,-1 is just x − 1.
  • Typing terms such as x^2-1 instead of numbers. Only plain numeric coefficients separated by commas are accepted, and anything else returns no result.
  • Expecting the GCD to keep your scale. It is always normalised to leading coefficient 1, so a common factor of 3 or 2 does not appear in the answer.
  • Reading "1" as an error. A GCD of 1 (degree 0) is a valid answer meaning the polynomials are coprime.

About this calculator

Just as integers have a greatest common divisor, two polynomials have a polynomial GCD — the highest-degree polynomial that divides both of them with no remainder. It's computed with the same Euclidean algorithm used for integers: repeatedly take the remainder of dividing the higher-degree polynomial by the lower-degree one until the remainder is zero, then normalize the result to monic form (leading coefficient 1) for a unique answer.

Polynomial GCD is a building block in computer algebra systems (Mathematica, Maple, SymPy) for simplifying rational expressions and factoring, and it underlies decoding algorithms for Reed-Solomon error-correcting codes used in QR codes, CDs, and satellite communication.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    The answer is always scaled so the leading coefficient is 1, so 2,-4,2 and 1,-1 both give x - 1, not 2x - 2. A result of 1 with degree 0 means the polynomials share no factor, which is the case for 1,0,-1 and 1,0,1. Use this to simplify a rational expression: divide top and bottom by the result. Which fraction are you trying to reduce?

Popular calculators

All Calculators