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

Solving quadratics by completing the square

For example, solve x²+6x=-2 by manipulating it into (x+3)²=7 and then taking the square root.

What you should be familiar with before taking this lesson

What you will learn in this lesson

So far, you've either solved quadratic equations by taking the square root or by factoring. These methods are relatively simple and efficient, when applicable. Unfortunately, they are not always applicable.
In this lesson, you will learn a method for solving any kind of quadratic equation.

Solving quadratic equations by completing the square

Consider the equation x2+6x=2. The square root and factoring methods are not applicable here.
But hope is not lost! We can use a method called completing the square. Let's start with the solution and then review it more closely.
(1)x2+6x=2(2)x2+6x+9=7Add 9, completing the square.(3)(x+3)2=7Factor the expression on the left.(4)(x+3)2=±7Take the square root.(5)x+3=±7(6)x=±73Subtract 3.
In conclusion, the solutions are x=73 and x=73.

What happened here?

Adding 9 to x2+6x in row (2) had the fortunate result of making the expression a perfect square that can be factored as (x+3)2. This allowed us to solve the equation by taking the square root.
This was no coincidence, of course. The number 9 was carefully chosen so the resulting expression would be a perfect square.

How to complete the square

To understand how 9 was chosen, we should ask ourselves the following question: If x2+6x is the beginning of a perfect square expression, what should be the constant term?
Let's assume that the expression can be factored as the perfect square (x+a)2 where the value of constant a is still unknown. This expression is expanded as x2+2ax+a2, which tells us two things:
  1. The coefficient of x, which we know to be 6, should be equal to 2a. This means that a=3.
  2. The constant number we need to add is equal to a2, which is 32=9.
Try to complete a few squares on your own.
Problem 1
What is the missing constant term in the perfect square that starts with x2+10x ?
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3/5
  • a simplified improper fraction, like 7/4
  • a mixed number, like 1 3/4
  • an exact decimal, like 0.75
  • a multiple of pi, like 12 pi or 2/3 pi

Problem 2
What is the missing constant term in the perfect square that starts with x22x ?
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3/5
  • a simplified improper fraction, like 7/4
  • a mixed number, like 1 3/4
  • an exact decimal, like 0.75
  • a multiple of pi, like 12 pi or 2/3 pi

Problem 3
What is the missing constant term in the perfect square that starts with x2+12x ?
  • Your answer should be
  • a simplified proper fraction, like 3/5

Challenge problem
What is the missing constant term in the perfect square that starts with x2+bx?
Choose 1 answer:

This challenge question gives us a shortcut to completing the square, for those that like shortcuts and don't mind memorizing things. It shows us that in order to complete x2+bx into a perfect square, where b is any number, we need to add (b2)2 to it.
For example, in order to complete x2+6x into a perfect square, we added (62)2=9 to it.

Solving equations one more time

All right! Now that you're a certified square-completer, let's go back to the process of solving equations using our method.
Let's look at a new example, the equation x210x=12.
(1)x210x=12(2)x210x+25=13Add 25, completing the square.(3)(x5)2=13Factor the expression on the left.(4)(x5)2=±13Take the square root.(5)x5=±13(6)x=±13+5Add 5.
In order to make the original left-hand expression x210x a perfect square, we added 25 in row (2). As always with equations, we did the same for the right-hand side, which made it increase from 12 to 13.
In general, the choice of the number to add in order to complete the square doesn't depend on the right-hand side, but we should always add the number to both sides.
Now it's your turn to solve some equations.
Problem 4
Solve x28x=5.
Choose 1 answer:

Problem 5
Solve x2+3x=14.
Choose 1 answer:

Arranging the equation before completing the square

Rule 1: Separate the variable terms from the constant term

This is how the solution of the equation x2+5x6=x+1 goes:
(1)x2+5x6=x+1(2)x2+4x6=1Subtract x.(3)x2+4x=7Add 6.(4)x2+4x+4=11Add 4, completing the square.(5)(x+2)2=11Factor.(6)(x+2)2=±11Take the square root.(7)x+2=±11(8)x=±112Subtract 2.
Completing the square on one of the equation's sides is not helpful if we have an x-term on the other side. This is why we subtracted x in row (2), placing all the variable terms on the left-hand side.
Furthermore, to complete x2+4x into a perfect square, we need to add 4 to it. But before we do that, we need to make sure that all the constant terms are on the other side of the equation. This is why we added 6 in row (3), leaving x2+4x on its own.

Rule 2: Make sure the coefficient of x2 is equal to 1.

This is how the solution of the equation 3x236x=42 goes:
(1)3x236x=42(2)x212x=14Divide by 3.(3)x212x+36=22Add 36,completing the square.(4)(x6)2=22Factor.(5)(x6)2=±22Take the square root.(6)x6=±22(7)x=±22+6Add 6.
The completing the square method only works if the coefficient of x2 is 1.
This is why in row (2) we divided by the coefficient of x2, which is 3.
Sometimes, dividing by the coefficient of x2 will result in other coefficients becoming fractions. This doesn't mean you did something wrong, it just means you will have to work with fractions in order to solve.
Now it's your turn to solve an equation like this.
Problem 6
Solve 4x2+20x3=0.
Choose 1 answer:

Want to join the conversation?

  • blobby green style avatar for user Emilyy Jade
    how did you get 25/4 and how did you equal it to 7
    (17 votes)
    Default Khan Academy avatar avatar for user
    • aqualine ultimate style avatar for user Megu
      The 25/4 and 7 is the result of completing the square method.

      To factor the equation, you need to first follow this equation: x^​2​ + 2ax + a^2.
      In x^2 +5x = 3/4, The a^2 is missing.

      To figure out the a, you need to take the 5 and divide it by 2 (because 2ax), which becomes 5/2. a=5/2.
      Then you need to square it, (because a^2) which becomes 5^2/2^2.
      5x5 is 25, and 2x2 is 4, so the a^2 is 25/4.
      When you add 25/4 on the left side, you have to add 25/4 on the right side as well.
      Remember, the 3/4 is still there, so add them: x^2 + 5x + 25/4 = 25/4 + 3/4
      25/4 + 3/4 = 28/4. 28 divided by 4 is 7.

      Hope this helps! :3
      (46 votes)
  • purple pi purple style avatar for user Federico
    How was 7 added at the 6 paragraph? Where it shows the steps on how to complete the square?
    (8 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user Santos Gonzalez
    what does what does it mean when there is a letter i In the solution of the equation?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • blobby green style avatar for user Miican Lin
      An "i" means the answer is the square root of a negative number. Since that doesn't work in the normal everyday world - but does have uses elsewhere - the "i" is used to make it easier to simplify the answers (and confuse the people ~_^). "i" is defined as the square root of negative 1, and can be factored out. Like an "x" or other variable, terms with "i" can only be added to or subtracted from other terms containing "i". However, "i" squared = -1. It becomes a regular number and can be added to regular numbers. This is important to remember when checking your answers.
      (11 votes)
  • leaf green style avatar for user Annika Breen
    How do you solve 5x^2 -10x =23
    (3 votes)
    Default Khan Academy avatar avatar for user
    • stelly blue style avatar for user Kim Seidel
      I'm going to assume you want to solve by completing the square.
      1) Divide the entire equation by 5: x^2 - 2x = 23/5
      2) Complete the square: -2/2 = -1. (-1)^2 = +1. Add +1 to both sides: x^2 - 2x + 1 = 23/5 + 1
      3) Rewrite the left side as a binomial squared, and add the fractions on the right: (x-1)^2 = 28/5
      4) Take square root of both sides: sqrt(x-1)^2 = +/- sqrt(28/5)
      5) Simplify both radicals:
      x-1 = +/- sqrt(4*7/5)
      x-1 = +/- 2 sqrt(7/5) * sqrt(5/5)
      x-1 = +/- 2 sqrt(35) / 5
      6) Add 1 to both sides:
      x = 1 +/- 2 sqrt(35) / 5
      x = 5/5 +/- 2 sqrt(35) / 5
      x = [5 +/- 2 sqrt(35)] / 5

      Hope this helps.
      (8 votes)
  • blobby green style avatar for user STEM
    Does each quadratic equation always have a square and those missing parts of the square; or is it (this method) just for the perfect square equations?
    (4 votes)
    Default Khan Academy avatar avatar for user
    • primosaur ultimate style avatar for user Monil Mehta
      Not every quadratic equation always has a square. It may have a square, missing parts for a square, or even both, in which case you could use the completing the square method. But no, for the most part, each quadratic function won't necessarily have squares or missing parts. It's possible, but not common. But since every number is a square and has a square root, you can still do it, though it would be much more painful.
      (2 votes)
  • blobby green style avatar for user LoganLandonLiam
    How do I do a quadratic equation using completing the square if a or x^2 have a number in front of it ( ie. 4x^2) because I have tried many things with it and it doesn't add up or subtract out.
    (1 vote)
    Default Khan Academy avatar avatar for user
    • purple pi purple style avatar for user doctorfoxphd
      This would be the same as rule 2 (and everything after that) in the article above.
      You are correct that you cannot get rid of it by adding or subtracting it out. As shown in rule 2, you have to divide by the value of a (which is 4 in your case). In the example following rule 2 that we were supposed to try, the coefficient of x² is 4. So, we have to divide the x² AND the x terms by 4 to bring the coefficient of x² down to 1. ​
      Let's use the example they gave us:
      4x² + 20x -3 = 0
      move the constant term
      4x² + 20x = 3
      divide through the x² term and x term by 4 to factor it out
      4(4x²/4 + 20x/4 ) = 3

      This leaves
      4( x² + 5x ) = 3

      Or, you can divide EVERY term by 4 to get
      x² + 5x = 3/4 → I prefer this way of doing it
      Now we complete the square by dividing the x-term by 2 and adding the square of that to both sides of the equation. That is 5/2 which is 25/4 when it is squared
      x² + 5x +25/4 = 3/4 + 25/4 → simplify the right side
      x² + 5x +25/4 = 28/4 → Hey, that is equal to 7
      Now rewrite the perfect square trinomial as the square of the two binomial factors
      We especially designed this trinomial to be a perfect square so that this step would work:
      x² + 5x +25/4 = (x + 5/2)²
      If you get stuck on the fractions, the right-hand term in the parentheses will be half of the x-term.
      (x + 5/2)² = 7
      Take the square root of both sides, remembering to take both the positive and negative square root of the number on the right
      (x + 5/2)² = ± √ 7
      x + 5/2 = ± √ 7
      Isolate the x by subtracting away the constant that is still with it
      x = - 5/2 ± √ 7
      That gives us our two correct solutions for x
      x = - 5/2 + √ 7
      x = - 5/2 - √ 7
      (8 votes)
  • blobby green style avatar for user lew.lehmann
    Often when coming across quadratics with non-zero leading co-efficients I'm not sure whether to pull out a common factor, or to divide by the leading co-efficient.

    For example in the above question in my first attempt I factored out a 4 to get 4(x^2 + 5x)-3=0.

    However, when attempting to solve from there, I end up at a dead end, or with a different result to if I'd divided out the leading co-efficient.

    Are these 2 methods interchangeable, and I'm just doing something wrong? Or, is there a preferred approach for some reason?
    (3 votes)
    Default Khan Academy avatar avatar for user
    • leaf orange style avatar for user A/V
      I wouldn't say that both methods are exactly interchangable; however, it's best to factor out. Factoring it out preserves the equation whilst dividing the equation by, for example it's GCF, removes that aspect of the equation. As a result from that, there might be some loss of solutions.

      Your completing the square method is exactly on point with the first half. Just remember when you find (b/2)², you must add that result in the parenthesis, and subtract it out and multiply it by the 4 by the number outside. Less abstractly:

      4(x²+5x+(25/4)) - 3(4)(25/4) = 0

      And solve by then. Hopefully that gives some insight
      (3 votes)
  • male robot hal style avatar for user Marioland
    This method is only available if factoring does not help correct?
    (0 votes)
    Default Khan Academy avatar avatar for user
  • blobby green style avatar for user braydonives
    What if my x^2 value has a coefficient in front. What do I do with it?
    (2 votes)
    Default Khan Academy avatar avatar for user
  • marcimus pink style avatar for user Luan
    It is given this equation: 3x^2 -2x+4=0
    in the end of solving i have this:(x-2/6)^2=-44/36
    ^2 means in power of two. Does this equation has no solution?
    (1 vote)
    Default Khan Academy avatar avatar for user