MatheramaMatherama
← Polynomials
Polynomials·Section 9·9 min read

Greatest Common Divisor

Let p1(x)p_1(x) and p2(x)p_2(x) be polynomials. The GCD of p1(x)p_1(x) and p2(x)p_2(x), denoted as GCD(p1(x),p2(x))\text{GCD}(p_1(x), p_2(x)), is the polynomial of the highest degree that divides both p1(x)p_1(x) and p2(x)p_2(x) without remainder.

If direct factorization of p1(x)p_1(x) and p2(x)p_2(x) is challenging, alternative methods such as the Euclidean Division Algorithm may be employed. Consider the Euclidean Division of p1(x)p_1(x) by p2(x)p_2(x), expressed as p1(x)=q(x)p2(x)+r(x)p_1(x) = q(x)p_2(x) + r(x), where q(x)q(x) is the quotient and r(x)r(x) is the remainder. It follows that, any common divisor of p1(x)p_1(x) and p2(x)p_2(x) is necessarily a divisor of r(x)r(x).

Proof:

Proof:

Consider polynomials p1(x)p_1(x) and p2(x)p_2(x). If a polynomial d(x)d(x) divides both p2(x)p_2(x) and the remainder r(x)r(x), then d(x)d(x) must also divide p1(x)p_1(x). This is evident from the equation p1(x)=q(x)p2(x)+r(x)p_1(x) = q(x)\color{red}p_2(x) \color{black}+ \color{red}r(x).

Moreover, since r(x)=p1(x)−q(x)p2(x)r(x) = \color{red}p_1(x)\color{black} - q(x)\color{red}p_2(x), any factor common to p1(x)p_1(x) and p2(x)p_2(x) must divide r(x)r(x) as well. This means that all common factors of p1(x)p_1(x) and p2(x)p_2(x) are also common to p2(x)p_2(x) and r(x)r(x), completing the mutual relationship between their common factors. ■\blacksquare

Euclidean Algorithm for GCD of two polynomials§

To determine the greatest common divisor (GCD) of two polynomials p1(x)p_1(x) and p2(x)p_2(x), apply the Euclidean Algorithm as follows:

  1. Perform long division on p1(x)p_1(x) by p2(x)p_2(x) to find a quotient q1(x)q_1(x) and a remainder r1(x)r_1(x), such that p1(x)=q1(x)p2(x)+r1(x)p_1(x) = q_1(x)p_2(x) + r_1(x), with r1(x)r_1(x) of lower degree than p2(x)p_2(x).

  2. Divide p2(x)p_2(x) by the new remainder r1(x)r_1(x) to obtain a quotient q2(x)q_2(x) and remainder r2(x)r_2(x), so p2(x)=q2(x)r1(x)+r2(x)p_2(x) = q_2(x)r_1(x) + r_2(x), where r2(x)r_2(x) is of lower degree than r1(x)r_1(x).

  3. Continue the process by dividing the last non-zero remainder by the current remainder. For the third iteration, it would be r1(x)=q3(x)r2(x)+r3(x)r_1(x) = q_3(x)r_2(x) + r_3(x), with each new remainder ri(x)r_i(x) having a lower degree than the previous remainder ri−1(x)r_{i-1}(x).

  4. Proceed iteratively nn times until the division yields a remainder rn(x)r_{n}(x) that is either a constant or identically zero, with the previous step being rn−2(x)=qn(x)rn−1(x)+rn(x)r_{n-2}(x) = q_{n}(x)r_{n-1}(x) + r_{n}(x).

  5. The algorithm concludes when the remainder rn(x)r_{n}(x) is zero or a constant. If rn(x)r_{n}(x) is zero, then rn−1(x)r_{n-1}(x) is the GCD. If rn(x)r_{n}(x) is a non-zero constant, p1(x)p_1(x) and p2(x)p_2(x) share no common divisors other than units, indicating they are relatively prime.

Theorem:

For any two polynomials p(x)p(x) and q(x)q(x), if there exist polynomials u(x)=ap(x)+bq(x)u(x) = ap(x) + bq(x) and v(x)=cp(x)+dq(x)v(x) = cp(x) + dq(x) with coefficients a,b,c,d∈Ra, b, c, d \in \mathbb{R} and ad−bc≠0ad - bc \neq 0, then the greatest common divisor (GCD) of u(x)u(x) and v(x)v(x) is the same as the GCD of p(x)p(x) and q(x)q(x).

Proof:

The condition u(x)=ap(x)+bq(x)u(x) = ap(x) + bq(x) and v(x)=cp(x)+dq(x)v(x) = cp(x) + dq(x) implies that any common factor of p(x)p(x) and q(x)q(x) is also a factor of u(x)u(x) and v(x)v(x), since common factors are distributive over polynomial addition.

Moreover, if we consider the expressions for p(x)p(x) and q(x)q(x) derived from u(x)u(x) and v(x)v(x), we have:

p(x)=du(x)−bv(x)ad−bcandq(x)=cv(x)−au(x)bc−adp(x) = \frac{du(x) - bv(x)}{ad - bc} \quad \text{and} \quad q(x) = \frac{cv(x) - au(x)}{bc - ad}

It follows from these equations that any common factor of u(x)u(x) and v(x)v(x) is also a common factor of p(x)p(x) and q(x)q(x).

Consequently, the set of common factors of u(x)u(x) and v(x)v(x) coincides with the set of common factors of p(x)p(x) and q(x)q(x), and thus their greatest common divisors are equivalent. This result allows the use of linear combinations u(x)u(x) and v(x)v(x) to simplify the process of finding the GCD of p(x)p(x) and q(x)q(x).

Prime and Composite Polynomials§

A polynomial is termed prime if it is non-factorable over the set of polynomials with coefficients in a given field, meaning it cannot be expressed as the product of two non-constant polynomials in that field. Conversely, if a polynomial can be factored as such, it is composite. For instance, (x+1)(x+1) and x2+1x^2+1 are prime polynomials in the field of real numbers, whereas x2(x+1)x^2(x+1) and (x2+1)(x−2)(x^2+1)(x-2) are composite since they can be factored into the product of lower-degree polynomials.

Two polynomials are coprime if they share no common polynomial factors except for constant factors, which are disregarded. For example, 2(x2+1)2(x^2+1) and 4(x+1)4(x+1) are coprime to one another since any common factor would be a non-constant polynomial, which they do not possess.

Given polynomials p(x)p(x), q(x)q(x), and r(x)r(x), if p(x)p(x) is a factor of q(x)r(x)q(x)r(x) and p(x)p(x) is coprime to q(x)q(x), it must be that p(x)p(x) is a factor of r(x)r(x). This is due to the fact that any factor of q(x)r(x)q(x)r(x) that is not a factor of q(x)q(x) must necessarily be a factor of r(x)r(x) by virtue of p(x)p(x) and q(x)q(x) being coprime.

Little Bezout's Identity Theorem:§

For any two polynomials p(x)p(x) and q(x)q(x), there exist polynomials A(x)A(x) and B(x)B(x) such that A(x)p(x)+B(x)q(x)=gcd(p(x),q(x))A(x)p(x) + B(x)q(x) = \text{gcd}(p(x), q(x)), or equivalently, A(x)p(x)+B(x)q(x)=1A(x)p(x) + B(x)q(x) = 1 if p(x)p(x) and q(x)q(x) are coprime.

Proof:

Suppose the gcd of p(x)p(x) and q(x)q(x) exists. By employing the Euclidean Algorithm to find the gcd, we obtain a sequence of equations:

p=q1q+R1,q=q2R1+R2,R1=q3R2+R3, ⋮Rn−2=qnRn−1+Rn.\begin{align*} p &= q_1q + R_1, \\ q &= q_2R_1 + R_2, \\ R_1 &= q_3R_2 + R_3, \\ &\ \vdots \\ R_{n-2} &= q_nR_{n-1} + R_n. \end{align*}

It follows that gcd(p,q)=gcd(q,R1)=gcd(R1,R2)=…=gcd(Rn−1,Rn)\text{gcd}(p, q) = \text{gcd}(q, R_1) = \text{gcd}(R_1, R_2) = \ldots = \text{gcd}(R_{n-1}, R_n).

Now, we have that p=q1q+R1p = q_1q + R_1 implies R1=p−q1qR_1 = p - q_1q, and q=q2R1+R2q = q_2R_1 + R_2 can be rewritten as R2=q−q2R1R_2 = q - q_2R_1. Substituting for R1R_1, we have R2=q−q2(p−q1q)=−q2p+(1+q1q2)qR_2 = q - q_2(p - q_1q) = -q_2p + (1 + q_1q_2)q. Repeating this substitution process for all remainders, we can express RiR_i as a linear combination of pp and qq.

Eventually, the last non-zero remainder RnR_n is the gcd of pp and qq, and it is expressed as a linear combination A(x)p(x)+B(x)q(x)A(x)p(x) + B(x)q(x), where A(x)A(x) and B(x)B(x) are found from the recursive substitution of remainders in terms of pp and qq.

If the gcd is not a constant, the equation A(x)p(x)+B(x)q(x)=gcd(p(x),q(x))A(x)p(x) + B(x)q(x) = \text{gcd}(p(x), q(x)) holds. If pp and qq are coprime, then the gcd is 1, and we have A(x)p(x)+B(x)q(x)=1A(x)p(x) + B(x)q(x) = 1.

Thus, by the process of back-substitution in the Euclidean Algorithm, A(x)A(x) and B(x)B(x) can be determined, completing the proof of Little Bezout's Identity.

Section 9 of 10 · Polynomials

Mark this section complete when you have worked through its proofs.