Nothing Special   »   [go: up one dir, main page]

Method of Least Squares Notes

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

SRI KRISHNA COLLEGE OF ENGINEERING AND TECHNOLOGY

(AN AUTONOMOUS INSTITUTION| AFFILIATED TO ANNA UNIVERSITY|ACCREDITED BY NAAC WITH “A” GRADE)
ACCREDITED BY NBA (CSE, ECE, IT, MECH ,EEE, CIVIL& MCT)
KUNIAMUTHUR, COIMBATORE, TAMILNADU, INDIA

PRINCIPLE OF LEAST SQUARE METHOD

www.skcet.ac.in
PROBLEM
By the method of principle of least squares find the best fitting straight line to the
data given below:
x 5 10 15 20 25
y 15 19 23 26 30

SOLUTION:
Let the straight line be 𝑦 = 𝑎𝑥 + 𝑏
The normal equations are
𝑎 ෍ 𝑥 + 5𝑏 = ෍ 𝑦 … … … … … … … … . . (1)

𝑎 ෍ 𝑥 2 + 𝑏 ෍ 𝑥 = ෍ 𝑥𝑦 … … … … … … … . (2)
To calculate σ 𝑥 , σ 𝑥 2 , σ 𝑦 , σ 𝑥𝑦 we form below the table.

𝑥 𝑦 𝑥2 𝑥𝑦
5 16 25 80
10 19 100 190
15 23 225 345
20 26 400 520
25 30 625 750
75 114 1375 1885
TOTAL
The normal equations are 75𝑎 + 5𝑏 = 114 … … … … … . (3)
1375𝑎 + 75𝑏 = 1885 … … … … . (4)
Eliminate b; Multiply (3) by 15,
1125𝑎 + 75𝑏 = 1710 … … … … . . (5)
(4)-(5) gives, 250𝑎 = 175, 𝑎 = 0.7; 𝑏 = 12.3
The best fitting line is 𝑦 = 0.7𝑥 + 12.3
PROBLEM
Fit a straight line to the data given below. Also estimate the value of 𝑦 𝑎𝑡 𝑥 = 2.5

x 0 1 2 3 4
y 1 1.8 3.3 4.5 6.3

SOLUTION:
Let the best fit be 𝑦 = 𝑎𝑥 + 𝑏 … … … … … … . . (1)
The normal equations are
𝑎 ෍ 𝑥 + 5𝑏 = ෍ 𝑦 … … … … … … … … … … … . . (2)

𝑎 ෍ 𝑥 2 + 𝑏 ෍ 𝑥 = ෍ 𝑥𝑦 … … … … … … … … … . (3)
To calculate σ 𝑥 , σ 𝑥 2 , σ 𝑦 , σ 𝑥𝑦 we form below the table.

𝑥 𝑦 𝑥2 𝑥𝑦
0 1.0 0 0
1 1.8 1 1.8
2 3.3 4 6.6
3 4.5 9 13.5
4 6.3 16 25.2
TOTAL 10 16.9 30 47.1
Substituting in (2) and (3), We get,
10𝑎 + 5𝑏 = 16.9
30𝑎 + 10𝑏 = 47.1
Solving, we get 𝑎 = 1.33 , 𝑏 = 0.72
The equation is 𝑦 = 1.33𝑥 + 0.72
𝑦 𝑎𝑡 𝑥 = 2.5 = 1.33 2.5 + 0.72 = 4.045.
PROBLEM
Fit a parabola, by the method of least squares, to the following data; also estimate
𝑦 𝑎𝑡 𝑥 = 6.
x 1 2 3 4 5
y 5 12 26 60 97

SOLUTION:
Let 𝑦 = 𝑎𝑥 2 + 𝑏𝑥 + 𝑐 be the best fit.
The normal equations are,
𝑎 ෍ 𝑥 2 + 𝑏 ෍ 𝑥 + 5𝑐 = ෍ 𝑦 … … … … … … . … … (1)

𝑎 ෍ 𝑥 3 + 𝑏 ෍ 𝑥 2 + 𝑐 ෍ 𝑥 = ෍ 𝑥𝑦 … … … … . . … (2)

𝑎 ෍ 𝑥 4 + 𝑏 ෍ 𝑥 3 + 𝑐 ෍ 𝑥 2 = ෍ 𝑥 2 𝑦 … … … … … (3)
To calculate σ 𝑥 , σ 𝑥 2 , σ 𝑦 , σ 𝑥𝑦 and so on, we form below the table.

𝑥 𝑦 𝑥2 𝑥3 𝑥4 𝑥𝑦 𝑥 2𝑦
1 5 1 1 1 5 5
2 12 4 8 16 24 48
3 26 9 27 81 78 234
4 60 16 64 256 240 960
5 97 25 125 625 485 2425
15 200 55 225 979 832 3672
Total

Hence the equations (1), (2), (3) become,


55𝑎 + 15𝑏 + 5𝑐 = 200 … … … … … … … … … … . (4)
225𝑎 + 55𝑏 + 15𝑐 = 832 … … … … … … … … … (5)
979𝑎 + 225𝑏 + 55𝑐 = 3672 … … … … … … … … (6)
Solving we get,𝑎 = 5.7143, 𝑏 = −11.0858, 𝑐 = 10.4001

The parabola is 𝑦 = 5.7143𝑥 2 − 11.0858𝑥 + 10.4001

𝑦 𝑥 = 6 = 149.6001
PROBLEM
From the table given below, find the best values of ‘a’ and ‘b’ in the law 𝑦 =
𝑎𝑒 𝑏𝑥 by the method of least squares.
𝑥 0 5 8 12 20
𝑦 3.0 1.5 1.0 0.55 0.18

SOLUTION:
𝑦 = 𝑎𝑒 𝑏𝑥
log10 𝑦 = log10 𝑎 + 𝑏𝑥 log10 𝑒
𝑌 = 𝐴 + 𝐵𝑥 … … … … … … … … … … … … … … … . (1)
The Normal equations are,
𝐵 ෍ 𝑥 + 5𝐴 = ෍ 𝑌 … … … … … … … … … … … … . (2)

𝐵 ෍ 𝑥2 + 𝐴 ෍ 𝑥 = ෍ 𝑥 𝑌 … … … … … … … … … … 3
𝑥 𝑦 𝑌 𝑥2 𝑥𝑌
0 3.0 0.4771 0 0
5 1.5 0.1761 25 0.8805
8 1.0 0 64 0
12 0.55 -0.2596 144 -3.1152
20 0.18 -0.7447 400 -14.894
Total 45 -0.3511 633 -17.1287
Using (2) and (3),

5𝐴 + 45𝐵 = −0.3511…………………………………..(4)

45𝐴 + 633𝐵 = −17.1287……………………………...(5)

Solving (4) and (5),

𝐴 = 0.4815, 𝐵 = −0.0613

𝑎 = 10𝐴 = 3.0304,

𝑏 log10 𝑒 = 𝐵 = −0.0613, 𝑏 = −0.1411

The curve is 𝑦 = 3.0304𝑒 −0.1411𝑥

You might also like