Math calculator

Perfect Square Trinomial Calculator

Three conditions — and when the answer is no, which one failed and by how much.

Is it a perfect square?

Three conditions, checked one at a time — and which one failed.

Degree 2. Fractions like 1/4 are exact here, not rounded.

x² + 6x + 9

(x + 3)²

A perfect square trinomial.

The three conditions

Each of the three perfect-square conditions with its verdict
ConditionNeedsHere
The x² coefficient is a perfect squarea = p²1 = (1)²
The constant is a perfect squarec = q²9 = (3)²
The middle term is twice the product of the two rootsb = ±2pq = ±6b = 6

Constant that would work

9

the given one is exactly right

Middle term that would work

±6

given a and c as they stand

Nearest perfect square

x² + 6x + 9

no correction needed

The identity being matched

(x + 3)² = x² + 6x + 9

All three conditions hold, and the factored form expands back to the trinomial exactly.

What this tool shows

Three conditions, each with its own verdict — because the useful answer to “is this a perfect square” is usually the reason it is not.

  • The three conditions checked one at a time, with the failing one named
  • The constant b²/4a that would make it a perfect square, and the gap
  • Common factors taken out first, so 2x² + 4x + 2 is recognised
  • The difference-of-squares factorisation when that is what the input is
All three conditions, checked separately The constant that would fix it Exact with fractions Free, no signup

Free, no signup — exact with fractional coefficients.

Updated 6 September 2026 · Works in any browser, no installation

A trinomial is a perfect square when a and c are both squares AND b is twice the product of their roots — all three, not two. x² + 6x + 9 passes: (x + 3)² = x² + 6x + 9. x² + 6x + 10 fails on one condition only — the constant needs to be 9 and is −1 away.

At a glance

Formula shown
a x\u00b2 + b x + c is a perfect square when a = p\u00b2, c = q\u00b2 and b = \u00b12pq. Then it factors as (px \u00b1 q)\u00b2.
Scenario support
Any quadratic trinomial with rational coefficients.
Educational estimate
Planning support from the values you enter — not professional advice.

Three conditions, and any one of them can fail

a x² + bx + c is a perfect square exactly when a = p², c = q², and b = ±2pq. Three separate requirements, and a trinomial can fail any one of them while passing the other two — which is why a single yes-or-no is a poor answer.

x² + 6x + 9 passes all three: 1 = 1², 9 = 3², and 6 = 2×1×3. So it is (x + 3)².

x² + 6x + 10 fails only on the constant: 10 is not a perfect square. Everything else lines up, and the trinomial misses being one by exactly −1. x² + 5x + 4 fails only on the middle: both ends are squares — 1 and 4 — but b would have to be 4 and it is 5.

Why two square ends are not enough

This is the failure worth naming, because it looks like a pass. x² + 5x + 4 has 1 at the front and 4 at the back, both perfect squares, and it factors perfectly well — as (x + 1)(x + 4). It is simply not a square.

The middle term is what distinguishes a square from any other factorisation. (px + q)² expands to p²x² + 2pqx + q², and that 2pq is forced: it is not a free parameter. Two square ends fix p and q, and p and q then fix b. If the given b is anything else, the trinomial is not that square.

The tool reports this case separately from the others for that reason. “Not a perfect square” and “not a perfect square, but here is why and here is what it factors as” are different amounts of help.

The gap is exactly what completing the square adds

Given a and b, the constant that would make a perfect square is b²/4a. Not approximately — exactly, and it is the same number completing the square asks you to add.

x² + 6x + 10 wants 9 and has 10, a gap of −1. Completing the square on it means writing x² + 6x + 9 + 1, which is (x + 3)² + 1 — the square, plus the leftover. That leftover is the gap this page reports.

So the two topics are the same arithmetic read in opposite directions. This page asks “is the constant already right?”; the Completing the Square Calculator asks “what do I add to make it right, and what do I subtract to keep the expression unchanged?” The number in the middle is the same either way.

Take the common factor out first

2x² + 4x + 2 has a leading coefficient of 2, which is not a perfect square — and it is still 2(x + 1)². The test only works after the common factor comes out.

This is the case implementations most often get wrong. Testing 2 for squareness and reporting “no” is technically a true statement about the leading coefficient and a false answer to the question, because 2(x + 1)² is the factorisation and it is a perfectly ordinary exam answer.

4x² + 12x + 9 is the other shape: a leading coefficient of 4 that is a square, so it needs no factoring out and comes to (2x + 3)². Both are handled, and the tool says which route it took.

A negative constant is asking a different question

No real number squares to a negative, so a trinomial with c < 0 cannot be a perfect square. That is not a near miss — it is a different category.

What it often is, when the middle term is absent, is a difference of squares. x² − 4 = (x + 2)(x − 2), which is the factorisation the question was really after. The tool gives it rather than only reporting that the perfect-square test failed.

With a middle term present and a negative constant, the trinomial may still factor — just not as a square, and not as a difference of squares either. The Factoring Trinomials Calculator handles that general case by the AC method.

Reading the identity backwards

The same identity used forwards squares a binomial and used backwards recognises one. Forwards is the Square of a Binomial Calculator; backwards is this page.

Recognition is the more valuable direction in practice, because it is what turns a three-term expression into a one-term one. (x + 3)² can be solved, shifted, differentiated and graphed in ways x² + 6x + 9 cannot without work.

Fractions are where the recognition gets harder by eye and the arithmetic stays easy. x² + x + (1/4) = (x + 1/2)² — a perfect square with a half in it, exact because the engine works over rationals rather than decimals.

Sources and methodology

The special-product identities are standard; the reference below carries their canonical statements.

Method. Every figure on this page comes from src/lib/perfect-square-trinomial.ts, which tests squareness by exact integer square roots over the rational coefficients rather than by comparing floating-point square roots. That is what lets 1/4 be recognised as (1/2)² and what makes the reported gap an exact fraction. That engine is verified on every change against 51 hand-written assertions, including that a trinomial reported as a perfect square expands back to itself, and that the reported required constant always produces one. The count and the per-case breakdown are published on the formula verification page.

Related calculators

Where this goes next:

Completing the SquareRewrite ax² + bx + c as a(x − h)² + k with every step shown, solve by the method, or find the constant that completes a square — all in exact fractions.
Square of a BinomialExpand (a plus or minus b) squared with the middle term named and a numeric example of exactly what the (a+b)^2 = a^2+b^2 mistake costs, plus the area model that makes it stick.
Factoring TrinomialsFactor a trinomial by the AC method with every factor pair of ac listed, the common factor taken out first, and the answer multiplied back out to check it.
Quadratic FormulaSolve any quadratic with exact roots — surds stay surds and a negative discriminant gives the complex pair — plus the vertex, the factored form and every step of the working.
DiscriminantEvaluate b² − 4ac, the cubic and quartic discriminants, or D = f_xx·f_yy − (f_xy)² for the second-derivative test, in exact arithmetic so the sign is never a rounding artefact.
FOILMultiply two binomials with all four products named — First, Outer, Inner, Last — shown as a grid too, with difference of squares and perfect squares recognised.

More in Math, or browse all calculators.

Read the guide

The gap this page reports is the number completing the square adds and subtracts. Which Method Should You Use to Solve a Quadratic? covers when that method beats factoring and when the formula beats both.

Educational use disclaimer

This calculator tests whether a quadratic trinomial is a perfect square, over the rationals. All arithmetic is exact, so a fractional constant like 1/4 is handled precisely rather than rounded. A trinomial that is a perfect square only after an irrational factor is taken out is reported as not one, which is the standard convention at this level.

How we calculate · Found an error? email us

Authorship & verification

Written and maintained by , a business operator who builds spreadsheet-based calculators.

What's changed (3 updates)

Published 6 September 2026

  1. Published the perfect square trinomial page: all three conditions checked separately, with the one that failed named.
  2. Reports the constant that would make the trinomial a perfect square and how far the given one is from it, which is the content of completing the square.
  3. Gives the difference-of-squares factorisation when that is what the input actually is, instead of only reporting that the perfect-square test failed.

Add this calculator to your site

Responsive embed — and private: nothing your visitors type leaves their browser.