Completing the Square Calculator
Rewrite a quadratic in vertex form and read off its vertex and axis of symmetry.
What it does
Completing the square rewrites a quadratic so that x appears only once. Starting from a x squared plus b x plus c, the result is a times (x minus h) squared plus k. That form makes the turning point of the parabola visible without graphing.
The tool takes the three coefficients and returns the vertex form, the coordinates h and k, the vertex itself, and the axis of symmetry. The default quadratic is 2 x squared minus 12 x plus 16.
The algebra works by adding and subtracting the square of half the x coefficient. For a leading coefficient other than one, you first factor a out of the two x terms, complete the square inside the bracket, then simplify the leftover constant.
The vertex coordinates follow directly. The x coordinate h is minus b over two a, and the y coordinate k is c minus b squared over four a. These are the same values you get from the vertex formula, so the two methods agree.
This form is also the first step in deriving the quadratic formula and in evaluating integrals that contain a quadratic under a root. Keeping it as an exact expression avoids the rounding that comes from reading a graph.
How to use
- Enter the coefficient a of the squared term.
- Enter the coefficient b of the linear term.
- Enter the constant term c.
- Read the vertex form as the main result.
- Check h and k to see the vertex coordinates separately.
- Use the axis line to locate the mirror line of the parabola.
Formula
- a, b, c
- The coefficients of the quadratic, with a not equal to zero.
- h
- The x coordinate of the vertex, equal to minus b over two a.
- k
- The y coordinate of the vertex, equal to c minus b squared over four a.
Expanding a times (x minus h) squared plus k gives a x squared minus 2 a h x plus a h squared plus k. Matching that with the original coefficients produces h equals minus b over two a and k equals c minus b squared over four a. If a is positive the vertex is a minimum, and if a is negative it is a maximum.
Worked example
Example: 2 x squared minus 12 x plus 16
The page opens with a = 2, b = -12, and c = 16.
- Factor 2 out of the two x terms to get 2 times (x squared minus 6x) plus 16.
- Half of minus 6 is minus 3, and its square is 9.
- Add and subtract 9 inside the bracket, then rewrite as 2 times ((x minus 3) squared minus 9) plus 16.
- Distribute the 2 to get 2 times (x minus 3) squared minus 18 plus 16.
- Combine the constants to get 2 times (x minus 3) squared minus 2.
- The vertex is at 3, minus 2 and the axis of symmetry is x = 3.
- The tool reports vertex form 2(x - 3)^2 - 2 with h = 3 and k = -2.
Reference table
| Coefficients a, b, c | Vertex form | Vertex | Axis |
|---|---|---|---|
| 2, -12, 16 | 2(x - 3)^2 - 2 | (3, -2) | x = 3 |
| 1, 6, 7 | 1(x + 3)^2 - 2 | (-3, -2) | x = -3 |
| 1, -4, 1 | 1(x - 2)^2 - 3 | (2, -3) | x = 2 |
| 1, -6, 5 | 1(x - 3)^2 - 4 | (3, -4) | x = 3 |
Limits
- The leading coefficient a cannot be zero.
- Coefficients are limited to the range minus 1,000,000 to 1,000,000.
- Results are shown with up to four decimal places, while the algebra keeps full precision.
- The tool rewrites one quadratic at a time.
Common mistakes
- Forgetting to factor a out before completing the square when a is not one.
- Adding the square term without subtracting it, which changes the expression.
- Reading the vertex x coordinate as positive h when the form shows x plus h.
- Dropping the sign of k when the constant is negative.
- Assuming every quadratic has two real roots to find by this method.
Try it yourself
Quick checks. Answers sit tucked under each question.
Write x squared plus 6x plus 7 in vertex form.
1(x + 3)^2 - 2, with vertex (-3, -2).
What is the vertex of x squared minus 4x plus 1?
(2, -3), because h is 2 and k is minus 3.
Axis of symmetry for 2 x squared minus 12 x plus 16?
x = 3, the same as the x coordinate of the vertex.
Questions
Why complete the square?
It reveals the vertex and axis directly and turns the quadratic into a form that is easier to solve or integrate.
What if the leading coefficient is not one?
Factor it out of the x terms first, complete the square inside, then multiply back and simplify the constant.
How do I find the vertex another way?
Use h equals minus b over two a, then substitute that x value into the quadratic to get k.
Is the vertex a maximum or a minimum?
It is a minimum when a is positive and a maximum when a is negative.
Can h be negative?
Yes. When b and a have the same sign, minus b over two a is negative and the form shows x plus a positive number.
Does this help solve quadratic equations?
Yes. Setting the vertex form equal to zero gives x minus h equals plus or minus the square root of minus k over a.
Sources
- University of Nebraska Math Books, section 6.2: the vertex of a parabola
- California State University Dominguez Hills, section A.2: completing the square