Polynomial Curve Fitting Calculator

This polynomial curve fitting calculator fits a polynomial of degree 1 to 6 to your points and compares R², adjusted R² and AICc by degree.

Checks on your data

  • A higher degree always fits the existing points better but can oscillate between and beyond them. Prefer the lowest degree that fits well and avoid extrapolating far.

Results

Degree 2 polynomial
y = 1.6277x² − 0.53498x + 1.523
R²
0.999909
Adjusted R²
0.999879
RMSE
0.320035
Degree with the lowest AICc
2
balances fit against complexity
Prediction at x = 9
128.552
Data with the degree-2 polynomial
05010002468xy
Adjusted R² by degree
00.5deg 1: 0.908213deg 10.908deg 2: 0.999879deg 21deg 3: 0.999905deg 31deg 4: 0.999891deg 41deg 5: 0.999865deg 51deg 6: 0.999892deg 61
Polynomial degrees compared
DegreeR²Adjusted R²RMSEAICc
10.919690.908219.527446.575
20.999910.999880.32003-9.7079
30.999940.99990.25935-6.2926
40.999950.999890.247744.8829
50.999950.999870.2391328.247
60.999970.999890.1746994.594
Show step-by-step solution
  1. Fit y = a₀ + a₁x + … + a2x² by least squares to the 9 points.
  2. Coefficients (a₀ first): 1.52303, -0.534978, 1.62771.
  3. R² = 1 − SSE ÷ SST = 1 − 0.921801 ÷ 10,172 = 0.999909; adjusted R² = 0.999879.
  4. Compare degrees in the table: choose the lowest degree that fits well.
Degree1 to 6
Compare byAdjusted R², AICc
RiskOverfitting
Needsdegree + 2 points

What Is Polynomial Curve Fitting?

Polynomial curve fitting finds the polynomial that best follows your data, using least squares. Degree 1 is a line, degree 2 a parabola, degree 3 a cubic and so on.

Enter your x and y values and choose a degree. You get the equation, R², adjusted R², RMSE, a prediction for any x and a table that compares every degree. The chart shows the data with the fitted curve and the adjusted R² of each degree.

Below are the formulas, a worked example and answers on avoiding overfitting.

How to Use the Polynomial Curve Fitting Calculator

  1. Enter x and y values.
  2. Choose the degree.
  3. Read the equation and R².
  4. Check the degree comparison table.

Polynomial Curve Fitting Formula

Polynomial

y=a0+a1x+a2x2+⋯+adxdy=a_0+a_1x+a_2x^2+\cdots+a_dx^d

Adjusted R²

Radj2=1−(1−R2)(n−1)n−d−1R^2_{adj}=1-\frac{(1-R^2)(n-1)}{n-d-1}

Polynomial Curve Fitting Variables Explained

SymbolMeaningNotes
dDegree of the polynomial
a₀…a_dCoefficients
R²Share of variation explained
Adjusted R²R² corrected for degree

Polynomial Curve Fitting Worked Example

Data that grow roughly like 1.5x² are fitted well by a quadratic: R² is very close to 1. A cubic adds almost nothing, and its adjusted R² is no better, so the quadratic is the right choice.

With the example values loaded in the calculator above, the steps are:

  1. Fit y = a₀ + a₁x + … + a2x² by least squares to the 9 points.
  2. Coefficients (a₀ first): 1.52303, -0.534978, 1.62771.
  3. R² = 1 − SSE ÷ SST = 1 − 0.921801 ÷ 10,172 = 0.999909; adjusted R² = 0.999879.
  4. Compare degrees in the table: choose the lowest degree that fits well.

Result: Degree 2 polynomial = y = 1.6277x² − 0.53498x + 1.523; R² = 0.999909; Prediction at x = 9 = 128.552.

How to Read a Polynomial Fit

R² tells you how much of the variation in y the curve explains. A value near 1 means a close fit. Adjusted R² penalises extra terms, so it can fall when a higher degree adds almost nothing.

Prefer the lowest degree that fits well. A quadratic that gives R² of 0.99 is a better model than a degree-8 curve with R² of 0.9999, because the high-degree curve usually bends to follow noise. Look at the plot before you trust a prediction outside your data.

Where Polynomial Curve Fitting Is Used

Trend lines

Fit a quadratic or cubic through measurements that curve, such as stopping distance against speed.

Choosing a degree

Compare R² and adjusted R² for several degrees to see where extra terms stop paying for themselves.

Prediction inside the data range

Estimate y at a new x between your observed values. Interpolation is far safer than extrapolation.

Coursework

Check the coefficients of a regression you worked by hand, with the full equation written out.

Common Polynomial Curve Fitting Mistakes to Avoid

  • You need more data points than coefficients. A degree-3 fit needs at least 4 points, and many more to be trustworthy.
  • Do not extrapolate far beyond your data. Polynomials can swing sharply outside the fitted range.
  • Judge fit with adjusted R², not R², when you compare degrees. R² never falls when you add a term.
  • Look at the plot. A high R² can hide a curve that wiggles between points.

Polynomial Curve Fitting Terms and Definitions

Degree
The highest power of x in the polynomial.

Polynomial Curve Fitting FAQs

How do I fit a polynomial to data?

Enter your x and y values and choose a degree. The calculator solves the least-squares normal equations for the coefficients and shows the equation, R² and the fitted curve over your points.

What degree should I use?

Start with the lowest degree that follows the pattern: 1 for a straight line, 2 for one bend, 3 for an S shape. Move up only if adjusted R² improves clearly and the curve still looks sensible.

Why is a high degree risky?

A degree n − 1 polynomial passes exactly through n points, so R² is 1 but the curve is fitting noise. It will usually predict new values badly. This is called overfitting.

What is polynomial regression?

It is regression with powers of x as predictors, such as y = a + bx + cx². It is still linear in the coefficients, so ordinary least squares solves it exactly.

Related calculators

Last updated 2026-11-09. See our disclaimer.