CURVE FITTING
Introduction
We often come across problems in deflection of beams, electrical circuits and mechanical
vibrations which depends up on the value of ࢞ and ࢟ although we do not know the functional
relationship between them. Fitting of a curve to a given set of values means finding a functional
relationship between ࢞ and ࢟. Such a curve for given set of values is called curve fitting.
The relation in general is assumed to be a linear function ࢟ = ࢇ + ࢈࢞ or a parabolic function
࢟ = ࢇ + ࢈࢞ + ࢉ࢞ or even exponential or logarithmic.
The method used for fitting the curve is based on the ‘Principle of least squares’
(a) To fit a straight line ࢟ = ࢇ + ࢈࢞
1. Substitute the observed set of n values in this equation
2. From normal equation for each constant i.e.
σ ܽ݊ = ݕ+ ܾσ ݔ, σ ܽ = ݕݔσ ݔ+ ܾσ ݔ2 ,
(The normal equation for the unknown a is obtained by multiplying the equation by the
coefficient of a and adding. The normal equation for b is obtained by multiplying the
equation by the coefficient of b and adding.)
3. Solve these normal equation as simultaneous equation for a and b.
4. Substitute the value of a and b in y = a + bx, which is the required line of best fit.
(b) To fit the parabola ࢟ = ࢇ + ࢈࢞ + ࢉ࢞
1. From the normal equation
σ ܽ݊ = ݕ+ ܾσ ݔ+ ܿ σ ݔ2
σ ܽ = ݕݔσ ݔ+ ܾσ ݔ2 + ܿ σ ݔ3 &
σ ݔ2 ܽ = ݕσ ݔ2 + ܾ σ ݔ3 + ܿ σ ݔ4
(The normal equation for c has been obtained by multiplying the equation by the
coefficient of c & adding.)
2. Solve these as simultaneous equations for a, b and c
3. Substitute the values of a, b, c in ࢟ = ࢇ + ࢈࢞ + ࢉ࢞ which is the required parabola of
best fit.
SOLVED PROBLEMS
Example: 1. Fit a straight line from the following data
x 12 15 21 25
y 50 70 100 120
Solution: To fit a straight line ࢟ = ࢇ + ࢈࢞……………………..(1), then
Corresponding normal equations are
σ ܽ݊ = ݕ+ ܾσ(……………………………………… ݔ2)
2 | APPLIED MATHEMATICS
σ ܽ = ݕݔσ ݔ+ ܾσ ݔ2 ……………………………………(3)
x y ࢞ xy
12 50 144 600
15 70 225 1050
21 100 441 2100
25 120 625 3000
σ =ݔ73 σ =ݕ340 σ = ݔ14352 σ = ݕݔ6750
From eq. (2) and (3) we have
340 = 4a + b (73)
6750 = a (73) + b (1435)
a = -11.8 , b = 5.3
From (1) the equation of line is ࢟ = ࢇ + ࢈࢞
y = -11.8 + 5.3x
Example: 2. Fit a straight line from the following data with x-as independent variable.
x 1965 1966 1967 1968 1969
y 125 140 165 195 200
Solution: To fit a straight line ࢅ = ࢇ + ࢈ࢄ…………(1), then
Corresponding normal equations are
σܻ = ݊ܽ + ܾσܺ …………………………………… .(2)
σܻܺ = ܽ σ ܺ + ܾσܺ 2 …………………………………(3)
x y Y=y X= x-1965 XY X2
1965 125 125 -2 -250 4
1966 140 140 -1 -140 1
1967 165 165 0 0 0
1968 195 195 1 195 1
1969 200 200 2 400 4
σ ܻ= 825 σ ܺ=0 σ ܻܺ = 205 2
σ ܺ =10
From eq. (2) and (3) we have
825 = 5a + b (0)
205 = a (0) + b (10)
a = 165 , b = 20.5
From (1) the equation of line is ܻ = ࢇ + ࢈ࢄ
Y =165 + 20.5X X X 165 & Y y we get
?y 20.5 x 40158.5
CURVE FITTINGS | 3
Example: 3. Fit a straight line from the following data.
x 1 2 3 4 5 6
y 49 54 60 73 80 86
Solution: To fit a straight line ࢇ = ݕ+ ࢈࢞…………(1), then
Corresponding normal equations are
σ ܽ݊ = ݕ+ ܾσ …………………………………… ݔ.(2)
σ ܽ = ݕݔσ ݔ+ ܾσ ݔ2 …………………………………(3)
x y xy x2
1 49 49 1
2 54 108 4
3 60 180 9
4 73 292 16
5 80 400 25
6 86 516 36
σ = ݔ21 σ =ݕ402 σ = ݕݔ1545 σ ݔ2 =91
From eq. (2) and (3) we have
402 = 6a + b (21)
1545 = a (21) + b (91)
Solving above simultaneously we get
a = 39.39 , b = 7.88
From (1) the equation of line is ࢇ = ݕ+ ࢈࢞
?y 7.88 x 39.39
Example 4: Fit a straight line from the following data.
x -1 1 2 3 4
y -5 1 4 7 10
Estimate y when x = 7.
Solution: To fit a straight line ࢇ = ݕ+ ࢈࢞…………(1), then
Corresponding normal equations are
σ ܽ݊ = ݕ+ ܾσ …………………………………… ݔ.(2)
σ ܽ = ݕݔσ ݔ+ ܾσ ݔ2 …………………………………(3)
x y xy x2
-1 -5 5 1
1 1 1 1
4 | APPLIED MATHEMATICS
2 4 8 4
3 7 21 9
4 10 40 16
σ = ݔ9 σ =ݕ17 σ = ݕݔ75 σ ݔ2 =31
From eq. (2) and (3) we have
17 = 5a + b (9)
75 = a (9) + b (31)
Solving above simultaneously we get
a = -2, b=3
From (1) the equation of line is ࢇ = ݕ+ ࢈࢞
?y 3x 2 ?y x 7 19
Example 5: Fit a straight line from the following data and estimate the production in 1957.
year (x) 1951 1961 1971 1981 1991
Production (y) 10 12 8 10 13
Solution: To fit a straight line ࢅ = ࢇ + ࢈ࢄ…………(1), then
Corresponding normal equations are
σܻ = ݊ܽ + ܾσܺ ……………………………………(2)
σܻܺ = ܽ σ ܺ + ܾσܺ 2 …………………………………(3)
Where X = x – 1971, & Y=y
x X= x-1971 Y=y ࢄ XY
1951 -20 10 400 -200
1961 -10 12 100 -120
1971 0 8 0 0
1981 10 10 100 100
1991 20 13 400 260
σ ܺ= 0 σ ܻ= 53 σ ܺ 2 =1000 σ ܻܺ = 40
From eq. (2) and (3) we have
53 = 5a + b(0) a = 10.6 &
40 = a(0) + b (1000) b = 0.04
From (1) Y = 10.6 + 0.04 X
X = x -1971 & Y = y, we have
y = 10.6 + 0.04 (x -1971)
y = 0.04x – 68.24
Expected production in 1957 is y = 10.04 Tones
CURVE FITTINGS | 5
Example 6. Fit a straight line from the following data in Tones
year (x) 1941 1951 1961 1971 1981
Production (y) 8 10 12 10 16
& find the expected production in 1986.
Solution: To fit a straight line ࢅ = ࢇ + ࢈ࢄ……………………..(1), then
Corresponding normal equations are
σܻ = ݊ܽ + ܾσܺ ………………………………………(2)
σܻܺ = ܽ σ ܺ + ܾσܺ 2 ……………………………………(3)
Where X = x – 1961, & Y=y
x X= x-1961 Y=y ࢄ XY
1941 -20 8 400 -160
1951 -10 10 100 -100
1961 0 12 0 0
1971 10 10 100 100
1981 20 16 400 320
σ ܺ= 0 σ ܻ= 56 2
σ ܺ =1000 σ ܻܺ = 160
From eq. (2) and (3) we have
56 = 5a + b(0) a = 11.2 &
160 = a(0) + b (1000) b = 0.16
From (1) Y = 11.2 + 0.16 X
X = x -1961 & Y = y, we have
y = 11.2 + 0.16 (x -1961)
y = 0.16x – 302.56
Expected production in 1986 is y = 15.2 Tones
Example 7. Fit a second degree parabolic curve from the following data
x 1 2 3 4 5 6 7 8 9
y 2 6 7 8 10 11 11 10 9
To fit a parabola ܻ = ܽ + ܾܺ + ܿܺ 2 …………………………………….(1)
Then corresponding nominal equations are
σܻ = ݊ܽ + ܾσܺ + ܿܺ 2 …………………………………………….(2)
σܻܺ = ܽ σ ܺ + ܾσܺ 2 + ܿ σ ܺ 3 …………………………………...(3)
σܺ 2 ܻ = ܽ σ ܺ 2 + ܾ σ ܺ 3 + ܿ σ ܺ 4 ………………………………...(4)
Where X = x – 5, and Y=y
6 | APPLIED MATHEMATICS
x X= x-5 ࢄ ࢄ ࢄ Y= y XY ࢄ ࢅ
1 -4 16 -64 256 2 -8 32
2 -3 9 -27 81 6 -18 54
3 -2 4 -8 16 7 -14 28
4 -1 1 -1 1 8 -8 8
5 0 0 0 0 0 0 0
6 1 1 1 1 11 11 11
7 2 4 8 16 11 22 44
8 3 9 27 81 10 30 90
9 4 16 64 256 9 36 144
σ ܺ= 0 2
σ ܺ = 60 3
σ ܺ =0 4
σ ܺ = 708 σ ܻ = 74 σ ܻܺ=51 2
σ ܺ ܻ=411
From equation (2) , (3) and (4) we have,
74 = 9a + b(0) + c(60)
51 = a(0) + b(60) + c (0)
411 = a(60) + b (0) + c (708)
a = 10, b = 0.85 and c = - 0.27
From equation (1), Y = 10 + 0.85X – 0.27ܺ 2
X = x – 5 & Y = y , we have
y = 10 + 0.85 (x – 5) – 0.27 ( ݔെ 5)2
= 10 + 0.85x – 4.25 – 0.27 ݔ2 + 2.7 x – 6.75
= - 1 + 3.55x – 0.27 ݔ2
Example 8: Fit a curve y ax bx 2 for the following data.
x 1 2 3 4 5 6
y 2.51 5.82 9.93 14.84 20.55 27.06
Solution: To fit a curve ݔܽ = ݕ+ ܾ ݔ2 …………………………………….(1)
Then corresponding nominal equations are
σܽ = ݕݔσ ݔ2 + ܾ σ ݔ3 ………………………………...(2)
σ ݔ2 ܽ = ݕσ ݔ3 + ܾ σ ݔ4 ……………………………….(3)
x y ࢞ ࢞ ࢞ xy ࢞ ࢟
1 2.51 1 1 1 2.51 2.51
2 5.82 4 8 16 11.64 23.28
3 9.93 9 27 81 29.79 89.37
4 14.84 16 64 256 59.36 237.44
CURVE FITTINGS | 7
5 20.55 25 125 625 102.75 513.75
6 27.06 36 216 1296 162.36 974.16
σ =ݔ21 σ =ݕ σ ݔ2 = 91 σ ݔ3 =441 σ ݔ4 = 2275 σ =ݕݔ368.41 σ ݔ2 =ݕ1840.51
From equation (2) , and (3) we have,
368.41 = 91 a + 441b
1840.51 = 441a + 2275b
a = 2.11, b = 0.4
From equation (1), y = 2.11x+0.4x2
Example 9: Fit a second degree parabolic curve from the following data.
x 1 2 3 4 5 6 7 8 9
y 2 6 7 8 10 11 11 10 9
Solution: To fit a parabola ܻ = ܽ + ܾܺ + ܿܺ 2 …………………………………….(1)
Then corresponding nominal equations are
σܻ = ݊ܽ + ܾσܺ + ܿܺ 2 …………………………………………….(2)
σܻܺ = ܽ σ ܺ + ܾσܺ 2 + ܿ σ ܺ 3 …………………………………...(3)
σܺ 2 ܻ = ܽ σ ܺ 2 + ܾ σ ܺ 3 + ܿ σ ܺ 4 ………………………………...(4)
Where X = x – 5, and Y=y
x X= x-5 ࢄ ࢄ ࢄ Y= y XY ࢄ ࢅ
1 -4 16 -64 256 2 -8 32
2 -3 9 -27 81 6 -18 54
3 -2 4 -8 16 7 -14 28
4 -1 1 -1 1 8 -8 8
5 0 0 0 0 0 0 0
6 1 1 1 1 11 11 11
7 2 4 8 16 11 22 44
8 3 9 27 81 10 30 90
9 4 16 64 256 9 36 144
σ ܺ= 0 σ ܺ 2 = 60 σ ܺ 3 =0 σ ܺ 4 = 708 σ ܻ = 74 σ ܻܺ=51 σ ܺ 2 ܻ=411
From equation (2) , (3) and (4) we have,
74 = 9a + b(0) + c(60)
51 = a(0) + b(60) + c (0)
411 = a(60) + b (0) + c (708)
a = 10, b = 0.85 and c = - 0.27
From equation (1), Y = 10 + 0.85X – 0.27ܺ 2
8 | APPLIED MATHEMATICS
X = x – 5 & Y = y , we have
y = 10 + 0.85 (x – 5) – 0.27 ( ݔെ 5)2
= 10 + 0.85x – 4.25 – 0.27 ݔ2 + 2.7 x – 6.75
= - 1 + 3.55x – 0.27 ݔ2
EXERCISE
Ex. 1 - Fit a straight line y = a + bx from the following data by the method of least square.
x 0 1 3 6 8
y 1 3 2 5 4
[Ans: y = 1.6 + 0.38x]
Ex. 2 – In some determinations of volume ߥ of carbon dioxide dissolve in a given volume of water
at different temperature ߠ, the following pairs of values were obtained.
ߠ 0 5 10 15
ߥ 1.80 1.45 1.18 1.00
Obtained by the method of least square, a relation of the form ߥ = a + bߠ which best fits to these
observations. [ Ans: ߥ = 1.758 – 0.053ߠ]
Ex. 3 - Find the parabola of the form ܽ = ݕ+ ܾ ݔ+ ܿ ݔ2 which fits most closely with the
observations.
x -3 -2 -1 0 1 2 3
y 4.63 2.11 0.67 0.09 0.63 2.15 4.58
[Ans: y = 1.243 - 0.004x + 0.22 ݔ2 ]
Ex. 4 – Fit a second degree parabolic curve from the following data
x 1.0 1.5 2.0 2.5 3.0 3.5 4.0
y 1.1 1.3 1.6 2.0 2.7 3.4 4.1
[Ans: y = 1.04 - 0.198x + 0.244 ݔ2 ]
Ex. 5 - Fit a second degree parabolic curve from the following data and estimate the value for
1979
Years 1973 1974 1975 1976 1977
Sales( in Thousands) 10 12 13 10 8
[Ans: y = -3341638.315 + 3384.55x – 0.857 ݔ2 , - 3.802]
Ex. 6 – Fit a parabola ܽ = ݕ+ ܾ ݔ+ ܿ ݔ2 from the following data.
x -3 -2 -1 0 1 2 3
y 4.63 2.11 0.67 0.09 0.63 2.15 4.58
[Ans: y = 1.243 - 0.004x + 0.22 ݔ2 ]