Quadratic Regression Calculator
Paste your paired values and this fits y = a + bx + cx² by least squares, then shows the parts most pages leave out: the fitted value for every row, the residual beside it, the turning point of the curve, and a scatter with each residual drawn as a short line to the fit. The solve is what makes the coefficients trustworthy. Instead of building the normal equations from the raw sums of x, x², x³ and x⁴ and inverting that system, this page centres x on its mean, scales it so every value lies between -1 and 1, factorises the design matrix with Householder QR and maps the answer back. On five points one per year from 2000 to 2004 that sit exactly on y = (x - 2000)², the normal equations on raw x return 3994678.502041, -3994.683816 and 0.998672, and this page returns 4000000.000000, -4000.000000 and 1.000000. Three points always fit a parabola exactly, so the page says so rather than letting an R² of 1 read as evidence, and fewer than three different x values is refused by name instead of being answered with a curve nothing pins down. Up to 5,000 points, no account, and nothing you paste leaves the browser.
x 1 2 3 4 5 6 y 3.2 5.1 9.4 15.2 23.5 33.1 y = 2.950000 - 0.798214 x + 0.973214 x^2 R^2 = 0.999843 n = 6 residuals +0.0750 -0.1464 +0.0857 -0.1286 +0.2107 -0.0964 vertex x = 0.410092 y = 2.786329 (outside the x range)
- a
- b
- c
- R²
6 points, least squares parabola y = 2.950000 - 0.798214 x + 0.973214 x^2, R² 0.999843, residual standard error 0.186764, fitted over x 1 to 6.
A comma, a space or a tab separates the x from the y, so two columns copied from a spreadsheet paste straight in. Bracketed pairs work too, and so do two labelled rows, the x values over the y values. Up to 5,000 points at a time, and three different x values are the fewest a parabola can be fitted to. Nothing you type leaves this browser.
Residuals
Each row is one of your points, the value the fitted curve gives at that x, and the gap between them. The residuals of a least squares fit with a constant term add up to zero, so this column is worth reading for its pattern rather than for its total: a long run of residuals with the same sign is a parabola describing something that is not one.
| x | y | Fitted | Residual |
|---|---|---|---|
| 1 | 3.2 | 3.125 | +0.075 |
| 2 | 5.1 | 5.246429 | -0.146429 |
| 3 | 9.4 | 9.314286 | +0.085714 |
| 4 | 15.2 | 15.328571 | -0.128571 |
| 5 | 23.5 | 23.289286 | +0.210714 |
| 6 | 33.1 | 33.196429 | -0.096429 |
Three cases, worked
Every line below is computed by the code that answers the calculator above, so an example and the tool cannot disagree.
Common questions
- How do I enter my data?
- One point per row, with a comma, a space or a tab between the x and the y, so two columns copied out of a spreadsheet paste in as they are. Bracketed pairs such as (0,1) (1,4) (2,9) work on a single row, and so does the shape the tool itself prints: a row of x values labelled x, with a row of y values labelled y underneath it. Up to 5,000 points and 200,000 characters at a time. A row that does not hold exactly two numbers is named by its row number rather than dropped quietly, and because the comma separates x from y, a thousands comma inside a number is reported instead of being read as two values.
- What do a, b and c mean on this page?
- They are the three coefficients of y = a + bx + cx², in that order: a is the constant, the height of the curve at x = 0, b is the linear term, and c is the quadratic term, which is what makes the fit a curve rather than a line. The sign of c is the direction the parabola opens: positive opens upward, negative opens downward. On the six points the page opens with, the fit is y = 2.950000 - 0.798214 x + 0.973214 x², so c is positive and the curve opens upward.
- Why do three points always give R² of 1?
- Because three coefficients fitted to three points is not a fit at all, it is a solve. Any three points with three different x values lie exactly on one parabola, the residuals are zero and R² is 1 whatever the three points are, so that figure is arithmetic rather than evidence. Enter x 0, 1, 2 with y 1, 4, 9 and you get a = 1, b = 2, c = 1 with R² 1, which is correct and tells you nothing about whether a parabola suits your data. The tool prints a line saying so: a fourth row is the first one that can disagree with the curve.
- Why does it refuse when my x values repeat?
- A parabola has three coefficients, so pinning one down needs at least three different x values. Repeated x values are fine, and common in measured data, as long as three distinct ones remain: six rows at x of 1, 1, 2, 2, 3, 3 fit without complaint. Two distinct x values do not, because an endless family of parabolas passes through two columns of points equally well, which is what rank deficient means, and the tool names that rather than returning one of them. Every x identical is refused too, and the message names the shared value.
- What does R² tell me about a curve fit, and what does it not?
- It is the share of the variation in y that the fitted parabola accounts for, and that is all it is. It is not a test of whether a parabola is the right shape. Take x = 1 to 10 with y = x³, ten points that lie exactly on a curve that is not a parabola: the least squares parabola through them is y = 85.800000 - 76.100000 x + 16.500000 x², R² is 0.997095, and the residuals run -25.2000, +8.4000, +21.0000, +18.6000, +7.2000, -7.2000, -18.6000, -21.0000, -8.4000, +25.2000, a clear pattern rather than scatter. The residual column is where the shape of the data shows itself, which is why every residual is on screen.
- Why does another quadratic regression calculator give me different coefficients?
- Most of them form the normal equations from the raw sums of x, x², x³ and x⁴ and solve that 3 by 3 system. Building those sums squares an already awkward condition number, and a Vandermonde matrix in raw x is awkward to begin with, so on x values the size of years there are not enough digits left to recover. Five points at x = 2000 to 2004 lying exactly on y = (x - 2000)², whose coefficients are exactly 4000000, -4000 and 1, come back from that route as 3994678.502041, -3994.683816 and 0.998672. This page centres x, scales it into -1 to 1, factorises with Householder QR, takes one step of iterative refinement and returns 4000000.000000, -4000.000000 and 1.000000.
- Where is the vertex, and can I use it?
- The turning point is printed under the residuals, computed in the same centred frame as the fit rather than as -b divided by 2c on the raw coefficients, and the line says whether it falls inside the x values you supplied. On the six points the page opens with it sits at x = 0.410092, y = 2.786329, which is outside the range 1 to 6, and that is exactly the case to be careful with: the curve is a description of the points you measured, so a minimum the data never reached is an extrapolation, not a finding. When the fit has no curvature left to speak of, the tool reports a straight line and no vertex instead of a turning point quadrillions away.
- What is the residual standard error underneath the readout?
- It is the square root of the sum of the squared residuals divided by n minus 3, so it is roughly the typical size of a residual, in the units of y. Three coefficients use up three rows, which is why the divisor is n minus 3 rather than n minus 2 as it is for a straight line. On the six points the page opens with it is 0.186764. It needs a row to spare, so it is shown from four points upwards and left out at three, where the curve passes exactly through every point and nothing is left over.
- Is there a limit on how many points I can fit?
- Five thousand points in one go, and 200,000 characters in one paste. Those are readability limits rather than compute limits: the residual table draws the first 100 rows and says how many it did not draw, the scatter thins itself past 1,000 points and says how many it left out, and the Copy button carries every row regardless. There is no account, no sign-up and nothing gated behind one.
- Does my data leave the browser?
- No. The fit, the residuals, the vertex, the plot and the copied report are all produced on this page, and nothing is uploaded or sent to analytics. The only copy kept anywhere is the draft this browser remembers, so your points are still in the box when you come back. Start over, above the tool, forgets it.
Least squares by QR decomposition on centred and scaled x rather than by inverting the normal equations, which is what keeps the coefficients stable when the x values are large or bunched together. Every residual is listed beside its point. R² describes how well this curve fits these points and says nothing about points outside their range.