Quadratic Regression Calculator
Fit a parabola y = ax² + bx + c to paired X and Y data by least squares. The calculator returns the quadratic equation, the coefficients a, b and c, R² and adjusted R², the residual standard error, the vertex and direction of the curve, a prediction for any X, the normal equations behind the answer, every residual and a scatter plot with the fitted curve.
For a straight line use the line of best fit calculator; for growth or decay use the exponential regression calculator. Related guides: linear regression explained and how to interpret R².
Enter numbers separated by commas, spaces or new lines
One Y for every X, in the same order
Related Calculators
Linear Regression Calculator
Fit a least-squares line and get the equation, R², coefficient tests, ANOVA table, confidence and prediction intervals, residuals and a plot.
Line of Best Fit Calculator
Find the least-squares line of best fit for X–Y data with the equation, slope, intercept, correlation, working table, residuals and a scatter plot.
R-Squared Calculator
Get R², adjusted R², r, and the SSR/SSE/SST breakdown from X–Y data or observed vs predicted values.
What quadratic regression does
Quadratic regression finds the parabola ŷ = ax² + bx + c that lies closest to your points, closest meaning the smallest possible sum of squared vertical distances. It is the model to reach for when a straight line leaves a systematic U-shaped or arched pattern in the residuals: the height of a thrown object, the braking distance of a car against its speed, revenue against price, or a yield that rises and then falls with the amount of fertiliser.
A parabola has one turning point, the vertex. When a is negative the curve opens downward and the vertex is the maximum; when a is positive it opens upward and the vertex is the minimum. The calculator reports the vertex, flags when it lies outside your data, and warns when a prediction extrapolates beyond it.
Formulas
Model: ŷ = a·x² + b·x + c
n·c + Σx·b + Σx²·a = Σy
Σx·c + Σx²·b + Σx³·a = Σxy
Σx²·c + Σx³·b + Σx⁴·a = Σx²y
Vertex: x = −b / (2a), y = c − b² / (4a)
R² = 1 − SSE / SST, SSE = Σ(y − ŷ)², SST = Σ(y − ȳ)²
Adjusted R² = 1 − [SSE / (n − 3)] / [SST / (n − 1)]
Residual standard error: s = √( SSE / (n − 3) )
The three normal equations are what minimising the sum of squared errors requires, and the calculator shows them with your own sums. It does not invert that matrix, though: with large X values such as calendar years, the sums of x³ and x⁴ are so large that the inversion loses most of its digits. The same least-squares problem is solved instead by QR factorization on an X that has been centred and scaled, and the coefficients are converted back afterwards. The result is the same a, b and c with far less rounding error.
How to read the results
| Output | What it tells you |
|---|---|
| a (x² coefficient) | The curvature. Positive a opens the parabola upward, negative a downward; the larger |a|, the sharper the bend. The slope of the curve changes by 2a for every unit of x. |
| b (x coefficient) | The slope of the curve at x = 0. On its own it is not the slope at your data, because the slope is 2ax + b. |
| c (constant) | The height of the curve at x = 0, which is only meaningful if x = 0 is in or near your data. |
| R² Value | The share of the variation in Y that the parabola explains, from 0 to 1. It cannot be lower than the R² of the best straight line, so compare adjusted R² and the residuals instead. |
| Adjusted R² | R² corrected for the three parameters used. It only rises when the extra x² term earns its place. |
| Residual standard error (s) | The typical distance of a point from the curve, in the units of Y, on n − 3 degrees of freedom. |
| Vertex (x, y) | The turning point, the maximum or the minimum of the fitted curve. |
| Predicted Y | The curve evaluated at the X value you enter. |
Worked example: the height of a thrown ball
A ball is tossed upward and its height is read every second: X = 0, 1, 2, 3, 4 seconds and Y = 1, 3, 4, 3, 1 metres. Load example fills in these numbers and asks for the height at x = 2.5.
- Sums: Σx = 10, Σx² = 30, Σx³ = 100, Σx⁴ = 354, Σy = 12, Σxy = 24, Σx²y = 62.
- Normal equations: 5c + 10b + 30a = 12, 10c + 30b + 100a = 24 and 30c + 100b + 354a = 62.
- Solution: a = −5/7 = −0.7143, b = 20/7 = 2.8571, c = 34/35 = 0.9714, so ŷ = −0.7143x² + 2.8571x + 0.9714.
- Fit: the fitted heights are 0.9714, 3.1143, 3.8286, 3.1143 and 0.9714, SSE = 2/35 = 0.0571 and SST = 7.2, so R² = 1 − 0.0571 ÷ 7.2 = 0.9921, adjusted R² = 0.9841 and s = √(0.0571 ÷ 2) = 0.1690.
- Vertex: x = −2.8571 ÷ (2 × −0.7143) = 2 and y = 3.8286: the ball peaks at about 3.83 m after 2 seconds. At x = 2.5 the curve gives 3.65 m.
A straight line fits the same data far worse: the points are symmetric about x = 2, so Sxy = 0, the slope is 0 and R² = 0, whereas the parabola explains 99.2% of the variation. Notice too that the parabola would put the ball at −2.6 m at x = 5, underground, which is why the calculator flags a prediction beyond the data as an extrapolation.
Quadratic, linear or something else?
- Plot the residuals of the straight line, for example with the residual calculator. An arch or a bowl means a bend that a parabola can capture; a random cloud means the line is enough.
- Prefer the simpler model unless the curve improves the adjusted R² and the residual standard error clearly. With n points a polynomial of degree n − 1 always fits perfectly and predicts badly.
- A parabola turns around once. If your data keep rising ever faster without a turning point, growth of a fixed percentage is often a better description: try the exponential regression calculator.
- To check how strong a linear relationship is on its own, use the correlation coefficient calculator; a symmetric curve like the ball above has a correlation of 0 although the pattern is perfectly regular.
Assumptions and pitfalls
- Three different X values are required. With fewer, many parabolas fit equally well and the calculator says so. With exactly three, the parabola passes through every point, R² is 1 and there are no degrees of freedom left for the error.
- Extrapolation is dangerous. A parabola runs off to plus or minus infinity on both sides of its vertex, however the real process behaves.
- Independent observations with constant spread. Repeated measures, or a scatter that widens with x, break the usual error estimates.
- Outliers pull a parabola harder than a line because the x² term amplifies points at the ends of the range. Check the residual table for values that stand out.
- Large X values. With years such as 2001 to 2005, a and b look extreme because they describe the curve at x = 0. Subtracting a base year from X gives readable coefficients without changing R² or predictions.
Quadratic regression in other software
| Tool | Command |
|---|---|
| TI-84 | STAT > CALC > 5:QuadReg gives a, b, c and, with DiagnosticOn, R² |
| Excel chart | Add Trendline > Polynomial, Order 2, then tick Display Equation on chart and Display R-squared value |
| Excel / Google Sheets | =LINEST(y, x^{1,2}, TRUE, TRUE) returns a, b, c in the first row of the output |
| Desmos | y_1 ~ a·x_1^2 + b·x_1 + c fits the parabola to a table of x_1 and y_1 |
| R | fit <- lm(y ~ x + I(x^2)); coef(fit); summary(fit)$r.squared |
| Python | numpy.polyfit(x, y, 2) returns [a, b, c], highest power first |
All of them minimise the same sum of squared errors, so they agree with this calculator to rounding error. To score a fitted curve against the observed values with MSE, RMSE and MAE, use the mean squared error calculator.
Frequently Asked Questions
What is quadratic regression?
Quadratic regression fits a second-degree polynomial, y = ax² + bx + c, to paired data by least squares: it chooses a, b and c so that the sum of the squared vertical distances between the points and the parabola is as small as possible. It is used when the relationship bends, for example when Y rises and then falls with X.
How do I find the vertex of the fitted parabola?
The vertex is at x = −b / (2a), with height y = c − b² / (4a). The calculator shows it directly. If a is negative it is the highest point of the curve, if a is positive the lowest. When the vertex lies outside your X values, the fitted curve only rises or only falls across your data.
How many data points do I need?
At least three points with three different X values. With exactly three the parabola passes through all of them, so R² is 1 but nothing can be said about error. In practice use at least 6 to 10 points, spread over the range you care about, so the curvature is not just noise.
How do I know if a quadratic fits better than a straight line?
Compare the adjusted R² and the residual standard error with those of the line of best fit, and look at the residuals: a line leaves an arch or a bowl, a good parabola leaves a shapeless scatter. Plain R² can only go up when a term is added, so it does not settle the question. The extra x² term must earn its place.
Why does a coefficient show as 0 to within rounding error?
If your points lie exactly on a line, or on a parabola with no x term, the true value of that coefficient is 0, but computers work with rounded numbers and the solution can come out as something like 3e-16. The calculator recognises coefficients whose largest possible contribution over your data is smaller than that rounding error, shows them as 0 and says so.
Can I use calendar years as the X values?
Yes, and the fit is accurate because the calculator centres and scales X internally. The printed a, b and c will look extreme, since they describe the curve at year 0. Subtract a base year from your X values, for example use 1, 2, 3 for 2001, 2002, 2003, to get readable coefficients; R² and the predictions do not change.
How does this compare with the TI-84 QuadReg or Excel?
They solve the same least-squares problem, so a, b, c and R² agree with this calculator up to rounding. This page also shows adjusted R², the residual standard error, the vertex, the normal equations with your sums and every residual.
Embed This Calculator
Add this free calculator to your course page or LMS.
Adjust the height value to fit your page.