SOLVETUTORMATH SOLVER

Instrument MI-07-134 · Statistics

Polynomial Regression Calculator

Some relationships need more bend than a straight line or even a single parabola can offer. This calculator fits your choice of degree, from a simple line up to a quintic curve.

Instrument MI-07-134
Sheet 1 OF 1
Rev A
Verified
Type 07 — Correlation & Regression SER. 2026-07134

R² — goodness of fit

1.000000

y = c0 + c1·x + ... + c3·x^3, fit by least squares (normal equations)

1.000000 c0 — constant term
2.000000 c1 — coefficient of x
2.000000 c2 — coefficient of x²
1.000000 c3 — coefficient of x³
0.000000 c4 — coefficient of x⁴
0.000000 c5 — coefficient of x⁵
The working Every figure verified twice
  1. degree=3 -> [1.000000, 2.000000, 2.000000, 1.000000], r^2=1.000000
Worksheet log
  1. No entries yet — change an input to log a scenario.

How this instrument works

Polynomial regression generalizes ordinary linear regression to curves with more than one bend, fitting an equation of the chosen degree — y = c0 + c1x + c2x² + ... up to the selected highest power — that minimizes the total squared vertical distance between the curve and your data points. Degree 1 is just an ordinary straight line; degree 2 is a parabola; degree 3 can have one hump and one dip; degrees 4 and 5 allow progressively more twists and turns.

Choosing the right degree is a genuine trade-off. Too low a degree, and the fitted curve can't capture real bends in the data, leaving a lower R² than the relationship deserves. Too high a degree, and the curve starts chasing individual data points too closely, a phenomenon called overfitting, producing an artificially high R² on the data it was fit to, but a curve that swings wildly and predicts poorly on new points. A polynomial of degree (n-1) will always pass through n data points exactly, regardless of whether that curve reflects any genuine underlying pattern.

This calculator fits the chosen degree via ordinary least squares (the normal-equations approach, solved by Gaussian elimination) and reports every coefficient up to c5, setting any coefficient above the chosen degree to zero — so switching the degree selector and comparing R² across a few different degrees on the same data is a quick, direct way to judge whether extra curvature is actually earning its keep, or just fitting noise.

y=k=0dckxky=\sum_{k=0}^{d}c_k x^k
x, y — your paired data · c0..c5 — the fitted coefficients up to the chosen degree, with higher-degree coefficients set to 0 · degree — the highest power of x included in the fit, chosen from 1 to 5 · R² — the proportion of variation in y explained by the fitted curve.
  • Enter your x values into X values, separated by commas, spaces, or new lines.
  • Enter the corresponding y values into Y values, matching order and count.
  • Choose the polynomial degree (1 through 5) from the dropdown — at least degree+1 data points are needed.
  • Read the coefficients c0 through c5 for y = c0 + c1x + c2x² + c3x³ + c4x⁴ + c5x⁵ (unused higher-degree coefficients read as 0).
  • Read R² — how much of the variation in y the fitted curve explains, from 0 to 1; compare it across a couple of degrees to check for overfitting.

Worked example — an exact cubic at degree 3

The true relationship is y = x³ + 2x² + 2x + 1. At x = 0, 1, 2, 3, this gives y = 1, 6, 21, 52. Enter '0, 1, 2, 3' into X values, '1, 6, 21, 52' into Y values, and choose degree 3.

With exactly 4 points and a degree-3 fit (4 coefficients, c0 through c3), the fit recovers the original coefficients exactly: c0 = 1, c1 = 2, c2 = 2, c3 = 1, with c4 and c5 both 0 since the degree was set to 3. R² = 1.0 — a perfect fit, since there are exactly enough points to pin down the curve with nothing left over to explain.

Questions

How do I choose the right degree for my data?

Start with the lowest degree that seems plausible given how your data looks when plotted, then compare R² as the degree increases by one at a time. A meaningful jump in R² when moving from degree 1 to 2, for instance, suggests real curvature the straight line was missing; if R² barely improves, or the fit starts to look implausibly wiggly, as the degree keeps rising, the fit has likely gone past what the data actually supports and is starting to fit noise instead of signal.

What is overfitting, and how does it show up here?

Overfitting happens when a curve is flexible enough to bend around essentially every individual data point rather than capturing the genuine underlying pattern — a degree-(n-1) polynomial will always achieve R² = 1.0 on exactly n data points, no matter how noisy or meaningless the relationship actually is. The warning sign is a very high degree relative to your number of data points, or a curve that swings sharply between points instead of following a smooth, plausible trend.

Why do the unused coefficients show as 0 instead of being left blank?

This calculator always reports coefficients c0 through c5 for consistency, regardless of which degree is selected — any coefficient for a power higher than the chosen degree is set to exactly 0, since that term simply isn't part of the fitted equation. A degree-2 fit, for example, will always show c3 = c4 = c5 = 0, confirming the fit is genuinely quadratic and not secretly using higher-order terms.

How is this different from the dedicated quadratic-regression calculator?

They share the exact same least-squares fitting engine, and choosing degree 2 here produces identical coefficients and R² to the dedicated quadratic-regression calculator on the same data. This page's advantage is flexibility — trying degree 1, 2, 3, 4, or 5 on the same dataset and comparing R² across all of them, rather than committing to a fixed quadratic shape from the start.

References