Expand menu menu_open Minimize Start chapters Home History history History expand_more
{{ item.displayTitle }}
No history yet!
Progress & Statistics equalizer Progress expand_more
{{ filterOption.label }}
{{ item.displayTitle }}
{{ item.subject.displayTitle }}
No results
{{ searchError }}
{{ courseTrack.displayTitle }}
{{ statistics.percent }}% Sign in to view progress
{{ printedBook.courseTrack.name }} {{ printedBook.name }}
search Use offline Tools apps
Login account_circle menu_open

Completing the Square

Quadratic expressions, functions, and equations can all be manipulated in useful ways with a method called completing the square. This method is based on the concept of perfect square trinomials.

Perfect Square Trinomial

Just as a perfect square integer, such as 9,9, can be written as the square of integer square roots, a perfect square trinomial is a trinomial which can be written as the square of a binomial. 9x2+2bx+b2(3)(3)(x+b)(x+b)32(x+b)2\begin{array}{c|c} 9 \quad&\quad x^2+2bx+b^2\\ \downarrow \quad&\quad \downarrow\\ (3)(3) \quad&\quad (x + b)(x + b)\\ \downarrow \quad&\quad \downarrow\\ 3^2 \quad&\quad (x+b)^2 \end{array}

There are two general types of perfect square trinomials that can be useful when dealing with quadratic functions or quadratic equations. This process involves factoring the quadratic trinomial and rewriting the perfect square trinomial as the square of a binomial.

Factoring a Perfect Square Trinomial

To be able to rewrite an expression to include a perfect square trinomial, it is first necessary to be able to recognize them. This can be achieved by expanding the square of a general binomial. The factoring is then done in the opposite direction. There are two kinds of perfect square trinomials, leading to different signs between the terms in the binomial.


a2+2ab+b2=(a+b)2a^2 + 2ab + b^2 = (a + b)^2

If a trinomial is in the form a2+2ab+b2,a^2 + 2ab + b^2, where aa and bb are variables or positive numbers, it is a perfect square trinomial that can be factored as (a+b)2.(a+b)^2. This is shown by expanding the squared binomial.

(a+b)2(a + b)^2
(a+b)(a+b)(a + b)(a + b)
aa+ab+ba+bba \cdot a + a \cdot b + b \cdot a + b \cdot b
a2+ab+ab+b2a^2 + ab + ab + b^2
a2+2ab+b2a^2 + 2ab + b^2

Thus, the trinomial and the square are equal.


a22ab+b2=(ab)2a^2 - 2ab + b^2 = (a - b)^2

If a trinomial instead is in the form a22ab+b2,a^2 - 2ab + b^2, it is also a perfect square trinomial and can be factored as (ab)2.(a-b)^2. This is shown by expanding the squared binomial.

(ab)2(a - b)^2
(ab)(ab)(a - b)(a - b)
aa+a(-b)+(-b)a+(-b)(-b)a \cdot a + a \cdot (\text{-} b) + (\text{-} b) \cdot a + (\text{-} b) \cdot (\text{-} b)
a2abab+b2a^2 - ab - ab + b^2
a22ab+b2a^2 - 2ab + b^2

The trinomial and the square are indeed equal.


The expressions in the table are perfect square trinomials. Complete the expressions to ensure equivalence between corresponding standard forms and factored forms.

standard form factored form
x22x+1x^2-2x+1 (x(x__ ___)2)^2
x2x^2-___x+x+___ (x7)2(x-7)^2
x210x+x^2-10x+___ (x(x__ ___)2)^2
x2+x^2+___x+100x+100 (x(x__ ___)2)^2
Show Solution

Here the same expressions are written both in standard form and in factored form, but one or more terms are missing in each expression. To identify the missing term(s) the rules for factoring a perfect square trinomial are useful.

a2+2ab+b2=(a+b)2a^2 + 2ab + b^2 = (a+b)^2
a22ab+b2=(ab)2a^2 - 2ab + b^2 = (a-b)^2

To help us identify the terms in the rule in the first example, we can for the expression x22x+1x^2-2x+1 rewrite 11 as 121^2 and 2x2x as 2x1.2\cdot x\cdot 1.

a22ab+b2=(ab)2a^2 - 2\phantom{\cdot}a\phantom{\cdot}b + b^2 = (a\phantom{\cdot}-\phantom{\cdot}b)^2
x22x1+12=(xx^2-2\cdot x\cdot 1+1^2=(x__ ___)2)^2

To make the expressions match each other we will fill in 1- 1 where the blanks are.

a22ab+b2=(ab)2a^2 - 2\phantom{\cdot}a\phantom{\cdot}b + b^2 = (a-b)^2
x22x1+12=(x1)2x^2-2\cdot x\cdot 1+1^2=(x-1)^2

We can use this reasoning to complete the other perfect square trinomials in the table. Next, we'll consider the second row.

a22ab+b2=(ab)2a^2 - 2ab + b^2 = (a-b)^2
x2x^2-___x+x+___ =(x7)2=(x-7)^2

To fill in the second blank we use that bb must be 7,7, which gives us that b2=72.b^2=7^2. When we study the first blank we can match aa with x.x. What is left is 2b=27.2\cdot b=2\cdot 7.

a22ab+b2=(ab)2a^2 - 2\phantom{\cdot}a\phantom{\cdot}b + b^2 = (a-b)^2
x22x7+72=(x7)2x^2-2\cdot x\cdot 7+7^2=(x-7)^2

This we prefer writing as x214x+49=(x7)2.x^2-14x+49=(x-7)^2. Let's continue with the third row

a22ab+b2=(a..b)2a^2 - 2ab + b^2 = (a\phantom{.}-\phantom{.}b)^2
x210x+x^2-10x+___=(x=(x__ ___)2)^2

Here the terms aa and xx match each other. Since the terms 2ab2ab and 10x10x must match each other we find that 2b=10,2b=10, or b=5.b=5. Let's use this to fill in the blanks in the expression.

a22ab+b2=(a..b)2a^2 - 2ab + b^2 = (a\phantom{.}-\phantom{.}b)^2

By squaring 55 we get that the second row reads x210x+25=(x5)2.x^2-10x+25=(x-5)^2. We are now going to deal with the last row in the table.

a2+2.a.b+b2=(a.+.b)2a^2 + 2\phantom{.}a\phantom{.}b + b^2 = (a\phantom{.}+\phantom{.}b)^2
x2+x^2+___x+100x+100=(x=(x__ ___)2)^2

The lines match each other when b=10,b=10, giving us the first blank 210=202\cdot10=20 and the second blank +10.+10. Let's write them together with the blanks filled in.

a2+2.a.b+b2=(a.+.b)2a^2 + 2\phantom{.}a\phantom{.}b + b^2 = (a\phantom{.}+\phantom{.}b)^2

We'll summarize our results by adding the found values to the table.

standard form factored form
x22x+1x^2-2x+1 (x1)2(x-1)^2
x214x+49x^2-14x+49 (x7)2(x-7)^2
x210x+25x^2-10x+25 (x5)2(x-5)^2
x2+20x+100x^2+20x+100 (x+10)2(x+10)^2

Completing the Square

Completing the square is a method by which a quadratic expression is rewritten as a difference of a perfect square trinomial and a constant. Commonly this is done by adding and subtracting a constant, p.p. x2+bx=x2+bx+pp=0 x^2 + bx = x^2 + bx + {\color{#0000FF}{\underbrace{p - p}_{=0}}} By choosing the constant, p,p, as (b2)2\left(\frac{b}{2} \right)^2 the quadratic expression becomes a difference of a perfect square trinomial and a constant. x2+bx+(b2)2perfect square trinomial(b2)2constant \underbrace{x^2 + bx + \left(\frac{b}{2} \right)^2}_{\text{perfect square trinomial}} - \underbrace{\left(\frac{b}{2} \right)^2}_{\text{constant}} The quadratic expression can then be factored and written and written in vertex form. x2+bx+(b2)2perfect square trinomial(b2)2=(x+b2)2(b2)2 \underbrace{x^2 + bx + \left(\frac{b}{2} \right)^2}_{\text{perfect square trinomial}} - \left(\frac{b}{2} \right)^2 = \left( x+\frac{b}{2} \right)^2-\left(\frac{b}{2} \right)^2


Completing the Square, In-Depth

Quadratic Expressions in the Form x2+bx+cx^2+bx+c

When completing the square for a quadratic expression in the form x2+bx+c,x^2+bx+c, the constant cc must also be taken into account. When adding and subtracting the term (b2)2,\left(\frac{b}{2} \right)^2, the quadratic expression gets a constant term of -(b2)2+c.\text{-} \left(\frac{b}{2} \right)^2+c. x2+bx+cx2+bx+(b2)2perfect square trinomial(b2)2+cconstant\begin{gathered} x^2+bx+c\\ \Downarrow\\ \underbrace{x^2+bx+\left(\dfrac{b}{2}\right)^2}_{\text{perfect square trinomial}}-\underbrace{\left(\dfrac{b}{2}\right)^2+c}_{\text{constant}} \end{gathered}



After completing its square, a quadratic expression can be rewritten into vertex form by factoring the perfect square trinomial. x2+bx+(b2)2perfect square trinomial(b2)2+c=(x+b2)2(b2)2+c \small \underbrace{x^2 + bx + \left(\tfrac{b}{2} \right)^2}_{\text{perfect square trinomial}} - \left(\tfrac{b}{2} \right)^2 +c = \left( x+\tfrac{b}{2} \right)^2-\left(\tfrac{b}{2} \right)^2 +c


Solving Quadratic Equations

Completing the square can be used when solving quadratic equations. An equation in the form x2+bx+c=0x^2+bx+c=0 is then rewritten by isolating the x2-x^2\text{-} and x-x\text{-}terms. x2+bx+c=0x2+bx=-c\begin{gathered} x^2+bx+c=0\\ \Downarrow\\ x^2+bx=\text{-} c \end{gathered} By adding the term (b2)2\left(\frac{b}{2} \right)^2 to both sides of the equation, a perfect square trinomial is formed. x2+bx=-cx2+bx+(b2)2=-c+(b2)2\begin{gathered} x^2+bx=\text{-} c\\ \Downarrow\\ x^2+bx+\left(\dfrac{b}{2}\right)^2=\text{-} c+\left(\dfrac{b}{2}\right)^2 \end{gathered} The equation can then be rewritten by factoring the perfect square trinomial. x2+bx+(b2)2=-c+(b2)2(x+b2)2=-c+(b2)2\begin{gathered} x^2+bx+\left(\dfrac{b}{2}\right)^2=\text{-} c+\left(\dfrac{b}{2}\right)^2\\ \Downarrow\\ \left(x+\dfrac{b}{2}\right)^2=\text{-} c+\left(\dfrac{b}{2}\right)^2 \end{gathered} When the equation is written on this form it can be solved with square roots.


Geometric Interpretation of Completing the Square

It can be helpful to visualize what's going on when completing the square. Press the button below to see an animation of this concept.
Complete the square


Completing the Square to Rewrite a Quadratic Expression

All quadratic expressions in standard form can be rewritten by completing the square. One example of how this can be used in practice is to rewrite the function f(x)=2x2+12x+2\begin{gathered} f(x) = 2x^2 + 12x + 2 \end{gathered} in vertex form to determine the vertex.


Factor the coefficient of x2x^2

It's easiest to complete the square when the expression is written in the form x2+bx.x^2 + bx. Therefore, any coefficient of x2x^2 that does not equal 11 should be factored out. Here, this means factoring 22 out of the expression. f(x)=2x2+12x+2f(x)=2(x2+6x+1)\begin{gathered} f(x) = 2x^2 + 12x + 2 \quad \Leftrightarrow \quad f(x) = 2(x^2 + 6x + 1) \end{gathered}


Identify the constant needed to complete the square

The constant cc that is necessary to complete the square can now be identified by focusing on the x2x^2- and xx- terms, while ignoring the rest. It is found either by comparing the binomial to the general perfect square trinomials, a2+2ab+b2anda22ab+b2\begin{gathered} a^2 + 2ab + b^2 \quad \text{and} \quad a^2 - 2ab + b^2 \end{gathered} or by squaring half the coefficient of the x-x\text{-}term. In this case, the coefficient of xx is 6.6. (62)2=32\begin{gathered} \left( \dfrac 6 2 \right)^2 = 3^2 \end{gathered} Therefore, the missing constant to complete the square is 32.3^2. Leaving the constant as a power will make the next steps a bit quicker.


Complete the square

The square can now be completed by adding and subtracting the constant found in Step 2.2. In the example, the constant 323^2 should be added and subtracted. For clarity the original constant may be written in the end of the new expression. f(x)=2(x2+6x+1)f(x)=2((x2+6x.+32).32+1)\begin{gathered} f(x) = 2 \Big( x^2 + 6x + 1 \Big) \quad \Leftrightarrow \quad f(x) = 2 \Big( \left(x^2 + 6x\phantom{} {\color{#0000FF}{\phantom{.}+ 3^2}}\right) {\color{#0000FF}{-\phantom{.}3^2}} + 1 \Big) \end{gathered} The resulting trinomial, x2+6x+32,x^2 + 6x + 3^2, is now a perfect square.


Factor the perfect square trinomial

The perfect square trinomial can now be factored as normal.

f(x)=2((x2+6x+32)32+1)f(x) = 2 \Big( \left( x^2 + 6x + 3^2 \right) - 3^2 + 1 \Big)
f(x)=2((x2+2x3+32)32+1)f(x) = 2 \Big( \left( x^2 + 2x \cdot 3 + 3^2 \right) - 3^2 + 1 \Big)
f(x)=2((x+3)232+1)f(x) = 2 \Big( (x + 3)^2 - 3^2 + 1 \Big)


Simplify the expression

Finally, the expression can be simplified. For the example, the goal is to write the function in vertex form to determine the vertex. To achieve this, the terms have to be simplified.

f(x)=2((x+3)232+1)f(x) = 2 \Big( (x + 3)^2 - 3^2 + 1 \Big)
f(x)=2((x+3)29+1)f(x) = 2 \Big( (x + 3)^2 - 9 + 1 \Big)
f(x)=2((x+3)28)f(x) = 2 \Big( (x + 3)^2 - 8 \Big)
f(x)=2(x+3)216f(x) = 2(x + 3)^2 - 16

The function is now written in vertex form. It can be seen that the vertex is (-3,-16).(\text{-} 3, \text{-} 16).

Instead of a purely algebraic approach, it can be helpful to visualize the process of completing the square geometrically.

Consider the quadratic function f(x)=x2x0.75. f(x)=x^2-x-0.75. Complete the square to determine the vertex and zeros of the parabola. Then, use them to draw the graph.

Show Solution
To begin, we'll complete the square on ff by focusing on the coefficient of x,x, which is -1.\text{-} 1. Since (-12)2=0.25,\left( \frac{\text{-} 1}{2} \right)^2=0.25, 0.250.25 is the constant term that will create a perfect square trinomial.
f(x)=(x2x+0.25)0.750.25f(x)= \left( x^2-x+{\color{#0000FF}{0.25}} \right)-0.75-{\color{#0000FF}{0.25}}
f(x)=(x0.5)20.750.25f(x)=(x-0.5)^2 -0.75 -0.25
Notice that ff is now written in vertex form. It can be seen that ff's vertex is (0.5,-1).(0.5,\text{-} 1). To find the zeros we can set f(x)f(x) equal to 00 and solve.
(x0.5)2=1(x-0.5)^2 = 1
x0.5=±1x-0.5 = \pm 1
x=0.5±1x = 0.5 \pm 1
x1=-0.5x2=1.5\begin{array}{l}x_1 = \text{-} 0.5 \\ x_2 = 1.5 \end{array}
Thus, the zeros of the parabola are x=-0.5x=\text{-} 0.5 and x=1.5.x=1.5. Lastly, we can use the vertex and the zeros to draw the graph of f.f.
{{ 'mldesktop-placeholder-grade-tab' | message }}
{{ 'mldesktop-placeholder-grade' | message }} {{ article.displayTitle }}!
{{ grade.displayTitle }}
{{ exercise.headTitle }}
{{ 'ml-tooltip-premium-exercise' | message }}
{{ 'ml-tooltip-programming-exercise' | message }} {{ 'course' | message }} {{ exercise.course }}
{{ 'ml-heading-exercise' | message }} {{ focusmode.exercise.exerciseName }}
{{ 'ml-btn-previous-exercise' | message }} arrow_back {{ 'ml-btn-next-exercise' | message }} arrow_forward