#1 India's Top IT Training Institute
×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
Mentors

Mentors

Meet the industry experts who train and guide you through your course.

Read More →
Free Resources

Free Resources

Free tutorials, interview questions, tools and calculators to help you learn.

Explore →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · STEP BY STEP

Curve Fitting Calculator: Least Squares Line, Parabola and Exponential

Enter x and y values and pick a curve to see the normal equations solved.

  • 📈 5 curve types
  • 🧾 Sums + normal equations
  • 🎯 Residuals and SSE

How to use the Least Squares Curve Fitting Calculator

  1. 1. Enter the dataType the x values and the matching y values, separated by commas.
  2. 2. Pick the curveStraight line, parabola, y = a e^(bx), y = a bˣ or y = a xᵇ.
  3. 3. Read the workingSee the table of sums, the normal equations, the constants and each residual.

The method of least squares

The best-fitting curve is the one that makes the sum of squared errors Σ(y − ŷ)² as small as possible. Setting the partial derivatives to zero gives the normal equations. For a straight line y = a + bx they are Σy = na + bΣx and Σxy = aΣx + bΣx². For a parabola y = a + bx + cx² there is a third unknown and a third equation, using Σx³, Σx⁴ and Σx²y.

Curves like y = a e^(bx), y = a bˣ and y = a xᵇ are fitted by taking logarithms, which turns them into straight lines in ln y (and ln x). This is the textbook approach; it minimises the error in ln y rather than in y.

Worked example

Fit y = a + bx + cx² to x = 0, 1, 2, 3, 4 and y = 1, 1.8, 1.3, 2.5, 6.3. The sums are n = 5, Σx = 10, Σx² = 30, Σx³ = 100, Σx⁴ = 354, Σy = 12.9, Σxy = 37.1 and Σx²y = 130.3.

The normal equations are 12.9 = 5a + 10b + 30c, 37.1 = 10a + 30b + 100c and 130.3 = 30a + 100b + 354c. Solving them gives a = 1.42, b = −1.07, c = 0.55, so the best parabola is y = 1.42 − 1.07x + 0.55x².

Which curve to choose

Plot the points first. A steady rise suggests a line, one bend suggests a parabola, and growth by a constant factor suggests an exponential. Compare the sums of squared errors. For correlation and both regression lines, use the regression line calculator.

Frequently asked questions

What are normal equations?

They are the equations you get by setting the derivative of the squared error to zero for each unknown. Solving them gives the least squares constants.

Why take logarithms for exponential curves?

ln(a e^(bx)) = ln a + bx is a straight line in x, so the line formulas apply. The tool then converts back to a and b.

How many points do I need?

At least one more than the number of unknowns: 3 points for a line and 4 for a parabola. More points give a more reliable fit.

Is this the same as linear regression?

The straight-line fit is the regression line of y on x. The other curves extend the same idea.

Is this calculator free?

Yes. You fill a short form once when you see your first result, and other Uncodemy tools then open without the form. Everything is calculated in your browser.

More free tools

See all free tools