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 x, squared, plus, 6, x, equals, minus, 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.\begin{aligned}(1)&&x^2+6x&=-2\\\\ \blueD{(2)}&&\Large\blueD{x^2+6x+9}&\Large\blueD{=7}&&\blueD{\text{Add 9, completing the square.}}\\\\ (3)&&(x+3)^2&=7&&\text{Factor the expression on the left.}\\\\ (4)&&\sqrt{(x+3)^2}&=\pm \sqrt{7}&&\text{Take the square root.}\\\\ (5)&&x+3&=\pm\sqrt{7}\\\\ (6)&&x&=\pm\sqrt{7}-3&&\text{Subtract 3.}\end{aligned}
In conclusion, the solutions are x, equals, square root of, 7, end square root, minus, 3 and x, equals, minus, square root of, 7, end square root, minus, 3.

What happened here?

Adding 9 to x, squared, plus, 6, x in row start color #11accd, left parenthesis, 2, right parenthesis, end color #11accd had the fortunate result of making the expression a perfect square that can be factored as left parenthesis, x, plus, 3, right parenthesis, squared. 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 x, squared, plus, 6, x 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 left parenthesis, x, plus, a, right parenthesis, squared where the value of constant a is still unknown. This expression is expanded as x, squared, plus, 2, a, x, plus, a, squared, which tells us two things:
  1. The coefficient of x, which we know to be 6, should be equal to 2, a. This means that a, equals, 3.
  2. The constant number we need to add is equal to a, squared, which is 3, squared, equals, 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 x, squared, plus, 10, x ?
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Problem 2
What is the missing constant term in the perfect square that starts with x, squared, minus, 2, x ?
  • Your answer should be
  • an integer, like 6
  • a simplified proper fraction, like 3, slash, 5
  • a simplified improper fraction, like 7, slash, 4
  • a mixed number, like 1, space, 3, slash, 4
  • an exact decimal, like 0, point, 75
  • a multiple of pi, like 12, space, start text, p, i, end text or 2, slash, 3, space, start text, p, i, end text

Problem 3
What is the missing constant term in the perfect square that starts with x, squared, plus, start fraction, 1, divided by, 2, end fraction, x ?
  • Your answer should be
  • a simplified proper fraction, like 3, slash, 5

Challenge problem
What is the missing constant term in the perfect square that starts with x, squared, plus, b, dot, x?
Choose 1 answer:
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 x, squared, plus, b, x into a perfect square, where b is any number, we need to add left parenthesis, start fraction, b, divided by, 2, end fraction, right parenthesis, squared to it.
For example, in order to complete x, squared, plus, start color #11accd, 6, end color #11accd, x into a perfect square, we added left parenthesis, start fraction, start color #11accd, 6, end color #11accd, divided by, 2, end fraction, right parenthesis, squared, equals, 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 x, squared, minus, 10, x, equals, minus, 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.\begin{aligned}(1)&&x^2-10x&=-12\\\\ \blueD{(2)}&&\Large\blueD{x^2-10x+25}&\Large\blueD{=13}&&\blueD{\text{Add 25, completing the square.}}\\\\ (3)&&(x-5)^2&=13&&\text{Factor the expression on the left.}\\\\ (4)&&\sqrt{(x-5)^2}&=\pm \sqrt{13}&&\text{Take the square root.}\\\\ (5)&&x-5&=\pm\sqrt{13}\\\\ (6)&&x&=\pm\sqrt{13}+5&&\text{Add 5.}\end{aligned}
In order to make the original left-hand expression x, squared, minus, 10, x a perfect square, we added 25 in row start color #11accd, left parenthesis, 2, right parenthesis, end color #11accd. As always with equations, we did the same for the right-hand side, which made it increase from minus, 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 x, squared, minus, 8, x, equals, 5.
Choose 1 answer:
Choose 1 answer:

Problem 5
Solve x, squared, plus, 3, x, equals, minus, start fraction, 1, divided by, 4, end fraction.
Choose 1 answer:
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 x, squared, plus, 5, x, minus, 6, equals, x, plus, 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.\begin{aligned}(1)&&x^2+5x-6&=x+1\\\\ \tealD{(2)}&&\tealD{x^2+4x-6}&\tealD{=1}&&\tealD{\text{Subtract }x.}\\\\ \purpleC{(3)}&&\purpleC{x^2+4x}&\purpleC{=7}&&\purpleC{\text{Add 6.}}\\\\ (4)&&x^2+4x+4&=11&&\text{Add 4, completing the square.}\\\\ (5)&&(x+2)^2&=11&&\text{Factor.}\\\\ (6)&&\sqrt{(x+2)^2}&=\pm\sqrt{11}&&\text{Take the square root.}\\\\ (7)&&x+2&=\pm\sqrt{11}\\\\ (8)&&x&=\pm\sqrt{11}-2&&\text{Subtract 2.}\end{aligned}
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 start color #01a995, left parenthesis, 2, right parenthesis, end color #01a995, placing all the variable terms on the left-hand side.
Furthermore, to complete x, squared, plus, 4, x 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 start color #aa87ff, left parenthesis, 3, right parenthesis, end color #aa87ff, leaving x, squared, plus, 4, x on its own.

Rule 2: Make sure the coefficient of x, squared is equal to 1.

This is how the solution of the equation 3, x, squared, minus, 36, x, equals, minus, 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.\begin{aligned}(1)&&3x^2-36x&=-42\\\\ \maroonD{(2)}&&\maroonD{x^2-12x}&\maroonD{=-14}&&\maroonD{\text{Divide by 3.}}\\\\ (3)&&x^2-12x+36&=22&&\text{Add 36,completing the square.}\\\\ (4)&&(x-6)^2&=22&&\text{Factor.}\\\\ (5)&&\sqrt{(x-6)^2}&=\pm\sqrt{22}&&\text{Take the square root.}\\\\ (6)&&x-6&=\pm\sqrt{22}\\\\ (7)&&x&=\pm\sqrt{22}+6&&\text{Add 6.}\end{aligned}
The completing the square method only works if the coefficient of x, squared is 1.
This is why in row start color #ca337c, left parenthesis, 2, right parenthesis, end color #ca337c we divided by the coefficient of x, squared, which is 3.
Sometimes, dividing by the coefficient of x, squared 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 4, x, squared, plus, 20, x, minus, 3, equals, 0.
Choose 1 answer:
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
    (15 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
      (36 votes)
  • 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?
    (5 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.
      (8 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 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.
      (1 vote)
  • 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.
      (5 votes)
  • male robot hal style avatar for user Marioland
    This method is only available if factoring does not help correct?
    (1 vote)
    Default Khan Academy avatar avatar for user
  • 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.
    (2 votes)
    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
      (6 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
      (2 votes)
  • 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
    • duskpin sapling style avatar for user Lin Gh.
      Yes, I believe you're correct.
      But if you want to check the solution, you can always find the discriminant.
      So, Δ = b^2 - 4ac
      Δ = (-2)^2 - 4 (3) (4)
      Δ = 4 - 48
      Δ = -44
      So it has no solution.

      Hope this helped. :)
      (3 votes)