Advanced maths

Polynomial extended Euclidean algorithm calculator

Find a monic rational-polynomial GCD and Bézout coefficient polynomials, with an exact Euclidean remainder chain and identity verification.

Your numbers

Coefficients in descending powers, including zero placeholders. Use rational fractions or decimals with at most six places; coefficients within ±10⁶. Degree at most twelve.
Coefficients in descending powers, including zero placeholders. Use rational fractions or decimals with at most six places; coefficients within ±10⁶. Degree at most twelve.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

The ordinary Euclidean algorithm keeps dividing until the polynomial remainder becomes zero. Its extended version also tracks how each remainder is built from the two original inputs. This page performs those operations over exact rational coefficients, normalizes the final nonzero remainder to a monic GCD and scales both tracked coefficients consistently. The result includes one Bézout pair s,t and a coefficient-by-coefficient verification of A*s+B*t=g.

THE FORMULAA(x)*s(x)+B(x)*t(x)=g(x), where g is the monic GCD over Q[x] for a nonzero input pair.

A worked example

For A=x²+1 and B=x−1, division gives A=(x+1)B+2. After making the constant remainder monic, s=1/2 and t=−(x+1)/2 give (x²+1)/2−(x−1)(x+1)/2=1. The rational GCD is therefore one. A constant remainder of two is not a nonunit common factor in Q[x], because every nonzero rational constant is invertible there.

Good to know

Supports two rational polynomials of degree at most twelve with coefficients within ±10⁶. Polynomial operations and the identity check remain exact under coefficient-growth limits. It works in Q[x], not Z[x] or a finite coefficient field. Bézout pairs are not unique. One zero input is supported by normalizing the other polynomial; when both inputs are zero, the page explicitly uses g=s=t=0 rather than claiming a nonzero monic GCD exists.

The coefficient field changes what counts as a unit

Over the rational numbers, two nonzero constants such as two and three are both units, so a polynomial GCD is conventionally scaled to leading coefficient one. Over integer coefficients, content and divisibility require a different treatment. A rational Bézout pair can therefore be valid even when its fractions would not be acceptable coefficients in a claimed integer-polynomial identity. The page names its coefficient field to keep that distinction explicit.

For A=x²−1 and B=x−1, the second input already divides the first and the monic GCD is x−1. For A=0 and B=2x+2, normalization gives g=x+1 with coefficient t=1/2. Swapping the inputs changes which tracked coefficient carries that identity. These zero and divisibility cases are genuine algebraic cases, not failures of the algorithm or reasons to divide by a zero remainder.

The final constant remainder produces a rational polynomial Bezout identityTrack the remainder 2A = (x+1)·B + 2s = 1/2t = −(x+1)/2A·s + B·t = 1
With A=x²+1 and B=x−1, division gives A=(x+1)B+2. Dividing that identity by two gives s=1/2 and t=−(x+1)/2, so A*s+B*t=1. The GCD is monic over Q[x].

The Partial fraction decomposition calculator with repeated factors instead solves an exact coefficient identity for the numerators of rational summands.

A verified Bézout pair is not generally a unique answer

If s,t satisfy A*s+B*t=g, adding (B/g)*h to s and subtracting (A/g)*h from t produces another valid pair for any rational polynomial h. The Euclidean chain supplies one convenient representative. Comparing two implementations by requiring identical coefficient polynomials can therefore reject two equally correct answers. Recombining each pair and checking the same normalized GCD is the stronger comparison.

When the GCD is one, the identity can imply a polynomial inverse modulo another polynomial over the same coefficient field. This page still returns the rational-polynomial identity itself. The existing finite polynomial quotient-ring calculator instead works modulo a prime coefficient modulus and a polynomial modulus; changing that field changes which coefficients, factors and inverses are available. Keeping these operations separate avoids presenting a rational Bézout result as an inverse in an unrelated finite ring.

A few questions, answered

Why scale s and t when making the GCD monic?

Scaling only the last remainder would break A*s+B*t=g. The same nonzero rational normalization must be applied to both tracked coefficient polynomials.

What is returned for two zero inputs?

This page uses the explicit convention g=s=t=0 and marks that no nonzero monic GCD is determined. The displayed zero identity holds, but it is not an ordinary nonzero-input normalization.

Find your calculator

Start typing to explore the library.