Polynomial Addition and Multiplication

Kenneth Levasseur
Mathematical Sciences
UMass Lowell
Kenneth_Levasseur@uml.edu

Calculations done here use AbstractAlgebra a Mathematica package available at http://www.central.edu/eaam/index.asp

Needs["AbstractAlgebra`Master`"] ; SwitchStructureTo[Ring] ;

You add and  multiply polynomials over an arbitrary ring the same way you learned to do it for polynomials over the real number in high school algebra.  The only thing you have to keep in mind is that the coefficient operations use the underlying operations for the ring over which you are working.  For example,  if you working with polynomials over _3  then adding 2x + 1   and 2x + 2 involved adding "like terms" and the result is  (2 + 2) x + (2 + 1) = 1 x + 0 = x .

Addition

Given two polynomials

    a(x) = a_0 + a_1 x + a_2 x^2 + a_3 x^3 +…
    
    b(x) = b_0 + b_1 x + b_2 x^2 + b_3 x^3 +…

Their sum is the polynomial

    a(x) + b(x) = (a_0 + b_0) + (a_1 + b_1) x + (a_2 + b_2) x^2 + (a_3 + b_3) x^3 +…

You just add corresponding coefficients to add.   Notice that we didn't specify exactly where either two of a(x) and b(x) "stop" but eventually the coefficients of both are zero and the number of additions in the underlying ring is no more than the largest degree of the two addends.

Example

P = PolynomialsOver[Z[5]] a = Poly[Z[5],   2 + 4x + 3x^2 + x^3] b = Poly[Z[5], 1 + 2x + 4x^3 + 4 x^4]

-Ring of Polynomials over Z[5]-

2 + 4 x + 3 x^2 + x^3

1 + 2 x + 4 x^3 + 4 x^4

Addition[P][a, b]

3 + x + 3 x^2 + 4 x^4

Multiplication

Given two polynomials of degree m and n, respectively

    a(x) = a_0 + a_1 x + a_2 x^2 + ⋯ + a_m x^m
    
    b(x) = b_0 + b_1 x + b_2 x^2 + ⋯ + b_n x^n

Their product is the polynomials is computed by multiplying all of the terms in the first polynomial by each term in the second.  This involves multiplying powers of the indeterminate x, which follows the rule   x^jx^k = x^(j + k), where the addition i + j is of integers, not in the underlying ring.   If we organize our results the product follows a regular pattern, but somewhat more complicated than for addition.

    a(x)   b(x) = (a_0 … b_0) + (a_0 … b_1 + a_1 … b_0) x + (a_0 … b_2 + a_1 … b_1 + a_2 ... Underoverscript[∑, k = 0, arg3] (Underoverscript[∑, j = 0, arg3] a_j … b_ (k - j)) x^k

In both of the formulae above it should be understood that coefficients with index higher than the respective degrees are equal to the zero of the underlying ring.    Notice that for each term in the product the coefficient of x^k is the sum of products of coefficients whose indices add up to k.   

In multiplying polynomials of degree m and n, the number of multiplications involving nonzero coefficients can be as high as (m + 1) (n + 1)

Example

This product isn't as easy to see as the sum above.  Work out a few coefficients to check the result.

P {a, b} Multiplication[P][a, b]

-Ring of Polynomials over Z[5]-

{2 + 4 x + 3 x^2 + x^3, 1 + 2 x + 4 x^3 + 4 x^4}

2 + 3 x + x^2 + x^4 + 3 x^5 + x^6 + 4 x^7

Here's why we will usually work with polynomials over a field.  The following strange things don't happen if a ring doesn't have zero divisors as _4 has.

Q = PolynomialsOver[Z[4]]

-Ring of Polynomials over Z[4]-

s = Poly[Z[4], 2 x] t = Poly[Z[4], 2x + 1]

2 x

1 + 2 x

A zero divisor among the polynomials

Multiplication[Q][s, s]

0

Here we see that t is a unit, which isn't bad; but normally we expect the degree of a product to be the sum of degrees, but not in this polynomial ring.  

Multiplication[Q][t, t]

1

Over a field this strange result never occurs — the product of two linear polynomials is always a quadratic polynomial.


Created by Mathematica  (September 13, 2005)