Quadratic Regression Calculator
Enter your paired x and y data points (separated by commas or spaces) and this calculator fits a quadratic curve y = ax^2 + bx + c using the method of least squares. You get the three coefficients, the coefficient of determination (R-squared), the vertex of the parabola, and a complete worked solution showing every sum and normal-equation step. At least three distinct data points are required.
Formula
Worked example
Data: x = 1,2,3,4,5,6 and y = 2.1, 3.9, 8.2, 14.1, 22.0, 31.8. The sums are computed, the 3x3 normal-equation system is solved, and the result is approximately y = 0.9714x^2 + 0.0543x + 1.0857 with R^2 = 0.9999, indicating an excellent quadratic fit.
What is quadratic regression?
Quadratic regression finds the parabola y = ax^2 + bx + c that passes as close as possible to a set of data points. It is a special case of polynomial regression where the highest power of the predictor x is 2. The method of least squares is used: the three coefficients a, b, and c are chosen to minimise the sum of the squared vertical distances between the observed y values and the fitted curve. When the underlying relationship between two variables curves rather than running in a straight line, a quadratic model often captures the pattern far better than a linear one. Classic examples include projectile trajectories, the area of shapes as a linear dimension grows, and many economic and biological dose-response relationships.
How the calculation works: normal equations
To fit y = ax^2 + bx + c by least squares, we minimise S = sum of (y_i - ax_i^2 - bx_i - c)^2 over all data points. Taking partial derivatives with respect to a, b, and c and setting them to zero gives three simultaneous linear equations called the normal equations. Written in matrix form, the coefficient matrix contains the sums: n (count), sum(x), sum(x^2), sum(x^3), and sum(x^4). The right-hand side contains sum(y), sum(xy), and sum(x^2*y). Solving this 3x3 system, for example with Cramer's rule or Gaussian elimination, yields the unique values of a, b, and c that give the best fit in the least-squares sense. This calculator uses Cramer's rule for clarity and numerical transparency.
Coefficient of determination R-squared
R-squared (R^2) measures how well the fitted parabola explains the variation in the y data. It is defined as 1 minus the ratio of the residual sum of squares (SS_res, the unexplained variation) to the total sum of squares (SS_tot, the total variation around the mean of y). A value of 1 means the curve passes through every data point exactly. A value of 0 means the quadratic fits no better than a flat horizontal line at the mean of y. In practice, R^2 above 0.95 is considered excellent for most scientific and engineering applications, while R^2 below 0.60 suggests the quadratic model is a poor description of the data.
The vertex and axis of symmetry
Every parabola has a vertex: the single point where the curve changes from decreasing to increasing (if a > 0) or from increasing to decreasing (if a < 0). The x-coordinate of the vertex is x_v = -b / (2a), and the y-coordinate is y_v = c - b^2 / (4a). The vertical line x = x_v is the axis of symmetry: the parabola is a mirror image of itself on either side of it. In applied problems the vertex often has a direct physical meaning - the maximum height of a projectile, the profit-maximising price, or the temperature at which a reaction is fastest. When a is positive the vertex is a minimum; when a is negative it is a maximum.
Interpreting R-squared in quadratic regression
| R² range | Interpretation | Typical action |
|---|---|---|
| 0.95 - 1.00 | Excellent fit | Quadratic model is appropriate |
| 0.80 - 0.94 | Good fit | Model is useful; check residual plot |
| 0.60 - 0.79 | Moderate fit | Consider adding predictors or trying other models |
| 0.40 - 0.59 | Weak fit | Investigate outliers, try different functional form |
| Below 0.40 | Poor fit | Quadratic model may be inappropriate for this data |
These thresholds are commonly used guidelines; context always matters.
Frequently asked questions
How many data points do I need for quadratic regression?
You need at least 3 data points because there are 3 unknown coefficients (a, b, and c). With exactly 3 non-collinear points the parabola will pass through all of them perfectly and R^2 will equal 1, which tells you nothing useful about whether the relationship is genuinely quadratic. As a practical rule, aim for at least 5 to 10 points to get a meaningful R^2 and to detect whether the quadratic form is actually appropriate for your data.
What does a negative coefficient a mean?
When a is negative the parabola opens downward, meaning the relationship has a maximum rather than a minimum. The vertex gives the x value at which y is largest. This pattern appears in projectile motion (peak height), in revenue curves that peak at a particular price, and in biological responses where an intermediate dose gives the maximum effect.
What is the difference between quadratic regression and polynomial regression?
Quadratic regression is polynomial regression with degree 2. Polynomial regression is the broader family of models y = a_n*x^n + ... + a_1*x + a_0 for any degree n. Degree 1 is ordinary linear regression, degree 2 is quadratic, degree 3 is cubic, and so on. Quadratic regression is often the right next step after linear regression when the residuals show a curved pattern, because it adds only one extra parameter while allowing the model to capture a wide range of curved relationships.
Can R-squared be negative in quadratic regression?
The standard R^2 formula can theoretically produce a negative value if the model fits worse than a horizontal line, but this calculator clamps it to a minimum of 0 to match common convention. A very low R^2 (near 0) is a signal that the quadratic model is not capturing the structure in your data, and you should inspect the residuals or try a different model.
How do I predict a new y value from the fitted equation?
Once you have the coefficients a, b, and c, substitute any x value into y = ax^2 + bx + c to get the predicted y. For example, if the equation is y = 0.97x^2 + 0.05x + 1.09 and you want to predict y at x = 7, compute 0.97 * 49 + 0.05 * 7 + 1.09 = 47.53 + 0.35 + 1.09 = 48.97. Keep in mind that extrapolating beyond the range of your original data is risky: the parabola shape is a model assumption that may not hold outside the observed range.
Is quadratic regression the same as a parabola through the data?
It is the best-fitting parabola in the least-squares sense, meaning the sum of the squared vertical distances between the actual y values and the parabola is as small as it can possibly be. This is generally NOT the parabola that passes through all the points unless you have exactly 3 points, because with more data there is usually no single parabola that passes through every point exactly.