# Solving Quadratic Equations by Completing the Square

## Related Calculator: Quadratic Equation Calculator

Completing the square is a method for solving quadratic equation.

Before we into the method itself, let's start from a simple example.

Example 1. Solve equation (x-3)^2=16.

We already saw something similar in the incomplete quadratic equations note.

Indeed, what number, when squared, will give 16?

Actually, two numbers: 4 and -4 (take square root of 16 and don't forget about plus/minus)

Thus, we have two linear equations:

• x-3=4. Its root is x=7.
• x-3=-4. Its root is x=-1.

Therefore, original equation has two roots: 7 and -1.

Answer: x=7 and x=-1.

We can generalize result of this example.

Fact: quadratic equation (mx-b)^2=c has two roots: (b+sqrt(c))/m and (b-sqrt(c))/m.

If c is negative, that above equation has no real roots (square of any real number can't give negative number)

Alas, not all quadratic equations are given in the above form.

Luckily, we can transform any quadratic equation to the above form.

This transformation is called completing of square.

We will need formula for square of sum/difference: (m+-n)^2=m^2+-2mn+n^2.

Example 2. Solve x^2+4x-21=0 by completing the square.

First step is to move constant to the right (don't forget to change the sign) to get equivalent equation x^2+4x=21.

Now, let's take square of sum formula and plug x instead of m:

(x+n)^2=x^2+color(red)(2n)x+n^2.

Right hand side is very similar to x^2+color(red)(4)x, except the different coefficient near x.

But we can find such value of n, that coefficients near x will be the same!

For this, solve equation color(red)(2n=4). This is linear equation: solution is n=2.

Now, plug 2 instead of n: (x+2)^2=x^2+4x+2^2=color(green)(x^2+4x)+4.

This is even closer to color(green)(x^2+4x), except the constant.

No problem! We can add any constants to the equation to leave it unchanged:

x^2+4x=21

x^2+4x+color(purple)(4)=21+color(purple)(4) (we need to add 4 to get square on the left hand side)

(x+2)^2=25 (x^2+4x+4=(x+2)^2)

We've got the equation very similar to equation in first example.

It has two solutions: x=sqrt(25)-2=3 and x=-sqrt(25)-2=-7.

Answer: x=3 and x=-7.

Next example explains how to handle cases, when coefficient near x^2 is not 1.

Example 3. Solve 3x^2=5x+2.

First of all, write equation in standard form by moving everything (except constant) to the left (don't forget to change the sign): 3x^2-5x=2.

Coefficient near x^2 is 3, and it is more convenient, when coeffcient near x^2 is 1.

That's not a problem, because we can divide both sides of equation by 3: x^2-color(red)(5/3)x=2/3.

Now, we take fomula for square of difference: (x-n)^2=x^2-color(red)(2n)x-n^2.

Again, notice, that we want to find such value of n, that color(red)(2n=5/3) or n=5/6.

Thus, (x-5/6)^2=x^2-5/3x+(5/6)^2.

x^2-5/3x=2/3

x^2-5/3x+(5/6)^2=2/3+(5/6)^2 (add (5/6)^2 to get square on the left hand side)

(x-5/6)^2=2/3+25/36 (x^2-5/3x+(5/6)^2=(x-5/6)^2)

(x-5/6)^2=49/36 (simplify)

Here we have two possibilities:

• x-5/6=sqrt(49/36)=7/6 ,which has solution x=2.
• x-5/6=-sqrt(49/36)=-7/6, which has solution x=-1/3.

Answer: x=2 and x=-1/3.

Above two examples showed, that we can write steps for completing the square.

Steps for completing the square:

1. Start with the equation ax^2+bx+c=0.
2. Divide both sides of the equation by a (if a!=1): x^2+b/ax+c/a=0.
3. Move constant to the right: x^2+b/ax=-c/a.
4. Find number n, such that n=b/(2a).
5. Add n^2 to both sides of equation: x^2+b/ax+(b/(2a))^2=-c/a+(b/(2a))^2.
6. Rewrite left hand side: (x+b/(2a))^2=-c/a+(b/(2a))^2.
7. Solve the equation.

Let's try to apply these steps in the next example.

Example 3. Solve equation -x^2+5x-21=0.

1. Start with equation: -x^2+5x-21=0.
2. Divide both sides of the equation by -1: x^2-5x+21=0.
3. Move constant to the right: x^2-5x=-21.
4. Number n is n=-5/2.
5. Add (-5/2)^2=25/4 to both sides of the equation: x^2-5x+25/4=-21+25/4.
6. Rewrite and simplify: (x-5/2)^2=-59/4.
7. This equation has no roots, because there is no real number, such that, when squared, will give negative number.

Answer: no real roots.

Now, it is time to exercise.

Exercise 1. Solve the following equation: (2x+5)^2=49.

Answer: 1 and -6.

Exercise 2. Solve equation (-3x+1)^2=5.

Answer: (1-sqrt(5))/3 and (1+sqrt(5))/3.

Exercise 3. Solve equation (-2x+3/4)^2=0.

Answer: 3/8. Hint: the only number, that, when squared, will give 0 is 0 itself.

Exercise 4. Solve equation (x-3)^2=-7.

Answer: no real roots.

Exercise 5. Solve equation by completing the square x^2+9x+14=0.

Answer: -2 and -7.

Exercise 6. Solve the following equation: 6x=9x^2+1.

Answer: 1/3.

Exercise 7. Solve equation -1/3x^2=3x+15.

Answer: no real roots.