ForHosting KIT · Math

Vieta's formulas calculator

For x² − 3x + 2 the roots add up to 3 and multiply to 2, read straight from the coefficients with Vieta's formulas and without solving the equation. Use it to check claimed roots of a quadratic or a cubic. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

Runs in your browser. Free, unlimited — your data never leaves this page.

Vieta's formulas connect the coefficients of a univariate polynomial to the elementary symmetric sums of its roots without ever computing those roots one by one. Given a dense list of finite coefficients in ascending powers—constant term first, highest degree last—this calculator returns the sum of all roots and the product of all roots for the equation a0 plus a1 x plus dots plus an x to the n equals zero, provided the leading coefficient an is nonzero. The classical identities are sum equals negative a sub n minus one over an, and product equals negative one to the n times a0 over an. That closed form is exact over the complex numbers for any degree at least one, works for monic and non-monic polynomials alike, and stays deterministic: no random seeds, no network calls, and no model drift. Invalid input such as a zero leading coefficient is rejected with a clear validation error instead of a silently wrong degree.

How Vieta's formulas relate coefficients to root sum and product

Start from a monic or non-monic polynomial written as a0 plus a1 x plus a2 x squared and so on up to an times x to the n, with an not equal to zero and n at least one. Intermediate elementary symmetric sums exist as well, but the two extremes—total sum and total product—are the identities students and engineers look up most often when checking quadratic factorizations, verifying cubic root guesses, or relating trace-like and determinant-like quantities of companion matrices without forming the matrix.

This implementation never iterates a numerical root finder; it only parses the coefficient list and evaluates the two closed ratios. That design choice keeps the result exact for the floating-point representation of the coefficients, avoids divergence on multiple roots, and finishes in constant time after a linear scan of the array. Coefficients must be finite numbers; NaN and Infinity are rejected.

Degree zero—an array with only a constant—is rejected because a nonzero constant has an empty root multiset and Vieta does not apply.

Where Vieta sum and product checks show up in real work

Secondary-school and college algebra courses constantly assign check-your-roots drills: after students claim three roots of a cubic, the teacher multiplies and adds them and compares against coefficient ratios from Vieta. A single trusted oracle that returns both numbers speeds grading and demo setup without revealing the individual roots when the lesson is still about verification.

Programming contest problems and interview warm-ups often ask only for the sum or product of roots of a monic polynomial derived from a recurrence or a characteristic equation, and engineers need the closed form rather than a fragile numerical factorization. Signal processing and control notebooks extract characteristic polynomials of discrete systems and use the product of roots to reason about constant terms and stability margins without solving for every pole.

If you later need the full list of elementary symmetric sums, explicit quadratic or cubic root formulas, or polynomial addition of coefficient vectors, treat those as separate search intents and landings rather than overloading this Vieta sum-and-product calculator page.

Homework root checks without full solving

Verify student-claimed roots of a quadratic or cubic by comparing their sum and product to Vieta ratios from the given coefficients.

Characteristic polynomial sanity checks

From a monic characteristic polynomial, read off the sum (trace-like) and product (determinant-like) of eigenvalues without computing them.

In what order should I send coefficients?

Ascending powers: index 0 is the constant term, and the last index is the leading coefficient of x^n. Example: x² − 3x + 2 is [2, −3, 1].

What if the leading coefficient is zero?

Vieta needs a well-defined degree; a zero highest-degree coefficient is not silently dropped.

Does this compute the individual roots?

For explicit quadratic roots use a quadratic-formula solver.

What does it cost?

The browser tool is free and runs locally.

What are the sum and product of the roots of x² − 3x + 2?

The sum is 3 and the product is 2. Vieta reads them off the coefficients, since the sum is minus the second-highest coefficient divided by the leading one, and for a quadratic the product is the constant term divided by the leading one.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/algebra/vieta-formulas

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/algebra/vieta-formulas \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"coefficients":[2,-3,1]}'
{
  "coefficients": [
    2,
    -3,
    1
  ]
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "algebra.vieta_formulas",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

How Vieta's formulas relate coefficients to root sum and product

Most importantly, if the last entry of the array is zero or extremely close to zero, the request fails with invalid input naming the leading coefficient, because the true algebraic degree would be lower and silently dropping trailing zeros would change which ratio is the product formula.

What you send and what you get back

The array must contain at least two entries so the formal degree is at least one, and at most ten thousand entries for safety. When the leading coefficient is zero the response is an explicit validation error rather than an automatic degree reduction, so clients that built the list by concatenation notice the bug instead of receiving a sum for a lower-degree polynomial. Classic textbook checks: coefficients two, negative three, one represent x squared minus three x plus two, whose roots one and two sum to three and multiply to two; coefficients negative six, eleven, negative six, one represent the monic cubic with roots one, two, and three, sum six and product six. Send a single required field coefficients: a JSON array of finite numbers in ascending powers, constant term at index zero and leading coefficient at the last index. Aliases coeffs and poly are accepted for convenience in scripts. Missing fields, non-array values, empty arrays, non-numeric strings, NaN, and Infinity fail with invalid_input and are not charged. On success the JSON echoes the cleaned coefficient list, the integer degree, the leading coefficient, the constant term, a printable equation string set equal to zero, the numeric sum_of_roots, the numeric product_of_roots, a formulas object restating the classical identities for UI labels, and a short note that results are over the complex numbers counting multiplicity. Pricing for successful API calls is the published base of $0.002 per item; validation failures do not consume prepaid balance.

Where Vieta sum and product checks show up in real work

Because this capability is a pure parse engine, API pricing is the published base of $0.002 per successful item and failed validation does not consume balance.

Contest and interview fixtures

Generate ground-truth sum and product values for synthetic coefficient vectors used in auto-graders and coding-challenge oracles.

What are Vieta's formulas for sum and product of roots?

For a0 + a1 x + … + an x^n = 0 with an ≠ 0, the sum of the n roots (counting multiplicity) is −a_{n−1}/an and the product is (−1)^n · a0/an.

Read the full KIT documentation →