Polynomial from Roots Calculator

Polynomial from Roots Calculator

Emerging AI Skill PRO

Enter Calculation

Results

Polynomial P(x)
P(x) = x^3 - 2x^2 - 5x + 6
expanded from the given roots
Degree 3
Number of roots 3
Leading coefficient 1
Constant term 6

Formula

P(x)=a∏i=1n(x−ri)P(x) = \text{a} \prod_{i=1}^{n} \left( x - {{\text{r}_i}} \right)
Usage stats

Advertisement

Report an error on this page

What this calculator does

The Polynomial from Roots Calculator reverses the usual root-finding problem: instead of solving for the zeros of a polynomial, it builds the polynomial when you already know its roots. Given a set of real roots and an optional leading coefficient, it returns the fully expanded standard form of \(P(x)\), along with its degree, leading coefficient, and constant term.

How to use it

Enter your roots as a comma-separated list (for example 1, -2, 3). Set the leading coefficient a — use 1 for the simplest monic polynomial, or another value to scale it. The calculator multiplies the factors \((x - r)\) together, applies the leading coefficient, and prints the expanded polynomial.

The formula explained

By the Factor Theorem, if \(r\) is a root of \(P(x)\) then \((x - r)\) is a factor. A polynomial with roots \(r_1, r_2, \ldots, r_n\) is therefore $$P(x) = a \prod_{i=1}^{n} \left( x - r_i \right).$$ The calculator performs this product step by step, expanding into descending powers of \(x\). The leading coefficient determines the highest-degree term, while the constant term equals \(a\) times the product of the negated roots.

Advertisement
Diagram showing factored form multiplying to expanded polynomial form
A polynomial is built as a leading coefficient times factors \((x - r_i)\), then expanded.

Worked example

Suppose the roots are 1, −2, and 3 with \(a = 1\). Multiply \((x - 1)(x + 2)(x - 3)\). First $$(x - 1)(x + 2) = x^2 + x - 2.$$ Then $$(x^2 + x - 2)(x - 3) = x^3 - 2x^2 - 5x + 6.$$ So \(P(x) = x^3 - 2x^2 - 5x + 6\), a cubic of degree 3 with constant term 6.

Number line marking real roots as points where the curve crosses zero
Each root \(r_i\) is where the polynomial curve crosses the x-axis.

More Worked Examples: Repeated Roots and Leading Coefficients

Example 1: a double root. Roots 2, 2 with a = 1. Each root contributes one factor, so the root 2 appears twice:

$$P(x) = 1\cdot(x-2)(x-2) = x^2 - 2x - 2x + 4 = x^2 - 4x + 4$$

Degree = 2 (two roots counted with multiplicity). Constant term = 4, which equals \((-2)(-2)\). The result is the perfect square \((x-2)^2\).

Example 2: a fractional root, a zero root and a leading coefficient. Roots 0, 1/2, −3 with a = 2. The factors are \(x\), \((x - \tfrac12)\) and \((x+3)\).

  1. Multiply the last two factors: \((x-\tfrac12)(x+3) = x^2 + 3x - \tfrac12 x - \tfrac32 = x^2 + \tfrac52 x - \tfrac32\).
  2. Multiply by \(x\): \(x^3 + \tfrac52 x^2 - \tfrac32 x\).
  3. Multiply by \(a = 2\): \(2x^3 + 5x^2 - 3x\).

$$P(x) = 2x^3 + 5x^2 - 3x$$

Degree = 3. Constant term = 0, because one root is 0. Check: \(P(\tfrac12) = 2\cdot\tfrac18 + 5\cdot\tfrac14 - \tfrac32 = 0.25 + 1.25 - 1.5 = 0\), and \(P(-3) = -54 + 45 + 9 = 0\).

Example 3: a quartic using the difference of squares. Roots 1, −1, 2, −2 with a = 1. Pair the opposite roots:

$$(x-1)(x+1) = x^2 - 1, \qquad (x-2)(x+2) = x^2 - 4$$

Multiply the two results, treating \(x^2\) as a single quantity:

$$(x^2-1)(x^2-4) = x^4 - 4x^2 - x^2 + 4 = x^4 - 5x^2 + 4$$

Degree = 4. Constant term = 4, which matches the product of the negated roots \((-1)(1)(-2)(2) = 4\). There are no odd-power terms because the roots come in ± pairs, so the polynomial is even.

Interpreting the Expanded Polynomial

Degree. The degree of P(x) equals the number of roots counted with multiplicity. A root listed twice adds 2 to the degree, so roots 2, 2, 5 give a cubic.

Vieta's formulas. For a monic polynomial \(P(x) = x^n + c_{n-1}x^{n-1} + \dots + c_1 x + c_0\) with roots \(r_1,\dots,r_n\):

  • Sum of roots: \(r_1 + r_2 + \dots + r_n = -c_{n-1}\)
  • Product of roots: \(r_1 r_2 \cdots r_n = (-1)^n c_0\)

Example: \(x^4 - 5x^2 + 4\) has \(c_3 = 0\), so the roots sum to 0, and \(c_0 = 4\) with \(n = 4\) gives a product of 4. If the leading coefficient is a, divide every coefficient by a first.

Multiplicity and the graph. At a root of even multiplicity (2, 4, …) the graph touches the x-axis and turns back without crossing. At a root of odd multiplicity (1, 3, …) it crosses the axis. For multiplicity 3 or more the curve also flattens near the axis.

Zero roots. If 0 is a root, the factor \(x\) divides the polynomial and the constant term is 0. Every term then contains at least one x.

Sign pattern. With a > 0 and all roots positive, the coefficients alternate in sign (+, −, +, −, …). With all roots negative, every coefficient is positive. Mixed roots give a mixed pattern, and a missing power means the corresponding signed sum of products is 0.

Quick check. Substitute each root r into the expanded polynomial. You should get \(P(r) = 0\) every time. Also confirm that the constant term equals \(a\cdot(-r_1)(-r_2)\cdots(-r_n)\).

Advertisement

How to Expand the Product by Hand

  1. Write each factor. For every root \(r_i\), write \((x - r_i)\). Change the sign of the root: root 3 gives \((x-3)\), and root −4 gives \((x+4)\).
  2. Multiply two factors at a time. Use distribution or FOIL: \((x-p)(x-q) = x^2 - (p+q)x + pq\). Then multiply that result by the next factor, and so on.
  3. Collect like terms. Combine terms with the same power and write them in descending order of power.
  4. Multiply by the leading coefficient a. Multiply every coefficient by a. This scales the polynomial vertically and does not move the roots.
  5. Verify. Substitute one root and confirm \(P(r)=0\). Then check that the constant term equals \(a\cdot(-r_1)(-r_2)\cdots(-r_n)\).

Why it works. The coefficients are the elementary symmetric polynomials of the roots with alternating signs:

$$P(x) = a\left(x^n - e_1 x^{n-1} + e_2 x^{n-2} - \dots + (-1)^n e_n\right)$$

Here \(e_1\) is the sum of the roots, \(e_2\) is the sum of all products of two roots, and \(e_n\) is the product of all roots. For roots 1, 2, 3: \(e_1 = 6\), \(e_2 = 2+3+6 = 11\), \(e_3 = 6\), so \(P(x) = x^3 - 6x^2 + 11x - 6\).

FAQ

Can I enter repeated roots? Yes — listing a root twice gives it multiplicity two, producing a squared factor.

Does it handle complex roots? This tool works with real roots. To include complex conjugate pairs, enter them as a real quadratic factor instead.

What does the leading coefficient do? It scales the entire polynomial vertically without changing the roots, so \(a = 2\) doubles every coefficient.

Last updated:

Most popular in Math and Statistics

View all Math and Statistics calculators