Goseeko blog

# What is the method of least squares?

## 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 examples

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

Sol.

Suppose the straight line

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

Fits the best-

Then-

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

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!