GCD and LCM of polynomials

The greatest common divisor (GCD) and the least common multiple (LCM) of two polynomials are determined.
p1(x) = a9·x9 + a8·x8 + ... + a0     and     p2(x) = b9·x9 + b8·x8 + ... + b0 .

The coefficients of the polynomial can be entered as fractions, as mixed numbers or as breaking decimal numbers.

Use the checkbox to choose whether the coefficients of the polynomials should be output as fractions or as decimal numbers.

p1(x) =  4·x6 - 2·x5 - 6·x4- 18·x3 - 2·x2 + 24·x + 8 
p2(x) =  10·x4- 14·x3 - 22·x2 + 14·x + 12

GCD(p1,p2) =  x2 - x - 2
LCM(p1,p2) =  40·x8 - 36·x7 - 76·x6 - 144·x5 + 88·x4+ 356·x3 - 4·x2 - 176·x - 48     

p1(x) =  (x2 - x - 2)·(4·x4 + 2·x3 + 4·x2 - 10·x - 4)
p2(x) =  (x2 - x - 2)·(10·x2 - 4·x - 6)


It is well known that the GCD and the LCM are needed when reducing fractions or when adding fractions. Transferred to polynomials, this corresponds to the reducing or adding of functional terms of rational functions.


The GCD of polynomials is determined analogously to the GCD of natural numbers with the Euclidean algorithm (cf. GCD and LCM). In the process, polynomial divisions are carried out repeatedly and coefficients can occur in the intermediate results which lead to an abort due to "overflow". In this case it is indicated that further common factors can exist.

See also:

Wikipedia: Euclidean algorithm