Intermediate

Polynomial Regression Calculator

Enter your (x, y) data, pick the polynomial degree, and get the best-fit equation, R², and RMSE — plus a plot of the fitted curve over your scatter points.
One pair per line, separated by comma or space

Polynomial degree

R² (coefficient of determination)
1

How well the polynomial fits the data (1 = perfect fit)

Equation
y = 1 +1x²
RMSE
0
Data points (n)
6
Degree
2
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

Polynomial regression fits y = β₀ + β₁x + β₂x² + … to data by minimising the sum of squared errors (OLS via normal equations). Enter data as x,y pairs, pick degree 1–5, and get the equation, R² (fit quality), and RMSE (average error). Needs at least degree + 2 points; higher degree always reduces training error but risks overfitting.

Formula
Minimise Σ (yᵢ − â₀ − â₁xᵢ − â₂xᵢ² − …)² → (XᵀX)β = Xᵀy
How this is calculated

Polynomial regression finds the polynomial of a given degree that minimises the sum of squared residuals between the fitted curve and each data point. The problem is solved exactly through ordinary least squares: build the Vandermonde-style design matrix X (each row is [1, xᵢ, xᵢ², …, xᵢⁿ]), form the normal equations (XᵀX)β = Xᵀy, and solve for the coefficient vector β using Gaussian elimination with partial pivoting.

R² (coefficient of determination) measures goodness of fit: 1 − SS_res/SS_tot. A value of 1 means the polynomial passes through every point; values near 0 mean the curve explains little of the variance. RMSE (root mean square error) is the average prediction error in the same units as y. Adding more degree always reduces RMSE on the training data, but risks overfitting — always compare the plot against your scatter points to judge whether extra complexity is warranted.

You need at least (degree + 2) data points for a meaningful fit. The system is solved numerically, so very large x-values or poorly scaled data can produce rounding errors; rescaling x to a smaller range often helps.

Frequently asked questions

Start with degree 2 (quadratic) and increase only if R² improves significantly and the added curve complexity matches the physical shape of your data. A high degree with few points overfits: the curve wiggles through every point but predicts poorly.

It means the polynomial explains 95% of the variance in y. The remaining 5% is unexplained scatter or noise. R² = 1 is a perfect fit; values below 0.7 often indicate the chosen degree is too low or a polynomial model is inappropriate.

Yes — set degree to 1. The result is identical to simple linear regression: y = a + bx, with the same R² and RMSE you would get from a standard linear-regression tool.

Also known as

quadratic regression calculator
cubic regression line calculator
curve fitting least squares
polynomial curve fit data
r squared polynomial fit
best fit polynomial equation

APA

TG we-Calculate Editorial Team. (2026). Polynomial Regression Calculator [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/polynomial-regression-calculator

Chicago

TG we-Calculate Editorial Team. "Polynomial Regression Calculator." TG we-Calculate. 2026. https://we-calculate.com/calculator/polynomial-regression-calculator.

IEEE

TG we-Calculate Editorial Team, "Polynomial Regression Calculator," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/polynomial-regression-calculator

BibTeX

@misc{wecalculate_polynomial_regression_calculator, title = {Polynomial Regression Calculator}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/polynomial-regression-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?