Curve Fitting Calculator

Choose a curve type and enter the x and y values of your points.

Numbers separated by commas.

The same number of numbers as the x values.

Try

Result

You entered4 points\text{4 points}

y=x2+1\displaystyle y = x^{2} + 1

R²

R2=1\displaystyle R^2 = 1
Show the work
  1. Least-squares quadratic fit

    Choose aa, bb and cc so that the sum of the squared vertical gaps between the points and the curve is as small as possible. That leads to three linear equations, the normal equations.

    Using y=ax2+bx+cy = a x^2 + b x + c

    ∑y=a∑x2+b∑x+cn∑xy=a∑x3+b∑x2+c∑x∑x2y=a∑x4+b∑x3+c∑x2\begin{aligned} \sum y &= a\sum x^2 + b\sum x + cn \\ \sum xy &= a\sum x^3 + b\sum x^2 + c\sum x \\ \sum x^2 y &= a\sum x^4 + b\sum x^3 + c\sum x^2 \end{aligned}
  2. Sums for the normal equations

    With n=4n = 4 points the sums are needed in exact fractions.

    ∑x=6, ∑x2=14, ∑x3=36, ∑x4=98, ∑y=18, ∑xy=42, ∑x2y=112\sum x = 6,\ \sum x^2 = 14,\ \sum x^3 = 36,\ \sum x^4 = 98,\ \sum y = 18,\ \sum xy = 42,\ \sum x^2 y = 112
  3. Solving the normal equations

    Eliminating in exact fractions gives the coefficients of the best-fitting parabola.

    a=1, b=0, c=1a = 1,\ b = 0,\ c = 1
  4. Coefficient of determination

    R2R^2 is the share of the spread in yy that the curve explains; 11 means every point lies on the curve.

    R2=1−SSresSStot=1−049=1\begin{aligned} R^2 &= 1 - \dfrac{SS_{res}}{SS_{tot}} \\ &= 1 - \frac{0}{49} \\ &= 1 \end{aligned}
  5. Result

    The best quadratic fit is y=x2+1y = x^{2} + 1.

Worked examples