Principle of Least Square
Principle of Least Square
𝑦 = 𝑓(𝑥, 𝑎0 , 𝑎1 , … … … , 𝑎𝑛 ),
Subject to variations in 𝑎0 , 𝑎1 , … … … , 𝑎𝑛 .
𝜕𝐸
𝜕𝑎𝑖
= 0; 𝑖 = 1, 2, … … … , 𝑛. (2)
## Fitting of curves is also useful in the study of correlation and regression; and the line of regression can
be considered as fitting of linear curves to the given bivariate distribution.
Fitting of a Parabola:
Suppose we are given a set of values (𝑥𝑖 , 𝑦𝑖 ), 𝑖 = 1, 2, … … … , 𝑛, where 𝑥 is independent variable and 𝑦 the
dependent variable. Such values can be located as points in the xy-plane.
𝑌 = 𝑎 + 𝑏𝑋 + 𝑐𝑋 2 (3)
𝜕𝐸 𝜕𝐸 𝜕𝐸
𝜕𝑎
= 0; 𝜕𝑏
= 0 and 𝜕𝑐
=0 (6)
𝜕𝐸
= −2 ∑𝑛𝑖=1[𝑦𝑖 − 𝑎 − 𝑏𝑥𝑖 − 𝑐𝑥𝑖 2 ] = 0,
𝜕𝑎
𝜕𝐸
= −2 ∑𝑛𝑖=1 𝑥𝑖 [𝑦𝑖 − 𝑎 − 𝑏𝑥𝑖 − 𝑐𝑥𝑖 2 ] = 0, (7)
𝜕𝑏
𝜕𝐸
= −2 ∑𝑛𝑖=1 𝑥𝑖 2 [𝑦𝑖 − 𝑎 − 𝑏𝑥𝑖 − 𝑐𝑥𝑖 2 ] = 0. }
𝜕𝑐
Fitting a Straight Line: By applying the similar process and putting 𝑐 = 0, the normal equations
for fitting a straight line 𝑌 = 𝑎 + 𝑏𝑋 are
∑𝑛𝑖=1 𝑦𝑖 = 𝑛𝑎 + 𝑏 ∑𝑛𝑖=1 𝑥𝑖 ,
ቋ (9)
∑𝑛𝑖=1 𝑥𝑖 𝑦𝑖 = 𝑎 ∑𝑛𝑖=1 𝑥𝑖 + 𝑏 ∑𝑛𝑖=1 𝑥𝑖 2 .
For the given data, we can calculate ∑ 𝑥 , ∑ 𝑦 , ∑ 𝑥𝑦 , ∑ 𝑥 2 , and the constants 𝑎 and 𝑏 can be
determined by solving equations (9).
We apply the same process for all the above curves. (Now we take the first curve)
Taking logarithm of each side, we get
This is a linear equation in U and V. Therefore, the normal equations for estimating A and b are:
∑𝑛𝑖=1 𝑉𝑖 = 𝑛𝐴 + 𝑏 ∑𝑛𝑖=1 𝑈𝑖 ,
ቋ (12)
∑𝑛𝑖=1 𝑈𝑖 𝑉𝑖 = 𝐴 ∑𝑛𝑖=1 𝑈𝑖 + 𝑏 ∑𝑛𝑖=1 𝑈𝑖 2 .
x 0 1 2 3 4
∑𝑛𝑖=1 𝑦𝑖 = 𝑛𝑎 + 𝑏 ∑𝑛𝑖=1 𝑥𝑖 ,
ቋ 𝑤𝑖𝑡ℎ 𝑛 = 5
∑𝑛𝑖=1 𝑥𝑖 𝑦𝑖 = 𝑎 ∑𝑛𝑖=1 𝑥𝑖 + 𝑏 ∑𝑛𝑖=1 𝑥𝑖 2 .
x y xy 𝑥2
0 1 0 0
1 1.8 1.8 1
2 3.3 6.6 4
3 4.5 13.5 9
4 6.3 25.2 16
16.9 = 5𝑎 + 10,
The normal equations become ൠ (1)
47.1 = 10𝑎 + 30𝑏.
Example 2. If 𝑃 is the pull required to lift a load 𝑊 by means of a pulley block, find a linear law
of the form 𝑃 = 𝑚𝑊 + 𝑐 connecting 𝑃 𝑎𝑛𝑑 𝑊, using the following data:
𝑃 12 15 21 25
𝑊 50 70 100 120
where 𝑃 𝑎𝑛𝑑 𝑊 are taken in kg-wt. Compute 𝑃 𝑤ℎ𝑒𝑛 𝑊 = 150 𝑘𝑔. 𝑤𝑡.
∑ 𝑃 = 4𝑐 + 𝑚 ∑ 𝑊 ,
Solution: The normal equations are ൠ (1)
∑ 𝑊𝑃 = 𝑐𝑊 + 𝑚 ∑ 𝑊 2 .
W P WP 𝑊2
50 12 600 2500
70 15 1050 4900
4 6.3 25.2 16
365 = 4𝑐 + 340𝑚,
ൠ (2)
6750 = 340𝑐 + 31800𝑚.
When 𝑊 = 150 𝑘𝑔. 𝑤𝑡, 𝑃 = 2.28 + 0.19 × 150 = 30.78 𝑘𝑔. 𝑤𝑡.
Solution:
𝒙 𝒚 𝒙𝟐 𝒙𝟑 𝒙𝟒 𝒙𝒚 𝒙𝟐 𝒚
0 1 0 0 0 0 0
∑ 𝑦 = 𝑛𝑎 + 𝑏 ∑ 𝑥 + 𝑐 ∑ 𝑥 2 ,
∑ 𝑥𝑦 = 𝑎 ∑ 𝑥 + 𝑏 ∑ 𝑥 2 + 𝑐 ∑ 𝑥 3 , (1)
∑ 𝑥2𝑦 = 𝑎 ∑ 𝑥2 + 𝑏 ∑ 𝑥3 + 𝑐 ∑ 𝑥4 . }
1. Show that the best fitting linear function for points (𝑥𝑖 , 𝑦𝑖 ), 𝑖 = 1, 2, … … … , 𝑛, may be expressed
𝑥 𝑦 1
in the form [ ∑ 𝑥𝑖 ∑ 𝑦𝑖 𝑛 ] = 0. Show that the line passes through the mean point (𝑥̅ , 𝑦̅).
∑ 𝑥𝑖2 ∑ 𝑥𝑖 𝑦𝑖 ∑ 𝑥𝑖
2. Fit a straight line to the following data taking 𝑦 as the dependent variable:
𝑥 1 2 3 4 5 6 7 8 9
𝑦 9 8 10 12 11 13 14 16 15
Ans. 𝑦 = 8 − 0.5𝑥.
3. Example 3. Fit a parabola of second degree to the following data:
𝑥 0 1 2 3 2
𝑦 1 5 10 22 38
𝑥 1 2 3 4 5 6 7 8
Ans. 𝑦 = 0.6821(1.38)𝑥 .