# Completing the Square

Instructions: Use this step-by-step calculator for Completing the Square, by providing a quadratic expression (Ex: $$3x^2 + 5x + 4$$ or $$x^2 + 2x + 1/2$$) in the form below. The coefficients of the quadratic expression can be numbers or fractions.

Quadratic Expression (Ex: '3x^2 + 5x + 4', 'x^2-2x-1', etc.) =

## Completing the Square Calculator

What is the meaning of completing the square? Well, the idea is to have the square of something. Whenever you have a quadratic expression of the form $$ax^2 + bx + c$$, you would want to have it as the "square of something".

Analyzing the expression, the only square you see if the part $$a x^2$$, which contains the square of $$x$$, but then you have other things aside the square. Mathematically, it is always possible to put a quadratic expression of the form $$ax^2 + bx + c$$ as the "square of something", but potentially we would need to add a constant.

Sometimes, if that constant is zero, we would get what is called a perfect square.

Completing the squares is simply the process of putting a quadratic expression $$ax^2 + bx + c$$ into the form of the square of a simple expression, plus possibly a constant. The procedure is straightforward, and it consists of various steps.

### How Do You Complete the Squre

Step 1: Ensure that the passed expression is quadratic, with a non-zero coefficient multiplying the term $$x^2$$. If that is not the case, you cannot do this procedure.

Step 2: Now that you have a proper quadratic term $$ax^2 + bx + c$$, you need to factor out $$a$$ (the term that multiplies $$x^2$$). If $$a = 1$$, then you leave it like it is.

$ax^2 + bx + c = \displaystyle a\left(x^2 + \frac{b}{a}x + \frac{c}{a}\right)$

Step 3: Now we will need to look at the term that is inside the parentheses (or the original term if $$a = 1$$). Observe that for a constant $$d$$, we have that $$(x+d)^2 = x^2 + 2dx + d^2$$. So, we observe that

$ax^2 + bx + c = \displaystyle a\left(x^2 + \frac{b}{a}x + \frac{c}{a}\right) = \displaystyle a\left(x^2 + 2 \left(\frac{b}{2a}\right)x + \frac{c}{a}\right)$

So then, the term $$2 \left(\frac{b}{2a}\right)x$$ in the above expression is awfully similar to the $$d$$ in $$(x+d)^2 = x^2 + 2dx + d^2$$. So indeed, we can do

$ax^2 + bx + c = \displaystyle a\left(x^2 + \frac{b}{a}x + \frac{c}{a}\right) = \displaystyle a\left(x^2 + 2 \left(\frac{b}{2a}\right)x + \frac{c}{a}\right)$ $= \displaystyle a\left(x^2 + 2 \left(\frac{b}{2a}\right)x + \left(\frac{b}{2a}\right)^2 - \left(\frac{b}{2a}\right)^2 + \frac{c}{a}\right)$ $= \displaystyle a \left( \left(x + \frac{b}{2a} \right)^2 - \left( \frac{b}{2a} \right)^2 + \frac{c}{a} \right)$ $= \displaystyle a \left(x + \frac{b}{2a} \right)^2 - \frac{b^2}{4a} + c$

### Completing the square examples

Consider the expression: $$2x^2 + 2x + 1$$. First, we factor 2 out:

$2x^2 + 2x + 1 = \displaystyle 2\left(x^2 + x + \frac{1}{2}\right)$

We can either memorize the formula given above, or you can follow the procedure of "forcing" the square". I believe that that latter is the best option, because you can definitely forget the formula, but you won't forget the procedure once you learn it. So, we look at the $$x$$ term and force the 2 in front of it. So we get

$2x^2 + 2x + 1 = \displaystyle 2\left(x^2 + x + \frac{1}{2}\right)= \displaystyle 2\left(x^2 + 2\left(\frac{1}{2}\right)x + \frac{1}{2}\right)$

Now, look at the term in the parenthesis to the left of $$x$$. We square the term and add it and subtract it: $$\displaystyle \left(\frac{1}{2}\right)^2 - \left(\frac{1}{2}\right)^2$$, so essentially we are adding 0, so the expression does not change:

$2x^2 + 2x + 1 = \displaystyle 2\left(x^2 + x + \frac{1}{2}\right)= \displaystyle 2\left(x^2 + 2\left(\frac{1}{2}\right)x + \frac{1}{2}\right)$ $= \displaystyle 2\left(x^2 + 2\left(\frac{1}{2}\right)x + \left(\frac{1}{2}\right)^2 - \left(\frac{1}{2}\right)^2 + \frac{1}{2}\right)$

So now we can indentify the first three terms as a perfect square, so we get:

$= \displaystyle 2\left( \left(x + \frac{1}{2}\right)^2 - \left(\frac{1}{2}\right)^2 + \frac{1}{2}\right)$ $= \displaystyle 2\left( \left(x + \frac{1}{2}\right)^2 - \frac{1}{4} + \frac{1}{2}\right)$ $= \displaystyle 2\left( \left(x + \frac{1}{2}\right)^2 + \frac{1}{4} \right)$ $= \displaystyle 2 \left(x + \frac{1}{2}\right)^2 + \frac{1}{2}$

### Why is it called the why it is?

You may be wondering why is it that the procedure of completing square is called completing the square? Well, I mentioned it at the beginning, what we are trying to do is get a quadratic expression and rewrite it as the "square of something", and that is done by adding the right constant so that we literally "completes the square". By adding (and subtracting) this constant, we get a perfect square, plus a constant, which allows to find this "square of something" that we were looking for

### Solving Quadratic Equations by Completing the Square

Interestingly enough, completing the square is equivalent to solving a quadratic equation. Indeed, if we want to solve

$ax^2 + bx + c = 0$

we now know that we can complete the square to get:

$ax^2 + bx + c = \displaystyle a \left(x + \frac{b}{2a} \right)^2 - \frac{b^2}{4a} + c$

we get that solving the quadratic equation is the same as solving

$ax^2 + bx + c = \displaystyle a \left(x + \frac{b}{2a} \right)^2 - \frac{b^2}{4a} + c = 0$

so then

$\displaystyle a \left(x + \frac{b}{2a} \right)^2 - \frac{b^2}{4a} + c = 0$ $\Rightarrow a \left(x + \frac{b}{2a} \right)^2 = \frac{b^2}{4a} - c$ $\Rightarrow \left(x + \frac{b}{2a} \right)^2 = \frac{b^2-4ac}{4a^2}$ $\Rightarrow x + \frac{b}{2a} = \pm \sqrt{ \frac{b^2-4ac}{4a^2} }$ $\Rightarrow x = - \frac{b}{2a} \pm \sqrt{ \frac{b^2-4ac}{4a^2} }$ $\Rightarrow x = \frac{-b \pm \sqrt{b^2-4ac}}{2a}$

So as you can use, if you complete the square to solve a quadratic equation is the exactly the same as using the traditional quadratic formula.

### Other related calculators

You may be interested in our quadratic equation calculator, if you want to compute roots using the traditional quadratic equation formula.

In case you have any suggestion, or if you would like to report a broken solver/calculator, please do not hesitate to contact us.