**Overview**

Introduction to the method of least squares- When we find the area of a triangle then it depends on base and height, hence we can say that area of the triangle is the function of base and height. Symbolically and mathematically the relationship is defined as below-

z is called a function of two variables x and y if z has one definite value for every pair of values of x and y.

it is written as

z = f (x, y)

The variable x and y are called independent variables while z is called the dependent variable.

Note- the function z = f (x, y) represents a surface.

**Method of least squares**

Suppose

y = a + bx ………. (1)

is the straight line has to be fitted for the data points given-

Let y1 be the theoretical value for x1

Now-

For the minimum value of S –

Or

Now

Or

On solving equation (1) and (2), we get-

These two equations are known as the normal equations.

Now on solving these two equations we get the values of a and b.

**Solved example**s

**Example: Find the straight line that best fits of the following data by using method of least square.**

X | 1 | 2 | 3 | 4 | 5 |

y | 14 | 27 | 40 | 55 | 68 |

Sol.

Suppose the straight line

y = a + bx…….. (1)

Fits the best-

Then-

x | y | xy | x^2 |

1 | 14 | 14 | 1 |

2 | 27 | 54 | 4 |

3 | 40 | 120 | 9 |

4 | 55 | 220 | 16 |

5 | 68 | 340 | 25 |

Sum = 15 | 204 | 748 | 55 |

Normal equations are-

Put the values from the table, we get two normal equations-

On solving the above equations, we get-

So that the best fit line will be- (on putting the values of a and b in equation (1))

**Example: Find the best values of a and b so that y = a + bx fits the data given in the table**

x | 0 | 1 | 2 | 3 | 4 |

y | 1.0 | 2.9 | 4.8 | 6.7 | 8.6 |

**Solution:**

y = a + bx

Normal equations,

On putting the values of in (2) and (3), we get

On solving (4) and (5) we get,

Substituting the values of a and b in (1) we obtain

Interested in learning about similar topics? Here are a few hand-picked blogs for you!