Sub topic 7
Factoring Perfect Square Trinomials
This chapter assumes you can expand products with FOIL and know the identities for (a+b)^2 and (a−b)^2 from the earlier chapters. It also assumes you can factor out a greatest common factor and recognize perfect squares such as 9, 49, and 16x^2. Here you learn to run those identities backward: given a trinomial, decide whether it is a perfect square and write it as a squared binomial.
What a Perfect Square Trinomial Is
A perfect square trinomial is a three-term expression that equals the square of a binomial. The two identities are:
- a^2 + 2ab + b^2 = (a + b)^2
- a^2 − 2ab + b^2 = (a − b)^2
Read left to right, these expand a square. Read right to left, they factor one. The pattern to look for has three parts:
- The first term is a perfect square (a^2).
- The last term is a perfect square (b^2).
- The middle term is exactly twice the product of the two square roots (2ab), with its sign deciding whether you get (a + b) or (a − b).
For example, x^2 + 10x + 25 has first term x^2 = (x)^2 and last term 25 = (5)^2. The middle term should be 2 · x · 5 = 10x, and it is. So x^2 + 10x + 25 = (x + 5)^2.
The Three-Step Test
Use this test every time. Skipping the middle-term check is the most common error.
- Take the square root of the first term. Call it a.
- Take the square root of the last term. Call it b (use the positive root).
- Compute 2ab and compare it with the middle term. If the middle term is +2ab, the factored form is (a + b)^2. If it is −2ab, the factored form is (a − b)^2. If it is neither, the trinomial is not a perfect square.
Notice that the last term of a perfect square trinomial is always positive, because it is b^2. A trinomial such as x^2 + 4x − 4 cannot be a perfect square.
Worked Example 1: A Negative Middle Term
Factor 9x^2 − 30x + 25.
- a = 3x, since (3x)^2 = 9x^2.
- b = 5, since 5^2 = 25.
- 2ab = 2 · 3x · 5 = 30x.
The middle term is −30x, so the sign is negative:
9x^2 − 30x + 25 = (3x − 5)^2
Worked Example 2: Two Variables
Factor 4x^2 + 12xy + 9y^2.
- a = 2x and b = 3y.
- 2ab = 2 · 2x · 3y = 12xy, which matches.
So 4x^2 + 12xy + 9y^2 = (2x + 3y)^2.
Worked Example 3: A Near Miss
Is x^2 + 6x + 16 a perfect square? Here a = x and b = 4, so 2ab = 8x. The middle term is 6x, not 8x. The expression is not a perfect square. It may still factor by other methods, but here it does not factor over the integers at all.
Verifying With Code
You can confirm a factorization by comparing both sides at several values. The check below tests the factorizations from the examples.
def check(expanded, factored, values):
for x in values:
assert expanded(x) == factored(x), x
check(lambda x: x**2 + 10*x + 25, lambda x: (x + 5) ** 2, range(-5, 6))
check(lambda x: 9*x**2 - 30*x + 25, lambda x: (3*x - 5) ** 2, range(-5, 6))
print("factorizations hold")Agreement at a handful of values is a sanity check, not a proof. Two quadratics that agree at three different values must be identical, so for a quadratic, checking three or more values is conclusive.
Pulling Out a Common Factor First
Many trinomials hide a perfect square behind a common factor. Always look for a greatest common factor (GCF) first.
Factor 3x^2 + 18x + 27.
- Factor out 3: 3(x^2 + 6x + 9).
- Inside the parentheses, a = x, b = 3, and 2ab = 6x, which matches.
- Result: 3(x + 3)^2.
Without step 1, the first term 3x^2 is not a perfect square and you might miss the pattern. A negative leading coefficient works the same way. Factor −x^2 + 8x − 16 by pulling out −1 to get −(x^2 − 8x + 16) = −(x − 4)^2.
Perfect Squares and Equations
A perfect square trinomial set equal to zero has exactly one solution, called a double root. For x^2 − 6x + 9 = 0, factoring gives (x − 3)^2 = 0, so x = 3 only.
This connects to the discriminant you will meet later. For a quadratic ax^2 + bx + c, a perfect square means b^2 − 4ac = 0. For x^2 − 6x + 9, that is 36 − 36 = 0.
import math
def is_perfect_square_trinomial(a, b, c):
# True if a*x**2 + b*x + c is k*(m*x + n)**2 with integer-valued roots of a, c.
if a <= 0 or c <= 0:
return False
return b * b == 4 * a * c
print(is_perfect_square_trinomial(1, -6, 9)) # True
print(is_perfect_square_trinomial(9, -30, 25)) # True
print(is_perfect_square_trinomial(1, 6, 16)) # FalseThe function tests the condition b^2 = 4ac, which is equivalent to the middle term being ±2 times the square roots of the outer terms. It restricts to a > 0 and c > 0 because the factored form (mx + n)^2 has positive outer terms. It does not test whether a and c are integer squares, so the trinomial 2x^2 + 4x + 2 also returns True. That is correct, since it equals 2(x + 1)^2.
Using the Pattern to Find a Missing Term
GRE questions often give two of the three terms and ask for the third.
- If x^2 + kx + 49 is a perfect square, then b = 7 and 2ab = 14x, so k = 14 or k = −14. Both signs work unless the problem restricts k.
- If x^2 − 12x + m is a perfect square, then 2 · x · b = 12x gives b = 6, so m = 36.
The second case is the idea behind completing the square: take half the coefficient of x, then square it.
| Trinomial start | Half of the x coefficient | Value needed to complete the square |
|---|---|---|
| x^2 + 8x + ? | 4 | 16 |
| x^2 − 10x + ? | −5 | 25 |
| x^2 + 3x + ? | 3/2 | 9/4 |
Common Errors
- Forgetting the middle term check. x^2 + 9 and x^2 + 5x + 9 are not perfect squares, even though 9 = 3^2. The expression (x + 3)^2 expands to x^2 + 6x + 9.
- Writing (a + b)^2 = a^2 + b^2. This drops the 2ab term. It is the same error as the one in the identity chapter, and it appears here when you work backward.
- Wrong sign. The sign inside the parentheses follows the sign of the middle term. The last term is always positive.
- Missing the GCF. Pull out the common factor before testing.
- Missing the double root. Setting (x − 3)^2 = 0 gives one solution, not two.
A GRE-Style Application
Suppose a Quantitative Comparison gives x^2 − 14x + 49 = 0 with x > 0, and compares x with 6. Factoring gives (x − 7)^2 = 0, so x = 7 and Quantity A (x = 7) is greater than Quantity B (6). Recognizing the perfect square takes seconds, while the quadratic formula would take much longer.
Exercise
For what values of k is 4x^2 + kx + 25 a perfect square trinomial?
Show answer
Here a = 2x and b = 5, so 2ab = 20x. Therefore k = 20 or k = −20. The expressions are (2x + 5)^2 and (2x − 5)^2.
Exercise
Factor 2x^2 − 28x + 98 completely, then solve 2x^2 − 28x + 98 = 0.
Show answer
Factor out 2 to get 2(x^2 − 14x + 49). Inside, a = x, b = 7, and 2ab = 14x, so the expression is 2(x − 7)^2. Setting it to zero gives x = 7, a double root.
Exercise
If x^2 + 10x + m is a perfect square, what is m? Then simplify (x^2 + 10x + m) / (x + 5) for x ≠ −5.
Show answer
Half of 10 is 5, and 5^2 = 25, so m = 25. The expression is (x + 5)^2 / (x + 5) = x + 5.