0% found this document useful (0 votes)
24 views37 pages

Curve Fitting

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views37 pages

Curve Fitting

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

NATIONAL INSTITUTE OF TECHNOLOGY : TIRUCHIRAPPALLI

Dr. K. Murugesan
Professor(HAG)
Department of Mathematics
National Institute of Technology, Tiruchirappalli 620015,
Tamil Nadu, India
Email : [email protected]

LECTURE NOTES ON CURVE FITTING

[Curve fitting - method of group averages - method of least squares - Solving difference equation with constant
coefficients ]

1
CURVE FITTING

1 Introduction
Very often in engineering and science, we obtain experimentally a number of corresponding values of
two variables x and y. It will be necessary to find a mathematical relation between them. This relation
when written as an equation y = f (x), is called an empirical equation. Many times we may not able to
get an exact relation but we may get only an approximate curve. This approximating curve is an empirical
equation and the method of finding such an approximating curve is called curve fitting.
The constants occurring in the equation of the approximating curve can be found by various methods.
If (xi , yi ), i = 1, 2, . . . n are the n paired data which are plotted on the graph sheet, it is possible to draw a
number of smooth curves passing through the points. So the approximating curve is not unique.

2 Method of group averages

2.1 Equations involving two constants

To fit a straight line


Let (xi , yi ), i = 1, 2, . . . n are the n sets of observations and the law relating x and y be

y = a + bx. (2.1)

We assume that the law is a linear one. We want to determine a and b. By assumption, y = a + bx is the
law, it doesn’t mean the points lie on the straight line. It is only an approximating straight line and it is
possible that no point may lie on the line.

y
Pn (xn , yn )
Pn (xn , yn )

Qn

P3 (x3 , y3 )
P3 (x3 , y3 )

Q3
Q2
P1 (x1 , y1 )
P1 (x1 , y1 )

Q1
P2 (x2 , y2 )
P2 (x2 , y2 )

x
M1 M2 M3 Mn

2
We plot the points (xi , yi ) by Pi , i = 1, 2, . . . n. The ordinates at x = xi , meets the straight line at Qi ,
i = 1, 2, . . . n. We have,

Pi Mi = yi = observed value of y at xi
Qi Mi = a + bxi = expected value of y at xi
di = Qi Pi = Pi Mi − Qi Mi = yi − (a + bxi )

which is the difference between the observed values y and the expected value of y is called the residual at
x = xi . In general di ’s may be positive or negative.
Principle: The method of group averages is based on the principle that the sum of the residuals at all points
P
is zero. That is di = 0.
Since we require two equations to find two unknowns a and b, we divide the given data into two groups,
first one containing γ sets of values and the other containing n − γ sets of values. We apply the principle
P
di = 0 for each group. Now consider the first group.

γ
X
[yi − (a + bxi )] = 0.
i=1
γ
X γ
X
=⇒ yi = (a + bxi ).
i=1 i=1
Xγ Xγ
=⇒ γa + b xi = yi
i=1 i=1
 Pγ  Pγ
i=1 xi i=1 yi
=⇒ a + b =
γ γ
=⇒ a + bx1 = y1 (2.2)

where x1 , y1 are the averages of x’s and y’s of the first group.
Now considering the second group,
n
X
[yi − (a + bxi )] = 0.
i=γ+1
n
X n
X
=⇒ yi = (a + bxi ).
i=γ+1 i=γ+1
Xn Xn
=⇒ (n − γ)a + b xi = yi .
i=γ+1 i=γ+1
Pn ! Pn
i=γ+1 xi i=γ+1 yi
=⇒ a + b =
(n − γ) (n − γ)

=⇒ a + bx2 = y2 (2.3)

where x2 , y2 are the averages of x’s and y’s of the second group.
From (2.2) and (2.3), we determine the values of a and b. Using these values in (2.1) we get the relation
y = a + bx.

3
Remark:
1. The answer is not unique since the grouping can be done in many ways. This is an important defect
of this method.

2. In general, we shall divide the data into two groups so that both contain the same number of points.

3. The relation we found using this method is a straight line passes through the points (x1 , y1 ) and
(x2 , y2 ). Hence the equation can be determine using the following formula

y − y1 y1 − y2
=
x − x1 x1 − x2

4. The equation got is only an approximate fit to the data given.

Example.
1. Find a straight line fit of the form y = a + bx, by the method of group averages for the following data.
x : 0 5 10 15 20 25
y : 12 15 17 22 24 30
Solution.
Let us divide the data into two groups each containing three sets of data.

Group I Group II
x y x y
0 12 15 22
5 15 20 24
10 17 25 30
P P P P
x =15 y =44 x =60 y =76

15
x1 = =5
3
44
y1 = = 14.6666
3
60
x2 = = 20
3
76
y2 = = 25.3333
3

Substituting the average values of each group in the relation y = a + bx, we get

a + 5b = 14.6666
a + 20b = 25.3333

Solving for a and b we get, a = 11.11105 and b = 0.71111


Hence the straight line is y = 11.11105 + 0.71111x

4
2. The following numbers relate to the flow of water over a triangular notch.
H : 1.2 1.4 1.6 1.8 2.0 2.4
Q : 4.2 6.1 8.5 11.5 14.9 23.5
If the law is Q = CH n , find C and n by the method of group averages.
Solution.
Given the law is Q = CH n .
By taking logarithm on both sides we have,log10 Q = log10 C +n log10 H. This is of the form y = a+nx
where log10 Q = y, log10 C = a and log10 H = x. Now we can fit a straight line y = a + nx.
Let us divide the data into two groups each containing three sets of data.

Group I Group II
x = log10 H y = log10 Q x = log10 H y = log10 Q
0.07918 0.62325 0.25527 1.06070
0.14163 0.78533 0.30103 1.17319
0.20412 0.92942 0.38021 1.37107
P P P P
x =0.42493 y =2.33800 x =0.93651 y =3.60496

0.42493
x1 = = 0.14164
3
2.33800
y1 = = 0.77933
3
0.93651
x2 = = 0.31217
3
3.60496
y2 = = 1.20165
3

Substituting the average values of each group in the relation y = a + nx, we get

a + (0.14164)n = 0.77933
a + (0.31217)n = 1.20165

Solving for a and n we get, a = 0.428557 and n = 2.47651


Hence C = 10a = 100.428557 = 2.68261.
Hence the law is Q = (2.68261)H 2.47651

3. Fit a curve of the form y = a + bx3 by the method of group averages given that
x : 5 7 9 11 12
y : 290 560 1144 1810 2300
Solution.
Put x3 = X. Then the law becomes to the form we required, that is y = a + bX

5
Group I Group II
3
X=x y X = x3 y
125 290 1331 1810
343 560 1728 2300
729 1144
P P P P
X =1197 y =1994 X =3059 y =4110

1197
X1 = = 399
3
1994
y1 = = 664.66
3
3059
X2 = = 1529
2
4110
y2 = = 2055
2

Substituting the average values of each group in the relation y = a + bX, we get

a + (399)b = 664.66
a + (1529)b = 2055

Solving for a and b we get, a = 173.73 and b = 1.2304


Hence the straight line is y = 173.73 + 1.2304X that is y = 173.73 + 1.2304x3

2.2 Equations involving three constants


If for a given set of data, a straight line fit is not correct, we may have to fit a parabola or other types
of curves which involve three constants. We will see some of these cases.

2.2.1 The equation of the form y = a + bx + cx2 (Parabola)

In this case first we reduce the given equation to a linear one and from which, two unknowns can be
found as in the previous section.
The curve we want to fit is

y = a + bx + cx2 (2.4)

Assume that a particular point (x1 , y1 ) satisfies the equation (2.4). That is

y1 = a + bx1 + cx1 2 (2.5)

Now subtracting (2.5) from (2.4), we have

y − y1 = b(x − x1 ) + c(x2 − x1 2 )
y − y1
= b + c(x + x1 )
x − x1

6
y − y1
Setting = Y and x + x1 = X, the equation becomes
x − x1

Y = b + cX

which is linear in X and Y . Now b and c can be found out by the previous method of group averages.

Example.
1. The data given below will fit a formula of the type y = a + bx + cx2 . Find the formula.
x : 87.5 84.0 77.8 63.7 46.7 36.9
y : 292 283 270 235 197 181
Solution.
Take the point (87.5,292) as the particular point on the curve.

y = a + bx + cx2 (2.6)
2
292 = a + (87.5)b + (87.5) c (2.7)

Now, (2.6) − (2.7) gives,

2
y − 292 = b(x − 87.5) + c(x2 − (87.5) )
y − 292
= b + c(x + 87.5)
x − 87.5

y − 292
Take Y = and X = x + 87.5, we have Y = b + cX
x − 87.5
Let us divide the data into two groups each containing three sets of data.

Group I Group II
y−292 y−292
x y X = x + 87.5 Y = x−87.5 x y X = x + 87.5 Y = x−87.5
87.5 292 - - 63.7 235 151.2 2.3950
84.0 283 171.5 2.5714 46.7 197 134.2 2.3284
77.8 270 165.3 2.2680 36.9 181 124.4 2.1937
P P P P
X =336.8 Y =4.8394 X =409.8 Y =6.9171

336.8
X1 = = 168.4
2
4.8394
Y1 = = 2.4197
2
409.8
X2 = = 136.6
3
6.9171
Y2 = = 2.3057
3

7
Substituting the average values of each group in the relation Y = b + cX, we get

b + (168.4)c = 2.4197
b + (136.6)c = 2.3057

Solving for b and c we get, b = 1.8168 and c = 0.00358


Substituting the values of b and c in Y = b + cX, we have

Y = 1.8168 + (0.00358)X
y − 292
= 1.8168 + (0.00358)(x + 87.5)
x − 87.5
= (0.00358)x + 2.13
y − 292 = (x − 87.5)[(0.00358)x + 2.13]
y = (0.00358)x2 + 1.81675x + 105.62

Therefore the parabola fit is y = (0.00358)x2 + 1.81675x + 105.62

2.2.2 Equation of the pattern y = axb + c.

First we will get the value of c so that the points (x1 , y1 ), (x2 , y2 ), (x3 , y3 ) be three points on the curve
y = axb + c where x1 , x2 , x3 are in geometric progression. (i.e, x2 2 = x1 x3 ). Substituting these points on
the curve

y = axb + c, (2.8)

we have,

y1 − c = ax1 b
y2 − c = ax2 b
y3 − c = ax3 b

b
Now, (y1 − c)(y3 − c) = a2 (x1 x3 )
= a2 (x2 2 )b
= (ax2 b )2
= (y2 − c)2
y1 y3 − c(y1 + y3 ) + c2 = y2 2 + c2 − 2cy2
y1 y3 − y2 2
c=
y1 + y3 − 2y2

Using the value of c in (2.8) we have only 2 unknowns left out. Taking logarithm on both sides of (2.8),

log10 (y − c) = log10 a + b log10 x.

8
It is of the form Y = A + bX where Y = log10 (y − c), A = log10 a, X = log10 x which is linear in X and Y .

Example.
1. Fit a curve of the form y = axb + c to the following data.
x : 2 4 6 8 10
y : 5.0 8.6 13.9 25.3 35.6
Solution
We search for three values of x’s which are in G.P.
∴, x1 = 2, x2 = 4, x3 = 8 so that x1 x3 = x2 2
The value of c can be obtained from

y1 y3 − y2 2
c=
y1 + y3 − 2y2
5(25.3) − (8.6)2
=
5 + 25.3 − 2(8.6)
= 4.01

Now the equation of curve becomes

y = axb + 4.01
y − 4.01 = axb (2.9)

Taking logarithm on both sides of (2.9),

log10 (y − 4.01) = log10 a + b log10 x.

It is of the form Y = A + bX where Y = log10 (y − 4.01), A = log10 a, X = log10 x, which is linear in


X and Y . Now the unknowns A and b can be found by the previous method for linear fit.
Let us divide the data into two groups.

Group I
x y X = log10 x y − 4.01 Y = log10 (y − 4.01)
2 5.0 0.3010 0.99 -0.0044
4 8.6 0.6020 4.59 0.6618
6 13.9 0.7782 9.89 0.9952
P P
X =1.6812 Y =1.6526

Group II
x y X = log10 x y − 4.01 Y = log10 (y − 4.01)
8 25.3 0.9031 21.29 1.3281
10 35.6 1.0000 31.59 1.4995
P P
X =1.9031 Y =2.8276

9
1.6812
X1 = = 0.5604
3
1.6526
Y1 = = 0.5509
3
1.9031
X2 = = 0.9516
2
2.8276
Y2 = = 1.4138
2

Substituting the average values of each group in the relation Y = A + bX, we get

A + (0.5604)b = 0.5509
A + (0.9516)b = 1.4138

Solving for A and b we get, b = 2.2057 and A = −0.6852


Now a = 10A = 0.2064
Hence the equation is y = (0.2064)x2.2057 + 4.01

2.2.3 Equation of the form y = abx + c.

If the curve is of the form y = abx + c, we select three points (x1 , y1 ), (x2 , y2 ), (x3 , y3 ) be three points
on the curve where x1 , x2 , x3 are in arithmetical progression. (i.e, x1 + x3 = 2x2 ).
Substituting these points on the curve

y = abx + c, (2.10)

we have,

y1 − c = abx1
y2 − c = abx2
y3 − c = abx3

Now, (y1 − c)(y3 − c) = a2 bx1 +x3


= a2 b2x2
= (abx2 )2
= (y2 − c)2
y1 y3 − c(y1 + y3 ) + c2 = y2 2 + c2 − 2cy2
y1 y3 − y2 2
c=
y1 + y3 − 2y2

If this c is found out, y − c is known. From (2.10) we have,

y − c = abx
log10 (y − c) = log10 a + x log10 b

10
It can be written in the form Y = A + Bx where Y = log10 (y − c), A = log10 a, B = log10 b which is linear
in x and Y .

2.2.4 Equation of the form y = aebx + c.

The equation y = aebx + c can be written as

y = aebx + c
= a(eb )x + c
= ak x + c where k = eb (2.11)

The equation (2.11) is same as the in the previous section 2.2.3

Example.
1. The temperature θ of a vessel of cooling water and the time t in minutes since the beginning of
observation are connected by the law of the form θ = aebt + c. The corresponding values of θ and t are
given by
t : 0 1 2 3 5 7 10 15 20
θ : 52.2 48.8 46.0 43.5 39.7 36.5 33.0 28.7 26.0
Find the best values of a, b, c.
Solution
Search for values of t which are in A.P.
Take t1 = 0, t2 = 10, t3 = 20 which are in A.P.
θ1 = 52.2, θ2 = 33, θ3 = 26.0. The value of c can be obtained from

θ1 θ3 − θ2 2
c=
θ1 + θ3 − 2θ2
52.2(26.0) − (33)2
=
52.2 + 26.0 − 2(33)
= 21.98

Applying the value of c in θ = aebt + c, we have,

θ − 21.98 = aebt .

Taking logarithm on both sides, we have,

log10 (θ − 21.98) = log10 a + bt log10 e.

It can be written in the form Y = A + Bt where Y = log10 (θ − 21.98), A = log10 a, B = b log10 e which
is linear in t and Y . Now the unknowns A and B can be found by the previous method for linear fit.
Let us divide the data into two groups.

11
Group I
t θ θ − 21.98 Y = log10 (θ − 21.98)
0 52.2 30.22 1.4803
1 48.8 26.82 1.4284
2 46.0 24.02 1.3806
3 43.5 21.52 1.3328
P P
X =6 Y =5.6221

Group II
t θ θ − 21.98 Y = log10 (θ − 21.98)
5 39.7 17.72 1.2485
7 36.5 14.52 1.1620
10 33.0 11.02 1.0422
15 28.7 6.72 0.8274
20 26.0 4.02 0.6042
P P
X =57 Y =4.8843

6
t1 = = 1.5
4
5.6221
Y1 = = 1.4055
4
57
t2 = = 11.4
5
4.8843
Y2 = = 0.9769
5

Substituting the average values of each group in the relation Y = A + Bt, we get

A + (1.5)B = 1.4055
A + (11.4)B = 0.9769

Solving for A and B we get, A = 1.4704 and B = −0.04329


B
Now a = 10A = 29.5393 and b = = −0.09968
log10 e
Hence the equation is θ = (29.5393)e−0.09968t + 21.98

Exercise.
1. By the method of group of averages, fit a straight line to the following data:
x : 0 5 10 15 20 25
y : 12 15 17 22 24 30

12
b
2. Convert the equation y = to a linear form and hence determine a and b. Which will best fit
x(x − a)
the following data:
x : 3.6 4.8 6.0 7.2 8.4 9.6 10.8
y : 0.83 0.31 0.17 0.10 0.07 0.05 0.04

3. Find the best values of a and b if the following data given are related by y = ax + bx2 .
x : 1 2 3 4 5 6
y : 2.6 5.4 8.7 12.1 16 20.2

4. The following pairs of values were found for the potential difference V volts and the current A amperes
in an electric circuit and are given below:
V : 50.3 47.3 46.8 45.1 43.6
A : 1.96 2.98 3.96 5.96 9.57
Find the curve of the form V = a + Ab .

5. If p is the pull required to lift a weight w by means of a pully block, find a law of the form p = a + bw
from the following data:
w : 50 70 100 120
p : 12 15 21 25
1
6. Fit a curve of the form x = a + by given the data:
y : 0 1 2.5 5 10
x : 1.02 0.08 0.62 0.46 0.32

7. Fit a curve of the form y = abx + c given the data:


x : 1.0 1.7 2.2 2.8 3.4
y : 3.47 4.96 7.11 12.13 22.45

8. Fit a curve of the form y = axb + c to the data:


x : 2 3 4 5 6 7 8 9
y : 18 33 52 80 112 153 197 248

3 The principle of least squares


In the method of group of averages, the evaluation of constants vary from one grouping to another grouping
of data. So, we adopt another method, called the method of least squares which gives a unique set of
values to the constants in the equation of the fitting curve.

13
y
Pn (xn , yn )
Pn (xn , yn )

Qn

P3 (x3 , y3 )
P3 (x3 , y3 )

Q2 Q3
P1 (x1 , y1 )
P1 (x1 , y1 )

Q1
P2 (x2 , y2 )
P2 (x2 , y2 )

x
M1 M2 M3 Mn

Let (xi , yi ), i = 1, 2, 3, . . . , n be the n sets of observation and let

y = f (x) (3.1)

be the relation suggested between x and y. Let (xi , yi ) be represented by the point Pi . Let the ordinate at
Pi meet y = f (x) at Qi , and the x-axis at Mi .

M i Pi = y i
Mi Qi = f (xi )
Qi Pi = Mi Pi − Mi Qi = yi − f (xi ), i = 1, 2, 3, . . . , n

di = yi − f (xi ) is called the residual at x = xi . Some of the di ’s may be positive and some may be negative.

n
X n
X
E= di 2 = [yi − f (xi )]2
i=1 i=1

is the sum of the squares of the residuals. If E = 0, i.e, each di = 0, then all the n points Pi will lie on
y = f (x). If not, we will choose f (x) such that E is minimum. That is, the best fitting curve to the set of
points is that for which E is minimum. This principle is known as the principle of least squares or the
least square criterion.
This principle does not suggest to determine the form of the curve y = f (x) but it determines the values
of the parameters or constants of the equation of the curve.

3.1 Fitting a straight line by the method of least squares


Let (xi , yi ), i = 1, 2, 3, . . . , n be the n sets of observations and let the related relation by y = ax + b. Now
we have to select a and b so that the straight line is the best fit to the data.
As explained earlier, the residual at x = xi is

di = yi − f (xi ) = yi − (axi + b), i = 1, 2, . . . n

14
n
X n
X
2
E= di = [yi − (axi + b)]2
i=1 i=1

By the principle of least squares, E is minimum. Therefore we have,

∂E ∂E
= 0 and =0
∂a ∂b

∂E
consider,
=0
∂a
X
2 [yi − (axi + b)](−xi ) = 0
n
X
(xi yi − ax2i − bxi ) = 0
i=1
n
X n
X n
X
a x2i + b xi = xi yi (3.2)
i=1 i=1 i=1

∂E
=0
consider,
∂b
X
2 [yi − (axi + b)](−1) = 0
n
X
(yi − axi − b) = 0
i=1
Xn n
X
a xi + nb = yi (3.3)
i=1 i=1

The equations (3.2) and (3.3) are called normal equations. By solving them, we can find a and b.

Example
1. Fit a straight line to the data given below. Also estimate the value of y at x = 2.5.
x : 0 1 2 3 4
y : 1 1.8 3.3 4.5 6.3
Solution.
Let the best fit be y = ax + b.
The normal equations are
X
X
a
x + 5b = y
X X X
a x2 + b x= xy

15
x y x2 xy
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
2
P P P P
x =10 y =16.9 x = 30 xy = 47.1

Therefore the normal equations become,

10a + 5b = 16.9
30a + 10b = 47.1

Solving for a and b we have, a = 1.33, b = 0.72. Substituting the values of a and b in the equation of
linear fit, we have,y = 1.33x + 0.72
When x = 2.5 , the value of y becomes y(2.5) = 1.33(2.5) + 0.72 = 4.045.

2. Fit a straight line to the following data. Also estimate the value of y at x = 70.
x : 71 68 73 69 67 65 66 67
y : 69 72 70 70 68 67 68 64
Solution.
Since the values of x and y are larger, we choose the origins for x and y at 69 and 67 respectively. In
other words, we transform x and y.
Let X = x − 69, and Y = y − 67.
Let Y = aX + b be the fit.
The normal equations are
X X
a
X + 8b = Y
X X X
a X2 + b X= XY

x y X Y X2 XY
71 69 2 2 4 4
68 72 -1 5 1 -5
73 70 4 3 16 12
69 70 0 3 0 0
67 68 -2 1 4 -2
65 67 -4 0 16 0
66 68 -3 1 9 -3
67 64 -2 -3 4 6
2
P P P P
X = -6 Y = 12 X = 54 XY = 12

16
Therefore the normal equations become,

−6a + 8b = 12
54a − 6b = 12

Solving for a and b we have, a = 0.4242, b = 0.1818. Substituting the values of a and b in the equation
of linear fit, we have,

Y = 0.4242X + 0.1818
y − 67 = 0.4242(x − 69) + 0.1818
y = 0.4242x + 37.909

When x = 70, y = 0.4242(70) + 37.909 = 67.6030.

3. By proper transformation, convert the relation y = a + bxy to a linear form and find the equation to
fit the data.
x : -4 1 2 3
y : 4 6 10 8
Solution.
Let X = xy ∴ The equation becomes y = a + bX.
The normal equations are
X X X
a X +b X2 = Xy
X X
4a + b X= y

x y X X2 Xy
-4 4 -16 256 -64
1 6 6 36 36
2 10 20 400 200
3 8 24 576 192
2
P P P P
y =28 X = 34 X = 1268 Xy = 364

The normal equations become,

34a + 1268b = 364


4a + 34b = 28

Solving for a and b we have, a = 5.9069, b = 0.1286. Substituting the values of a and b in the equation
of linear fit, we have,

y = 5.9069 + 0.1286X
y = 5.9069 + 0.1286xy

17
Thus the equation of linear fit is given by y = 5.9069 + 0.1286xy.
The equation can be rewritten as

y(1 − 0.1286x) = 5.9069


5.9069
y=
1 − 0.1286x

From the above equation we can tabulate the values as follows:


x : -4 1 2 3
y : 5.23 6.78 7.95 9.62
We can verify the values of y with the given data.

3.2 Fitting a parabola or fitting a second degree curve by the method of least
squares
Let (xi , yi ), i = 1, 2, . . . n be n sets of observations of two related variables x and y. Let y = ax2 + bx + c
be the equation which fits them best. Now we have to find the constants a, b, c.
For any x = xi , the expected value of y is axi 2 + bxi + c and the corresponding observed value is yi .
The residual di = yi − (axi 2 + bxi + c)
Let E denote the sum of the squares of the residuals.
n
X
E= [yi − (axi 2 + bxi + c)]2
i=1

By the principle of least squares, E is minimum for best values a, b, c.

∂E ∂E ∂E
∴ = 0, = 0 and =0
∂a ∂b ∂c

Differentiating E, partially with respect to a, b, c and equating to zero, we get


n
X
2[yi − (axi 2 + bxi + c)](−xi 2 ) = 0
i=1
Xn
2[yi − (axi 2 + bxi + c)](−xi ) = 0
i=1
Xn
2[yi − (axi 2 + bxi + c)](−1) = 0
i=1

Simplifying, we get
X X X X
a xi 4 + b xi 3 + c xi 2 = xi 2 yi
X X X X
a xi 3 + b xi 2 + c xi = xi yi
X X X
a xi 2 + b xi + nc = yi

18
Dropping the suffices, the normal equations are
X X X X
a x4 + b x3 + c x2 = x2 y (3.4)
X X X X
a x3 + b x2 + c x= xy (3.5)
X X X
a x2 + b x + nc = y (3.6)

Solving the equations (3.4), (3.5), (3.6) we get the values of a, b, c. Substituting these values of a, b, c in
y = ax2 + bx + c, we get the result.

Example
1. Fit a parabola, by th method of least squares, to the following data; also estimate y at x = 6.
x : 1 2 3 4 5
y : 5 12 26 60 97
Solution
Let y = ax2 + bx + c be the best fit.
The normal equation are
X X X
a x2 + b x + nc = y
X X X X
a x3 + b x2 + c x= xy
X X X X
a x4 + b x3 + c x2 = x2 y

x y x2 x3 x4 xy x2 y
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
2 3 4 2
P P P P P P P
x =15 y =200 x = 55 x = 225 x = 979 xy =832 x y =3672

The normal equations becomes,

55a + 15b + 5c = 200


225a + 55b + 15c = 832
979a + 225b + 55c = 3672

Solving we get a = 5.7143, b = −11.0858 and c = 10.4001


Hence the parabola is, y = 5.7143x2 − 11.0858x + 10.4001
When x = 6, y(6) = 149.6001.

19
2. Fit a second degree parabola to the data.
x : 1929 1930 1931 1932 1933 1934 1935
y : 352 356 357 358 360 361 361
Solution
Let X = x − 1932, Y = y − 357. Let Y = aX 2 + bX + c be the best fit.
The normal equation are
X X X
a X2 + b X + nc = Y
X X X X
a X3 + b X2 + c X= XY
X X X X
a X4 + b X3 + c X2 = X 2Y

x y X Y X2 X3 X4 XY X 2Y
1929 352 -3 -5 9 -27 81 15 -45
1930 356 -2 -1 4 -8 16 2 -4
1931 357 -1 0 1 -1 1 0 0
1932 358 0 1 0 0 0 0 0
1933 360 1 3 1 1 1 3 3
1934 361 2 4 4 8 16 8 16
1935 361 3 4 9 27 81 12 36
X 2 = 28 X3 = 0 X 4 = 196 X 2Y = 6
P P P P P P P
X=0 Y =6 XY = 40

The normal equations become,

28a + 7c = 6
28b = 40
196a + 28c = 6

Solving we get a = −0.21429, b = 1.4286 and c = 1.7143


The equation of best fit becomes,

Y = −0.21429X 2 + 1.4286X + 1.7143


y − 357 = −0.21429(x − 1932)2 + 1.4286(x − 1932) + 1.7143
y = −0.21429x2 + 829.445x − 802265.33

3.3 Fitting an exponential curve


Let (xi , yi ), i = 1, 2, . . . n be n sets of observations of related data and let

y = abx (3.7)

20
be the best fit for the data. Now, taking logarithm on both sides of (3.7),

log10 y = log10 a + x log10 b


i.e., Y = A + Bx

where Y = log10 y, A = log10 a, B = log10 b. This is linear in x and Y . The value of A and B can be found
by fitting a straight line as in section 3.1. Using the value of A and B, we can find a and b and hence the
curve y = abx .

3.4 Fitting a curve of the form y = axb


Let (xi , yi ), i = 1, 2, . . . n be n sets of observations of related data and let

y = axb (3.8)

be the best fit for the data. Now, taking logarithm on both sides of (3.8),

log10 y = log10 a + b log10 x


i.e., Y = A + bX

where Y = log10 y, A = log10 a, X = log10 x. This is linear in X and Y . The value of A and b can be found
by fitting a straight line as in section 3.1. Using the value of A, we can find a and hence the curve y = axb .

Example
1. From the table given below, find the best values of a and b in the law y = aebx by the method of least
squares.
x : 0 5 8 12 20
y : 3.0 1.5 1.0 0.55 0.18
Solution.
Let

y = aebx (3.9)

be the best fit. Now taking logarithm on both sides of (3.9),

log10 y = log10 a + bx log10 e


i.e., Y = A + Bx

where Y = log10 y, A = log10 a, B = b log10 e. The normal equations are


X X
5A + B x= Y
X X X
A x+B x2 = xY

21
x y Y x2 xY
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
2
P P P P
x =45 Y = −0.3511 x =633 xY = − 17.1287

The normal equation becomes,

5A + 45B = −0.3511
45A + 633B = −17.1287

Solving we get A = 0.4815 and B = −0.0613.


Now A = 0.4815 =⇒ a = 10A = 3.0304 and
B = −0.0613, =⇒ −0.0613 = b log10 e =⇒ b = −0.1411
Hence the curve is y = 3.0304 e−0.1411x .

2. Fit a curve of the form y = abx to the data


x : 1 2 3 4 5 6
y : 151 100 61 50 20 8
Solution.
Let

y = abx (3.10)

be the best fit. Now taking logarithm on both sides of (3.10),

log10 y = log10 a + x log10 b


i.e., Y = A + Bx

where Y = log10 y, A = log10 a, B = log10 b. The normal equations are


X X
6A + B x= Y
X X X
A x+B x2 = xY

22
x y Y x2 xY
1 151 2.1790 1 2.1790
2 100 2.0 4 4.0
3 61 1.7853 9 5.3559
4 50 1.6990 16 6.7960
5 20 1.3010 25 6.5050
6 8 0.9031 36 5.4186
2
P P P P
x =21 Y =9.8674 x =91 xY = 30.2545

The normal equation becomes,

6A + 21B = 9.8674
21A + 91B = 30.2545

Solving we get A = 2.5010 and B = −0.2447.


Now A = 2.5010 =⇒ a = 10A = 316.9568 and
B = −0.2447, =⇒ b = 10B = 0.5692
x
Hence the curve is y = 316.9568 (0.5692) .

3. It is known that the curve y = axb fits in the data given below. Find the best values of a and b.
x : 1 2 3 4 5 6
y : 1200 900 600 200 110 50
Solution.
Let

y = axb (3.11)

be the best fit. Now taking logarithm on both sides of (3.11),

log10 y = log10 a + b log10 x


i.e., Y = A + bX

where Y = log10 y, A = log10 a, X = log10 x. The normal equations are


X X
6A + b X= Y
X X X
A x+b X2 = XY

23
x y X Y X2 XY
1 1200 0.0 3.0792 0.0 0.0
2 900 0.3010 2.9542 0.0906 0.8892
3 600 0.4771 2.7782 0.2276 1.3255
4 200 0.6021 2.3010 0.3625 1.3854
5 110 0.6990 2.0414 0.4886 1.4269
6 50 0.7781 1.6990 0.6054 1.3220
2
P P P P
x =2.8573 Y =14.8530 X =1.7747 XY = 6.3490

The normal equation becomes,

6A + 2.8573b = 14.8530
2.8573A + 1.7747b = 6.3490

Solving we get A = 3.3086 and b = −1.7494.


Now A = 3.3086 =⇒ a = 10A = 2035. Hence the curve is y = 2035 x−1.7494 .

3.5 Calculation of the sum of the squares of the residuals


3.5.1 In the case of straight line fit

In fitting a straight line, we have seen that the sum of the squares of the residuals E is given by,
X
E= [y − (ax + b)]2
X
= [y − (ax + b)][y − (ax + b)]
X
= y[y − (ax + b)] − ax[y − (ax + b)] − b[y − (ax + b)]
X X X
= y[y − (ax + b)] − a x[y − (ax + b)] − b [y − (ax + b)]
X X X
= y2 − a xy − b y

P P
since the last two sums vanish due to normal equations x[y − (ax + b)] = 0 and [y − (ax + b)] = 0.
Thus the error committed(which is minimum), when we fit a straight line by the method of least squares is
given by
X X X
E= y2 − a xy − b y

24
3.5.2 In the case of parabola fit

In fitting a parabola, we have seen that the sum of the squares of the residuals E is given by,
X
E= [y − (ax2 + bx + c)]2
X
= [y − (ax2 + bx + c)][y − (ax2 + bx + c)]
X X X X
= y[y − (ax2 + bx + c)] − a x2 [y − (ax2 + bx + c)] − b x[y − (ax2 + bx + c)] − c [y − (ax2 + bx + c)]
X X X X
= y2 − a x2 y − b xy − c y

since the last three sums vanish due to normal equations.


Thus the error committed(which is minimum), when we fit a parabola by the method of least squares is
given by
X X X X
E= y2 − a x2 y − b xy − c y

Example
1. Fit a straight line and a parabola to the following data and find out which one is most appropriate.
Reason out for your conclusion.
x : 0 1 2 3 4
y : 1 1.8 1.3 2.5 6.3
Solution

x y x2 x3 x4 xy x2 y y2
0 1 0 0 0 0 0 1
1 1.8 1 1 1 1.8 1.8 3.24
2 1.3 4 8 16 2.6 5.2 1.69
3 2.5 9 27 81 7.5 22.5 6.25
4 6.3 16 64 256 25.2 100.8 39.69
2 3 4 2
y 2 =51.87
P P P P P P P P
x =10 y =12.9 x =30 x =100 x =354 xy = 37.1 x y =130.3

To fit a straight line: The normal equations are


X X
a x + 5b = y
X X X
a x2 + b x= xy

that is

10a + 5b = 12.9
30a + 10b = 37.1

25
Solving we get a = 1.13 and b = 0.32. Therefore the best straight line fit is given by

y = 1.13x + 0.32

X X X
Error in this case = E1 = y2 − a xy + b y

= 51.87 − 1.33(37.1) − 0.32(12.9)


= 5.81

To fit a parabola: The normal equations are


X X X
a x2 + b x + 5c = y
X X X X
a x3 + b x2 + c x= xy
X X X X
a x4 + b x3 + c x2 = x2 y

that is

30a + 10b + 5c = 12.9


100a + 30b + 10c = 37.1
354a + 100b + 30c = 130.3

Solving we get a = 0.55, b = −1.07 and c = 1.42. Therefore the best parabola fit is given by

y = 0.55x2 − 1.07x + 1.42

.
X X X X
Error in this case = E2 = y2 − a x2 y − b xy − c y

= 51.87 − 0.55(130.3) + 1.07(37.1) − 1.42(12.9)


= 1.584

The error in the case of straight line fit, |E1 | = 5.81


The error in the case of parabola fit, |E2 | = 1.584
|E2 | = 1.584 < 5.81 = |E1 |
Therefore the parabola fit is better.
The error in straight line is more then the error in parabola
Hence, wesaythattheparabolaf itisbetterf itf orthedatagiven.

x : 0 1 2 3 4
y by data given : 1 1.8 1.3 2.5 6.3
y by straight line fit : 0.32 1.65 2.98 4.31 5.64
y by parabola fit : 1.42 0.90 1.48 3.16 5.94

26
Exercise
1. The weights of a calf taken at weekly intervals are supplied below. Fit a straight line and calculate the
average rate of growth per week.
Age (x) : 1 2 3 4 5 6 7 8 9 10
Weight (y) : 52.5 58.7 65.0 70.2 75.4 81.1 87.2 95.5 102.2 106.4

2. A rubber band stretched under a force F is found to increase in length l. The following observations
were got.
F : 2 3 4 5 6 7 8 9 10 11 12
l : 10 17 21 28 36 43 51 60 70 83 93
Fit a straight line.

3. Fit a straight line to the data.


x : 0.5 1.0 1.5 2.0 2.5 3.0
y : 0.31 0.82 1.29 1.85 2.51 3.02

4. The following table gives the levels of prices in certain years. Fit a second degree parabola to the data.
Year : 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885
Price : 88 87 81 78 74 79 85 84 90 92 100

5. Fit a curve of the form y = ax + bx2 to the data


x : 1 2 3 4 5
y : 1.8 5.1 8.9 14.1 19.8

6. Fit a law of the type y = aebx to the data


x : 0 1 2 3
y : 1.05 2.10 3.85 8.30

7. Fit the parabola and the straight line of best fit to the following data and out of them which is more
reliable ?
x : −2 1 4 7 10
y : 10.8 1.9 29.2 92 190

4 Solving Difference Equation

Definition
An equation which expresses a relation between the independent variable, the dependent variable and the
successive differences of the dependent variable is called a difference equation.
For example,

∆3 yx − 4∆yx + 7yx = x2 + cosx + 7


∆2 yx − 2∆yx + yx = 0 are difference equation

27
Using ∆ = E − 1, ∆r = (E − 1)r , and assuming the interval of differencing as 1, we can write

∆yx = (E − 1)yx = Eyx − yx = yx+1 − yx


∆2 yx = (E − 1)2 yx = yx+2 − 2yx+1 + yx

Hence

∆2 yx − 2∆yx + 3yx = x2 (4.1)

can be written as

yx+2 − 4yx+1 + 6yx = x2 (4.2)


or as y(x + 2) − 4y(x + 1) + 6y(x) = x2 (4.3)
2 2
or as E yx − 4Eyx + 6yx = x
i.e., (E 2 − 4E + 6)yx = x2 (4.4)

This indicates that a difference equation can be written in various forms such as (4.1), (4.2), (4.3), and (4.4).

Order and degree of a difference equation


The order of a difference equation written in the form free from ∆’s is the difference between the highest
and lowest subscripts of y or arguments of y.

Difference Equation Order


yx+3 − 5yx+2 + 7yx+1 + yx = 10x (x + 3) − x = 3
yx+3 − 5yx+2 + yx+1 = 0 (x + 3) − (x + 1) = 2
y(x + 3) − y(x + 2) = 5x2 (x + 3) − (x + 2) = 1

The degree of a difference equation written in the form free from ∆’s is the highest power of the y’s. The
5 3
degree of yx+1 yx+2 − yx+1 yx + yx+3 = cosx is of degree 5. Some more examples for order and degree of
difference equation are given below

Difference Equation Order Degree


2
∆ ux − 5∆ux + 7ux = 0 2 1
y(x + 3) − 7y(x + 1) + 8yx = cosx 3 1
y(x + 3) − y(x + 2) + 7y(x + 1) + 10y(x) = 0 3 1
2 x
(E − 5E + 16)yx = e 2 1
2 2
yx yx+1 − yx+2 yx + 5yx = x + 7 2 2

A Solution of a difference equation is a function which satisfies the difference equation.


A general solution of a difference equation of order n is a solution which contains n arbitrary constants or
n arbitrary functions which are periodic of period equal to the interval of differencing.
A particular solution of a difference equation is a solution got from the general solution by giving particular

28
values to the arbitrary constants. For example yx = A.3x + B(−3)x is the general solution of

yx+2 − 9yx = 0

while yx = 3x or yx = (−3)x are particular solutions.

Linear difference equations

An equation of the form

a0 yx+n + a1 yx+n−1 + a2 yx+n−2 + . . . + an yx = ϕ(x) (4.5)


i.e.,(a0 E n + a1 E n−1 + a2 E n−2 + . . . + an )yx = ϕ(x) (4.6)

where a0 , a1 , a2 , . . . an and ϕ(x) are known function of x is called a linear difference equation.
The successive values of y viz, yx , yx+1 , yx+2 , . . . occur in the equation only in first degree and are not
multiplied together.
If a0 , a1 , a2 , . . . an are constants then it is called a linear equation with constant coefficients
The equation (4.5) or (4.6) can be written as

f (E)yx = ϕ(x) (4.7)

where f (E) is a polynomial expression in E. If ϕ(x) = 0 then (4.7)becomes

f (E)yx = 0 (4.8)

is called homogeneous equation corresponding to (4.7). The solution of the non-homogeneous linear equation
(4.7) depends upon the corresponding homogeneous linear equation (4.8).

Note.
1. If yx = f1 (x) is a solution of homogeneous equation (4.8), then yx = C1 f1 (x) is also a solution of (4.8).

2. If yx = f1 (x), yx = f2 (x), yx = f3 (x), . . . yx = fn (x) are n independent solution of (4.8), then


Pn
yx = i=1 Ci fi (x) is also a solution of (4.8), where C1 , C2 , C3 , . . . , Cn are constants.
n
X
3. If yx = ux is a particular solution of the non-homogeneous equation (4.7), then yx = Ci fi (x) + ux
i=1
is the general solution of (4.7).
X n
Ci fi (x) is called the complementary function of (4.7) or general solution of (4.8).
i=1

Complementary function
Consider

f (E)yx = ϕ(x) (4.9)

29
To find complementary function replace E by a in f (E), and f (a) = 0 which is called the auxiliary equation
of (4.9). If the roots of f (a) = 0 are a1 , a2 , . . . , an then the following cases will arise.

1. If a1 , a2 , . . . , an are distinct then yx = c1 a1 x + c2 a2 x + . . . + cn an x is the complementary function of


(4.9).

2. If a1 = a2 , then yx = (c1 + c2 x)a1 x + c3 a3 x . . . + cn an x is the complementary function of (4.9).


If a1 = a2 = a3 = . . . = ar , then yx = (c1 + c2 x + c3 x2 + . . . + cr xr−1 )ar x + . . . + cn an x is the
complementary function of (4.9).

3. If a1 = α + iβ, a2 = α − iβ are complex roots and a3 , a4 , . . . an are distinct then yx = rx (c1 cos θx +
p
c2 sin θx + c3 a3 x + . . . + cn an x ) is the complementary function of (4.9) where r = |α + iβ| = α2 + β 2
β
and θ = tan−1 α .

Particular Integral
While finding the particular integral of (4.9) we have the following four types.
Type 1
Suppose ϕ(x) = ax , where a is a constant. Then

ax
P.I = if f (a) ̸= 0.
f (a)

If f (a) = 0 and (E − a)r is a factor of f (E) then

x(r) x−r
P.I = a
r!

where x(r) = x(x − 1)(x − 2) . . . (x − (r − 1))


Type 2
Let ϕ(x) = a polynomial in x of degree m. Then

ϕ(x)
P.I =
f (E)
= [f (1 + ∆)]−1 ϕ(x)

We expand [f (1 + ∆)]−1 in ascending power of ∆ and then operate on ϕ(x).

30
Type 3
Let ϕ(x) = ax F (x) where F (x) is some function of x. Then

F (x)
P.I = ax
f (aE)

Type 4
Let ϕ(x) = cos kx or sin kx
This can be done in two ways.

use cos kx = Real part of eikx


sin kx = Imaginary part of eikx and proceed

Or

eikx + e−ikx
Take cos kx =
2
e − e−ikx
ikx
sin kx = and proceed
2

Example
1. Form the difference equation of lowest order by eliminating the arbitrary constants a and b given
(i) y = a.2x + b.3x
(ii) y = (a + bx)2x
Solution.
(i) Given yx = a.2x + b.3x
From which we can write

yx+1 = a.2x+1 + b.3x+1


yx+2 = a.2x+2 + b.3x+2

Now 2yx − yx+1 = −b.3x


and 2yx+1 − yx+2 = −b.3x+1

From the above two equations we get the result

2yx+1 − yx+2 = 3(2yx − yx+1 )


i.e., yx+2 − 5yx+1 + 6yx = 0 is the required equation

31
(ii) Given yx = (a + bx)2x
From which we can write

yx+1 = (a + bx + b)2x+1 = 2(a + bx + b)2x


yx+2 = (a + bx + 2b)2x+2 = 4(a + bx + 2b)2x

We have the result yx+2 − 4yx+1 + 4yx = 0

2. Solve yx+3 − 2yx+2 − yx+1 + 2yx = 0


Solution.
Writing in the shift operator form,

(E 3 − 2E 2 − E + 2)yx = 0.

The auxiliary equation is a3 − 2a2 − a + 2 = 0 whose roots are 1, −1, 2.


Since the equation is homogeneous equation, the complete solution is

yx = A.1x + B(−1)x + C(2)x


= A + B(−1)x + C 2x


3+1
3. Solve yx+2 − yx+1 + yx = 0 given y0 = 1, y1 = .
2
Solution.
Writing in the shift operator form,
(E 2 − E + 1)yx = 0

2 1 3
The auxiliary equation is a − a + 1 = 0 whose roots are ± i
2 2
√ 2
v !
u 2
u 1 3 √ π
r= t + = 1 and θ = tan−1 3 =
2 2 3

 π π 
∴ yx = 1x A cos x + B sin x
3 3
π π
= A cos x + B sin x
3 3

Since y0 = 1,
√ substituting x = 0 and y = 1 we get
√ A = 1.
3+1 3+1
Since y1 = , substituting x = 1 and y = we get
2 2

π π 3+1
y1 = 1 cos + B sin =
3 √ 3 √ 2
1 3 3+1
+ B=
2 2 2
B=1

32
Hence the solution is
πx πx
yx = cos + sin
3 3

4. Form the Fibonacci difference equation and solve it.


Solution.
The integers 0, 1, 1, 2, 3, 5, 8, 13, 21, . . . are said to form a Fibonacci sequence. Let yn be the nth term
of this sequence.
Then yn = yn−1 + yn−2 if n > 2
or yn+2 − yn+1 − yn = 0 if n > 0
i.e., (E 2 − E − 1)yn = 0 √
1± 5
The auxiliary equation is a2 − a − 1 = 0 whose roots are .
2
√ !n √ !n
1+ 5 1− 5
Hence yn = A +B if n > 0
2 2
√ ! √ !
1+ 5 1− 5
Since y1 = 0, we have y1 = A +B = 0.
2 2
√ !2 √ !2
1+ 5 1− 5
Since y2 = 1, we have y2 = A +B = 1.
2 2

√ √
5− 5 5+ 5
Solving for A and B, we get A = , and B = .
10 10
Hence nth term of the sequence is
√ ! √ !n √ ! √ !n
5− 5 1+ 5 5+ 5 1− 5
yn = + .
10 2 10 2

5. Solve yn+2 − 4yn+1 + 3yn = 2n + 3n + 7.


Solution.
Given equation can be written as

(E 2 − 4E + 3)yn = 2n + 3n + 7.

The auxiliary equation is a2 − 4a + 3 = 0 whose roots are 1, 3.

CF = A.1n + B.3n
= A + B.3n

2n
P.I1 =
E 2 − 4E + 3
2n
= , Replacing E by 2
4−8+3
= −2n

33
3n
P.I2 =
E 2 − 4E + 3
3n
=
(E − 1)(E − 3)
3n 1 3n
= = .
(3 − 1)(E − 3) 2 E−3
1
= .n 3n−1
2
7.1n
P.I3 = 2
E − 4E + 3
7.1n
=
(E − 1)(1 − 3)
−7
= .n 1n−1
2
−7
= n
2

Hence the complete solution is

yn = CF + PI
1 7
= A + B.3n − 2n + .n 3n−1 − n
2 2

6. Solve yx+2 − 4yx = 9x2


Solution.
Given equation can be written as
(E 2 − 4)yx = 9x2 .

The auxiliary equation is a2 − 4 = 0 whose roots are ±2.

CF = A.2x + B.(−2)x

9x2
P.I =
E2 − 4
9x2
=
(1 + ∆)2 − 4
9x2
= 2
∆ + 2∆ − 3
1 9x2
=−
3 ∆2 + 2∆
1−
3
 2
−1
∆ + 2∆
= −3 1 − x2
3
" 2 #
∆2 + 2∆
 2
∆ + 2∆
= −3 1 + + + . . . x2
3 3
 
2∆ 7 2
= −3 1 + + ∆ + . . . (x(2) + x(1) )
3 9

34
 
2 7
= −3 (x(2) + x(1) ) + (2x(1) + 1) + (2)
3 9
 
2 14
= −3 x(x − 1) + x + (2x + 1) +
3 9
 
4x 20
= −3 x2 + +
3 9

Hence the complete solution is


 
4x 20
yx = A.2x + B(−2)x − 3 x2 + +
3 9

Aliter: To find the P.I assume the particular integral yx = ax2 + bx + c. Substituting in the given
equation

a(x + 2)2 + b(x + 2) + c − 4(ax2 + bx + c) = 9x2


−3ax2 + x(4a − 3b) + 4a + 2b − 3c = 9x2

Equating the coefficients we get −3a = 9; 4a − 3b = 0; 4a + 2b − 3c = 0.


Solving we get a = −3; b = −4; c= − 20
3
2 20
∴ P.I = −3x − 4x − 3

Note.
In the case of unit interval differencing

(a) ∆r x(n) = n(n − 1)(n − 2) . . . (n − r + 1) x(n−r) which is analogous to the differentiation of xn .


(b) ∆n x(n) = n!
where x(n) = x(x − 1)(x − 2) . . . (x − (n − 1))

7. Solve yx+2 − 7yx+1 − 8yx = x(x − 1)2x .


Solution.
Given equation can be written as

(E 2 − 7E − 8)yx = x(x − 1)2x .

The auxiliary equation is a2 − 7a − 8 = 0 whose roots are 8, −1.

CF = A.8x + B.(−1)x

x(x − 1).2x
PI =
E 2 − 7E − 8
x(x − 1)
= 2x 2
(2E) − 7(2E) − 8
x(x − 1)
= 2x 2
4E − 14E − 8

35
x(x − 1)
= 2x
4(1 + ∆)2 − 14(1 + ∆) − 8
x(x − 1)
= 2x
4∆2 − 6∆ − 18
x(x − 1)
= 2x−1
2∆2 − 3∆ − 9
−1
2x−1 2∆2 − 3∆

= 1+ x(x − 1)
−9 −9
"  2   2 2 #
1 x−1 2∆ − 3∆ 2∆ − 3∆
= − .2 1+ + + . . . x(2)
9 9 9
 
1 x−1 ∆ 1 2
= − .2 1− + ∆ + . . . x(2)
9 3 3
 
1 x−1 (2) 2 (1) 1
= − .2 x − x + (2)
9 3 3
 
1 x−1 2x 2
= − .2 x(x − 1) − +
9 3 3
 
1 x−1 2 5 2
= − .2 x − x+
9 3 3

Hence the solution is  


1 5 2
yx = A.8x + B.(−1)x − .2x−1 x2 − x +
9 3 3

8. Solve u(x + 1) − au(x) = cos nx


Solution.
Given equation can be written as
(E − a)ux = cos nx.

The auxiliary equation is m − a = 0 whose root is a.

CF = A.ax

cos nx
PI =
E−a
einx
= Real part of
E−a
(ein )x
= R.p of
E−a
einx
= R.p of in
e −a
einx (e−in − a)
= R.p of in
(e − a)(e−in − a)
ein(x−1) − aeinx
= R.p of
1 − a(ein + e−in ) + a2
cos n(x − 1) − a cos nx
=
1 − 2a cos n + a2

36
Hence the solution is
cos n(x − 1) − a cos nx
ux = A.ax +
1 − 2a cos n + a2

Exercise
1. Solve yx+1 − 3yx = 0.

2. Solve ux+2 + 2ux+1 + 4ux = 0.

3. Solve yn+2 − 6yn+1 + 9yn = 0 given y0 = 1, y1 = 0.

4. Solve yx+2 − 8yx+1 + 16yx = 4x .

5. Solve yn+2 − 3yn+1 + 2yn = 5n + 2n .

37

You might also like