Polynomials & Factoring

Perfect Square Trinomials

A perfect square trinomial is a three-term expression that equals a binomial squared: a2+2ab+b2=(a+b)2a^2 + 2ab + b^2 = (a + b)^2 or a2−2ab+b2=(a−b)2a^2 - 2ab + b^2 = (a - b)^2.

a2±2ab+b2=(a±b)2a^2 \pm 2ab + b^2 = (a \pm b)^2

Try it with your numbers

Show every step

This pattern is one of the special products of binomials, and it is worth knowing cold. It collapses a three-term polynomial into one squared factor, it powers completing the square, and it explains why some quadratics have exactly one root.

What makes a trinomial a perfect square?

Look at the shape of a2+2ab+b2a^2 + 2ab + b^2. The two end terms are squares, and the middle term is twice the product of their square roots. The sign of the middle term decides the sign inside the binomial. The last term is always positive, because b2b^2 and (−b)2(-b)^2 are the same number.

That gives a three-part test:

  1. The first term is a perfect square, a2a^2. Its root is aa.
  2. The last term is a positive perfect square, b2b^2. Its root is bb.
  3. The middle term equals 2ab2ab in size. A plus sign gives (a+b)2(a + b)^2 and a minus sign gives (a−b)2(a - b)^2.

Try 9x2+12x+49x^2 + 12x + 4. The roots of the end terms are 3x3x and 22, and 2⋅3x⋅2=12x2 \cdot 3x \cdot 2 = 12x, which matches. So 9x2+12x+4=(3x+2)29x^2 + 12x + 4 = (3x + 2)^2.

Most wrong answers come from skipping step 3. Two square ends do not make a perfect square trinomial; the middle term is the whole test. Also remember that “square” applies to the variable part too: x4+6x2+9=(x2+3)2x^4 + 6x^2 + 9 = (x^2 + 3)^2 works because x4=(x2)2x^4 = (x^2)^2 and 2⋅x2⋅3=6x22 \cdot x^2 \cdot 3 = 6x^2.

Quick check

Is 25x2−40x+1625x^2 - 40x + 16 a perfect square trinomial? If so, factor it.

Where does the perfect square trinomial formula come from?

Draw a square whose side length is a+ba + b. Cut it with one vertical and one horizontal line, and you get four pieces: an a×aa \times a square, a b×bb \times b square, and two identical a×ba \times b rectangles. Adding the areas gives

(a+b)2=a2+ab+ab+b2=a2+2ab+b2.(a + b)^2 = a^2 + ab + ab + b^2 = a^2 + 2ab + b^2.

The 2 in the middle term is not a coincidence. It counts the two rectangles.

The algebraic version is the FOIL method applied to (a+b)(a+b)(a + b)(a + b). The inner and outer products are both abab, so they combine into 2ab2ab. Replace bb with −b-b and the same work gives (a−b)2=a2−2ab+b2(a - b)^2 = a^2 - 2ab + b^2, which is why a single formula covers both signs.

Why a2+b2a^2 + b^2 is wrong

Squaring a sum is missing two rectangles. At a=3a = 3 and b=4b = 4, (3+4)2=49(3 + 4)^2 = 49 but 32+42=253^2 + 4^2 = 25, and the gap of 2424 is exactly 2ab2ab.

The coefficients 1,2,11, 2, 1 are the third row of Pascal’s triangle. The binomial theorem extends the same idea to higher powers, so a perfect square trinomial is simply the n=2n = 2 case. For n=3n = 3 the coefficients become 1,3,3,11, 3, 3, 1.

How do you factor a perfect square trinomial?

Run the formula backwards: read off aa and bb from the end terms, confirm the middle term, and write the square. Two examples show the full process, including the case where the pattern hides.

Example 1. Factor 4x2−20x+254x^2 - 20x + 25.

The root of 4x24x^2 is 2x2x and the root of 2525 is 55. The middle term should have size 2(2x)(5)=20x2(2x)(5) = 20x, which matches, and the sign is negative, so the binomial uses subtraction:

4x2−20x+25=(2x−5)2.4x^2 - 20x + 25 = (2x - 5)^2.

Expanding confirms it: (2x−5)2=4x2−20x+25(2x - 5)^2 = 4x^2 - 20x + 25.

Example 2. Factor 50x2+60x+1850x^2 + 60x + 18.

Neither 5050 nor 1818 is a perfect square, so the test appears to fail. Take out the greatest common factor first (see factoring out the GCF):

50x2+60x+18=2(25x2+30x+9).50x^2 + 60x + 18 = 2(25x^2 + 30x + 9).

Inside the parentheses, the roots are 5x5x and 33, and 2⋅5x⋅3=30x2 \cdot 5x \cdot 3 = 30x matches. Therefore

50x2+60x+18=2(5x+3)2.50x^2 + 60x + 18 = 2(5x + 3)^2.

Always pull out the GCF before testing. A perfect square can hide behind a constant multiplier, and that is the usual reason students declare a valid case “not a perfect square.”

What if the trinomial has negatives, fractions or two variables?

A negative leading term looks like a failure, but the negative sits outside the square. For −x2+6x−9-x^2 + 6x - 9, factor out −1-1:

−x2+6x−9=−(x2−6x+9)=−(x−3)2.-x^2 + 6x - 9 = -(x^2 - 6x + 9) = -(x - 3)^2.

The expression is a negative perfect square, and it is never positive, which is useful to know when you sketch its graph.

Fractions follow the same test. For x2+23x+19x^2 + \tfrac{2}{3}x + \tfrac{1}{9}, the roots are xx and 13\tfrac{1}{3}, and 2⋅x⋅13=23x2 \cdot x \cdot \tfrac{1}{3} = \tfrac{2}{3}x matches, so the result is (x+13)2\left(x + \tfrac{1}{3}\right)^2. If fractions slow you down, multiply through by 99 to get 9x2+6x+1=(3x+1)29x^2 + 6x + 1 = (3x + 1)^2, then divide back. Decimals work too: x2+1.2x+0.36=(x+0.6)2x^2 + 1.2x + 0.36 = (x + 0.6)^2.

Try this: Factor −x2−10x−25-x^2 - 10x - 25 by first pulling out −1-1, then expand your answer to confirm it matches.

With two variables, treat each root as a product of letters. In 16x2+24xy+9y216x^2 + 24xy + 9y^2, the roots are 4x4x and 3y3y, and 2⋅4x⋅3y=24xy2 \cdot 4x \cdot 3y = 24xy matches. So the expression equals (4x+3y)2(4x + 3y)^2. The middle term must contain both letters, or the pattern is broken.

What is the discriminant test for a perfect square trinomial?

Side-by-side comparison of x² + 4x + 16 failing and x² + 8x + 16 passing the discriminant test
Both trinomials have square ends, but only x² + 8x + 16 has a zero discriminant and factors as (x + 4)².

Here is the trap that costs the most points. Consider x2+4x+16x^2 + 4x + 16. Both end terms are squares (x2x^2 and 424^2), so it looks promising. But the middle term would need to be 2⋅x⋅4=8x2 \cdot x \cdot 4 = 8x, and it is only 4x4x. It is not a perfect square, and (x+4)2(x + 4)^2 expands to x2+8x+16x^2 + 8x + 16 instead.

A faster, algebraic test uses the discriminant. For ax2+bx+cax^2 + bx + c with aa and cc positive squares, say a=A2a = A^2 and c=C2c = C^2, the middle term must be ±2AC\pm 2AC. Squaring gives b2=4A2C2=4acb^2 = 4A^2C^2 = 4ac. So the trinomial is a perfect square exactly when

b2−4ac=0.b^2 - 4ac = 0.

Trinomial Middle term needed b2−4acb^2 - 4ac Perfect square?
x2+4x+16x^2 + 4x + 16 ±8x\pm 8x −48-48 No
x2+8x+16x^2 + 8x + 16 ±8x\pm 8x 00 Yes
9x2−30x+259x^2 - 30x + 25 ±30x\pm 30x 00 Yes

This test is more general than it first looks. A zero discriminant means the quadratic has one repeated root, so its graph touches the x-axis at the vertex without crossing. For 2x2+12x+182x^2 + 12x + 18, the discriminant is 144−144=0144 - 144 = 0, and indeed it equals 2(x+3)22(x + 3)^2, a constant times a perfect square.

When the test fails, the trinomial needs a different method. Try the standard approaches in factoring trinomials. If the discriminant is negative, as with x2+4x+16x^2 + 4x + 16, it will not factor over the real numbers at all.

Quick check

For what value of kk is kx2+12x+9kx^2 + 12x + 9 a perfect square trinomial?

Perfect square trinomial vs difference of two squares

These two patterns look related and get mixed up constantly. A difference of two squares has two terms and no middle term: a2−b2=(a−b)(a+b)a^2 - b^2 = (a - b)(a + b). A perfect square trinomial has three terms and a repeated factor: a2−2ab+b2=(a−b)2a^2 - 2ab + b^2 = (a - b)^2. The full rules for the first pattern are in factoring the difference of two squares.

The classic error is writing (x−5)2=x2−25(x - 5)^2 = x^2 - 25. That drops the middle term. The correct expansion is

(x−5)2=x2−10x+25.(x - 5)^2 = x^2 - 10x + 25.

Sign rule

The last term of a perfect square trinomial is always positive. An expression such as x2+6x−9x^2 + 6x - 9 cannot be a binomial squared, whatever the middle term does.

The two patterns can also work together. Take x4−8x2+16x^4 - 8x^2 + 16. The roots are x2x^2 and 44, and 2⋅x2⋅4=8x22 \cdot x^2 \cdot 4 = 8x^2 matches, so it equals (x2−4)2(x^2 - 4)^2. The factor x2−4x^2 - 4 is itself a difference of two squares, so

x4−8x2+16=(x−2)2(x+2)2.x^4 - 8x^2 + 16 = (x - 2)^2(x + 2)^2.

A good habit: after factoring, look at each factor again and ask whether it can be factored further.

How does completing the square use perfect square trinomials?

Completing the square means building the missing last term of a perfect square trinomial. Since x2+bxx^2 + bx has middle term bx=2⋅x⋅b2bx = 2 \cdot x \cdot \tfrac{b}{2}, the missing piece must be (b2)2\left(\tfrac{b}{2}\right)^2. Add it, and the expression becomes (x+b2)2\left(x + \tfrac{b}{2}\right)^2.

Example 3. Solve x2+8x+5=0x^2 + 8x + 5 = 0.

Move the constant to the right side:

x2+8x=−5.x^2 + 8x = -5.

Half of 88 is 44, and 42=164^2 = 16. Add 1616 to both sides:

x2+8x+16=−5+16=11.x^2 + 8x + 16 = -5 + 16 = 11.

The left side is now a perfect square trinomial, so

(x+4)2=11⇒x+4=±11⇒x=−4±11.(x + 4)^2 = 11 \quad\Rightarrow\quad x + 4 = \pm\sqrt{11} \quad\Rightarrow\quad x = -4 \pm \sqrt{11}.

You can confirm it with the formula: the discriminant is 64−20=4464 - 20 = 44, and x=−8±442=−4±11x = \dfrac{-8 \pm \sqrt{44}}{2} = -4 \pm \sqrt{11}, since 44=211\sqrt{44} = 2\sqrt{11}. Working this derivation on a general ax2+bx+cax^2 + bx + c is exactly how the quadratic formula is proved. For more reps, see these quadratic formula practice problems.

If the leading coefficient is not 11, divide every term by it first. The same move rewrites y=x2−6x+5y = x^2 - 6x + 5 as y=(x−3)2−4y = (x - 3)^2 - 4, which shows the vertex is (3,−4)(3, -4) at a glance.

How do you check your answer and use it for mental math?

The sure check is to expand your factored form and compare it to the original. A quicker check is to substitute a number into both versions. For x2−10x+25x^2 - 10x + 25 and (x−5)2(x - 5)^2, try x=1x = 1 (both give 1616) and x=0x = 0 (both give 2525). One test value can match by accident, so use two, and make one of them negative if you suspect a sign error.

The same pattern gives fast mental squares. Split the number into a round number plus or minus a small one:

522=(50+2)2=2500+200+4=2704,52^2 = (50 + 2)^2 = 2500 + 200 + 4 = 2704,

982=(100−2)2=10000−400+4=9604.98^2 = (100 - 2)^2 = 10000 - 400 + 4 = 9604.

Real uses follow the geometry. A square garden with side x+2x + 2 meters has area (x+2)2=x2+4x+4(x + 2)^2 = x^2 + 4x + 4, so adding 22 meters to each side adds 4x+44x + 4 square meters, which is the two strips plus the corner. Engineers and statisticians meet the same expansion whenever they square a deviation, since (x−xˉ)2(x - \bar{x})^2 always produces a middle term.

Once the pattern feels automatic, mix it with other techniques in these factoring practice problems.

Quick check

Use (a+b)2(a + b)^2 to compute 52252^2 in your head.

Practice problems

0 of 5 solved

  1. Factor x2+12x+36x^2 + 12x + 36.

  2. Factor 9x2−42x+499x^2 - 42x + 49.

  3. Find every value of kk that makes x2+kx+81x^2 + kx + 81 a perfect square trinomial.

  4. Factor completely: 12x2+36x+2712x^2 + 36x + 27.

  5. Solve x2−6x−4=0x^2 - 6x - 4 = 0 by completing the square.

Common questions

What is the formula for a perfect square trinomial?

a2+2ab+b2=(a+b)2a^2 + 2ab + b^2 = (a + b)^2 and a2−2ab+b2=(a−b)2a^2 - 2ab + b^2 = (a - b)^2. The first and last terms are squares, and the middle term is twice the product of their square roots.

How do you know if a trinomial is a perfect square?

Check that the first and last terms are perfect squares, then check that the middle term equals 2ab2ab in absolute value. For ax2+bx+cax^2 + bx + c, the equivalent test is b2=4acb^2 = 4ac with aa and cc both perfect squares.

Can a perfect square trinomial have a negative last term?

No. The last term is b2b^2, and both b2b^2 and (−b)2(-b)^2 are positive. An expression like x2+6x−9x^2 + 6x - 9 cannot be the square of a binomial.

What number completes the square for x2+bxx^2 + bx?

Add (b2)2\left(\frac{b}{2}\right)^2. For x2+10xx^2 + 10x that is 52=255^2 = 25, which gives (x+5)2(x + 5)^2.

Is a2+b2a^2 + b^2 a perfect square trinomial?

No. It has two terms, and over the real numbers it does not factor. Squaring (a+b)(a + b) adds the missing 2ab2ab term.

What is the difference between a perfect square trinomial and a difference of two squares?

A perfect square trinomial has three terms and factors as (a±b)2(a \pm b)^2. A difference of two squares has two terms and factors as (a−b)(a+b)(a - b)(a + b), with no middle term.

Up next