Google Play badge

Complete the square in a quadratic expression to reveal the maximum or minimum value of the function it defines.


Complete the square to reveal the maximum or minimum value

A basketball shot, a satellite dish, and the profit from selling a product can all be modeled by the same kind of algebraic expression: a quadratic expression. What makes quadratics especially powerful is that one hidden point controls the whole story. That point is the vertex, and it tells you the highest or lowest value the function can reach. Completing the square is the algebraic method that reveals that point directly.

When a quadratic is written in its usual form, such as \(f(x)=x^2+6x+1\), the maximum or minimum is not always obvious. But if we rewrite it in a special equivalent form, we can see the extreme value immediately. As [Figure 1] suggests, this is one of the most useful examples of "seeing structure in expressions": the expression changes form, but the function itself stays the same.

Why this form matters

A quadratic function graphs as a parabola. If the parabola opens upward, it has a lowest point, so the function has a minimum value. If it opens downward, it has a highest point, so the function has a maximum value. That highest or lowest point is called the vertex.

In many applications, the question is not "What are the roots?" but "What is the greatest height?" or "What is the least cost?" Completing the square answers those questions by rewriting the expression so the vertex becomes visible.

coordinate plane with one upward-opening parabola and one downward-opening parabola, each vertex marked, one labeled minimum and the other maximum
Figure 1: coordinate plane with one upward-opening parabola and one downward-opening parabola, each vertex marked, one labeled minimum and the other maximum

Before learning this method, it helps to recall two facts: first, squaring a number never gives a negative result, so \((x-h)^2\ge 0\) for every real number \(x\); second, equivalent expressions can look different but represent the same function.

These two facts are the foundation of the method. Once a quadratic is written as a squared expression plus or minus a constant, the extreme value becomes easy to read.

Reviewing quadratic expressions

A quadratic expression in one variable often appears in standard form:

\(ax^2+bx+c\)

Here, \(a\), \(b\), and \(c\) are constants, and \(a\ne 0\). When this expression defines a function \(f(x)=ax^2+bx+c\), the sign of \(a\) determines whether the graph opens upward or downward.

Condition on \(a\)Graph behaviorExtreme value
\(a>0\)Parabola opens upwardMinimum
\(a<0\)Parabola opens downwardMaximum

Table 1. How the sign of \(a\) determines whether a quadratic has a maximum or minimum value.

Standard form is useful for many purposes, but it does not usually reveal the vertex at a glance. To expose the vertex, we use a different equivalent form.

Vertex form is the form \(a(x-h)^2+k\). In this form, the vertex is \((h,k)\). If \(a>0\), the minimum value is \(k\). If \(a<0\), the maximum value is \(k\).

This form is powerful because the quantity \((x-h)^2\) is always at least \(0\). That means the expression \(a(x-h)^2+k\) is built from a squared part plus a vertical adjustment.

What completing the square does

The process of completing the square changes a quadratic from standard form into vertex form. Vertex form makes the horizontal and vertical shift of the parabola visible immediately. Instead of seeing just \(x^2+6x+1\), we can rewrite it as something involving a perfect square.

As [Figure 2] illustrates, the key idea is based on this pattern:

\[(x+p)^2=x^2+2px+p^2\]

If you have an expression like \(x^2+bx\), you can choose a number that turns it into a perfect square trinomial. Since \(2p=b\), we get \(p=\dfrac{b}{2}\). So:

\[x^2+bx=x^2+bx+\left(\frac{b}{2}\right)^2-\left(\frac{b}{2}\right)^2\]

The first three terms combine into a square:

\[x^2+bx=\left(x+\frac{b}{2}\right)^2-\left(\frac{b}{2}\right)^2\]

This is the heart of the method. We add a carefully chosen number to create a perfect square, and then subtract that same number so the value of the expression does not change.

side-by-side coordinate planes showing y=x^2 and a shifted parabola with vertex moved right and up, vertices highlighted
Figure 2: side-by-side coordinate planes showing y=x^2 and a shifted parabola with vertex moved right and up, vertices highlighted

Why the extreme value appears in vertex form

Because \((x-h)^2\ge 0\) for all real \(x\), the smallest possible value of \((x-h)^2\) is \(0\), which happens when \(x=h\). Therefore, in \(a(x-h)^2+k\), the extreme value occurs at \(x=h\). If \(a>0\), the squared part adds nonnegative amounts to \(k\), so \(k\) is the minimum. If \(a<0\), the squared part subtracts nonnegative amounts from \(k\), so \(k\) is the maximum.

Notice that the number inside the parentheses affects the horizontal location of the vertex, while the number outside affects the vertical location. This is why reading signs carefully matters.

How to complete the square

There are two common cases. The first is when the coefficient of \(x^2\) is \(1\). The second is when it is not \(1\).

Case 1: For \(x^2+bx+c\), take half of \(b\), square it, and use that number to build a perfect square.

Case 2: For \(ax^2+bx+c\) with \(a\ne 1\), first factor out \(a\) from the \(x^2\) and \(x\) terms. Then complete the square inside the parentheses.

Solved example 1

Rewrite \(f(x)=x^2+8x+5\) in vertex form and identify the minimum value.

Step 1: Focus on the \(x^2+8x\) part.

Half of \(8\) is \(4\), and \(4^2=16\).

Step 2: Add and subtract \(16\).

\(x^2+8x+5=x^2+8x+16-16+5\)

Step 3: Write the perfect square.

\(x^2+8x+16=(x+4)^2\), so \(f(x)=(x+4)^2-11\).

The vertex form is \(f(x)=(x+4)^2-11\). The vertex is \((-4,-11)\), and because the coefficient of the squared term is positive, the minimum value is \(-11\).

This example shows a common pattern: once the quadratic is in vertex form, the extreme value is the constant outside the square.

Reading the maximum or minimum from vertex form

Suppose a quadratic is written as

\[f(x)=a(x-h)^2+k\]

Then the vertex is \((h,k)\). The value \(k\) is the maximum or minimum value of the function, depending on the sign of \(a\).

Be careful with signs. In \((x+4)^2-11\), the vertex is \((-4,-11)\), not \((4,-11)\). The sign inside the parentheses is opposite the \(x\)-coordinate of the vertex.

Solved example 2

Rewrite \(g(x)=-x^2+6x-5\) in vertex form and identify the maximum value.

Step 1: Factor out \(-1\) from the \(x^2\) and \(x\) terms.

\(g(x)=-(x^2-6x)-5\)

Step 2: Complete the square inside the parentheses.

Half of \(-6\) is \(-3\), and \((-3)^2=9\).

\(g(x)=-(x^2-6x+9-9)-5\)

Step 3: Rewrite and simplify.

\(g(x)=-(x-3)^2+9-5\)

\(g(x)=-(x-3)^2+4\)

The vertex is \((3,4)\). Because the coefficient of the squared term is negative, the function has a maximum value of \(4\).

The graph confirms this structure: the parabola opens downward, rises to its highest point, and then falls again, as shown in [Figure 3]. That highest point is exactly the vertex found by completing the square.

coordinate plane with a downward-opening parabola for y=-x^2+6x-5, vertex labeled at (3,4), x-intercepts visible
Figure 3: coordinate plane with a downward-opening parabola for y=-x^2+6x-5, vertex labeled at (3,4), x-intercepts visible

Notice how much easier it is to see the maximum in vertex form than in standard form. The expression \(-x^2+6x-5\) hides the answer, but \(-(x-3)^2+4\) displays it.

Solved example 3

Rewrite \(h(x)=2x^2+12x+7\) in vertex form and identify the minimum value.

Step 1: Factor out the coefficient of \(x^2\) from the first two terms.

\(h(x)=2(x^2+6x)+7\)

Step 2: Complete the square inside the parentheses.

Half of \(6\) is \(3\), and \(3^2=9\).

\(h(x)=2(x^2+6x+9-9)+7\)

Step 3: Rewrite and simplify.

\(h(x)=2(x+3)^2-18+7\)

\(h(x)=2(x+3)^2-11\)

The vertex is \((-3,-11)\). Since \(2>0\), the function has a minimum value of \(-11\).

When the leading coefficient is not \(1\), factoring it out first is essential. If you do not, the square you create will not match the original expression correctly.

Solved example 4

Find the minimum value of the expression \(x^2-10x+14\) without graphing.

Step 1: Complete the square.

Half of \(-10\) is \(-5\), and \((-5)^2=25\).

\(x^2-10x+14=x^2-10x+25-25+14\)

Step 2: Rewrite.

\(x^2-10x+14=(x-5)^2-11\)

Step 3: Use the square to identify the least possible value.

Since \((x-5)^2\ge 0\), the smallest value of the expression occurs when \((x-5)^2=0\).

Therefore, the minimum value is \(-11\), and it occurs when \(x=5\).

This example is important because it shows that completing the square is not only for graphing. It can answer optimization questions directly from the expression itself.

Common mistakes and checks

Students often make the same few errors when completing the square. Knowing them in advance can save a lot of frustration.

A useful check is to expand your final answer. For example, if you found \(2(x+3)^2-11\), expand it: \(2(x^2+6x+9)-11=2x^2+12x+18-11=2x^2+12x+7\). If you get the original expression back, your rewriting is correct.

Real-world applications

Quadratic functions often model situations with a highest or lowest value. In physics, the path of a thrown object is approximately shaped like a parabola, so the vertex gives the maximum height. The highest point of the path is the same idea as the maximum value of a quadratic function.

As [Figure 4] suggests, suppose the height of a ball is modeled by \(h(t)=-5t^2+20t+1\), where \(t\) is time in seconds. Completing the square reveals the maximum height.

ball traveling in a parabolic arc over a field, highest point marked, simple axes or ground line included
Figure 4: ball traveling in a parabolic arc over a field, highest point marked, simple axes or ground line included

Application example

Find the maximum height of \(h(t)=-5t^2+20t+1\).

Step 1: Factor out \(-5\) from the quadratic and linear terms.

\(h(t)=-5(t^2-4t)+1\)

Step 2: Complete the square inside.

Half of \(-4\) is \(-2\), and \((-2)^2=4\).

\(h(t)=-5(t^2-4t+4-4)+1\)

Step 3: Rewrite and simplify.

\(h(t)=-5(t-2)^2+20+1\)

\(h(t)=-5(t-2)^2+21\)

The maximum height is \(21\), and it occurs at \(t=2\) seconds.

Economics also uses quadratics. A profit model may rise, reach a peak, and then fall as production increases too far. Engineering design uses quadratic models when minimizing material, energy, or distance. The same algebraic technique reveals the critical value in every case.

The graph ideas from earlier sections still apply here. The maximum height of the ball matches the vertex, just as the highest point of the parabola did in [Figure 1] and [Figure 3].

Satellite dishes, suspension bridge cables, and reflective headlights all use parabolic shapes. Their geometry helps focus signals, support weight efficiently, or direct light precisely.

That is why rewriting a quadratic expression is more than a symbolic trick. It reveals a feature of the quantity being modeled.

Comparing forms of a quadratic

A quadratic can be written in several equivalent forms, and each one highlights a different property.

FormGeneral appearanceBest for seeing
Standard form\(ax^2+bx+c\)General coefficients, y-intercept
Factored form\(a(x-r_1)(x-r_2)\)Zeros or x-intercepts
Vertex form\(a(x-h)^2+k\)Vertex and maximum/minimum value

Table 2. Three common equivalent forms of a quadratic and the property each form reveals most clearly.

This comparison is a major algebra idea: choose the form that reveals the property you need. If you want roots, factored form may help most. If you want the extreme value, vertex form is usually best.

"Good algebra is not just about getting an answer. It is about choosing a form that makes the answer visible."

Completing the square is one of the clearest examples of this principle. The expression is transformed, not changed in meaning, and that transformation reveals the maximum or minimum directly.

Download Primer to continue