If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

Factoring quadratics: Perfect squares

Learn how to factor quadratics that have the "perfect square" form. For example, write x²+6x+9 as (x+3)².
Factoring a polynomial involves writing it as a product of two or more polynomials. It reverses the process of polynomial multiplication.
In this article, we'll learn how to factor perfect square trinomials using special patterns. This reverses the process of squaring a binomial, so you'll want to understand that completely before proceeding.

Intro: Factoring perfect square trinomials

To expand any binomial, we can apply one of the following patterns.
  • left parenthesis, start color #11accd, a, end color #11accd, plus, start color #1fab54, b, end color #1fab54, right parenthesis, squared, equals, start color #11accd, a, end color #11accd, squared, plus, 2, start color #11accd, a, end color #11accd, start color #1fab54, b, end color #1fab54, plus, start color #1fab54, b, end color #1fab54, squared
  • left parenthesis, start color #11accd, a, end color #11accd, minus, start color #1fab54, b, end color #1fab54, right parenthesis, squared, equals, start color #11accd, a, end color #11accd, squared, minus, 2, start color #11accd, a, end color #11accd, start color #1fab54, b, end color #1fab54, plus, start color #1fab54, b, end color #1fab54, squared
Note that in the patterns, a and b can be any algebraic expression. For example, suppose we want to expand left parenthesis, x, plus, 5, right parenthesis, squared. In this case, start color #11accd, a, end color #11accd, equals, start color #11accd, x, end color #11accd and start color #1fab54, b, end color #1fab54, equals, start color #1fab54, 5, end color #1fab54, and so we get:
(x+5)2=x2+2(x)(5)+(5)2=x2+10x+25\begin{aligned}(\blueD x+\greenD 5)^2&=\blueD x^2+2(\blueD x)(\greenD5)+(\greenD 5)^2\\\\ &=x^2+10x+25\end{aligned}
You can check this pattern by using multiplication to expand left parenthesis, x, plus, 5, right parenthesis, squared.
The reverse of this expansion process is a form of factoring. If we rewrite the equations in the reverse order, we will have patterns for factoring polynomials of the form a, squared, plus minus, 2, a, b, plus, b, squared.
  • start color #11accd, a, end color #11accd, squared, plus, 2, start color #11accd, a, end color #11accd, start color #1fab54, b, end color #1fab54, plus, start color #1fab54, b, end color #1fab54, squared, space, equals, left parenthesis, start color #11accd, a, end color #11accd, plus, start color #1fab54, b, end color #1fab54, right parenthesis, squared
  • start color #11accd, a, end color #11accd, squared, minus, 2, start color #11accd, a, end color #11accd, start color #1fab54, b, end color #1fab54, plus, start color #1fab54, b, end color #1fab54, squared, space, equals, left parenthesis, start color #11accd, a, end color #11accd, minus, start color #1fab54, b, end color #1fab54, right parenthesis, squared
We can apply the first pattern to factor x, squared, plus, 10, x, plus, 25. Here we have start color #11accd, a, end color #11accd, equals, start color #11accd, x, end color #11accd and start color #1fab54, b, end color #1fab54, equals, start color #1fab54, 5, end color #1fab54.
x2+10x+25=x2+2(x)(5)+(5)2=(x+5)2\begin{aligned}x^2+10x+25&=\blueD x^2+2(\blueD x)(\greenD5)+(\greenD 5)^2\\\\ &=(\blueD x+\greenD 5)^2\end{aligned}
Expressions of this form are called perfect square trinomials. The name reflects the fact that this type of three termed polynomial can be expressed as a perfect square!
Let's take a look at a few examples in which we factor perfect square trinomials using this pattern.

Example 1: Factoring x, squared, plus, 8, x, plus, 16

Notice that both the first and last terms are perfect squares: x, squared, equals, left parenthesis, start color #11accd, x, end color #11accd, right parenthesis, squared and 16, equals, left parenthesis, start color #1fab54, 4, end color #1fab54, right parenthesis, squared. Additionally, notice that the middle term is two times the product of the numbers that are squared: 2, left parenthesis, start color #11accd, x, end color #11accd, right parenthesis, left parenthesis, start color #1fab54, 4, end color #1fab54, right parenthesis, equals, 8, x.
This tells us that the polynomial is a perfect square trinomial, and so we can use the following factoring pattern.
start color #11accd, a, end color #11accd, squared, plus, 2, start color #11accd, a, end color #11accd, start color #1fab54, b, end color #1fab54, plus, start color #1fab54, b, end color #1fab54, squared, space, equals, left parenthesis, start color #11accd, a, end color #11accd, plus, start color #1fab54, b, end color #1fab54, right parenthesis, squared
In our case, start color #11accd, a, end color #11accd, equals, start color #11accd, x, end color #11accd and start color #1fab54, b, end color #1fab54, equals, start color #1fab54, 4, end color #1fab54. We can factor our polynomial as follows:
x2+8x+16=(x)2+2(x)(4)+(4)2=(x+4)2\begin{aligned}x^2+8x+16&=(\blueD x)^2+2(\blueD x)(\greenD 4)+(\greenD4)^2\\ \\ &=(\blueD{x}+\greenD{4})^2\end{aligned}
We can check our work by expanding left parenthesis, x, plus, 4, right parenthesis, squared:
(x+4)2=(x)2+2(x)(4)+(4)2=x2+8x+16\begin{aligned}(x+4)^2&=(x)^2+2(x)(4)+(4)^2\\ \\ &=x^2+8x+16 \end{aligned}

Check your understanding

1) Factor x, squared, plus, 6, x, plus, 9.
Choose 1 answer:
Choose 1 answer:

2) Factor x, squared, minus, 6, x, plus, 9.
Choose 1 answer:
Choose 1 answer:

3) Factor x, squared, plus, 14, x, plus, 49.

Example 2: Factoring 4, x, squared, plus, 12, x, plus, 9

It is not necessary for the leading coefficient of a perfect square trinomial to be 1.
For example, in 4, x, squared, plus, 12, x, plus, 9, notice that both the first and last terms are perfect squares: 4, x, squared, equals, left parenthesis, start color #11accd, 2, x, end color #11accd, right parenthesis, squared and 9, equals, left parenthesis, start color #1fab54, 3, end color #1fab54, right parenthesis, squared. Additionally, notice that the middle term is two times the product of the numbers that are squared: 2, left parenthesis, start color #11accd, 2, x, end color #11accd, right parenthesis, left parenthesis, start color #1fab54, 3, end color #1fab54, right parenthesis, equals, 12, x.
Because it satisfies the above conditions, 4, x, squared, plus, 12, x, plus, 9 is also a perfect square trinomial. We can again apply the following factoring pattern.
start color #11accd, a, end color #11accd, squared, plus, 2, start color #11accd, a, end color #11accd, start color #1fab54, b, end color #1fab54, plus, start color #1fab54, b, end color #1fab54, squared, space, equals, left parenthesis, start color #11accd, a, end color #11accd, plus, start color #1fab54, b, end color #1fab54, right parenthesis, squared
In this case, start color #11accd, a, end color #11accd, equals, start color #11accd, 2, x, end color #11accd and start color #1fab54, b, end color #1fab54, equals, start color #1fab54, 3, end color #1fab54. The polynomial factors as follows:
4x2+12x+9=(2x)2+2(2x)(3)+(3)2=(2x+3)2\begin{aligned}4x^2+12x+9&=(\blueD {2x})^2+2(\blueD {2x})(\greenD 3)+(\greenD3)^2\\ \\ &=(\blueD{2x}+\greenD{3})^2\end{aligned}
We can check our work by expanding left parenthesis, 2, x, plus, 3, right parenthesis, squared.

Check your understanding

4) Factor 9, x, squared, plus, 30, x, plus, 25.
Choose 1 answer:
Choose 1 answer:

5) Factor 4, x, squared, minus, 20, x, plus, 25.

Challenge problems

6*) Factor x, start superscript, 4, end superscript, plus, 2, x, squared, plus, 1.

7*) Factor 9, x, squared, plus, 24, x, y, plus, 16, y, squared.

Want to join the conversation?

  • starky sapling style avatar for user Aaishahali
    is (4+x)^2 the same as (x+4)^2
    (19 votes)
    Default Khan Academy avatar avatar for user
  • aqualine seed style avatar for user Sanjna Ayyar
    Just curious, what's the point of doing this to an expression? Like, where will this be applied?
    (10 votes)
    Default Khan Academy avatar avatar for user
    • duskpin ultimate style avatar for user Theo Mostert
      Pretty much all of algebra will be used when we start doing calculus which is where math gets really cool with way more real world applications like launching satellites into space and making vaccines. Endless possibilities! But we must have a SOLID foundation in algebra for all this cool stuff!
      (20 votes)
  • blobby green style avatar for user sean cabo
    Number three marks (X+7) squared wrong as well, but the "I need help" section is correct.
    (4 votes)
    Default Khan Academy avatar avatar for user
  • spunky sam blue style avatar for user mtchuenkam
    I don't understand question 4 and 5. in question 4 he said ""notice that the middle term is two times the product of the numbers that are squared: 2(3x)(5)=30x2(3x})(\D 5)=30x2(3x)(5)=30x2, l, 3, x, D, 5, equals, 30, x. then he does the equation again and shows the answer I don't understand how he got there
    (7 votes)
    Default Khan Academy avatar avatar for user
    • leaf green style avatar for user Eric Parker
      normally when you have for example x^2+6x+9 you would take the root of 9 and multiply it by 2. if the answer is the first-degree variable coefficient (6) then it satisfy the perfect squares "trick" rule, and the answer would be (x+3)^2.

      when you have a coefficient to the 2nd-degree variable like in 9x^2+30x+25, you do almost the same:
      first you find the root of the 0-degree variable (25), which is 5. (5^2=25)
      then you find the root of the 2nd-degree variable's coefficient (9), which is 3 (3^2=9).

      now here is the different from before: you need to multiply both roots (3 and 5) and then multiply them by 2 (as you normally would). if the answer is the same as the 1st-degree variable's coefficient ((5*3)*2=30) then the trick can be applied here also, giving you the answer made of those 2 roots you found erlier(3 and 5)-squared.
      (3x+5)^2
      hope you understood and that it helped you.
      (7 votes)
  • mr pink orange style avatar for user Ian Philbrick-Miller
    What do the a and b stand for in the equation a^2+2ab+b^2 ? I'm very confused :/
    (4 votes)
    Default Khan Academy avatar avatar for user
  • duskpin tree style avatar for user HermioneGranger1219
    is algebra 1 a high school class because im taking it in middle school
    (3 votes)
    Default Khan Academy avatar avatar for user
    • starky sapling style avatar for user KC
      It can be, many people take algebra in middle school but there are also plenty of people who take it in high school. I think most people take geometry freshman year in high school (9th grade) but there are plenty of people who take it before or after
      (5 votes)
  • leaf green style avatar for user 😎  Tommy 😎
    Is there any more formulas like (a+b)^2?
    And How to factorize irrational numbers?
    2x^2+y^2+8z^2-2√2xy-4√2yz+8xz?
    (3 votes)
    Default Khan Academy avatar avatar for user
  • leafers seed style avatar for user Buggy
    I just factored 16x^2+80x+100 using the perfect square trinomial method and got (4x+10)^2. However, the answer key to the worksheet said that the answer is 4(2x+5)^2. Both answers are equal to 16x^2+80x+100. What method was used to get 4(2x+5)^2, and how do I know what method to use over the other?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • starky ultimate style avatar for user Iris Litiu
      Your answer is not correct because it is not in it's simplest form. First, you must find the greatest common factor, which would be 4 in this situation. So, 16x^2+80x+100= 4(4x^2+20x+25). Then, 4(4x^2+20x+25) can be further factored to equal 4(2x+5)^2. I hope this helps.
      (5 votes)
  • male robot hal style avatar for user hossein darestany
    in problem 5 we can write (-2x+5)^2. i wonder why this works.
    (2 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      It works because the difference between your version: (-2x+5)^2 and the typical factors of (2x - 5)^2 is that each of your factors has an extra factor of -1. And, -1 (-1) = +1.
      It would be like having: 5*5 vs. (-5)(-5). Both equal +25.
      Hope this helps.
      (2 votes)
  • piceratops seed style avatar for user ceairra wood
    it doesn't show the how to find the side of the squares
    (2 votes)
    Default Khan Academy avatar avatar for user