# Curve Fitting and Method of Least Squares

Curve Fitting

Curve fitting is the process of introducing mathematical relationships between dependent and independent variables in the form of an equation for a given set of data.

Method of Least Squares

The method of least squares helps us to find the values of unknowns $a$ and $b$ in such a way that the following two conditions are satisfied:

• The sum of the residual (deviations) of observed values of $Y$ and corresponding expected (estimated) values of $Y$ will be zero. $\sum \left( {Y – \widehat Y} \right) = 0$.
• The sum of the squares of the residual (deviations) of observed values of $Y$ and corresponding expected values ($\widehat Y$) should be at least $\sum {\left( {Y – \widehat Y} \right)^2}$.

Fitting of a Straight Line

A straight line can be fitted to the given data by the method of least squares. The equation of a straight line or least square line is $Y = a + bX$, where $a$ and $b$ are constants or unknowns.

To compute the values of these constants we need as many equations as the number of constants in the equation. These equations are called normal equations. In a straight line there are two constants $a$ and $b$ so we require two normal equations.

Normal Equation for ‘a       $\sum Y = na + b\sum X$

Normal Equation for ‘b       $\sum XY = a\sum X + b\sum {X^2}$

The direct formula of finding $a$ and $b$ is written as

$b = \frac{{\sum XY – \frac{{\left( {\sum X} \right)\left( {\sum Y} \right)}}{n}}}{{\sum {X^2} – \frac{{{{\left( {\sum X} \right)}^2}}}{n}}}{\text{ }}, \,\,\,\,\,\,\,\,\,\,\,\,a = \overline Y – b\overline X$