Work with functionsLesson 23 of 48 · 7 min

Read a polynomial and its roots

Use Poly and roots to distinguish degree, coefficients and multiplicity.

Maths refresher: Repeated factors

A root r corresponds to a factor x-r. Repeating that factor creates a root with higher multiplicity.

(x−1)2(x+2)=x3−3x+2(x-1)^2(x+2)=x^3-3x+2
Worked example

The polynomial has degree 3. Root 1 has multiplicity 2 and root -2 has multiplicity 1; the multiplicities total 3.

Maths prerequisite map ↗

A polynomial in x is a finite sum of nonnegative integer powers of x with coefficients. Poly makes the chosen polynomial variable explicit, which matters when other symbols act as parameters.

See the mathematics
-3-1.65-0.31.052.4-5-1.751.54.758xy
-3-1.65-0.31.052.4-5-1.751.54.758xy
p(x)=(x−1)2(x+2)p(x)=(x-1)^2(x+2)
Starter reference. At −2 the curve crosses the axis; at the double root 1 it touches and turns.

The degree is the highest power with a nonzero coefficient. A root can occur more than once: multiplicity records how many copies of its factor appear. The roots function returns a mapping from discovered roots to multiplicities for this tractable example.

Compare the expanded coefficients, factored expression and root multiplicities. A repeated root may touch rather than cross the horizontal axis in a real plot. General polynomial equations need not have simple radical forms, so do not assume a small explicit roots mapping always describes every possible problem.

Does a repeated root count only once towards the degree?

Write a prediction (optional)

Exact symbolic investigation

Select Run Python with the code unchanged.

Tools
About Python

Python and the course packages can load while you read. Each run starts with fresh user variables; imported modules stay loaded. Stop replaces the worker. Runtime details ↗

Ctrl+Enter or ⌘+Enter runs Python.

Compare with the worked example

Executed from the published Python during the site build. Your own run appears above. Build environment ↗

Expanded polynomial
x3−3x+2x^{3} - 3 x + 2
Degree
33
Coefficients, descending powers
[1, 0, −3, 2]\left[ 1, \ 0, \ -3, \ 2\right]
Roots with multiplicities
{−2:1, 1:2}\left\{ -2 : 1, \ 1 : 2\right\}
Worked text output
Expanded polynomial: x**3 - 3*x + 2
Degree: 3
Coefficients, descending powers: [1, 0, -3, 2]
Roots with multiplicities: {-2: 1, 1: 2}

Read the starter result

Coefficients, descending powers includes a zero for any missing power. In Roots with multiplicities, each root is paired with the number of times its factor appears.

Edit and compare

Replace (x-1)**2*(x+2) on the expression line with (x-1)**3*(x+2). Select Run Python and compare Degree and Roots with multiplicities with the first run. Which root accounts for the extra degree?

Return to the editor

Scope. Exact radical roots are not available for all polynomials; RootOf-style descriptions or numerical roots may be appropriate.

Try a fresh case

A degree-four polynomial has a root with multiplicity three. How much degree does that factor account for?

Choose an answer
Need a hint?
Hint 1

Expand the repeated factor as a power.

Hint 2

Multiplicity counts repeated linear factors.

Your notesNotes save in this browser when storage is available.