Perfect square trinomial
x² + 6x + 9 is a perfect square, (x + 3)², because 6² equals 4 × 1 × 9. Enter the three coefficients to learn whether ax² + bx + c is the square of a binomial and, if so, get its factored form. 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
- 6
- C
- 9
- Polynomial
- x^2 + 6x + 9
- Discriminant
- 0
- Power (W)
- 1
- Q
- 3
A quadratic trinomial ax squared plus bx plus c is a perfect square when it is exactly the square of a linear binomial. Expanding (px plus q) squared produces p squared times x squared, plus twice p q times x, plus q squared, so the three coefficients are locked together: the middle term is twice the product of the outer square roots. Students meet this pattern as x squared plus six x plus nine equals (x plus three) squared, or four x squared plus twelve x plus nine equals (two x plus three) squared, and they search for a perfect square trinomial checker rather than a general quadratic factorer. This capability accepts the three coefficients, tests the identity b squared equals four a c with a positive leading coefficient, and when the test holds returns the binomial coefficients p and q together with a compact factored form. When the identity fails it still answers the yes-or-no question instead of inventing a factorization.
What a perfect square trinomial is and how the test works
In school algebra a perfect square trinomial is a three-term quadratic that is the square of a binomial. The two textbook families are x squared plus two x y plus y squared, which is (x plus y) squared, and x squared minus two x y plus y squared, which is (x minus y) squared. Allowing a non-unit leading coefficient, the same idea is (p x plus q) squared equals p squared x squared plus two p q x plus q squared.
Matching coefficients with a, b, and c therefore gives three conditions: a equals p squared, c equals q squared, and b equals two p q. Those three collapse into a single arithmetic test that does not require guessing factors: the leading coefficient must be strictly positive, so a real square root p exists, and the discriminant b squared minus four a c must be zero, which is exactly the statement that b equals plus or minus two times the square root of a times the square root of c.
Classic checks include one, six, nine, which yields (x plus three) squared; four, twelve, nine, which yields (two x plus three) squared; and nine, minus twelve, four, which yields (three x minus two) squared. If the leading coefficient is negative the trinomial may still have a repeated real root, but it is the negative of a square rather than a square, so the answer is not a perfect square trinomial over the reals.
If the discriminant is not zero the two linear factors, when they exist, are unlike, and the pattern does not apply. The test is exact on ordinary textbook integers and uses a relative tolerance only so nearby floating values that are meant to be zero do not flip the verdict.
Where a perfect square trinomial checker earns its keep
Classrooms and tutoring platforms use a perfect square trinomial calculator so learners can confirm the middle-term identity without mixing it up with a general AC-method factorization or with completing the square that leaves a leftover constant. Exam-prep generators need a deterministic oracle that marks a non-square such as x squared plus five x plus six as false and that rejects a non-finite coefficient instead of returning NaN that a buggy grader might treat as success.
Engineering notebooks that reduce a repeated-root characteristic polynomial or a perfect-square residual sometimes need the same three-coefficient test without pulling a computer-algebra system. Failed validation does not consume balance. Keep the three coefficients finite, pin p and q in tests for the textbook identities you care about, and you get a reproducible yes-or-no plus the binomial coefficients for homework, LMS plugins, and edge workers.
What you can do with it
Classroom and homework checks
Let students submit a, b, and c and verify whether ax²+bx+c is a perfect square trinomial, then compare the returned p and q with the binomial they wrote by hand.
Exam and LMS auto-grading
Mark perfect-square-trinomial items with a deterministic oracle that returns false for unlike factors and rejects a non-finite coefficient instead of inventing a factorization.
Worksheet generators and notebooks
Build drills around (px+q)² or classify a repeated-root quadratic residual without importing a full computer-algebra library.
FAQ
How do I tell if ax² + bx + c is a perfect square trinomial?
Send finite numbers a (non-zero), b, and c. The trinomial is a perfect square when a is positive and b² = 4ac.
Why must a be non-zero, and why must a be positive to be a square?
If a is negative the polynomial cannot be the square of a real binomial; even a zero discriminant then means it is the negative of a square.
How is this different from factoring a quadratic or completing the square?
A general factorer splits unlike binomials such as (x+2)(x+3). Completing the square always writes a(x−h)²+k, even when k is not zero. This checker answers only the perfect-square-trinomial question and returns p and q when the leftover is zero.
What does it show when the trinomial is not a perfect square?
It still answers the question with a clear no and shows the value of b² − 4ac, which is not zero in that case. No factored form is invented, so you never get a square that does not exist.
Does it work when the middle term is negative?
Yes. The sign is carried by the second term of the binomial: 9x² − 12x + 4 is (3x − 2)². The test only needs the leading coefficient to be positive and b² to equal 4ac.
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/math/perfect-square-trinomial \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":1,"b":6,"c":9}'const res = await fetch("https://api.kit.forhosting.com/math/perfect-square-trinomial", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": 1,
"b": 6,
"c": 9
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/math/perfect-square-trinomial",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": 1,
"b": 6,
"c": 9
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/math/perfect-square-trinomial", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":1,"b":6,"c":9}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":1,"b":6,"c":9}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/math/perfect-square-trinomial", 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": 6,
"c": 9
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "math.perfect_square_trinomial",
"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
Any coefficient that is not a finite number is rejected with invalid_input.
What a perfect square trinomial is and how the test works
When both hold, this endpoint takes p as the non-negative square root of a and sets q equal to b divided by two p, so the sign of the middle coefficient is absorbed into q and there is a unique canonical pair.
Input contract, response shape, and error behaviour
POST a JSON body with three required finite numbers: a, the non-zero leading coefficient of x squared; b, the linear coefficient; and c, the constant term. Each field may arrive as a JSON number, a numeric string, or a simple fraction such as three slash four; the aliases A or leading, B or linear, and C or constant are accepted so scripts can reuse existing payloads. Missing fields, empty strings, NaN, and plus or minus Infinity fail with invalid_input naming the field. On success the body always echoes the cleaned coefficients a, b, and c; a polynomial string such as x caret two plus six x plus nine; the discriminant b squared minus four a c; a boolean is_perfect_square; and a formula string restating the identity. When the boolean is true the body also includes p and q, the factored-form coefficients of (p x plus q) squared, and a factored_form string such as (x plus three) caret two. When the boolean is false those three factor fields are omitted rather than sent as null, so clients that treat null as a value do not have to special-case them. Example: a equals four, b equals twelve, c equals nine yields discriminant zero, is_perfect_square true, p equals two, q equals three, and factored_form (2x + 3)^2. Example of a miss: a equals one, b equals five, c equals six has discriminant one and returns is_perfect_square false with no p or q. Pair the response with your own graphing code if you need a sketch of the parabola that just touches the axis; this endpoint classifies the trinomial and, when it is a square, returns the binomial coefficients only.
Where a perfect square trinomial checker earns its keep
Worksheet and LMS plugins that ask students to name p and q for (p x plus q) squared can call this endpoint first, hide the factor fields from the student, and then compare the submitted binomial against the returned coefficients.
Technical questions
What is returned when the trinomial is not a perfect square?
A success payload with is_perfect_square set to false, plus the echoed coefficients, the polynomial string, and the discriminant. The factor fields p, q, and factored_form are omitted, not set to null.
What does the perfect square trinomial checker cost?
The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.