Skip to main content
Logo image

Section 9.6 Multiplying Polynomials

Multiplying polynomials is a lot of work when done ’by hand’ since you need to multiply each term of the first polynomial with each term of the second polynomial. Example:
\begin{equation*} p_1(x) = x^2 - 3x, \text{ } p_2(x) = x - 1 \end{equation*}
Then \(p = p_1 * p_2\) is found via
\begin{equation*} p(x) = (x^2 - 3x)(x-1) = x^3 - 4x^2 + 3x \end{equation*}
MATLAB can do this work for you, and the process is known as convolving:
>> p1 = [1 -3 0];
>> p2 = [1  -1];
>> p = conv(p1,p2)
p =
         1    -4     3     0
The result of the conv function is a row vector of coefficients of the product of the two polynomial arguments. The two polynomials need not be of the same order.

Activity 9.6.

Use MATLAB to multiply the polynomials \(p\) and \(q\) and plot the product in the same graph. Turn on the grid.
\begin{equation*} p(x) = 2x^3 - 3x^2 + x + 5 \end{equation*}
\begin{equation*} q(x) = 3x^4 + x^2 + 2x - 4 \end{equation*}
Please put your MATLAB code into the textbox.