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: Difference of squares

Learn how to factor quadratics that have the "difference of squares" form. For example, write x²-16 as (x+4)(x-4).
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 use the difference of squares pattern to factor certain polynomials. If you don't know the difference of squares pattern, please check out our video before proceeding.

Intro: Difference of squares pattern

Every polynomial that is a difference of squares can be factored by applying the following formula:
start color #11accd, a, end color #11accd, squared, minus, start color #1fab54, b, end color #1fab54, squared, equals, left parenthesis, start color #11accd, a, end color #11accd, plus, start color #1fab54, b, end color #1fab54, right parenthesis, left parenthesis, start color #11accd, a, end color #11accd, minus, start color #1fab54, b, end color #1fab54, right parenthesis
Note that a and b in the pattern can be any algebraic expression. For example, for a, equals, x and b, equals, 2, we get the following:
x222=(x+2)(x2)\begin{aligned}\blueD{x}^2-\greenD{2}^2=(\blueD x+\greenD 2)(\blueD x-\greenD 2)\end{aligned}
The polynomial x, squared, minus, 4 is now expressed in factored form, left parenthesis, x, plus, 2, right parenthesis, left parenthesis, x, minus, 2, right parenthesis. We can expand the right-hand side of this equation to justify the factorization:
(x+2)(x2)=x(x2)+2(x2)=x22x+2x4=x24\begin{aligned}(x+2)(x-2)&=x(x-2)+2(x-2)\\\\&=x^2-2x+2x-4\\ \\ &=x^2-4\end{aligned}
Now that we understand the pattern, let's use it to factor a few more polynomials.

Example 1: Factoring x, squared, minus, 16

Both x, squared and 16 are perfect squares, since 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. In other words:
x, squared, minus, 16, equals, left parenthesis, start color #11accd, x, end color #11accd, right parenthesis, squared, minus, left parenthesis, start color #1fab54, 4, end color #1fab54, right parenthesis, squared
Since the two squares are being subtracted, we can see that this polynomial represents a difference of squares. We can use the difference of squares pattern to factor this expression:
start color #11accd, a, end color #11accd, squared, minus, start color #1fab54, b, end color #1fab54, squared, equals, left parenthesis, start color #11accd, a, end color #11accd, plus, start color #1fab54, b, end color #1fab54, right parenthesis, left parenthesis, start color #11accd, a, end color #11accd, minus, start color #1fab54, b, end color #1fab54, right parenthesis
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. Therefore, our polynomial factors as follows:
left parenthesis, start color #11accd, x, end color #11accd, right parenthesis, squared, minus, left parenthesis, start color #1fab54, 4, end color #1fab54, right parenthesis, squared, equals, left parenthesis, start color #11accd, x, end color #11accd, plus, start color #1fab54, 4, end color #1fab54, right parenthesis, left parenthesis, start color #11accd, x, end color #11accd, minus, start color #1fab54, 4, end color #1fab54, right parenthesis
We can check our work by ensuring the product of these two factors is x, squared, minus, 16.

Check your understanding

1) Factor x, squared, minus, 25.
Choose 1 answer:
Choose 1 answer:

2) Factor x, squared, minus, 100.

Reflection question

3) Can we use the difference of squares pattern to factor x, squared, plus, 25?
Choose 1 answer:
Choose 1 answer:

Example 2: Factoring 4, x, squared, minus, 9

The leading coefficient does not have to equal to 1 in order to use the difference of squares pattern. In fact, the difference of squares pattern can be used here!
This is because 4, x, squared and 9 are perfect squares, since 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. We can use this information to factor the polynomial using the difference of squares pattern:
4x29=(2x)2(3)2=(2x+3)(2x3)\begin{aligned}4x^2-9 &=(\blueD {2x})^2-(\greenD{3})^2\\ \\ &=(\blueD {2x}+\greenD 3)(\blueD {2x}-\greenD 3) \end{aligned}
A quick multiplication check verifies our answer.

Check your understanding

4) Factor 25, x, squared, minus, 4.
Choose 1 answer:
Choose 1 answer:

5) Factor 64, x, squared, minus, 81.

6) Factor 36, x, squared, minus, 1.

Challenge problems

7*) Factor x, start superscript, 4, end superscript, minus, 9.

8*) Factor 4, x, squared, minus, 49, y, squared.

Want to join the conversation?

  • aqualine tree style avatar for user Elly Hamilton
    If the question is x^2 + 25 its not factorable? Why?
    (5 votes)
    Default Khan Academy avatar avatar for user
    • winston default style avatar for user Anderson Le
      The difference of squares: (a+b)(a-b). x^2 + 25 is not factorable since you're adding 25, not subtracting. A positive multiplied by a negative is always a negative. If you were to factor it, you would have to use imaginary numbers such as i5. The factors of 25 are 5 and 5 besides 1 and itself. Since the formula: (a-b)(a+b), it uses a positive and negative sign, making the last term always a negative.
      (14 votes)
  • female robot grace style avatar for user purpleabb
    Does the order of the signs matter? I have gotten it right when I do (x+y)(x-y). If I did it (x-y)(x+y) would it be wrong?
    (6 votes)
    Default Khan Academy avatar avatar for user
  • stelly yellow style avatar for user Brittne Wiley
    i really don't understand factoring AT ALL even after watching the videos so can someone help me because i really suck at math! thank you in advance!
    (6 votes)
    Default Khan Academy avatar avatar for user
    • mr pink green style avatar for user David Severin
      Are you talking about just this video (difference of squares) or about any factoring at all? If it is factoring in general, you have to go through a sequence of factoring to support your learning. So just reaching out says that you are not as bad as you think. If you say all factoring, then we will start with a=1 and go one step at a time.
      (2 votes)
  • blobby green style avatar for user Fernando Garcia
    in the video how did he know what number to divide by ?
    (5 votes)
    Default Khan Academy avatar avatar for user
  • aqualine seed style avatar for user shackelforddo2023
    So when you have 25x-4 you have to make the 4 into a 2
    (3 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user benjamin.kolkert
    how do you explain difference of squares to someone in words
    (3 votes)
    Default Khan Academy avatar avatar for user
  • winston default style avatar for user mikaela.esparagoza
    Why can't we use the difference of squares pattern to factor x^2 + 25?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • cacteye blue style avatar for user Jerry Nilsson
      First, let's write 𝑥² + 25 as a difference of squares.
      𝑥² + 25 = 𝑥² − (−25) = 𝑥² − (√(−25))²

      This would then factorize to (𝑥 − √(−25))(𝑥 + √(−25))

      The problem is that there exists no real number 𝑎, such that 𝑎 = √(−25)
      because squaring both sides gives us 𝑎² = −25 and the square of a real number cannot be negative.

      – – –

      The square roots of negative numbers are called imaginary numbers.
      In and of themselves, imaginary numbers are quite pointless, but there are situations where they can prove useful.

      For example, there is a formula for solving third-degree polynomial equations.
      Using this formula, the calculations often require the use of imaginary numbers, even though the solutions in the end are real numbers.
      (3 votes)
  • spunky sam blue style avatar for user ickleingus
    What's the deal with expanding from the two brackets where it goes (x+2)(x-2)=x(x-2)+2(x-2). I've never learnt this what type of property is it so that I can check it out, is it the distributive property?
    (1 vote)
    Default Khan Academy avatar avatar for user
  • aqualine tree style avatar for user Katie Migounoff
    Silly question, but do you ever get questions where you need to find difference of squares without perfect squares?
    (2 votes)
    Default Khan Academy avatar avatar for user
    • mr pink green style avatar for user David Severin
      You could at least theoretically do this x^2 - 3 = (x + sqrt(3))(x-sqrt(3)), but we often do not factor this way, but we might solve it other ways. Most of the time, it is referred to as the difference of perfect squares, not just the difference of squares.
      (2 votes)
  • aqualine ultimate style avatar for user MJ
    How would I solve for a question like xp^2-4x and give a number for x to make the binomial a difference of perfect squares?
    (1 vote)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      You aren't solving, you are factoring.
      The first step you should always try when factoring is to look for a common factor. Your binomials has a common factor of X. Factor it out using the distributive property.
      x (p^2 - 4)
      You now have a binomial in the parentheses that is a difference of 2 squares. When you factor it, your factors become:
      x(p-2)(p+2)
      Hope this helps.
      (3 votes)