Sum and product of roots calculator
For x^2 - 5x + 6 = 0 the roots add up to 5 and multiply to 6, read straight from the coefficients with Vieta's formulas: the sum is −b/a and the product is c/a. No quadratic formula needed. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- A
- 1
- B
- -5
- C
- 6
- Equation
- x^2 - 5x + 6 = 0
- Sum of roots
- 5
- Product of roots
- 6
High-school algebra, entrance exams, and engineering prep all ask the same quick question about a quadratic: what is the sum of its roots, and what is their product, when you only know the coefficients a, b, and c of ax squared plus bx plus c equals zero. You do not always need the individual roots; textbooks introduce Vieta relations so learners can read sum equals negative b over a and product equals c over a in a single glance. This sum and product of roots calculator accepts those three finite coefficients, rejects a zero leading coefficient so the equation stays a true quadratic, and returns both elementary symmetric values with a short formula block you can show next to the answer.
Vieta for a quadratic: sum and product without finding roots
Rearranged for classroom use, the sum of the roots is negative b divided by a, and the product of the roots is c divided by a. They remain valid when the discriminant is negative: complex conjugate roots still have a real sum and a real product equal to those ratios whenever a, b, and c are real. They also remain valid for a double real root, when the sum is twice that root and the product is its square.
You never need to compute the square root of b squared minus four a c to answer a sum-or-product question, which is why exam questions often forbid the quadratic formula on purpose and force students to use Vieta.
Where the sum and product of roots help
Classrooms and tutoring platforms use a dedicated sum and product of roots calculator so students can check Vieta homework without being tempted by a full root solver that spoils the exercise. Exam-prep generators need a deterministic oracle that grades the two elementary symmetric values and rejects zero leading coefficients as invalid input rather than silently treating the problem as linear.
Keep requests small, pin the rounded sum and product in tests, and you get reproducible Vieta answers for LMS plugins, edge workers, and homework bots without standing up symbolic math infrastructure of your own.
What you can do with it
Classroom Vieta drills
Let students submit a, b, and c and verify sum = −b/a and product = c/a without revealing the individual roots.
Notebooks and monic reconstruction
Rebuild x² − (sum)x + (product) factors in scripts from known coefficients without a full CAS.
FAQ
Does this work when the discriminant is negative?
Yes. Complex roots still satisfy Vieta: the real sum and product equal −b/a and c/a for real coefficients. The calculator never needs the discriminant.
Does the calculator return the individual roots?
No. It only returns sum and product from the coefficients.
What are the formulas for the sum and product of roots?
For a quadratic with coefficients a, b and c, the sum of the roots is −b/a and the product is c/a. These are Vieta's formulas, and they skip the square root of the discriminant entirely.
Why can't a be zero?
With a zero leading coefficient the equation is no longer quadratic but linear, so it does not have two roots to add or multiply. The calculator rejects it instead of quietly treating it as linear.
Do the formulas work for a double root?
Yes. When both roots are the same number, the sum is twice that root and the product is its square, exactly what −b/a and c/a give.
Related tools
For developers — API access
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.
API endpoint
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.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/algebra/sum-product-of-roots \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":1,"b":-5,"c":6}'const res = await fetch("https://api.kit.forhosting.com/algebra/sum-product-of-roots", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 1,
"b": -5,
"c": 6
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/algebra/sum-product-of-roots",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 1,
"b": -5,
"c": 6
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/algebra/sum-product-of-roots", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":1,"b":-5,"c":6}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":1,"b":-5,"c":6}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/algebra/sum-product-of-roots", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a": 1,
"b": -5,
"c": 6
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "algebra.sum_product_of_roots",
"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.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Vieta for a quadratic: sum and product without finding roots
Those two formulas are exactly what this endpoint evaluates.
Input contract, response shape, and error behaviour
Failed validation is not billed. Example: a equals one, b equals negative five, c equals six yields sum five and product six, matching the textbook roots two and three without ever returning those roots. Pair the response with your own root finder only when you also need the individual solutions; this capability is intentionally limited to sum and product so the landing page matches the search intent of learners who typed that exact homework phrase. POST a JSON body with three required finite numbers named a, b, and c for the standard form a x squared plus b x plus c equals zero. Each field may arrive as a JSON number or as a numeric string; missing fields, empty strings, and non-finite values such as NaN or Infinity fail with invalid_input naming the field. On success the body echoes a, b, and c; an equation string that rewrites the quadratic for display; sum_of_roots equal to negative b over a; product_of_roots equal to c over a; a formulas object restating both identities in compact ASCII; and a short note that the relations hold over the complexes.
Where a sum-and-product API earns its keep
Engineering and science notebooks often reduce characteristic equations of simple second-order systems to a quadratic and only need the sum and product for damping ratios or for reconstructing monic factors; calling a tiny parse API avoids importing a computer-algebra system for three divisions.
Integration use cases
Exam and LMS auto-grading
Mark sum-and-product items with a deterministic oracle that rejects a = 0 and never invents roots.
Technical questions
How do I get the sum and product of the roots of ax²+bx+c=0?
Send finite numbers a (non-zero), b, and c. The API returns sum_of_roots = −b/a and product_of_roots = c/a without solving for the roots.
Why must a be non-zero?
If a is zero, the equation is not quadratic and the classical pair r1+r2=−b/a, r1·r2=c/a does not apply. The task fails with invalid_input.
What does the sum and product of roots calculator cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.