Curve fitting. Least squares regression
Online curve fitting simulations on this page help us to understand how to fit a point cloud and show us some of the most common techniques such as least squares regression.
This Thematic Unit is part of our Mathematics collection

STEM OnLine mini dictionary
Correlation Coefficient (r)
A numerical index that quantifies the degree of linear association between two variables, ranging from -1 to +1.
Curve Fitting
A mathematical modeling process that finds the function that best describes the general trend of a set of experimental data.
Extrapolation
Inference of values outside the observed data interval, assuming that the model’s behavior remains constant.
Interpolation
Calculation of intermediate values within the range of known data points based on the obtained fitting function.
Least Squares Regression
An optimization procedure that determines the parameters of a function by minimizing the sum of the squared residuals between the points and the curve.
Linear Fit
A regression model that assumes a constant proportionality relationship between variables, represented by a straight line.
Overfitting
An error where the model fits the random fluctuations of the data too closely, losing the ability to predict new values.
Polynomial Fit
A fitting technique that uses $n$-degree polynomials to model non-linear relationships or behaviors with multiple changes in curvature.
Scatter Plot
A two-dimensional graphical representation of data where each point represents the value of two variables, allowing visual identification of their correlation.
Underfitting
A deficiency in the model when it is too simple to capture the underlying structure or trend present in the observed data.
What is curve fitting
Curve fitting is a technique used in data analysis to find a mathematical function that fits a set of points. The goal is to find a smooth curve that passes close to all the points and represents the relationship between the variables of interest accurately.
Curve fitting applications
Curve fitting is used in a wide range of fields, such as physics, statistics, economics and engineering. It is especially useful when you have a set of data and you want to obtain a function that describes them adequately. This can be useful for predicting future values, interpolating between known points, or better understanding the relationship between variables.
Curve fitting methods
There are several methods for curve fitting, the most common being linear fitting and polynomial fitting. Linear fitting is used when data are expected to follow a linear relationship, while polynomial fitting allows more complex relationships to be represented by higher degree polynomials. These methods are based on minimizing the difference between the values predicted by the fitted function and the actual data values.
Another popular approach is curve fitting using exponential, logarithmic or trigonometric functions, depending on the shape of the data and the expected relationship between the variables. These models can capture nonlinear patterns and provide a better approximation in some cases.
Least squares regression method
The least squares regression method is a mathematical technique used to find the most accurate relationship between a set of data and a function by minimizing the sum of the squares of the differences between the observed values and the values predicted by the model. This method is fundamental in curve fitting, since it allows determining the curve that best fits the experimental data, optimizing its representation and reducing prediction errors. It is widely used in statistics, physics, engineering and other disciplines to analyze trends and make predictions based on observed data.
Limitations of curve fitting
It is important to note that curve fitting is not always appropriate, as it can lead to overfitting or underfitting. Overfitting occurs when the fitted function over-fits the training data and performs poorly on new data, while underfitting occurs when the function does not adequately capture the relationship between variables.

STEM OnLine mini dictionary
Correlation Coefficient (r)
A numerical index that quantifies the degree of linear association between two variables, ranging from -1 to +1.
Curve Fitting
A mathematical modeling process that finds the function that best describes the general trend of a set of experimental data.
Extrapolation
Inference of values outside the observed data interval, assuming that the model’s behavior remains constant.
Interpolation
Calculation of intermediate values within the range of known data points based on the obtained fitting function.
Least Squares Regression
An optimization procedure that determines the parameters of a function by minimizing the sum of the squared residuals between the points and the curve.
Linear Fit
A regression model that assumes a constant proportionality relationship between variables, represented by a straight line.
Overfitting
An error where the model fits the random fluctuations of the data too closely, losing the ability to predict new values.
Polynomial Fit
A fitting technique that uses $n$-degree polynomials to model non-linear relationships or behaviors with multiple changes in curvature.
Scatter Plot
A two-dimensional graphical representation of data where each point represents the value of two variables, allowing visual identification of their correlation.
Underfitting
A deficiency in the model when it is too simple to capture the underlying structure or trend present in the observed data.
Explore the exciting STEM world with our free, online, simulations and accompanying companion courses! With them you’ll be able to experience and learn hands-on. Take this opportunity to immerse yourself in virtual experiences while advancing your education – awaken your scientific curiosity and discover all that the STEM world has to offer!
Curve fitting simulations
Fitting the curve
With the mouse, drag the data points and their error bars, and see the best fit of the polynomial curve that instantly updates. You can choose the type of fit: linear, quadratic, or cubic. The reduced chi-square statistic shows you when the fit is good. Or you can try to find the best fit manually by adjusting the parameters.
Giants of science
“If I have seen further, it is by standing on the shoulders of giants”
Isaac Newton
Andrey Kolmogorov
–
Blaise Pascal
–
Become a giant
Probability and Statistics in Data Science using Python
Introduction to Probability
Fundamentals of Statistics
Fat Chance: Probability from the Ground Up
Polynomials, Functions and Graphs
Maths Essentials
Introduction to Algebra
MathTrackX: Special Functions
Professional development for Educators
Teaching Coding in Grades 5-8 with Scratch Encore
Teach teens computing: How computers work
Higher education assessing in the age of AI
HP Digital Skills for Educators – Google Workspace
Giants of science
“If I have seen further, it is by standing on the shoulders of giants”
Isaac Newton
Blaise Pascal
–
Henri Poincaré
–
Become a giant
Probability and Statistics in Data Science using Python
Introduction to Probability
Fundamentals of Statistics
Fat Chance: Probability from the Ground Up
MathTrackX: Special Functions
Maths Essentials
Pre-University Calculus
Polynomials, Functions and Graphs
Professional development for Educators
Teaching Computational Thinking
Support kids’ projects: Programming with Scratch
Classroom Strategies for Inquiry-Based Learning
Teach Teens Computing: Understanding AI for Educators
Test your knowledge
What is curve fitting, and why is it essential in data analysis?
What methods are used in curve fitting, and how does the least‑squares method help find the best model?
What is curve fitting used for when working with data?
What is the difference between linear and polynomial fitting?
What is the least‑squares method, and why is it so common?
You may also be interested
Last simulations
To learn and experience
Take your knowledge to the next level with science kits and hands-on tools that connect theory with experimentation
Teachers essentials
Notion
Organize your notes, tasks, and projects in one place. Notion combines notes, lists, and calendars in one flexible space.
Canva
Design presentations, diagrams, and infographics with easy-to-use templates and professional results
Genially
Create interactive content, presentations, and educational games in a simple and visual way
Desmos
The most intuitive graphing calculator to explore mathematics and create dynamic classroom activities
Tinkercad
Design in 3D and simulate electronic circuits for free; it’s the perfect tool for simple robotics projects
Your Infinite Library
Enjoy the freedom to explore millions of titles and a curated selection of magazines on any device
Join Prime for students and young adults
The best series. Millions of songs. All included with your subscription.
Science made fun
Learn with the best courses
edX
Online courses from leading universities and companies. Learn practical skills and earn professional certifications
Coursera
Courses from leading universities and companies. Learn practical skills and earn professional certifications
Udemy
Thousands of online courses tailored to your level. Learn at your own pace with expert instructors

