Completing the Square Calculator (Step by Step)

  • Free
  • No sign-up
  • Works on phones
  • Shows the working
Algebra & Trig#63

Completing the Square

Rewrites \(ax^2 + bx + c\) as \(a(x - h)^2 + k\) step by step, with the vertex and the solutions.

This completing the square calculator rewrites any quadratic ( ax^2 + bx + c ) in vertex form ( a(x – h)^2 + k ), showing each step: factoring out a, halving and squaring the middle coefficient, adding and subtracting it, and simplifying. It then gives the vertex of the parabola and solves ( ax^2 + bx + c = 0 ), including complex solutions.

It’s free and needs no sign-up.

Completing the Square Calculator (Step by Step): Completing the square rewrites x² + 6x + 5 as (x + 3)² − 4, which shows…
Completing the square rewrites x² + 6x + 5 as (x + 3)² − 4, which shows the vertex (−3, −4) and the roots −5 and −1 directly.

How to use it

  1. Enter the coefficients a, b and c of ( ax^2 + bx + c ). Fractions and decimals are fine.
  2. Press Complete.

The method

  1. If ( a neq 1 ), factor a out of the ( x^2 ) and x terms.
  2. Take half of the coefficient of x (inside the brackets) and square it.
  3. Add and subtract that number inside the brackets.
  4. The first three terms now form a perfect square ( (x + tfrac{b}{2a})^2 ). Simplify the constants.

The result is

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

so the vertex is ( (h, k) = left(-frac{b}{2a}, c – frac{b^2}{4a}right) ).

Worked example: x² + 6x + 5

As loaded above. Here ( a = 1 ), so skip step 1.

A calculator, laptop, and pen on a white surface.
  • Half of 6 is 3, and ( 3^2 = 9 ).
  • Add and subtract 9: ( x^2 + 6x + 9 – 9 + 5 ).
  • Group the perfect square: ( (x + 3)^2 – 4 ).

The vertex is ( (-3, -4) ). To solve ( x^2 + 6x + 5 = 0 ): ( (x + 3)^2 = 4 ), so ( x + 3 = pm 2 ), giving ( x = -1 ) or ( x = -5 ).

Worked example: 2x² − 8x + 3

  • Factor out 2: ( 2(x^2 – 4x) + 3 ).
  • Half of −4 is −2, and ( (-2)^2 = 4 ).
  • Add and subtract 4 inside: ( 2(x^2 – 4x + 4 – 4) + 3 ).
  • Move the −4 out (it is multiplied by 2): ( 2(x – 2)^2 – 8 + 3 = 2(x – 2)^2 – 5 ).

The vertex is ( (2, -5) ). As a result, solving ( 2(x – 2)^2 = 5 ) gives ( x = 2 pm sqrt{tfrac{5}{2}} = 2 pm frac{sqrt{10}}{2} ).

Worked example: complex roots

For ( x^2 + 2x + 5 ): half of 2 is 1, so ( x^2 + 2x + 5 = (x + 1)^2 + 4 ). Setting it to zero gives ( (x + 1)^2 = -4 ), so ( x = -1 pm 2i ). The parabola’s vertex ( (-1, 4) ) sits above the x-axis, which is why there are no real roots.

why completing the square calculator is useful

  • Vertex form shows the turning point of a parabola immediately, which is what you need to sketch it (see graphs of functions).
  • It proves the quadratic formula. Completing the square on ( ax^2 + bx + c = 0 ) in general gives ( x = frac{-b pm sqrt{b^2 – 4ac}}{2a} ); see the quadratic formula.
  • Circles and conics. Rewriting ( x^2 + y^2 – 4x + 6y = 3 ) as ( (x – 2)^2 + (y + 3)^2 = 16 ) reveals a circle with centre ( (2, -3) ) and radius 4.
  • Integration. Integrals like ( int frac{dx}{x^2 + 2x + 5} ) become ( int frac{dx}{(x + 1)^2 + 4} ), an arctangent (see integration formulas).

Common mistakes

  • Forgetting to multiply by a when moving the subtracted number out of the brackets (the −8 in the second example).
  • Squaring b instead of b/2. You add ( left(frac{b}{2}right)^2 ), not ( b^2 ).
  • Sign of h. ( (x + 3)^2 ) has its vertex at ( x = -3 ).

Deriving the quadratic formula

Completing the square on the general equation ( ax^2 + bx + c = 0 ) gives the quadratic formula:

$$x^2 + frac{b}{a}x = -frac{c}{a}$$

$$x^2 + frac{b}{a}x + frac{b^2}{4a^2} = frac{b^2}{4a^2} - frac{c}{a} = frac{b^2 - 4ac}{4a^2}$$

$$left(x + frac{b}{2a}right)^2 = frac{b^2 - 4ac}{4a^2} quadRightarrowquad x = frac{-b pm sqrt{b^2 - 4ac}}{2a}$$

So every time you use the quadratic formula, you are using a completed square.

Why it is called “completing the square”

Picture ( x^2 + 6x ) as an x-by-x square plus two 3-by-x strips placed along two sides. The shape is almost a big ( (x + 3) ) square, with a 3-by-3 corner missing. Adding that corner, ( 3^2 = 9 ), literally completes the square: ( x^2 + 6x + 9 = (x + 3)^2 ).

Worked example: maximum profit

A company’s profit is ( P(x) = -2x^2 + 40x – 150 ) (thousands of dollars) when it sells x thousand items. Complete the square:

$$P(x) = -2(x^2 - 20x) - 150 = -2(x^2 - 20x + 100 - 100) - 150 = -2(x - 10)^2 + 50$$

Since ( -2(x – 10)^2 le 0 ), the maximum profit is $50,000 at x = 10 thousand items. Completing the square finds a maximum or minimum without calculus.

Worked example: a circle

( x^2 + y^2 + 8x – 2y = 8 ). Complete the square in x and in y:

$$(x^2 + 8x + 16) + (y^2 - 2y + 1) = 8 + 16 + 1 quadRightarrowquad (x + 4)^2 + (y - 1)^2 = 25$$

A circle with centre ( (-4, 1) ) and radius 5.

Practice problems

  1. ( x^2 – 10x + 21 ).
  2. ( x^2 + 3x ).
  3. ( 3x^2 + 12x + 7 ).

Answers: 1. ( (x – 5)^2 – 4 ); roots 3 and 7. 2. ( left(x + frac32right)^2 – frac94 ). 3. ( 3(x + 2)^2 – 5 ); vertex ( (-2, -5) ).

Completing the square vs other methods

MethodBest when
Factoringthe quadratic factors with whole numbers
Quadratic formulayou only need the roots
Completing the squareyou need the vertex, a circle’s centre, or an integral

Completing the square in integration

To integrate ( int frac{dx}{x^2 + 4x + 13} ), complete the square in the denominator: ( x^2 + 4x + 13 = (x + 2)^2 + 9 ). Then substitute ( u = x + 2 ):

$$int frac{du}{u^2 + 9} = frac13arctanfrac{u}{3} + C = frac13arctanfrac{x + 2}{3} + C$$

The same trick turns many square roots of quadratics into standard forms for trig substitution.

Using the Calculator: A Detailed Guide

First, identify the coefficients a, b, and c from your quadratic equation, ax^2 + bx + c. These numbers are crucial. Ensure you include their correct signs. For instance, in x^2 – 4x + 3, a=1, b=-4, and c=3.

Next, input these values into the designated fields of the completing the square calculator. Most calculators will have separate input boxes for a, b, and c. Fractions or decimals are usually handled correctly.

Then, click the "Calculate" or "Complete" button. The calculator will process your input. It will display the step-by-step transformation of your quadratic into vertex form. This process includes factoring, halving, squaring, and simplifying.

Interpreting and Verifying the Output

The calculator provides the quadratic in vertex form, a(x – h)^2 + k. The vertex of the parabola is (h, k). Remember the sign convention: if the form is (x + 3)^2, then h is -3. This point is either the maximum or minimum value.

You can check the result by expanding the vertex form. For example, if the output is 2(x – 1)^2 + 3, expand it: 2(x^2 – 2x + 1) + 3. This simplifies to 2x^2 – 4x + 2 + 3, or 2x^2 – 4x + 5. This should match your original equation.

Also, the calculator often provides the roots of the equation. You can substitute these roots back into the original quadratic. The result should be zero. This confirms the accuracy of the solutions. This verification step helps build confidence in the completing the square calculator's results.

Practical Tips for Success

Always double-check your initial coefficient inputs. Because a simple sign error for b or c can lead to a completely different result. Use the calculator to verify your manual calculations. This strengthens your understanding of each step.

Pay close attention to fractions. When b is an odd number, b/2 will be a fraction. Squaring this fraction requires squaring both the numerator and the denominator. For example, (3/2)^2 becomes 9/4.

Remember that the value subtracted outside the parenthesis must be multiplied by 'a' if 'a' is not 1. This is a frequent source of error. The calculator clearly shows this multiplication step, so observe it carefully.

Related guides

Further reading

FAQ

What does completing the square mean?

Rewriting ( x^2 + bx ) as ( left(x + frac{b}{2}right)^2 – left(frac{b}{2}right)^2 ), so a quadratic becomes a perfect square plus a constant.

What number completes the square?

Half the coefficient of x, squared: for ( x^2 + 10x ) it is ( 5^2 = 25 ).

What is vertex form?

( y = a(x – h)^2 + k ), where ( (h, k) ) is the vertex of the parabola.

Is completing the square better than the quadratic formula?

They give the same roots. Completing the square also gives the vertex form, and it is how the quadratic formula is derived.

How do I complete the square when a is negative?

Factor out the negative a first, exactly as with any other a, then complete the square inside the brackets. The parabola opens downward and the vertex is a maximum.

What if b is odd?

Use fractions: half of 3 is ( frac32 ), and ( left(frac32right)^2 = frac94 ).

Embed this calculator on your website

Teachers, tutors and bloggers are welcome to use this calculator for free. Copy the code below and paste it into any page (in WordPress, use a "Custom HTML" block). The small script makes the calculator grow to fit its answer; if your site removes scripts, it still works at a fixed height. Please keep the credit link.

More calculators

See all calculators