Completing the Square Calculator
Convert ax² + bx + c to vertex form a(x−h)² + k step by step. Find the vertex, axis of symmetry, and roots of any quadratic.
Enter the coefficients of ax² + bx + c. Leave b or c blank to use 0.
Presets
Enter to calculate · Esc to reset
What Is the Completing the Square Calculator?
This calculator converts any quadratic expression from standard form (ax² + bx + c) to vertex form (a(x − h)² + k), step by step. Vertex form immediately reveals the parabola's highest or lowest point, its axis of symmetry, and whether real roots exist, without solving anything by hand.
- ›Full step-by-step working, shows every algebraic move: factoring out a, finding (b/2a)², adding and subtracting, and simplifying the constant term k.
- ›Parabola visualisation, an interactive SVG graph auto-scales to show the vertex, axis of symmetry, real roots (if any), and y-intercept.
- ›All root types handled, two real roots, a double root, or complex conjugate roots are all correctly computed and displayed.
- ›Six presets, classic textbook examples load instantly so you can see the method applied before entering your own values.
- ›Copy results, one click copies the vertex form, vertex, axis, discriminant, and roots to your clipboard.
- ›Persistent inputs, your last coefficients are saved to localStorage and restored when you return to the page.
Formula
Standard Form → Vertex Form
ax² + bx + c → a(x − h)² + k
Vertex Coordinates
h = −b / (2a) k = c − b² / (4a)
Axis of Symmetry
x = h = −b / (2a)
Discriminant & Root Conditions
Δ = b² − 4ac
Δ > 0 → two distinct real roots | Δ = 0 → one double root | Δ < 0 → complex roots
Quadratic Formula (from vertex form)
x = (−b ± √(b² − 4ac)) / (2a) = h ± √(−k/a)
| Symbol | Name | Description |
|---|---|---|
| a | Leading coefficient | Determines parabola width and direction (a > 0 opens up, a < 0 opens down) |
| b | Linear coefficient | Coefficient of x; shifts the axis of symmetry left or right |
| c | Constant term | The y-intercept, value of the quadratic at x = 0 |
| h | Vertex x-coordinate | h = −b/(2a), the horizontal position of the vertex |
| k | Vertex y-coordinate | k = c − b²/(4a), the minimum (a > 0) or maximum (a < 0) value |
| Δ | Discriminant | Δ = b² − 4ac, determines the number and type of roots |
| x₁, x₂ | Roots | Solutions to ax² + bx + c = 0; real when Δ ≥ 0 |
Key Relationships
Vertex form: y = a(x − h)² + k
Constant k: k = c − ah² = c − b²/(4a)
Half-step: (b/2a)², the value added & subtracted to complete the square
Roots: x = h ± √(−k/a) when k/a ≤ 0
Sum of roots: x₁ + x₂ = −b/a = 2h
Product: x₁ · x₂ = c/a
How to Use
- 1Enter coefficient a: The leading coefficient of x². Must be non-zero. Use decimals or fractions (e.g. 0.5 or −2).
- 2Enter coefficient b: The coefficient of x. Can be any real number including zero (which centres the vertex at x = 0).
- 3Enter coefficient c: The constant term, the y-intercept of the parabola.
- 4Try a preset: Click any of the six preset buttons to load a textbook example and see the complete solution instantly.
- 5Press Enter or click Calculate: The vertex form, vertex coordinates, axis of symmetry, discriminant, and roots all appear together with the step-by-step working.
- 6Read the step-by-step panel: Expand the working (shown by default) to see each algebraic step. For a ≠ 1, the first step factors out a before completing the square inside the brackets.
- 7Check the parabola graph: The SVG graph auto-scales to your values. The orange dashed line marks the axis of symmetry, and coloured dots mark the vertex, roots, and y-intercept.
Example Calculation
Example 1 (a = 1): Complete the square for x² + 6x + 5
Given: a = 1, b = 6, c = 5
Step 1: Already in the form x² + bx + c (a = 1, skip factoring)
x² + 6x + 5
Step 2: Half the coefficient of x: b/2 = 6/2 = 3 → (b/2)² = 9
Step 3: Add and subtract (b/2)² inside
x² + 6x + 9 − 9 + 5
Step 4: Factor the perfect square trinomial
(x + 3)² − 9 + 5
Step 5: Simplify the constant
(x + 3)² − 4 → vertex form: (x − (−3))² + (−4)
Vertex: (−3, −4) | Axis: x = −3 | Roots: x = −1 and x = −5
Example 2 (a ≠ 1): Complete the square for 2x² + 8x + 6
Given: a = 2, b = 8, c = 6
Step 1: Factor out a from the first two terms
2(x² + 4x) + 6
Step 2: Complete the square inside: (4/2)² = 4
2(x² + 4x + 4 − 4) + 6
Step 3: Move the −4 outside (multiply by a = 2)
2(x + 2)² − 8 + 6
Step 4: Simplify
2(x + 2)² − 2 → vertex form: 2(x − (−2))² + (−2)
Vertex: (−2, −2) | Axis: x = −2 | Roots: x = −1 and x = −3
| Expression | h | k | Vertex | Roots |
|---|---|---|---|---|
| x² + 6x + 5 | −3 | −4 | (−3, −4) | x = −1, −5 |
| 2x² + 8x + 6 | −2 | −2 | (−2, −2) | x = −1, −3 |
| x² − 4x + 4 | 2 | 0 | (2, 0) | x = 2 (double) |
| x² + 2x + 5 | −1 | 4 | (−1, 4) | Complex (Δ < 0) |
Understanding Completing the Square
What Is Completing the Square?
Completing the square is an algebraic technique for rewriting a quadratic expression ax² + bx + c in the equivalent form a(x − h)² + k. Both forms represent the same parabola, but vertex form makes its key properties immediately visible without any further calculation. The name comes from the geometric idea of adding a literal square to make a perfect square trinomial.
Unlike the quadratic formula, which jumps straight to the roots, completing the square reveals the vertex, axis of symmetry, and minimum or maximum value as natural outputs of the algebra. It also shows exactly why the quadratic formula looks the way it does, the formula is simply the completed square solved for x.
The Step-by-Step Procedure
The procedure differs slightly depending on whether the leading coefficient a equals 1 or not. When a = 1 the steps are:
- ›Write x² + bx + c.
- ›Compute (b/2)², half the x-coefficient, squared.
- ›Add and subtract (b/2)² to keep the expression equal: x² + bx + (b/2)² − (b/2)² + c.
- ›Factor the first three terms as a perfect square: (x + b/2)².
- ›Combine the constants: k = c − (b/2)².
- ›Result: (x − h)² + k where h = −b/2.
When a ≠ 1, factor out a first:
- ›Factor: a(x² + (b/a)x) + c.
- ›Complete the square inside the brackets using (b/2a)².
- ›Expand back out, remembering to multiply the adjustment −(b/2a)² by a when distributing.
- ›Simplify: a(x − h)² + k where h = −b/(2a) and k = c − b²/(4a).
Why does factoring out a matter?
When you complete the square inside a(x² + (b/a)x), any value you add inside is multiplied by a. So if you add (b/2a)² inside the bracket, you have really added a × (b/2a)² = b²/(4a) to the whole expression, and you must subtract the same amount outside to keep balance. Missing this step is the most common source of errors when a ≠ 1.
Deriving the Quadratic Formula from Vertex Form
The quadratic formula is not a separate fact, it is completing the square solved for x. Starting from ax² + bx + c = 0:
a(x − h)² + k = 0
(x − h)² = −k/a
x − h = ±√(−k/a)
x = h ± √(−k/a)
Substituting h = −b/(2a) and −k/a = (b²−4ac)/(4a²):
x = (−b ± √(b²−4ac)) / (2a)
This derivation shows that the discriminant Δ = b² − 4ac is precisely the quantity under the square root in the vertex-form solution, which is why its sign tells you the root type even before computing the roots.
Vertex Form vs Standard Form, When to Use Each
| Property | Standard Form ax²+bx+c | Vertex Form a(x−h)²+k |
|---|---|---|
| y-intercept | Directly: y = c | Set x = 0: y = ah² + k |
| Vertex | Compute h = −b/(2a) | Directly: (h, k) |
| Axis of symmetry | Compute x = −b/(2a) | Directly: x = h |
| Roots | Apply quadratic formula | Solve (x−h)² = −k/a |
| Adding/combining | Straightforward | Must expand first |
| Graphing | Less immediate | Optimal, vertex visible at a glance |
The Discriminant and Root Types
The discriminant Δ = b² − 4ac is the number under the square root in the quadratic formula. It completely determines how many real solutions exist:
- ›Δ > 0, two distinct real roots. The parabola crosses the x-axis at two points, symmetric about the vertex. Example: x² − 5x + 4 has Δ = 9, roots x = 4 and x = 1.
- ›Δ = 0, one double root (tangent). The parabola touches the x-axis exactly at the vertex. The vertex lies on the x-axis, so k = 0. Example: x² − 4x + 4 = (x−2)², root x = 2.
- ›Δ < 0, complex conjugate roots. The parabola does not cross the x-axis. The vertex is above the x-axis for a > 0, below for a < 0. Roots are h ± i√(|k/a|).
Real-World Applications
| Field | What completing the square solves | Example |
|---|---|---|
| Physics | Maximum height of a projectile | h(t) = −4.9t² + 20t + 1.5 → vertex gives peak height |
| Economics | Profit maximisation | P(x) = −2x² + 40x − 50 → vertex is the optimal price |
| Engineering | Minimum material for a constraint | Area or cost functions in quadratic form |
| Geometry | Circle / ellipse standard form | x²+y²+4x−6y = 3 → (x+2)²+(y−3)² = 16 |
| Calculus | Completing the square to integrate | ∫ 1/(x²+4x+5) dx → ∫ 1/((x+2)²+1) dx = arctan |
| Computer graphics | Parabolic trajectory curves | Bezier curves and ballistic simulations |
| Architecture | Parabolic arch design | Fitting a parabola through key structural points |
| Statistics | Least squares regression | Minimising Σ(yᵢ−ŷᵢ)² is a quadratic optimisation |
Frequently Asked Questions
When should I complete the square instead of using the quadratic formula?
Both methods find roots, but they have different strengths:
- ›Complete the square when you need the vertex or axis of symmetry, the formula gives only roots.
- ›Complete the square when you want to understand the structure of the expression, not just its zeros.
- ›Use the quadratic formula when you only need roots quickly, especially for messy coefficients.
- ›Prefer vertex form for graphing parabolas and for optimisation problems (finding maxima/minima).
- ›In calculus, completing the square enables integration of rational functions that cannot be handled directly.
The two approaches are mathematically equivalent, the quadratic formula is derived by completing the square on the general form ax² + bx + c = 0.
What does vertex form tell me about the parabola?
Vertex form y = a(x − h)² + k encodes five key properties immediately:
- ›Vertex: the point (h, k) is the highest or lowest point of the parabola.
- ›Direction: a > 0 opens upward (vertex is a minimum); a < 0 opens downward (vertex is a maximum).
- ›Axis of symmetry: the vertical line x = h passes through the vertex and mirrors the parabola.
- ›Width: |a| > 1 makes the parabola narrower than y = x²; |a| < 1 makes it wider.
- ›Minimum/maximum value: the output value k is the extreme value of the function.
Standard form hides all of this. A glance at vertex form tells you everything you need to sketch the parabola without computing a single extra step.
How do I complete the square when a ≠ 1?
When a ≠ 1, always factor out a from the quadratic and linear terms first:
- ›Write: a(x² + (b/a)x) + c
- ›Inside the bracket, compute (b/2a)² and add/subtract it: a(x² + (b/a)x + (b/2a)² − (b/2a)²) + c
- ›Factor the perfect square inside: a((x + b/2a)² − (b/2a)²) + c
- ›Distribute the a back out: a(x + b/2a)² − b²/(4a) + c
- ›Combine constants to find k = c − b²/(4a), and note h = −b/(2a).
The critical step people miss: when you multiply the bracket by a, the subtracted square becomes a × (b/2a)² = b²/(4a), not just (b/2a)². Always distribute a carefully before combining with c.
What is the axis of symmetry and why does it matter?
The axis of symmetry is the vertical line x = h = −b/(2a) that passes through the vertex. Every parabola is symmetric about this line, the y-values on either side are mirror images.
- ›If you fold the parabola along its axis of symmetry, both halves overlap exactly.
- ›The two real roots (when they exist) are always equidistant from the axis: x₁ = h + d, x₂ = h − d.
- ›The axis passes through the midpoint of any two points on the parabola with equal y-values.
- ›In optimisation: the axis tells you the exact input x that minimises or maximises the output.
In practice: if a ball follows a parabolic path and lands at x = 0 and x = 10, the axis is at x = 5 and the peak height occurs exactly there.
What does it mean if the discriminant is negative?
A negative discriminant (Δ = b² − 4ac < 0) means the quadratic has no real roots:
- ›The parabola does not cross the x-axis, it floats entirely above (a > 0) or below (a < 0).
- ›The roots are complex conjugates: x = h ± i√(|k/a|) where i = √(−1).
- ›The expression ax² + bx + c is strictly positive for all real x when a > 0, and strictly negative when a < 0.
- ›This means the quadratic never equals zero for any real input, useful in inequality proofs.
Complex roots always come in conjugate pairs, if h + si is a root, so is h − si. In the vertex form, k and a have the same sign when roots are complex (both keep the parabola on one side of the axis).
Is completing the square the same as finding the vertex?
Yes, they produce the same result, but completing the square is a fuller algebraic process that shows the derivation, while "finding the vertex" is sometimes done by formula alone.
- ›Finding the vertex by formula: compute h = −b/(2a), then substitute back to find k = f(h).
- ›Completing the square: rewrites the entire expression algebraically, making h and k emerge naturally.
- ›Both give the same (h, k), but completing the square also gives you the vertex form y = a(x−h)² + k, which is more useful for graphing and solving.
- ›Completing the square also reveals the discriminant and root structure along the way.
Think of finding the vertex as the shortcut, and completing the square as the full derivation that proves where the shortcut comes from.
Can completing the square be used in higher dimensions?
Yes, completing the square generalises beyond single-variable quadratics:
- ›Circle/ellipse: x²+y²+Dx+Ey+F = 0 is converted to (x−h)²+(y−k)² = r² by completing the square in both x and y separately.
- ›Multivariable calculus: completing the square in a quadratic form Q(x,y) = ax²+bxy+cy² helps classify critical points (saddle vs. min vs. max).
- ›Linear algebra: the process is equivalent to diagonalising a symmetric matrix via an orthogonal change of variables.
- ›Integration: completing the square transforms integrals like ∫1/(ax²+bx+c)dx into arctan or logarithm forms.
- ›Differential equations: completing the square in the characteristic equation identifies oscillation frequency and damping.
Does the calculator save my inputs?
Yes, your coefficients are saved automatically to your browser's localStorage:
- ›Coefficients a, b, and c are saved after each calculation.
- ›The data stays entirely in your browser, nothing is sent to any server.
- ›Your last inputs are restored the next time you visit the page.
- ›Click Reset to clear both the form and the saved data.
All calculations happen locally in your browser. The calculator works offline once the page has loaded.