Enter the coefficients a, b and c of the quadratic function y = ax² + bx + c. The equation below is linked to the input fields, so you can also edit the coefficients in the equation directly.
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formulas and graphs
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Enter the coefficients, and the quadratic function \(y = ax^{2} + bx + c\) is rewritten in the form \(y = a(x - p)^{2} + q\) (vertex form) by completing the square
- The steps follow the textbook method line by line: factor out the leading coefficient, add and subtract the square of half the \(x\) coefficient, then write the perfect square
- You also get the vertex \((p,\ q)\), the axis of symmetry \(x = p\), which way the graph opens (upward or downward) and the maximum or minimum value, along with a graph of the parabola
- Answers are shown both as reduced fractions (exact values) such as \(-\dfrac{5}{4}\) and as decimals. Coefficients can be decimals, negative numbers or fractions such as 3/4
- The calculator shows the equation the way you would write it by hand, and you can edit the coefficients right in the equation
- A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are also on this page
What is this calculation used for?
The height of a ball thrown upward, or of the water in a fountain, is often modeled as a quadratic function of time. For example, if the height is \(h = -16t^{2} + 64t\) (in feet, with \(t\) in seconds, ignoring air resistance), completing the square gives \(h = -16(t - 2)^{2} + 64\). You can read off that the ball reaches its highest point, 64 feet, after 2 seconds.
Pulling the vertex, "the highest point and when it happens", straight out of the equation is the strength of completing the square, and projectile problems in physics are a classic use of it.
When "raising the price increases the profit per item but reduces how many you sell", profit can sometimes be modeled as a quadratic function of price that opens downward. The price that gives the most profit is exactly the vertex of the parabola. For example, if the profit is \(y = -x^{2} + 60x - 500\) dollars (with \(x\) the price in dollars), the vertex \(x = 30\) is the price that maximizes profit: $30.
Real markets are more complicated, but "look for the best value at the vertex" is a starting point for thinking about pricing and how to split an ad budget.
For a rectangle with a fixed perimeter, the area is a quadratic function of the side length. For example, with 40 feet of fence, if the width is \(x\) feet, the length is \(20 - x\) feet, and the area is \(y = x(20 - x) = -x^{2} + 20x\). Completing the square gives \(y = -(x - 10)^{2} + 100\), so the largest area is 100 square feet when \(x = 10\) (a square).
This is the most basic form of an optimization problem: getting the most out of limited materials or a limited budget.
Satellite dishes and the reflectors in car headlights and flashlights have the shape of a parabola spun around its axis (a paraboloid). They use a property of the parabola: radio waves or light coming in parallel to the axis all bounce to one point on the axis (the focus), and light sent out from the focus travels straight out parallel to the axis.
In design, a parabola is described by where its vertex is and how wide it opens in which direction, so the idea of vertex form \(y = a(x - p)^{2} + q\), built around the vertex, is the foundation.
Formulas and graphs
Symbols and terms
Symbols
| \(a,\ b,\ c\) | a, b, c | The coefficients of the quadratic function \(y = ax^{2} + bx + c\). \(a\) is the \(x^{2}\) coefficient (not 0), \(b\) is the \(x\) coefficient, and \(c\) is the constant. Letters from the start of the alphabet, \(a,\ b,\ c\), are usually used for fixed numbers. |
| \(x,\ y\) | x, y | Variables. \(x\) is the input and \(y\) is the output. Letters from the end of the alphabet, \(x,\ y,\ z\), are usually used for numbers that can take many values. |
| \(p\) | pee | The \(x\)-coordinate of the vertex, which is also where the axis of symmetry (the line \(x = p\)) is. Many US textbooks use \(h\) for this. |
| \(q\) | cue | The \(y\)-coordinate of the vertex. It is the minimum value if \(a > 0\) and the maximum value if \(a < 0\). It is the letter after \(p\), so the two are used as a pair. Many US textbooks use \(k\) for this. |
| \((x - p)^{2}\) | x minus p, squared | The squared part made by completing the square. As a square it is always 0 or more, and it is 0 only when \(x = p\). This is exactly why the maximum or minimum is at the vertex. |
| \(x^{2}\) | x squared | \(x\) multiplied by itself (\(x^{2} = x \times x\)). The small raised number (the exponent) tells how many times it is multiplied. |
Terms
| quadratic function | A function of the form \(y = ax^{2} + bx + c\) (\(a \neq 0\)). Its graph is a parabola. It is taught in Algebra 1 and Algebra 2. |
| parabola | The symmetric U-shaped curve that is the graph of a quadratic function. It is the same shape as the path of a thrown ball. |
| vertex | The turning point of a parabola: the lowest point if it opens upward, the highest point if it opens downward. Its coordinates are \((p,\ q)\). |
| axis of symmetry | The vertical line \(x = p\) that a parabola is symmetric about. The parabola is a mirror image of itself across this line, and the vertex lies on it. |
| completing the square | Rewriting \(y = ax^{2} + bx + c\) in the form \(y = a(x - p)^{2} + q\). The name comes from "making a perfect square". It is the basic tool for finding the vertex, the axis and the maximum or minimum, and the quadratic formula itself is derived with it. |
| perfect square | An expression that is something squared, such as \((x - 2)^{2} = x^{2} - 4x + 4\). A square is a number times itself: the square of \(3\) is \(3^{2} = 9\). |
| standard form | The form \(y = ax^{2} + bx + c\). It is the usual expanded form, and you can easily read where it crosses the \(y\)-axis (\(y = c\) when \(x = 0\)). |
| vertex form | The form \(y = a(x - p)^{2} + q\) (often written \(y = a(x - h)^{2} + k\)). You can see the vertex \((p,\ q)\) at a glance. Completing the square converts standard form into vertex form. |
| opens upward | The graph opens like a valley. This happens when \(a > 0\), and the vertex is the lowest point. |
| opens downward | The graph opens like a hill. This happens when \(a < 0\), and the vertex is the highest point. |
| maximum value | The largest value the function \(y\) can take. For a quadratic that opens downward, the \(y\)-coordinate of the vertex \(q\) is the maximum value. |
| minimum value | The smallest value the function \(y\) can take. For a quadratic that opens upward, the \(y\)-coordinate of the vertex \(q\) is the minimum value. |
| coefficient | The number in front of a letter. In \(2x^{2}\), 2 is the coefficient. A term with no number written, such as \(x^{2}\), has coefficient 1. |
| constant term | A number-only term without \(x\), such as the 3 in \(2x^{2} - 8x + 3\). It is called constant because it does not change whatever the value of \(x\). |
| symmetric | Matching exactly when folded over. If you fold a parabola along its axis, the left and right sides match exactly (line symmetry). |
| domain | The set of values \(x\) is allowed to take. When the domain is limited (for example, \(0 \le x \le 3\)), the maximum or minimum may be at an end of the domain instead of at the vertex. |
| translation | Sliding a figure without changing its shape (also called a shift). The graph of \(y = a(x - p)^{2} + q\) is the graph of \(y = ax^{2}\) shifted \(p\) in the \(x\) direction and \(q\) in the \(y\) direction. |
Good to know before you start
Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
If you get stuck, going back to review these topics is the fastest way forward.
| Functions and graphs (Grade 8 and Algebra 1) |
|
| Expanding and factoring (Algebra 1) |
|
| Signed numbers and algebraic expressions (Grades 6–7) |
|
| Working with fractions (Grades 5–6) |
|
| Graphs of quadratic functions (Algebra 1 and Algebra 2) |
|
How to calculate it in Excel
| x² coefficient a | 2 |
| x coefficient b | -8 |
| Constant c | 3 |
| Vertex x-coordinate p | =-B2/(2*B1) |
| Vertex y-coordinate q | =B3-B2^2/(4*B1) |
| x² coefficient a | 1 |
| x coefficient b | -6 |
| Vertex x-coordinate p = −b/(2a) | =-B2/(2*B1) |
| x² coefficient a | 1 |
| x coefficient b | -6 |
| Constant c | 5 |
| Vertex y-coordinate q = c − b²/(4a) | =B3-B2^2/(4*B1) |
| x² coefficient a | 2 |
| x coefficient b | -8 |
| Constant c | 3 |
| x value to check | 1 |
| Vertex x-coordinate p | =-B2/(2*B1) |
| Vertex y-coordinate q | =B3-B2^2/(4*B1) |
| Value of ax²+bx+c | =B1*B4^2+B2*B4+B3 |
| Value of a(x−p)²+q | =B1*(B4-B5)^2+B6 |
"^" is a power, "*" is multiplication and "/" is division.
The first table is the example y = 2x² − 8x + 3. p is 2 and q is −5 (so y = 2(x − 2)² − 5).
The second and third tables are the example y = x² − 6x + 5. p is 3 and q is −4.
The fourth table is a check. For the same x (1 in the example), "value of ax²+bx+c" and "value of a(x−p)²+q" are both −3, so the two forms match.
How to calculate it in Google Sheets
| x² coefficient a | 2 |
| x coefficient b | -8 |
| Constant c | 3 |
| Vertex x-coordinate p | =-B2/(2*B1) |
| Vertex y-coordinate q | =B3-B2^2/(4*B1) |
| x² coefficient a | 1 |
| x coefficient b | -6 |
| Vertex x-coordinate p = −b/(2a) | =-B2/(2*B1) |
| x² coefficient a | 1 |
| x coefficient b | -6 |
| Constant c | 5 |
| Vertex y-coordinate q = c − b²/(4a) | =B3-B2^2/(4*B1) |
| x² coefficient a | 2 |
| x coefficient b | -8 |
| Constant c | 3 |
| x value to check | 1 |
| Vertex x-coordinate p | =-B2/(2*B1) |
| Vertex y-coordinate q | =B3-B2^2/(4*B1) |
| Value of ax²+bx+c | =B1*B4^2+B2*B4+B3 |
| Value of a(x−p)²+q | =B1*(B4-B5)^2+B6 |
How to calculate it in Python
from fractions import Fraction
# Coefficients of the quadratic function y = ax² + bx + c (a fraction such as 3/4 can be written as Fraction(3, 4))
coef_a = Fraction(2) # x² coefficient (not 0)
coef_b = Fraction(-8) # x coefficient
coef_c = Fraction(3) # constant
vertex_x = -coef_b / (2 * coef_a) # vertex x-coordinate p = −b/(2a)
vertex_y = coef_c - coef_b ** 2 / (4 * coef_a) # vertex y-coordinate q = c − b²/(4a)
print(f"Vertex x-coordinate p: {vertex_x}")
print(f"Vertex y-coordinate q: {vertex_y}")
print(f"Vertex form: y = {coef_a} * (x - ({vertex_x}))**2 + ({vertex_y})")
if coef_a > 0:
print(f"Opens upward, so the minimum is {vertex_y} at x = {vertex_x}")
else:
print(f"Opens downward, so the maximum is {vertex_y} at x = {vertex_x}")
How to write it in LaTeX and other math languages (copy and paste)
y = a(x − p)² + q
y = a(x - p)^{2} + q
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>y</mi>
<mo>=</mo>
<mi>a</mi>
<msup>
<mrow><mo>(</mo><mi>x</mi><mo>−</mo><mi>p</mi><mo>)</mo></mrow>
<mn>2</mn>
</msup>
<mo>+</mo>
<mi>q</mi>
</mrow>
</math>
y = a(x - p)^2 + q
a*(x - p)^2 + q
y := a*(x - p)^2 + q;
y = a*(x - p)^2 + q;
y = a(x - p)^2 + q
p = −b/(2a)
p = -\frac{b}{2a}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>p</mi>
<mo>=</mo>
<mo>−</mo>
<mfrac>
<mi>b</mi>
<mrow><mn>2</mn><mi>a</mi></mrow>
</mfrac>
</mrow>
</math>
p = -b/(2a)
-b/(2*a)
p := -b/(2*a);
p = -b/(2*a);
p = −b/(2a)
q = c − b²/(4a)
q = c - \frac{b^{2}}{4a}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>q</mi>
<mo>=</mo>
<mi>c</mi>
<mo>−</mo>
<mfrac>
<msup><mi>b</mi><mn>2</mn></msup>
<mrow><mn>4</mn><mi>a</mi></mrow>
</mfrac>
</mrow>
</math>
q = c - b^2/(4a)
c - b^2/(4*a)
q := c - b^2/(4*a);
q = c - b^2/(4*a);
q = c − b^2/(4a)
How to have ChatGPT do the calculation
You are a math assistant for quadratic functions. Do the following calculation by actually running Python, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing). Complete the square on the quadratic function y = 2x² − 8x + 3. Show each of the following: 1. The steps of completing the square (factor out the x² coefficient → add and subtract the square of half the x coefficient → write the perfect square) 2. The vertex form y = a(x − p)² + q, the vertex (p, q) and the axis of symmetry (as reduced fractions) 3. Which way the graph opens (upward or downward), and the maximum or minimum value In Python, use the fractions module from the standard library to calculate exactly. Show the formulas you used and the numbers from the execution result.
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
