Audited 31 Jul 2026·Last updated 28 Oct 2026·3 citations·Tier 2·0 uses

Square of a Binomial Calculator

Expand (ax + b)² into a²x² + 2abx + b²: enter a and b to get the x² coefficient, the middle x coefficient and the constant term of the trinomial.

Square of a Binomial Calculator

x^2 coefficient
9
The coefficient of x² in the expansion, equal to a², the square of the x coefficient you entered.
x coefficient
-12
Constant term
4
Model scope
Exact real-coefficient binomial-square identity; it does not factor general quadratics or manipulate symbolic coefficients.

Background.

The most common slip in school algebra is writing (x + 3)² as x² + 9. It looks right, it is wrong, and it is wrong for a reason worth seeing. Squaring a sum means multiplying it by itself, (x + 3)(x + 3), and that produces four products, not two: x², 9, and two copies of 3x. The correct answer is x² + 6x + 9, and the missing 6x is the whole story.

A picture makes it stick. Draw a square with side x + 3 and divide each side into a piece of length x and a piece of length 3. Inside you get an x-by-x square, a 3-by-3 square, and two x-by-3 rectangles. Those two rectangles are the middle term, which is why it carries a factor of 2.

In general, (ax + b)² = a²x² + 2abx + b². The first and last coefficients are squares, so they can never be negative. The middle one takes the sign of a × b, which is why (3x − 2)² has a minus sign in the middle and nowhere else.

The same identity runs in reverse, and that is where it earns its keep. Spotting that 9x² − 12x + 4 is a perfect square lets you factor it in one step, and completing the square, the technique behind the quadratic formula, is this identity applied backwards. It even helps with mental arithmetic: 103² is (100 + 3)², or 10,000 + 600 + 9 = 10,609.

Here you enter the numbers a and b and get back the three coefficients of the expanded trinomial. Both may be negative, zero or decimal; only numeric coefficients are handled, not letters.

What is square of a binomial calculator?

The square of a binomial is the result of multiplying a two-term expression by itself. For a binomial of the form ax + b, the identity (ax + b)² = a²x² + 2abx + b² gives the expansion directly: the square of the first term, twice the product of the two terms, and the square of the second term. The three-term result is called a perfect square trinomial.

How to use this calculator.

  1. Write your binomial in the form ax + b and read off the two numbers. For (x + 5)², a is 1 and b is 5; for (2x − 7)², a is 2 and b is −7.
  2. If the constant comes first, as in (5 − x)², take a = −1 and b = 5. The expansion is the same as for (x − 5)², because a squared expression does not care about an overall sign.
  3. Enter fractions as decimals, for example 0.5 for x/2.
  4. Read the x² coefficient, the x coefficient and the constant term, and assemble them as a²x² + 2abx + b².

The formula.

(ax+b)^2 = a^2 x^2 + 2ab x + b^2

(ax + b)² = a²x² + 2abx + b². The x² coefficient is a², the square of the number in front of x. The constant term is b², the square of the number on its own. The x coefficient is 2ab: when (ax + b)(ax + b) is multiplied out, the cross products ax × b and b × ax are equal, and together they give 2abx. Because a² and b² are squares, those two coefficients are never negative; the middle coefficient is negative exactly when a and b have opposite signs, and zero if either is zero. Every perfect square trinomial has discriminant (2ab)² − 4a²b² = 0, so its graph touches the x-axis at a single point, x = −b/a.

A worked example.

Example

Expand (3x − 2)², so a = 3 and b = −2. The x² coefficient is a² = 3² = 9. The x coefficient is 2ab = 2 × 3 × (−2) = −12. The constant term is b² = (−2)² = 4. The expansion is 9x² − 12x + 4. A quick check by substitution: at x = 2, the original gives (6 − 2)² = 16 and the expansion gives 36 − 24 + 4 = 16. The discriminant of the result is (−12)² − 4 × 9 × 4 = 144 − 144 = 0, confirming a perfect square with a repeated root at x = 2/3, where 3x − 2 is zero.

a3
b-2

Frequently asked questions.

Why isn't (x + 3)² equal to x² + 9?
Because squaring a sum multiplies every term by every other term, and the cross terms do not cancel. (x + 3)(x + 3) gives x², 3x, 3x and 9, which add to x² + 6x + 9. Test it with x = 1: (1 + 3)² is 16, while 1 + 9 is only 10.
How do I spot a perfect square trinomial so I can factor it?
Check three things: the first and last terms are perfect squares, and the middle term is twice the product of their square roots. In 4x² + 20x + 25, the roots are 2x and 5 and twice their product is 20x, so it factors as (2x + 5)². The sign of the middle term gives the sign inside the bracket.
What does squaring a binomial have to do with completing the square?
Completing the square is this identity read backwards. To rewrite x² + 6x, you notice it matches the first two terms of (x + 3)² = x² + 6x + 9, so x² + 6x = (x + 3)² − 9. Doing that to a general quadratic is how the quadratic formula is derived.
Can I expand something like (2x + 3y)² here?
Not directly, because the page takes numbers for a and b, not a second variable. The pattern is identical, though: square the first term, square the second, and add twice their product, giving 4x² + 12xy + 9y². Enter a = 2 and b = 3 to see the coefficients 4, 12 and 9.
How can I square numbers like 97 in my head?
Split them into a round number and a small adjustment. 97 is 100 − 3, so 97² = 100² − 2 × 100 × 3 + 3² = 10,000 − 600 + 9 = 9,409. The same trick turns 103² into 10,000 + 600 + 9 = 10,609.

How this page was produced

Published by
Quanta Calculator
Primary sources
3 cited below
Method
(ax+b)^2 = a^2 x^2 + 2ab x + b^2
Published
Last verified

Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.

In this category

Embed

Quanta Pro

Paid features are coming later.

  • All 1560 calculators remain free
  • No billing is enabled
Coming soon