Block 2
Block 2
NUMERICAL ANALYSIS
Indira Gandhi National Open University
School of Sciences
Block
2
SOLUTIONS OF LINEAR ALGEBRAIC EQUATIONS
Block Introduction 119
Notations and Symbols 120
UNIT 5
Direct Methods 121
UNIT 6
Inverse of a Square Matrix 169
UNIT 7
Iterative Methods 201
UNIT 8
Eigenvalues and Eigenvectors 247
* The course design is based on the recommendations of the Programme Expert Committee and the UGC-
CBCS template
Acknowledgement: To Sh. Santosh Kumar Pal and Sh. Prashant Kumar for the word
processing and to Sh. S. S. Chauhan for preparing CRC of this block. Parts of this block are
based on the course material of the elective course Numerical Analysis (MTE-10) of the
Bachelor’s Degree Programme.
Disclaimer – Any materials adapted from web-based resources in this course are being used for educational purposes
only and not for commercial purpose.
November, 2021
© Indira Gandhi National Open University, 2021
ISBN-978-93-89200-39-3
All right reserved. No part of this work may be reproduced in any form, by mimeograph or any other
means, without permission in writing from the Indira Gandhi National Open University.
Further information on the Indira Gandhi National Open University courses, may be obtained from the
University’s office at Maidan Garhi, New Delhi-110 068 and IGNOU website www.ignou.ac.in.
Printed and published on behalf of the Indira Gandhi National Open University, New Delhi by
118 Prof. Sujatha Varma, Director, School of Sciences.
BLOCK INTRODUCTION
In Block1, we have discussed various numerical methods for finding
approximate roots of a non-linear equation in one unknown. But there are large
number of physical, biological and engineering situations in which we need to
find the solution or the inverse or the eigenvalues and eigenvectors of the
systems of linear equations. These systems arise, both directly in modeling
physical situations and indirectly in the numerical solutions of other
mathematical models. For instance, problems such as determining the potential
in certain electrical networks, stresses in a building frame, flow rates in a
hydraulic systems etc. are all reduced to solving a set of algebraic equations
simultaneously. Linear algebraic systems are also involved in the optimization
theory, least squares fitting of data, numerical solution of boundary value
problems for ordinary and partial differential equations, statistical inference etc.
In this block we shall discuss both direct and iterative methods of solving linear
algebraic system of equations.
In Unit 5, which is the first unit of this block, we begin with a recall of a few
definitions and properties of matrices and determinants which are necessary to
understand the numerical methods of solving linear system of equations. We
shall then discuss some direct methods i.e., the methods which, in the absence
of round-off or other errors, yield the exact solution in a finite number of
elementary arithmetic operations. These methods include Cramer’s rule, direct
methods for solving system of linear equations with special coefficient matrices
such as diagonal matrix, lower-triangular matrix and upper-triangular matrix,
Gauss elimination method and LU decomposition method.
In Unit 6, we shall discuss the method of adjoints, the Gauss-Jordan reduction
method and LU decomposition method for finding the inverse of a non-singular
square matrix.
In Unit 7, we shall discuss three iterative methods namely, the Jacobi iteration
method, the Gauss-Seidel iteration method and successive over relaxation
method for solving the system of linear equation. These methods start with an
initial approximation and by applying a suitable chosen algorithm, lead to
successively better approximations.
In Unit 8, which is the last unit of this block, we shall deal with the problem of
computation of the absolutely largest eigenvalue or smallest eigenvalue or even
all the eigenvalues of a given square matrix along with the corresponding
eigenvectors. More precisely, we shall discuss the power method and the
inverse power method for solving the eigenvalue problems. We shall also
discuss Gershgorin bounds to find the feasible region for the eigenvalues of a
square matrix.
As already mentioned in the course introduction, we shall be using a non-
programmable scientific calculator for doing computations throughout the block. While
attempting the exercises given in this block, you would also need a calculator. We
therefore suggest you to use the non-programmable scientific calculator.
Lastly we remind you to go through the solved examples carefully, and to attempt all
exercises in each unit and all exercises given in miscellaneous examples and
exercises. This will help you to gain some practice over various methods discussed in
this block.
119
NOTATIONS AND SYMBOLS
120
Unit 5 Direct Methods
UNIT 5
DIRECT METHODS
5.1 INTRODUCTION
In Block 1, we discussed various numerical methods for finding the
roots of an equation f ( x ) = 0 along with the convergence of these
methods. Another important problem of applied mathematics is to find
the solution of systems of linear equations. Systems of linear equations
arise in a large number of areas, both directly in modelling physical
situations and indirectly in the numerical solution of other mathematical
models. These applications occur in all areas of the physical, biological
and engineering sciences. For instance, in physics, the problem of
steady state temperature in a plate is reduced to solving linear
equations. Engineering problems such as determining the potential in
certain electrical networks, stresses in a building frame, flow rates in a
hydraulic system etc. are all reduced to solving a set of algebraic
equations simultaneously. Linear algebraic systems are also involved
in the optimization theory, least squares fitting of data, numerical
solution of boundary value problems for ordinary and partial differential
equations, statistical inference etc. Hence, the numerical solution of
system of linear algebraic equations play a very important role. 121
Block 2 Solutions of Linear Algebraic Equations
Also, in Block 1, we discussed the direct and indirect methods for
solving non-linear equations in one variable. You may recall that direct
methods are the methods which use a formula and give the exact
results, whereas indirect methods are the iterative methods which are
used to find the approximate solution in successive iterations until the
desired accuracy is achieved. In this unit we will discuss direct methods
for solving the system of linear equations. We will also discuss indirect
methods for solving the system of linear equations in Unit 7.
Objectives
After studying this unit, you should be able to:
• define various terms related to matrices;
• obtain the solution of system of linear algebraic equations by using
the direct methods such as Cramer’s rule, Gauss elimination method
and LU decomposition method;
• use the pivoting technique while transforming the coefficient matrix
to upper or lower triangular matrix.
iii) Row of a matrix: The horizontal lines are called rows of a matrix.
122
Unit 5 Direct Methods
iv) Column of a matrix: The vertical lines are called columns of a
matrix.
vi) Square matrix: If the matrix has the same number of rows and
columns, i.e., if m = n, we call it a square matrix.
M
a n1
viii) Row matrix: If a matrix has only one row it is a row matrix or row
vector. For example, B = [a 11 , a 12 , K, a 1n ] is a row matrix.
a 11 0 0
L = a 21 a 22 0 is a lower triangular matrix.
a 31 a 32 a 33
a 11 a 12 a 13
U= 0 a 22 a 23 is a upper triangular matrix.
0 0 a 33
− 4 6 3 5 − 1 0
For example, if A = and B = , then
0 1 2 3 1 0
1 5 3 − 9 7 3
A+B = and A − B =
3 2 2 − 3 0 2
That is, to obtain the (i, k ) th element of AB , take the ith row of A
and kth column of B, multiply their corresponding elements and
add up all these products. For example, if
1 1 2
2 3 − 1
A= and B = 2 4 1 , then (1, 2) th element
1 0 2 1 2 1
124
Unit 5 Direct Methods
of AB is
1
[2, 3, − 1] 4 = 2 × 1 + 3 × 4 + (−1) × 2 = 12 .
2
1
3
A = 5 , then AT = [1 3 5 − 2 4].
− 2
4
a a 12
For a 2 × 2 matrix A = 11
a 21 a 22
a 11 a 12 a 11 a 12
det(A ) = det = = a 11a 22 − a 12 a 21
a 21 a 22 a 21 a 22
a 11 a 12 a 13
For a 3 × 3 matrix A = a 21 a 22 a 23
a 31 a 32 a 33
a 22 a 23 a 21 a 23 a 21 a 22
det(A ) = a 11 det − a det + a det
a 33 a a a 32
12 13
a 32 31 a 33 31
1 2 6
Example 1: If A = 5 4 1 , calculate det(A ).
7 3 2
4 1
| A11 | = = 4 × 2 − 1× 3 = 5,
3 2
5 1
| A12 | = = 5 × 2 − 7 ×1 = 3
7 2
5 4
| A13 | = = 5 × 3 − 4 × 7 = −13
7 3
Thus,
det(A ) = | A | = (−1)1+1 × a 11 × | A11 | + (−1)1+ 2 × a 12 × | A12 | + (−1)1+3 × a 13 × | A13 |
= 1 × 1 × 5 − 1 × 2 × 3 + 1 × 6 × (−3) = 5 − 6 − 78 = −79
***
4 − 2 3
Example 2: Consider the matrices A = − 2 1 6 and
1 2 2
1 −3 0
B = − 3 1 0 . Find A T , B T , ( A + B) T , ( AB) T . Also, verify the
0 0 − 2
following:
i) ( A + B) T = A T + B T
ii) ( AB) T = B T A T
3 6 2
The transpose of the matrix B is
1 −3 0
B = − 3 1
T
0
0 0 − 2
126
Unit 5 Direct Methods
5 − 5 3
A + B = − 5 2 6
1 2 0
5 − 5 1
( A + B) T = − 5 2 2
3 6 0
4 − 2 3 1 − 3 0 10 − 14 − 6
AB = − 2 1 6 − 3 1 0 = − 5 7 12
1 2 2 0 0 − 2 − 5 − 1 − 4
10 − 5 − 5
( AB) T = − 14 7 − 1
− 6 12 − 4
4 − 2 1 1 − 3 0 5 − 5 1
i) A T + B T = − 2 1 2 + − 3 1 0 = − 5 2 2 = ( A + B ) T
3 6 2 0 0 2 3 6 0
1 − 3 0 4 − 2 1 10 − 5 − 5
ii) B T A T = − 3 1 0 − 2 1 2 = − 14 7 − 1 = ( AB) T .
0 0 − 2 3 6 2 − 6 12 − 4
***
a − b 2a + c − 1 8
E1) Find the values of a , b, c and d, if = .
2a − b 3c + d 0 17
2 1 3 1 − 2
E2) If A = 3 − 2 1 and B = 2 1 , find AB and BA.
− 1 0 1 4 − 2
− 3 − 2 0 2
2 1 0 − 1
E3) If A = , calculate det(A) .
1 0 1 2
2 1 −3 1
You also know from your knowledge of linear algebra course that the
non-homogeneous system of Eqn. (2) has a unique solution, if the
matrix A is non-singular. You may recall the following theorem (ref.
BMTE-141).
In case the matrix A is singular, then the system (2) has no solution if
b ≠ 0 or has an infinite number of solutions if b = 0. Here we assume
that A is a non-singular matrix.
You may recall from Unit 1, Block 1 that the solution of non-linear
equations f ( x ) = 0 may be obtained using direct methods or iterative
methods, similarly, the methods of solving system (2) may be classified
into two types:
1 1 1
i) A = 2 3 1
0 − 1 1
1 5 2
ii) B = 5 4 − 7 .
− 3 0 5
a 11 a 12 ... a 1n
a 21 a 22 ... a 2 n
x 1d = x 1
M M M M
a n1 a n 2 K a nn
x 1a 11 a 12 ... a 1n
x 1a 21 a 22 ... a 2n [Using the properties of determinant,
= Ref. P4(a), Unit 11, BMTE-141]
M M M M
x 1a n1 a n2 a n3 a nn
x 1a 11 + x 2 a 12 + ... + x n a 1n a 12 L a 1n
x 1a 21 + x 2 a 21 + ... + x n a 2n a 22 L a 2n [Using
= C1 = C1 + x 2 C 2 + x 3 C 3 + ... + x n C n ;
M M
Ref. P4 (b), Unit 11, BMTE-141]
x 1a n1 + x 2 a n 2 + ... + x n a nn a n 2 L a nn
130
Unit 5 Direct Methods
b1 a 12 ... a 1n
b2 a 22 ... a 2 n
=
M M M M
bn a n2 ... a nn
= d 1 (let),
d1
or we can write x 1 = .
d
d2
x2 = ,
d
d3
x3 = ,
d
M M
d
xn = n .
d
di
In general x i = , 1 ≤ i ≤ n, (4)
d
where d = det(A ) = | A |≠ 0 and d i is the determinant of the
matrix obtained from A by replacing the ith column of A by the
column vector b.
3x 1 + x 2 + 2 x 3 = 3
2x 1 − 3x 2 − x 3 = −3
x 1 + 2x 2 + x 3 = 4
using Cramer’s rule.
3 1 2
Solution: The coefficient matrix A = 2 − 3 − 1 , and the constant
1 2 1
3
matrix b = − 3 We have
4
3 1 2
d = | A | = 2 − 3 −1 = 8 ≠ 0
1 2 1 131
Block 2 Solutions of Linear Algebraic Equations
3 1 2
d1 = − 3 − 3 − 1 = 8 (first column in A is replaced by the column vector b )
4 2 1
3 3 2
d 2 = 2 − 3 − 1 = 16 (second column in A is replaced by the column vector b )
1 4 1
3 1 3
d 3 = 2 − 3 − 3 = −8 (third column in A is replaced by the column vector b )
1 2 4
Solution: Let the amount invested be ` x and ` y in the first and second
account respectively.
It is given that,
x + y = 10000 (5)
8 5
and x +x× + y + y× = 10710.
100 100
interest in interest in
first account second account
Thus, Eqns. (5) and (6) represent the system of linear equations. Let us
use Cramer’s rule to find the solution of the given problem. Here we
1 1 10000
have A = and b = and the variables to be obtained
108 105 1071000
are x and y.
1 1
Now, d = A = = −3 ≠ 0
108 105
10000 1
d1 = = 10000 × 105 − 1071000 × 1 = −21000
1071000 105
132
Unit 5 Direct Methods
1 10000
d2 = = 1 × 1071000 − 100000 × 108 = −9000
108 1071000
Using Eqn. (4), we get
d1 − 21000
x= = = 7000
d −3
d 2 − 9000
and y = = = 3000
d −3
Thus, the person invested ` 7000 in the first account and ` 3000 in the
second account.
***
While going through the example and attempting the exercises you
must have observed that in Cramer’s method we need to evaluate n + 1
determinants each of order n , where n is the number of equations. If
the number of operations required to evaluate a determinant is
measured in terms of multiplications only, then to evaluate a
determinant of second order, i.e.,
a 11 a 12
= a 11a 22 − a 12 a 21
a 21 a 22
a 11 a 12 a 13
a 21 a 22 a 23 = a 11a 22 a 33 − a 11a 23 a 32 − a 12 a 21a 33 + a 12 a 23 a 31 + a 13a 21a 32 − a 13 a 22 a 31
a 31 a 32 a 33
a 11 0 L 0 x 1 b1 a 11 x 1 + 0 + L + 0 = b1
0 a 22 0 x b 0 + a 22 x 2 + L + 0 = b 2
2 = 2 (7)
M O M M M M M M M
0 L a nn x n b n 0 + 0 + L + a nn x n = b n
You may note that in this case we need only n divisions to obtain the
solution vector.
a 11 0 0 L 0 x 1 b1 a 11 x1 + 0 + 0 + L + 0 = b1
a a 22 0 L 0 x2 b a 21 x1 + a 22 x 2 + 0 + L + 0 = b 2
21 2
a 31 a 32 a 33 L 0 x 3 = b 3 a 31x 1 + a 32 x 2 + a 33 x 3 + L + 0 = b 3 (8)
M M M M M M M M M
a n1 a n2 a n3 L a nn x n b n a n1x 1 + a n 2 x 2 + a n 3 x 3 + L + a nn x n = b n
You may note here that the first equation of the system (8) contains
only x 1 , the second equation contains only x 1 and x 2 and so on.
Hence, we find x 1 from the first equation, x 2 from the second equation
and proceed in that order till we get x n from the last equation. 135
Block 2 Solutions of Linear Algebraic Equations
Since the coefficient matrix A is non-singular, a ii ≠ 0, i = 1, 2, K, n . We
thus obtain
b
a 11 x 1 = b1 x 1 = 1
a 11
(b − a 21 x 1 )
a 21 x 1 + a 22 x 2 = b 2 x 2 = 2
a 22
(b − a 31 x 1 − a 32 x 2 )
a 31 x 1 + a 32 x 2 + a 33 x 3 = b 3 x 3 = 3
a 33
n −1
b n − a nj x j
a n1x 1 + a n 2 x 2 + a n 3 x 3 + ... + a nn x n = b n x n = j=1
a nn
You may note here that the nth (last) equation contains only x n , the
(n − 1) th equation contains x n and x n −1 and so on. We can obtain x n
from the nth equation, x n −1 from the (n − 1) th equation and proceed in
that order till we get x 1 from the first equation. Since, the coefficient
matrix A is non-singular, a ii ≠ 0, i = 1, 2,K, n and we obtain
bn
a nn x n = b n x n =
a nn
(b n−1 − a ( n −1) n x n )
a ( n −1)(n −1) x n −1 + a ( n−1) n x n = b n−1 x n −1 =
a ( n −1) ( n −1)
n
b1 − a 1 j x j
Similarly, x 1 =
j= 2
a 11
In general, we write
n
b i − a ij x j
xi = , i = 1, 2, K, n
j= i +1
a ii
In the above discussion you have observed that the system of Eqn.
Ax = b can be easily solved if the coefficient matrix A has one of the
three forms, diagonal matrix, lower triangular matrix or upper triangular
matrix. Sometimes, if the matrix is not given directly in either of the
three forms, we can transform it to one of these forms. Now, you would
like to know how to reduce the given matrix A into one of these three
forms? One such method which transforms the matrix A to the upper
triangular matrix U is the Gauss elimination method which we shall
describe in the next section.
a 31 a 32 a 33 a 31 a 32 a 33
You may note that if any matrix A is transformed into another matrix B
by a series of elementary row operations, we say that A and B are
equivalent matrices. Formally, we have the following definition.
The new system called the first derived system then becomes
a 11 x 1 + a 12 x 2 + a 13 x 3 = b1
a (332 ) x 3 = b3( 2)
where
You may note here that the system of Eqn. (14) is an upper triangular
system and can be solved using the back substitution method provided
( 2)
a 33 ≠ 0 . The situation a (332) = 0 shall be discussed later in Example 9.
You may observe that we can write the above procedure more
conveniently in matrix form. Since the arithmetic operations we have
performed here affect only the elements of the matrix A and the vector
b, , we consider the augmented matrix i.e., [ A | b] (the matrix A
augmented by the vector b ) and perform the elementary row operations
on the augmented matrix as shown below:
a 11 a 12 a 13 b1
[A | b] = a 21 a 22 a 23 b 2 R 2 ← R 2 − 21 R 1
a
a 11
a 31 a 32 a 33 b 3
a
R 3 ← R 3 − 31 R 1
a 11
a 11 a 12 a 13 b1
≈ 0 a (221) a (231) b (21) (symbol ≈ means
(1) equivalent to)
0 a (321) a (331) b 3(1) R ← R − a 32 R
3 3 2
a (221)
141
Block 2 Solutions of Linear Algebraic Equations
a 11 a 12 a 13 b1
≈ 0 a (221) a (231) b (21) (19)
0 a ( 2)
33 b (32)
Now, going back to system (19), the diagonal members of the upper
triangular matrix are given special name as given in the following
definition.
Definition: The diagonal elements a 11 , a (221) and a (332 ) which are used as
divisors are called pivots.
You might have observed here that for a linear system of order 3, the
elimination was performed in 3 − 1 = 2 stages. In general for a system
Ax = b, of n equations given by Eqn. (2) the elimination is performed in
(n − 1) stages. At the ith stage of elimination, we eliminate x i , starting
from (i + 1) th row upto the nth row. Sometimes, it may happen that the
elimination process stops in less than (n − 1) stages. But this is
possible only when no equations containing the unknowns are left or
when the coefficients of all the unknowns in remaining equations
become zero. Thus, if the process stops at the rth stage of elimination
142 then we get a derived system of the form
Unit 5 Direct Methods
a 11 x 1 + a 12 x 2 + L + a 1n x n = b1
a (221) x 2 + L + a 2(1n) x n = b 2(1)
M
( r −1) ( r −1)
a rr x r + L + a (rnr −1) x n = b r (20)
( r −1)
0=b r +1
M M
0 = b n( r −1)
where r ≤ n and a 11 ≠ 0, a (221) ≠ 0, K , a (rrr −1) ≠ 0 .
4 1 1 4
≈ 0 15 − 9 6
4 4
0 0 − 12 6
5 5
9 1
3+ −
4 2 1
x2 = =
15 2
4
1 1
4 − − −
x1 = 2 2 =1
4
1 1
Hence, x 1 = 1, x 2 = and x 3 = − .
2 2
You may observe that in this case r = n = 3 and the given system of
equations has a unique solution. Also, the coefficient matrix A in this
case is non-singular as det ( A ) = A = −36 ≠ 0.
***
3 2 1 3
1 − 2
≈ 0 − 1
3 3
0 − 2 2 0 R 3 ← R 3 − 6R 2
3 2 1 3
1 − 2
≈ 0 − 1
3 3
0 0 0 12
In this case, you can see that r < n and the elements b1 , b (21) and b 3( 2)
are all non-zero.
Since we cannot determine x 3 from the last equation, the system has
no solution. In such a situation we say that the equations are
inconsistent, which means that the system does not have a solution.
Also, note that det(A) = 0 i.e., the coefficient matrix is singular.
***
16 22 4 − 2
≈ 0 − 17 1 19
2 2
0 0 0 0
Now in this case r < n and elements b1 , b (21) are non-zero, but b (32) is
zero. Also, the last equation is satisfied for any value of x 3 . Thus, we
get
x 3 = any value
2 19
x2 = − − x3
17 2
1
x1 = (−2 − 22x 2 − 4x 3 )
16
The conclusions derived from Examples 8, 9 and 10 are true for any
system of linear equations. We now summarise these conclusions as
follows:
ii) If r < n, and all the elements b (rr+−11) , b (rr+−21) , K , b (nr −1) are non-zero,
then the system has no solution. In this case, we say that the
system of equations is inconsistent. 145
Block 2 Solutions of Linear Algebraic Equations
iii) If r < n, and all the elements b (rr+−11) , b (rr+−21) , K , b (nr −1) , if present, are
zero, then the system has infinite number of solutions. In this
case, the system has only r linearly independent rows.
In both the cases (ii) and (iii) above, the matrix A is singular.
Also the back substitution adds n divisions (one division at each step)
and the number of multiplications added are
(n − 1) th equation 1 multiplication
(n − 2) th equation 2 multiplications
……………………………………….
1st equation (n − 1) multiplication
146
Unit 5 Direct Methods
n (n − 1)
∴ Total multiplications = (n − 1) =
2
Total operations (multiplication and division) added by back substitution
n (n − 1) n (n + 1)
= +n = . (22)
2 2
You can verify these results for n = 3 from Eqns. (12) and (14).
Thus, from Eqns. (20), (21) and (22) we find the total number of
operations needed to find the solution vector x using the Gauss
elimination method. Thus, we need
n (n − 1) 1 n
M= + n (n 2 − 1) + (n + 1)
2 3 2
n
= [ 2 n 2 + 6 n − 2]
6
n3 n
= + n 2 − operations, which is of O(n 3 ) Big O notation (with a
3 3 capital letter O, not a zero)
defines the asymptotic
Thus we may say that the total number of operations needed on an behavior of functions. It
shows you how fast a
1
average is n 3 (approximately). Thus, we find that Gauss elimination function grows or declines.
3 For example, if we write
method needs much lesser number of operations compared to the x2
Cramer’s rule. ex = 1+ x + + O( x 3 );
2
for x ≥ 0, this means that
You may now try a few exercises. the error is smaller in
absolute value than some
3
constant times x if x is
E10) Use Gauss elimination method to solve the system of equations close enough to 0.
x1 + 2x 2 + x 3 = 3
3x1 − 2 x 2 − 4 x 3 = −2
2x1 + 3x 2 − x 3 = −6
3x1 + 18x 2 + 9 x 3 = 18
2x1 + 3x 2 + 3x 3 = 117
4x1 + x 2 + 2 x 3 = 283
1 2 − 3 1 x 1 − 5
0 1 3 1 x 6
2 =
2 3 1 1 x3 4
1 0 1 1 x 4 1
using Gauss elimination method.
E13) Using the Gauss elimination method show that the system of
equations
147
Block 2 Solutions of Linear Algebraic Equations
3 2 − 1 − 4 x 1 10
1 − 1 3 − 1 x − 4
2 =
2 1 − 3 0 x 3 16
0 − 1 8 − 5 x 4 3
are inconsistent.
2 −1 0 0 0 x1 1
− 1 2 − 1 0 0 x 2 0
0 − 1 2 − 1 0 x 3 = 0
0 0 − 1 2 − 1 x 4 0
0 0 0 − 1 2 x 5 1
It is clear from above that you can apply Gauss elimination method to a
system of equations of any order. However, what happens if one of the
diagonal elements i.e., the pivots in the triangularization process
vanishes? Then the method will fail. In such situations we modify the
Gauss elimination method and this procedure is called pivoting. We will
discuss Gauss elimination method with pivoting in the following section.
In the elimination procedure the pivots a 11 , a (221) , K , a (nnn −1) are used as
divisors. If at any stage of the elimination one of these pivots say
a ii(i−1) , (a 11
( 0)
= a 11 ) , vanishes then the elimination procedure cannot be
continued further. Also, it may happen that the pivot a (iii−1) , though not
zero, may be very small in magnitude compared to the remaining
elements in the ith column. Using a small number as a divisor may lead
to the growth of the round-off error. In such cases, the multipliers
− a ((ii −−12))i − a ((ii −−32)) i
e.g. , (i −1) will be larger than one in magnitude. The use of
a ( i −1)
a ii
ii
large multipliers will lead to magnification of errors both during the
elimination phase and during the back substitution phase of the
solution. To avoid this we rearrange the remaining rows (ith row upto
nth row) so as to obtain a non-vanishing pivot or to make it the largest
element in magnitude in that column. The strategy is called pivoting.
The pivoting is of the two types:
i) partial pivoting
ii) complete pivoting.
In the first stage of elimination, the first column is searched for the
largest element in magnitude and this largest element is then brought at
the position of the first pivot by interchanging the first row with the row
having the largest element in magnitude in the first column. In the
second stage of elimination, the second column is searched for the
largest element in magnitude among the (n − 1) elements leaving the
first element and then this largest element in magnitude is brought at
the position of the second pivot by interchanging the second row with
the row having the largest element in the second column. This
searching and interchanging of rows is repeated in all the n − 1 stages
of the elimination. Thus we follow the following steps to find the pivot.
{ }
a (jii −1) = max a ii(i −1) , a (( ii −+11))i , a (( ii−+12))i , ..., a (nii−1) ,
Complete Pivoting
Here in the first stage of elimination, we search the entire matrix A for
the largest element in magnitude and bring it at the position of the first
pivot. In the second stage of elimination we search the square matrix of
order n − 1 (leaving the first row and the first column) for the largest
element in magnitude and bring it to the position of second pivot and so
on. This requires at every stage of elimination not only the 149
Block 2 Solutions of Linear Algebraic Equations
interchanging of rows but also interchanging of columns. The following
steps are performed.
Step 2: Interchanging the first row and i th row and then interchanging
first column and j th column i.e. R 1 ↔ R i and C1 ↔ C j .
In general,
{ }
a ij( k ) = max a ij( k ) ; i, j = k + 1, k + 2,..., n , k = 0, 1, K, (n − 1).
1 1 1 6
≈ 0 0 1 2
0 − 1 1 1
150
Unit 5 Direct Methods
(1)
Note that in the above matrix the second pivot that is a has the value 22
zero and the elimination procedure cannot be continued further unless,
pivoting is used.
b) Let us now use the partial pivoting.
Since a 21 = max { a 11 , a 21 , a 31 } therefore, interchanging R 1 ↔ R 2 ,
we get
3 3 4 20
[ A | b ] = 1 1 1 6 R 2 ← R 2 − R 1
1
3
2 1 3 13 2
R 3 ← R 3 − R1
3
3 3 4 20
≈ 0 0 − 1 − 2
3 3
0 − 1 1 − 1
3 3
1 1 1 6
[A | b] = 3 3 4 20
2 1 3 13
3 3 4 20
[ A | b ] ≈ 1 1 1 6
2 1 3 13
and then interchanging C3 ↔ C1 , we get 151
Block 2 Solutions of Linear Algebraic Equations
Leaving the first row and first column, a (321) is the largest element in
magnitude in the given matrix. Thus, a (321) is the second pivot.
Interchanging R 2 ↔ R 3 (there is no need to interchange columns
as already the pivot is in the second column), we get
4 3 3 20
≈ 0 − 5 − 1 − 2
4 4
1
0 1 1 1 R3 ← R3 + R2
4 4 5
4 3 3 20
≈ 0 − 5 − 1 − 2
4 4
0 0 1 3
5 5
In this unit, henceforth, we shall be using partial pivoting only and refer
to it by pivoting.
With Pivoting
We interchange the first and second equation of system (21) and get
0.3454 x 1 + 0.436 x 2 = 3.018
0.0003x 1 + 1.566 x 2 = 1.569
we obtain
a
m 21 = − 21 = −0.0009 (rounded-off to four decimal places)
a 11
a (221) = 1.566 − 0.0009 × (0.436)
= 1.566 − 0.0004
= 1.5656
(1)
b 2 = 1.569 − 3.018 × (0.0009)
= 1.569 − 0.0027
= 1.5683
Thus, we get the system of equations
0.3454 x 1 − 0.436 x 2 = 3.018
1.5656x 2 = 1.5683
which gives
x 2 = 1.0017
3.018 + 0.4367 3.4547
x1 = = = 10.0020
0.3454 0.3454
Step 1: Write A = LU as
a 11 a 12 a 13 l 11 0 0 1 u 12 u 13
a a 22 a 23 = l 21 l 22 0 0 1 u 23
21
a 31 a 32 a 33 l 31 l 32 l 33 0 0 1
or
a 11 a 12 a 13 l 11 l 11u 12 l 11u 13
a a 22 a 23 = l 21 l 21u 12 + l 22 l 21u 13 + l 22 u 23
21
a 31 a 32 a 33 l 31 l 31u 12 + l 32 l 31u 13 + l 32 u 23 + l 33
Step 4: Comparing the elements of the second column leaving the first
element, we get
l 21 u 12 + l 22 = a 22 l 22 = a 22 − l 21u 12
l 31 u 12 + l 32 = a 32 l 32 = a 32 − l 31 u 12 (26)
Thus, the second column of L is determined.
The number of operations for this method remains the same as that in
the Gauss-elimination method. We are leaving it for you to verify
yourself (see E16).
Thus, it is clear from Eqns. (24) – (28) that we can determine all the
elements of L and U provided the non-singular matrix A is such that
a 11 a 12
a 11 ≠ 0, ≠0.
a 21 a 22
In general, for the system of Eqn. (2), we obtain the elements of L and
U using the relations
j−1
l ij = a ij − l ik u kj , i ≥ j
k =1
j−1
a ij − l ik u kj
u ij = , i ≥ j
k =1
l ii
u ii = 1
Also, det(A) = l 11l 22 , K, l nn .
156
Unit 5 Direct Methods
Thus, we can say that every non-singular matrix A can be written as
the product of a lower triangular matrix and an upper triangular matrix if
all the principal minors of A are non-singular, i.e., if
a 11 a 12 a 13
a 11 a 12
a 11 ≠ 0, ≠ 0, a 21 a 22 a 23 ≠ 0, K| A | ≠ 0
a 21 a 22
a 31 a 32 a 33
1 1 1 u 11 u 12 u 13
4 3 − 1 = l 21u 11 l 21u 12 + u 22 l 21 u 13 + u 23
3 5 3 l 31 u 11 l 31u 12 + l 32 u 22 l 31 u 13 + l 32 u 23 + u 33
1 0 0 1 1 1
L = 4 1 0 ; U = 0 − 1 − 5
3 − 2 1 0 0 − 10
1 1 1 l 11 l 11 u 12 l 11u 13
4 3 − 1 = l 21 l 21 u 12 + l 22 l 21u 13 + l 22 u 23
3 5 3 l 31 l 31 u 12 + l 32 l 31 u 13 + l 32 u 23 + l 33
5.8 SUMMARY
In this unit we have covered the following:
5.9 SOLUTIONS/ANSWERS
E1) Equating the corresponding elements both sides, we get
a − b =1
2a − b = 0
2a + c = 8
3c + d = 17
a = 1, b = 2, c = 6, d = −1.
2 1 3 1 − 2 16 − 12
E2) AB = 3 − 2 1 2 1 = 3 − 10
− 1 0 1 4 − 2 3 0
E3) det(A ) = 8
3 5 0
E5) d = − 1 2 − 1 = 11
3 −6 4
5 0 8
d1 = 2 − 1 0 = 11
6 4 1
3 8 0
d 2 = − 1 0 − 1 = 11
3 1 4
3 5 8
d3 = −1 2 0 = 11
3 −6 1
Thus, x 1 = x 2 = x 3 = 1
1 2 −3 1
0 1 3 1
E6) d = = 20
2 3 1 1
1 0 1 1
5 2 −3 1
6 1 3 1
d1 = =0
4 3 1 1
1 0 1 1
1 5 −3 1
0 6 3 1
d2 = = 20
2 4 1 1
1 1 1 1
1 2 5 1
0 1 6 1
d3 = = 40
2 3 4 1
1 0 1 1
1 2 −3 5
0 1 3 6
d4 = = −20
2 3 1 4
1 0 1 1
Thus, x 1 = 0, x 2 = 1, x 3 = 2, x 4 = −1
d = A = −2 ≠ 0
160 2 1
d1 = 200 1 1 = −120
120 0 1
1 160 1
d 2 = 2 200 1 = −40
1 120 1
1 2 160
d 3 = 2 1 200 = −120
1 0 120
d1 − 120
x= = = 60
d −2
d − 40
y= 2 = = 20
d − 20
d − 120
z= 3 = = 60
d −2
E8) x 1 = 1
2 ×1 − x 2 = 1 x 2 = 1
3 ×1 − 1 − 2 x 3 = 0 x 3 = 1
4 ×1 + 1 − 3 ×1 + x 4 = 3 x 4 = 1
5 × 1 − 2 × 1 − 1 − 2 × 1 + x 5 = 1 x 5 = 1.
E9) x 5 = 1
x 4 − 2 × 1 = −1 x 4 = 1
x 3 − 2 ×1 + 3 ×1 = 2 x 3 = 1
x 2 − 2 × 1 + 3 × 1 − 4 × 1 = −2 x 2 = 1
x 1 − 2 ×1 + 3 ×1 − 4 ×1 + 5 ×1 = 3 x 1 = 1
163
Block 2 Solutions of Linear Algebraic Equations
1 2 1 3
E10) [A | b] = 3 − 2 4 − 2 R 2 ← R 2 − 3R 1
2 3 − 1 − 6 R 3 ← R 3 − 2R 1
1 2 1 3
≈ 0 − 8 − 7 − 11
0 − 1 − 3 − 12 R ← R − 1 R
3 3 2
8
1 2 1 3
≈ 0 − 8 − 7 − 11
17 85
0 0 − 8 − 8
The given system of equations is reduced to
x1 + 2x 2 + x 3 = 3
− 8x 2 − 7 x 3 − 11
17 85
− x3 = −
8 8
Hence, x 3 = 5, x 2 = −3, x 1 = 4.
3 18 9 18
2
E11) [A | b] = 2 3 3 117 R 2 ← R 2 − R 1
3
4 1 2 283 R ← R − R 4
3 3 1
3
3 18 9 18
≈ 0 − 9 − 3 105
0 − 23 − 10 259 R ← R − 23 R
3 3 2
9
3 18 9 18
≈ 0 − 9 − 3 105
7 28
0 0 − 3 − 3
Thus, the reduced system of equations is
3x 1 + 18x 2 + 9x 3 = 18
− 9 x 2 − 3x 3 = 105
7 28
− x3 = −
3 3
Thus, solution of the system is x 3 = 4, x 2 = −13, x 1 = 72.
1 2 − 3 1 − 5
0 1 3 1 6
E12) [A | b] =
2 3 1 1 4 R 3 ← R 3 − 2R 1
1 0 1 1 1 R 4 ← R 4 − R 1
164
Unit 5 Direct Methods
1 2 − 3 1 − 5
0 1 3 1 6
≈
0 0 10 0 20
0 − 2 4 0 6 R 4 ← R 4 + 2R 2
1 2 − 3 1 − 5
0 1 3 1 6
≈
0 0 10 0 20
0 0 10 2 18 R 4 ← R 4 − R 3
1 2 − 3 1 − 5
0 1 3 1 6
≈
0 0 10 0 20
0 0 0 2 − 2
3 2 −1 − 4 10
0 − 5 10 1 − 22
3 3 3 3
E13) Final derived system [A | b] ≈
0 0 −3 13 54
5 5
0 0 0 0 29
2 −1 0 0 0 1
0 3 −1 0 0 1
2 2
4 −1 0 1
E14) Final derived system [A | b] ≈ 0 0
3 3
0 0 0 5 −1 1
4 4
0 0 0 0 6 6
5 5
Solution of the system is x 5 = x 4 = x 3 = x 2 = x1 = 1
The solution is
x = 0.2245, y = 0.2814, z = 0.3279 165
Block 2 Solutions of Linear Algebraic Equations
Solution with pivoting:
n (n + 1)
=
2
3 18 9 1 0 0 u 11 u 12 u 13
2 3 3 = l 1 0 0 u 21 u 22
21
4 1 2 l 31 l 32 0 0 0 u 33
2 − 1 0 0 0 l 11 0 0 0 0 1 u 12 u 13 u 14 u 15
− 1 2 − 1 0 0 l 21 l 22 0 0 0 0 1 u 23 u 24 u 25
0 − 1 2 − 1 0 = l 31 l 32 l 33 0 0 0 0 1 u 34 u 35
0 0 − 1 2 − 1 l 41 l 42 l 43 l 44 0 0 0 0 1 u 44
0 0 0 − 1 2 l l 42 l 43 l 44 l 45 0 0 0 0 1
41
2 0 0 0 0
− 1 3
0 0 0
2
−1 4
0 0
L = 0 3
0 0 −1 5 0
4
0 0 0 −1 6
5
1
1 − 2 0 0 0
0 1 2
− 0 0
3
U=
0 0 1 −
3
0
4
0 0 0 1 − 4
5
0 0 0 0 1
T
1 1 1 1
The system Ly = b gives y = 1
2 3 4 5
The system Ux = y gives x = [1 1 1 1 1]T .
168
Unit 6 Inverse of a Square Matrix
UNIT 6
6.1 INTRODUCTION
In the previous unit, you have studied the Gauss elimination method
with and without pivoting. We also discussed there the LU
decomposition method for solving systems of algebraic equations
Ax = b , when A is a n × n non-singular matrix. Matrix inversion is
another problem associated with the problem of finding solutions of a
linear system. If the inverse matrix A −1 of the coefficient matrix A is
known then the solution vector x can be obtained from x = A −1b . In
general, inversion of matrices for solving system of equations should be
avoided whenever possible. This is because, it involves greater amount
of work and also it is difficult to obtain the inverse accurately in many
problems. However, there are two cases in which the explicit
computation of the inverse is desirable. Firstly, when several systems
of equations, having the same coefficient matrix A but different right
hand side b, have to be solved. Then computations are reduced if we
first find the inverse matrix and then find the solution. Secondly, when
the elements of A −1 themselves have some special physical
significance. For instance, in the statistical treatment of the fitting of a
function to observational data by the method of least squares, the
elements A −1 give information about the kind and magnitude of errors
in the data.
In this unit, we shall study a few important methods for finding the
inverse of a non-singular square matrix. We begin the unit by discussing
the method of adjoints to find the inverse of a matrix in Sec. 6.2. In Sec. 169
Block 2 Solutions of Linear Algebraic Equations
6.3, we will discuss Gauss-Jordan reduction method with and without
pivoting to find an inverse of a matrix. Finally, we will discuss LU
decomposition method of finding the inverse of a matrix in Sec. 6.4.
Now we will list the objectives of this unit. After going through the unit,
please read the list again and make sure that you have achieved the
objectives.
Objectives
After studying this unit, you should be able to:
• obtain the inverse of a matrix using the method of adjoints for n < 4 ;
• obtain the inverse of a matrix by the Gauss-Jordan method and LU
decomposition method;
• obtain the solution of a system of linear equations using the inverse
of a matrix.
You may also recall from the course BMTE-141, that the transpose of
the matrix of the cofactors of elements of A is called the adjoint matrix
and is denoted by adj (A ) .
Note that det(A ) in Eqn. (1) must not be zero and therefore the matrix
A must be non-singular.
− 5 4 − 8
A = 11 − 9 17
c
6 − 5 10
− 5 11 6
∴ adj( A) = (A ) = 4 − 9 − 5
c T
− 8 17 10
171
Block 2 Solutions of Linear Algebraic Equations
1
Step 2: Now A −1 = adj(A ) [using Eqn. (1)]
det(A)
− 5 11 6 5 − 11 − 6
1
∴ A =−1
4 − 9 − 5 = − 4 9 5
(−1)
− 8 17 10 8 − 17 − 10
5 − 11 − 6 2 3
i) x = A b = − 4
−1
9 5 − 1 = − 2 .
8 − 17 − 10 3 3
5 − 11 − 6 1 5
ii) x = A b = − 4
−1
9 5 0 = − 4
8 − 17 − 10 0 8
5 − 11 − 6 1 9
iii) x = A b = − 4
−1
9 5 − 2 = − 7
8 − 17 − 10 3 12
***
1 0 0
A = 2 3 0 .
4 5 6
1 2 3
A = 0 4 5
0 0 6
1 1
24 − 12 − 2 1 − 2 − 12
adj ( A) (A c ) T 1
∴ A −1 = = = 0 6 − 5 = 0 1 − 5
det ( A ) det ( A) 24 4 24
0 0 4 0 0 1
6
which is again an upper triangular matrix. You may note that the
inverse of an upper triangular matrix is an upper triangular matrix.
***
2 3 4 1 x 1 3
1 2 0 1 x 2 2
=
2 3 1 − 1 x 3 1
1 − 2 − 1 4 x 4 5
For large n , there are methods which are efficient and are frequently
used for finding the inverse of a matrix and solving linear systems. We
shall now discuss these methods.
x i = d i , i = 1, 2, K, n (4)
174
Unit 6 Inverse of a Square Matrix
In this method also, we use elementary row operations that are used
in the Gauss elimination method. We apply these operations both
below and above the diagonal in order to reduce all the off-diagonal
elements of the matrix to zero. We can also use pivoting in the Gauss-
Jordan reduction method. Pivoting can be used to make the pivot non-
zero or to make it the largest element in magnitude in that column as
discussed in Unit 5. We illustrate the method through an example.
1 0 0 1
≈ 0 1 0 1
2
0 0 1 − 1
2
The matrix form obtained after row operations is [I | d]. Thus, the
solution is given by
1 1
x 1 = 1, x 2 = and x 3 = −
2 2 175
Block 2 Solutions of Linear Algebraic Equations
We now solve the given system of equations using Gauss-Jordan
reduction method with partial pioviting.
The augmented matrix
1 1 1 1
[A | b] = 4 3 − 1 6
3 5 3 4 R 1 ↔ R 2
4 3 − 1 6
≈ 1 1 1 1 R 2 ← R 2 − R 1
1
4
3 5 3 4 3
R 3 ← R 3 − R1
4
4 3 − 1 6
≈ 0 1 5 − 1
4 4 2
0 11 15 − 1 R1
4 4 2 R 1 ←
4
4 3 − 1 6
11 15
≈ 0 4 4 − 1 1
2 R3 ← R3 − R2
11
0 1 5 1 12
4 4 − 2 R ← R − R2
1 1
11
− 56 72
4 0 11 11
11 15 1
≈ 0 − 56
4 4 2 R 1 ← R1 + R3
10
0 0 10
−
5
33
11 11 R 2 ← R 2 − R3
8
4 0 0 4
≈ 0 11 0 11
R
8 R1 ← 1 , R 2 ←
4
4
R2
4 11
0 0 10 5 11
11 11 R 3 ←
10
R3
1 0 0 1
≈ 0 1 0 12
0 0 1 − 1
2
The matrix obtained is of the form [I | d], where d is the solution vector.
Thus, we obtain
1 1
x 1 = 1, x 2 = , x 3 = − .
2 2
***
176
Unit 6 Inverse of a Square Matrix
The method can be easily extended to a general system of n equations
in n unknowns. Just as we calculated the number of operations needed
for Gauss elimination method in Unit 5, in the same way you can verify
that the total number of operations needed for this method is
1 n2
M = n3 + + n , which is of O(n 3 ).
2 2
E3) Verify that the total number of operations needed for the Gauss-
1 n2
Jordan reduction method is n 3 + + n.
2 2
That is
Gauss
[A | I ] → [I | A −1 ] (5)
Jordan
3 1 2
A = 2 − 3 − 1
1 − 2 1
3 1 2 1 0 0
[A | I ] = 2 − 3 − 1 0 1 0
1 − 2 1 0 0 1 R ← 1 R
1 1
3
1 2 1
1 3 3 3
0 0
≈ 2 − 3 − 1 0 1 0
R 2 ← R 2 − 2R 1
1 − 2 1 0 0 1
R 3 ← R 3 − R1
1 2 1
1 3 3 3
0 0
7
≈ 0 − 11 − −
2
1 0
3 3 3
0 − 7 1
−
1
0 1 R ← − 3 R
3 3 3 2 2
11
1 2 1
1 3 3 3
0
0
7 3
2
≈ 0 1 − 0 1
11 11 11 R1 ← R1 − 3 R 2
0 − 7 1
−
1
0 1 7
3 3 3 R 3 ← R 3 + R 2
3
5 3 1
1 0 11 11
0
11
7 2
3
≈ 0 1 0
−
11 11 11
0 0 20 1
−
7
1 R ← 11 R
11 11 11 3 3
20
5 3 1
1 0 11 11 11
0
7 2 3
≈ 0 1 − 0 5
11 11 11 R 1 ← R 1 − 11 R 3
0 0 1 1
−
7 11
7
20 20 20 R 2 ← R 2 − R3
11
1 1 1
1 0 0 4 4
−
4
3 1 7
≈ 0 1 0 − − = [I | A −1 ]
20 20 20
0 0 1 1
−
7 11
20 20 20
Thus, we obtain
178
Unit 6 Inverse of a Square Matrix
1 1 1
4 −
4 4
A −1 = 3 −
1
−
7
20 20 20
1 −
7 11
20 20 20
***
2 0 0 0
1 1 0 0
A=
2
2 0 −3 0
1 − 7 − 17
55
2 3
2 0 0 0 1 0 0 0
1 1 0 0 0 1 0 0
[A | I ] =
2
2 0 −3 0 0 0 1 0
1 − 7 − 17 55 1
0 0 0 1 R 1 ← R 1
2 3 2
1
1 0 0 0
2
0 0 0
1 1 0 0 0 1 0 0 R 2 ← R 2 − R 1
≈ 2
2 0 −3 0 0 0 1 0 R 3 ← R 3 − 2R 1
1 − 7 − 17 55 0 0 0 1 R 4 ← R 4 − R 1
2 3
1
1 0 0 0
2
0 0 0
0 1 0 0 −1 1 0 0
≈ 2 2
0 0 − 3 0 −1 0 1 0
0 − 7 − 17 55 − 1 0 0 1 R 2 ← 2R 2
2 3 2
1
1 0 0 0
2
0 0 0
0 1 0 0 −1 2 0 0
≈
0 0 − 3 0 −1 0 1 0
7 55 7
0 − 2 − 17 3 − 2
1
0 0 1 R 4 ← R 4 + 2 R 2
179
Block 2 Solutions of Linear Algebraic Equations
1
1 0 0 0
2
0 0 0
0 1 0 0 − 1 2 0 0
≈
0 0 −3 0 − 1 0 1 0
55 1
0 0 − 17 − 4 7 0 1 R 3 ← − 3 R 3
3
1
1 0 0 0
2
00 0
0 1 0 0 − 1 2 0 0
≈ 1 1
0 0 1 0 3
0 −
3
0
0 R ← R 4 + 17R 3
0 − 17 55
− 4 7 0 1 4
3
1
1 0 0 0
2
0 0 0
0 1 0 0 −1 2 0 0
≈ 1 1
0 0 1 0 3
0 −
3
0
3
0 R4 ← R4
0 0 55 5
7 − 17 1 55
3 3 3
1
1 0 0 0
2
0 0 0
0 1 0 0 −1 2 0 0
−1
≈ 1 1 = [I | A ]
0 0 1 0
3
0 −
3
0
0 0 0 1 1 21
−
17 3
11 55 55 55
Hence,
1
2 0 0 0
− 1 2 0 0
A =1
−1
3 0 − 13 0
1 21 − 17 3
11 55 55 55
is the inverse of the given lower triangular matrix. You may again
note that inverse of a lower triangular matrix is again a lower triangular
matrix.
***
180
Unit 6 Inverse of a Square Matrix
3 1
1 2 2
2
0 1 − 4 1
A=
0 0 1 2
3
0 0 0 1
3
1
1 2 2 1 0 0 0
2
0 1 − 4 1 0 1 0 0
[A | I ] =
0 0 1 2 0 0 1 0
3
R1 ← R 1 − 3 R 2
0 0 0 1 0 0 0 1 2
3
1 0 8 −1 1 − 0 0
2
0 1 −4 1 0 1 0 0
≈
0 0 1 2
0 0 1 0 R 1 ← R 1 − 8R 3
3
0 0 0 1 0 0 0 1 R 2 ← R 2 + 4R 3
19 3
1 0 0 − 1 − − 8 0
3 2 19
R1 ← R1 + R 4
11
0 1 0 0 1 4 0 3
≈ 3 R ← R − 11 R
0 0 1 2
0 0 1 0
2 2
3
4
3 2
R3 ← R3 − R4
0 0 0 1 0 0 0 1 3
3 19
1 0 0 0 1 − −8
2 3
11
0 1 0 0 0 1 4 −
≈ 3 = [I | A −1 ]
0 0 1 0 0 0 1 −
2
3
0 0 0 1 0 0 0 1
Hence,
3
19
1 − 2 −8
3
11
0 1 4 −
A −1 = 3
0 0 1 −
2
3
0 0 0 1
1 2 − 1
A = 2 1 0
− 1 1 2
Solution: We write
3 1 2 l 11 0 0 1 u12 u 13
A = LU 2 − 3 − 1 = l 21 l 22 0 0 1 u 23
1 − 2 1 l 31 l 32 l 33 0 0 1
3 1 2 l 11 l11u12 l 11u13
2 − 3 − 1 = l 21 l 21u12 + l 22 l 21u13 + l 22 u 23 (8)
1 − 2 1 l 31 l 31u12 + l 32 l 31u13 + l 32 u 23 + l 33
l′ = 0 l′21 = 6 = 2
11
2 l′11 −
3 21 33 11
7 20
l′11 − l′21 + l′ = 0 l′31 = 1
3 11 31 20
7 20
− l′ + l′ = 0 l′32 = − 7
3 22 11 32 20
1
3 0 0
3
∴ L−1 = 2 −
11
0
11
1 − 7
20
20 20 11
1 1 1
4 −
4 4
3 1 7
= − −
20 20 20
1 − 7 11
20 20 20
***
E12) Find the inverse of the matrix given in E7) using the LU
decomposition method with l ii = 1, i = 1, 2, 3, 4.
6.5 SUMMARY
In this unit we have covered the following:
[A | b] reduced
to
→ [ I | d]
[A | I ] reduced
to
→[I | A −1 ]
6.6 SOLUTIONS/ANSWERS
1 1 1 1 1
0 2 1 −3 4
≈
0 5 7 5 6
1
0 − 2 − 4 − 1 4 R 2 ← R 2
2
1 1 1 1 1
1 3
0 1 − 2 R 1 ← R 1 − R 2
2 2
≈
0 5 7 5 6 R 3 ← R 3 − 5R 2
0 − 2 − 4 − 1 4 R 4 ← R 4 + 2R 2
1 5
1 0 − 1
2 2
0 1 1 −3 2
≈ 2 2
0 0 9 25
− 4
2 2 2
0 R ← R3
0 − 3 − 4 8
3
9
1 5
1 0 − 1
2 2
1
0 1 1 − 3 2 R1 ← R1 − 2 R 3
≈ 2 2 1
0 0 1 25
−
8 R 2 ← R1 − R 3
9 9 2
0 0 − 3 − 4 8 R 4 ← R 4 + 3R 3
189
Block 2 Solutions of Linear Algebraic Equations
10 5
1 0 0
9
−
9
0 1 0 − 26 22
9 9
≈
0 0 1 25
−
8
9 9 3
13 16 R 4 ← R4
0 0 0 13
3 3
10 5
1 0 0
9
−
9
R ← R − 10 R
0 1 0 − 26 22
1 1
9
4
9 9
≈ 26
0 0 1 25
−
8 R2 ← R2 + R4
9 9 9
25
16 R 3 ← R 3 − R4
0 0 0 1 9
13
1 0 0 0 − 25
13
0 1 0 0 6
=
0 0 1 0 − 56
13
0 0 0 1 16
13
Now we will apply the same method but with pivoting. The
augmented matrix
1 1 1 1 1
2 4 3 − 1 6
[A | b] =
− 2 3 5 3 4
3 1 − 1 2 7 R 1 ↔ R 4
3 1 −1 2 7
2 4 3 − 1 6
≈
− 2 3 5 3 4
1
1 1 1 1 1 R 1 ← 3 R 1
1 1 2 7
1 3
−
3 3 3
2 4 3 − 1 6 R 2 ← R 2 − 2R 1
≈
− 2 3 5 3 4 R 3 ← R 3 + 2R 1
1 1 1 1 1 R 4 ← R 4 − R 1
190
Unit 6 Inverse of a Square Matrix
1 1 2 7
1 3 − 3 3 3
10 11 7 4
0 −
3 3 3 3
≈
0 11 13 13 26
3 3 3 3
4 1 R ↔ R
0 23 − 4 2 3
3 3 3
1 1 2 7
1 3 −
3 3 3
0 11 13 13 26
3 3 3 3
≈
0 10 11
−
7 4
3 3 3 3 3
2 4 1 4 R2 ← R2
0 3 − 11
3 3 3
1 1 2 7
1 3 −
3 3 3
1
13 13 26 R 1 ← R 1 − R 2
0 1 3
11 11
≈ 11
10
0 10 11
−
7 4 R3 ← R3 − R2
3 3 3 3 3
2
2 4 1 4 R ← R4 − R2
0 3 − 4 3
3 3 3
17
1 0 −8 3
11 11 11
13 13 26
0 1
11 11 11
≈
0 0 −3 −
69
−
72
11 11 11 11
6 5 32 R 3 ← − R 3
0 0 − − 3
11 11 11
1 0 −8 3 17
11 11 11 8
13 13
26 R 1 ← R 1 + R3
0 1 11
≈ 11 11 11 13
0 0 1 23 24 R 2 ← R 2 − R3
11
0 6 5 32 R ← R − 6 R
0 − −
11 11 11 3 4
11
3
1 0 0 19
17
0 1 0 − 26 − 26
≈
0 0 1 23 24
1
0 0 0 − 13 − 16 R 4 ← − 13 R 4
191
Block 2 Solutions of Linear Algebraic Equations
1 0 0 19 17
0 1 0 − 26 − 26 R ← R − 17R
≈ 4 1 4
0 0 1 23 24 R ← R + 26R
2 2 4
16
0 0 0 1 R ← R − 23R
13 3 3 4
1 0 0 0 − 25
13
0 1 0 0 6
≈
0 0 1 0 − 56
13
0 0 0 1 16
13
3 3
1 1
2 2
≈1 2 1 0 R 2 ← R 2 − R1
− 1 − 3 0 2 R 3 ← R 3 + R1
3 3
1 1 2 2
≈ 0 1 − 1 −
3
2 2
0 − 2 3 7 R 2 ↔ R3
2 2
3 3
1 1
2 2
3 7
≈ 0 −2 −
2 2
1
0 1 −
1
−
3 R2 ← − R2
2 2 2
3 3
1 1
2 2
≈ 0 1 −3 −
7
4 4
R 1 ← R1 − R 2
0 1 −
1
−
3
2 2 R 3 ← R 3 − R 2
192
Unit 6 Inverse of a Square Matrix
9 13
1 0 4 4
≈ 0 1 − 3 −
7
4 4
0 0 1 1
4 4 R 3 ← 4R 3
9 13
1 0 4 4
≈ 0 1 − 3 −
7
9
4 4 R1 ← R1 − R 3
4
0 0 1 1 3
R 2 ← R 2 + R 3
4
1 0 0 1
≈ 0 1 0 − 1 = [I | d]
0 0 1 1
E6) In Example 6
2 0 0 0 1
2 0 0 0 1 0 0 0
1 1 0 0 − 1 2 0 0 0 1 0 0
2
AA −1 = 1 = =I
2 0 −3 0 3 0 −3
1
0 0 0 1 0
1 − 7 − 17
55
1 21 − 17 3 0 0 0 1
2 3
11 55 55 55
and
1 2 0 0 0 1
2 0 0 0 0 0 0
− 1 2 0 0 0 1 0 0 0 1 0 0
2
A −1A = 1 = =I
3 0 −3
1
0 2 0 −3 0 0 0 1 0
1 − 7 55
3 0 0 0 1
1 21 − 17 3 − 17
2
11 55 55 55
1
1 − 2 0 0 1 0 0 0
2
2 1 2
≈ 0 1 − 3 0 3 3
0 0
1
0 − 1 2 − 1 0 0 1 0 R 1 ← R 1 + R2
2
0 0 − 1 2 0 0 0 1 R 3 ← R 3 + R 2
1 0 −1 0 2
3
1
3
0 0
3
0 1 − 23 0 1
3
2
3
0 0
≈
0 0 4
− 1 13 2
1 0
3 3 3
R3 ← 4 R3
0 0 −1 2 0 0 0 1
1 0 −1 0 2 1
0 0
3 3 3
R ← R + 1R
0 1 −2 0 1 2
0 0 1 1
3
3
≈ 3 3 3 2
0 0 1 −
3 1 1 3
0 R 2 ← R 2 + R3
4 4 2 4 3
0 0 −1 2 0 0 0 1 R 4 ← R 4 + R 3
194
Unit 6 Inverse of a Square Matrix
1 0 0 −1 3 1 1
0
4 4 2 4
0 1 0 −1 1
1 1
0
2 2 2
≈
0 0 1 −3 1 1 3
0
4 4 2 4 4
5 1 1 3 R4 ← R4
0 0 0 1 5
4 4 2 4
1 0 0 −1 3 1 1
0
4 4 2 4
1
0 1 0 −1 1
1 1
0 R1 ← R 1 + 4 R 4
2 2 2
≈ 1
0 0 1 −3 1 1 3
0 R 2 ← R 2 + 2 R 4
4 4 2 4
3
1 2 3 4 R3 ← R3 + R4
0 0 0 1 4
5 5 5 5
4 3 2 1
1 0 0 0
5 5 5 5
3 6 4 2
0 1 0 0
5 5 5 5
≈ = [I | A −1 ]
0 0 1 0 2 4 6 3
5 5 5 5
1 2 3 4
0 0 0 1
5 5 5 5
Hence,
4 3 2 1
5 5 5 5
3 6 4 2
5 5 5 5
A −1 =
2 4 6 3
5 5 5 5
1 2 3 4
5 5 5 5
The system of equation Ax = b x = A −1b, if A −1 ≠ 0.
4 3 2 1
5 5 5 5 2 1
3 6 4 2
− 1 0
5 5 5 5
Thus, x = =
2 4 6 3 − 1 0
5 5 5 5
1 2 3 4 2 1
5
5 5 5
Hence, x1 = 1, x 2 = 0, x 3 = 0, x 4 = 1.
1 0 0 1 0 0
≈ 0 1 0 − 2 1 0
1 1
0 2 1 1 0 1 R 3 ← R 3 − 2 R 2
1 0 0 1 0 0
≈ 0 1 0 − 2 1 0 = [I | A −1 ]
1
0 0 1 2 − 2 1
Thus, we obtain
1 0 0
A −1 = − 2 1 0
1
2 − 2 1
1 2 − 1 1 0 0
≈ 0 − 3 2 − 2 1 0
1
0 3 1 1 0 1 R 2 ← − R 2
3
1 2 − 1 1 0 0
≈ 0 1 − 2 2
−
1
0 R 1 ← R 1 − 2R 2
3 3 3
0 3 1 1 0 1 R 3 ← R 3 − 3R 2
1 1 2
1 0 3 −
3
0
3
≈ 0 1 − 2 2
−
1
0
3 3 3 1
0 0 3 − 1 1 1 R 3 ← R 3
3
1 1 2
1 0 3 −
3 3
0
2
≈ 0 1 − 2 −
1
0 1
3 3 3 R1 ← R 1 − 3 R 3
0 0 1 −
1 1 1 2
3 3 3 R 2 ← R 2 + R 3
3
196
Unit 6 Inverse of a Square Matrix
2 5 1
1 0 0 − 9 9 − 9
≈ 0 1 0 4 − 1 2 = [I | A −1 ]
9 9 9
0 0 1 − 1 1 1
3 3 3
Hence,
2 5 1
− 9 9 − 9
A −1 = 94 − 19 29
− 1 1 1
3 3 3
Hence, x1 = 1, x 2 = 0, x 3 = 1.
E10) Let A = LU
5 8 1 1 0 0 u11 u12 u13
0 2 1 = l 21 1 0 0 u 22 u 23
4 3 − 1 l 31 l 32 1 0 0 u 33
After multiplying both the matrices on RHS and comparing
corresponding elements of LHS and RHS, we get
1 0 0 5 8 1
L = 0 1 0 and U = 0 2 1
4 17 1
5 − 10 1 0 0 − 10
Now the inverse of the matrices L and U are
1 1 4
0 0 − −6
5 5
1
−1
L = 0 1 0 and U −1 = 0 5
2
4 17
−
5 10 1 0 0 − 10
197
Block 2 Solutions of Linear Algebraic Equations
5 − 11 − 6
Thus, A −1 = U −1L−1 = − 4 9 5
8 − 17 − 10
E11) Let A = LU
3 1 2 l11 0 0 1 u12 u13
2 − 1 − 1 = l 21 l 22 0 0 1 u 23
1 − 2 1 l 31 l 32 l 33 0 0 1
1 2
3 0 0 1 3 3
7
L = 2 − 5 0 and U = 0 1
3 5
1 − 7 18 0
0 1
3 5
Now, the inverse of the matrices L and U are
1 1 1
3 0 0 1 − 3 −
5
L−1 = 2 −
3
0 and U −1 = 0 1 −
7
5 5 5
3 7 5 0 0 1
−
18 18 18
1 5 1
6 18 − 18
Thus, A −1 = U −1L−1 = 1 − 1 − 7
6 18 18
1 − 7 5
6 18 18
1 0 0 0 2 − 1 0 0
− 1 1 0 0 0 3 − 1 0
2
2
L= and U =
0 −
2
1 0 0 0 4
− 1
3 3
3 5
0 0 − 1 0 0 0 4
4
1 0 0 0 1 1 1 1
1 2 3 4 5
1 0 0 1
2 2
2 0
3 2 5
−1
L = 1 and U =
−1
2
1 0 0 3 3
3 3 0
1 4 5
4
1 3
1 4
2 4 0 0 0
5
4 3 2 1
5 5 5 5
3 6 4 2
5 5 5 5
Now, A −1 = U −1L−1 =
2 4 6 3
5 5 5 5
1 2 3 4
5 5
5 5
15 1 9 1
− 32 −
32 16 8
− 11 11 5 1
48 48 24 12
Hence, A = U L =
−1 −1 −1
43 5
−
13
−
5
96 96 48 24
37 11 19 11
− 96 −
24
96 48
15 1 9 1
− 32 −
32 16 8 8 1
− 11 11 5 1
4 1
48 48 24 12
The solution vector x = A b =
−1 = .
43 5
−
13
−
5 8 1
96 96 48 24
37 11 19 11 3 1
− 96 −
24
96 48
Thus, x1 = 1, x 2 = 1, x 3 = 1, x 4 = 1.
200
Unit 7 Iterative Methods
UNIT 7
ITERATIVE METHODS
7.1 INTRODUCTION
In the previous two units, you have studied direct methods for solving
linear system of equations Ax = b, A being n × n non-singular matrix.
Direct methods provide the exact solution in a finite number of steps
provided exact arithmetic is used and there is no round-off error. Also,
direct methods are generally used when the matrix A is dense or
filled, that is, there are few zero elements, and the order of the matrix is
not very large say n < 50 .
Now we will list the objectives of this unit, please read this list again and
make sure that you have achieved the objectives.
Objectives
After studying this unit, you should be able to:
• obtain the solution of system of linear equations, Ax = b, when the
matrix A is large or sparse, by using the iterative method viz;
Jacobi method or the Gauss-Seidel method or the successive over
relaxation method;
• check convergence of these iterative methods;
• obtain the rate of convergence and the approximate number of
iterations needed for the required accuracy of these iterative
methods.
In general we can write the iteration method for solving the linear
system of Eqn. (1) in the form
x ( k +1) = Hx ( k ) + c, k = 0, 1, 2, K (5)
where x ( k ) and x ( k +1) are the approximations to the solution vector x at
the kth and the (k + 1) th iterations, respectively. H is called the
iteration matrix and depends on A . c is a column vector and depends
on both A and b . The matrix H is generally a constant matrix.
where ε ( 0) is the error in the initial approximate vector. Thus, for the
convergence of the iterative method, we must have
lim ε (k) = 0
k→∞
independent of ε (0) .
We shall not be proving this theorem here as its proof makes use of
advanced concepts from linear algebra and is beyond the scope of this
course.
In (i) and (ii) above, the maximum is taken over all (non-zero) n-vectors.
The most commonly used norms is the maximum norm || Α ||∞ , as it is
easier to calculate. It can be calculated in any of the following ways:
Α ∞
= max a ik (maximum absolute column-sum)
k
i
or,
|| Α ||∞ = max | a ik | (maximum absolute row-sum)
i
k
Theorem 2: The iteration method of the form (5) for the solution of
system (1) converges to the exact solution for any initial vector, if
|| H || < 1 . 205
Block 2 Solutions of Linear Algebraic Equations
Also note that
|| H || ≥ ρ(H) .
Then || Αx || = || λx || = | λ | || x ||
or | λ | || x || = || Αx || ≤ || Α || || x ||
i.e., | λ | ≤ || Α || since || x || ≠ 0
then the iteration method (5) converges for any initial approximation
x ( 0) .
For using the iteration method (5), we need the matrix H and the vector
c which depend on the matrix Α and the vector b . The well-known
iteration methods are based on the splitting of the matrix Α in the form
Α = D+L+U (12)
where D is the diagonal matrix, L and U are respectively the lower and
upper triangular matrices with zero diagonal elements. Based on the
splitting (12), we now discuss three iteration methods of the form (5)
namely, the Jacobi iteration method, the Gauss-Seidel iteration method
and successive over relaxation (SOR) method in this unit.
We rewrite system (2) in the form (3) and define the Jacobi iteration
method as
1
x (1k +1) = − (a 12 x (2k ) + a 13 x (3k ) + L + a 1n x (nk ) − b1 )
a 11
1
x (2k +1) = − (a 21 x (2k ) + 2a 23 x 3( k ) + L + a 2 n x (nk ) − b 2 )
a 22
M
1
x (nk +1) = − (a n1 x1( k ) + a n 2 x (2k ) + L + a n , n −1x (nk−)1 − b n )
a nn
1 n
or, x ( k +1)
=− a ij x j − b i , i = 1, 2, K , n , k = 0,1, K
(k)
(13)
i
a ii j=1
i≠ j
1
x 1( k +1) a 11 0 L 0 0 a 12 L a 1n x 1( k ) b1
x (2k +1) 0 1
L 0 a 21 0 L a 2 n x (2k ) b 2
= − −
a 22
M M M M M M M M M M M
x ( k +1) 0 1 (k )
a n1 a n 2 L 0 x n b n
n
0 L a
nn
or
x ( k +1) = − D −1 (L + U ) x ( k ) + D −1b, k = 0, 1, 2, K (14)
where
0 0 L 0 0
a 11 L 0 a 0
0
0 0 L 0
a 22 L 0 21
D= , L = a 31 a 32 L 0 0
M M L M
L a nn M M L M M
0 0
a n1 a n 2 L a n ( n −1) 0
207
Block 2 Solutions of Linear Algebraic Equations
0 a 12 a 13 L a 1n
0 0 a 23 L a 2n
and U = M M M L M
0 0 0 L a ( n −1) n
0 0 0 L 0
For the better understanding of the method and its convergence let us
now solve a few examples.
Example 1: Perform four iterations of the Jacobi method for solving the
system of equations
− 8 1 1 x1 1
1 −5 1 x = 16 (16)
2
1 1 − 4 x 3 7
Solution: The Jacobi method when applied to the system of Eqn. (16)
becomes
1
x 1( k +1) = [ x (2k ) + x (3k ) − 1]
8
1
x (2k +1) = [ x 1( k ) + x 3( k ) − 16] (17)
5
1
x (3k +1) = [x 1( k ) + x (2k ) − 7],
4
where
k = 0, 1, 2, K
4 − 1 1 x 1 7
4 − 8 1 x = − 21 (19)
2
− 2 1 5 x 3 15
a 11 0 0 4 0 0
D = 0 a 22 0 = 0 − 8 0,
0 0 a 33 0 0 5
0 0 0 0 0 0
L = a 21 0 0 = 4 0 0
a 31 a 32 0 − 2 1 0
and
0 a 12 a 13 0 − 1 1
U = 0 0 a 23 = 0 0 1
0 0 0 0 0 0
1 1 1 1
0 − 4 4 0 4 −
4
= − − 1 0 − 1 = 1 0 1
2 8 2 8
− 2 1 0 2 − 1 0
5 5 5 5
b1
a11 7
4
and c = a 2 = 21
b
22
b 8
3 3
33
a
1 1
− λ 4 − 4
1 −λ 1 = 0
2 8
2 − 1 − λ
5 5
210
Unit 7 Iterative Methods
3
λ3 − =0
80
All the three eigenvalues of the matrix H are equal and they are equal
to
λ = 0.3347
1 1 7
0 4 −
4 4
x ( k +1) = 1 0 1
x(k ) + 21 , k = 0, 1, 2, K (22)
2 8
8
2 − 1 0
5 5 3
1 1 7
0 4 −
4 1.8437 4
1
= 1 0 3.875 + 21 = 1.9625
[ 3.925 2.9625]
T
x ( 3)
2 8
8
2 − 1 3.025
0
5 5 3
1 1 7
0 4 −
4 1.9625 4
1
= 1 0 3.925 + 21 = 1.9906
[ 3.9766 3.0000]
T
x ( 4)
2 8
8
2 − 1 2.9625
0
5 5 3
1 1 7
0 4 −
4 1.9906 4
1
= 1 0 3.9766 + 21 = 1.9941
[ 3.9953 3.0009]
T
x (5)
2 8
8
2 − 1 3.0000
0
5 5 3
which is the solution vector after five iterations. Thus, you can see that
the solution vector obtained after five iterations is quite close to the
exact solution [2 4 3]T .
***
Example 3: Perform four iterations of the Jacobi method for solving the
system of equations
2 −1 0 0 x 1 1
− 1 2 − 1 0 x 0
2 = (23)
0 − 1 2 − 1 x 3 0
0 0 − 1 2 x 4 1
with x ( 0) = [0.5 0.5 0.5 0.5]T . What can you say about the solution
obtained if the exact solution is x = [1 1 1 1]T ?
Solution: The Jacboi method when applied to the system of Eqn. (23)
becomes
212
Unit 7 Iterative Methods
1
x 1( k +1) = [1 + x (2k ) ]
2
1
x (2k +1) = [ x 1( k ) + x (3k ) ]
2
1
x 3( k +1) = [ x (2k ) + x (4k ) ]
2
1
x (4k +1) = [1 + x (3k ) ] ,
2
where, k = 0, 1, 2, K
We start with x (0) = [0.5 0.5 0.5 0.5]T and perform following iterations:
You may notice here that the solution is improving after each iteration.
Also, the solution vector obtained after four iterations is not a good
approximation to the exact solution x = [1 1 1 1]T . This shows that we
require a few more iterations to get a good approximation.
***
Example 4: Find the spectral radius of the iteration matrix when the
Jacobi method is applied to the system of equations
1 0 2 x 1 − 1
0 1 − 2 x = 5
2
1 − 1 1 x 3 − 3
1 0 0 0 0 0 0 0 2
D = 0 1 0 , L = 0 0 0 and U = 0 0 − 2,
0 0 1 1 − 1 0 0 0 0
1 0 0 0 0 2 0 0 − 2
H = − 0 1 0 0 0 − 2 = 0 0 2
0 0 1 1 − 1 0 − 1 1 0
b1 1
a 11 −
1
and c = a 2 = 5 = [−1 5 − 3]T .
b
22 1
b 3
3 − 1
33
a
− λ (λ2 − 4) = 0
214
Unit 7 Iterative Methods
i.e., λ = 0, ± 2
∴ ρ(H) = max{λ i } = 2 > 1 .
i
We now perform few iterations and see what happens actually. Taking
x ( 0) = [0 0 0] and using the Jacobi method
T
0 0 − 2 − 1
x = 0 0 2 x + 5
( k +1) (k)
[ref. Eqn. (5)] (25)
− 1 1 0 − 3
where k = 0, 1, 2, K .
E1) Perform five iterations of the Jacobi method for solving the system
of equations given in Example 4 with x (0) = [1 1 1]T .
with x (0) = [0 1 1]T . What can you say about the solution obtained if the
exact solution is x = [0 1 2]T ?
x 2( k +1) = 1
x 3( k +1) = [−1 + 3x (2k ) ] ,
where, k = 0, 1, 2, K
0 1 1 3
The matrix notation is x ( k +1)
= 0 0 0 x + 1
(k )
(26)
0 − 3 0 − 1
where k = 0, 1, 2, K .
You may notice here that the coefficient matrix is not diagonally
dominant but the iterations converge to the exact solution after only two
iterations.
***
E2) Perform four iterations of the Jacobi method for solving the system
of equations
5 2 2 x 1 1
2 5 3 x = − 6 .
2
2 1 5 x 3 − 4
E3) Perform four iterations of the Jacobi method for solving the system
of equations
2 −1 0 3
2 x1 2
− 3 2 − 1 x2 = 0
2 2
0 x 3 1
−3 2 2
2
E4) Perform four iterations of the Jacobi method for solving the system
of equations
5 − 1 − 1 − 1 x 1 − 4
− 1 10 − 1 − 1 x 12
A= 2 =
− 1 − 1 5 − 1 x 3 8
− 1 − 1 − 1 10 x 4 34
E5) Set up the Jacobi method in matrix form for solving the system of
equations 217
Block 2 Solutions of Linear Algebraic Equations
1 1 1
1 0 −
4
−
4 x1 2
1 1
1
0 1 − − x 2 2
4 4
=
− 1 −
1
1 0 x 3 1
4 4 2
1 1 x 4 1
− 4 − 0 1 2
4
and perform four iterations. Exact solution is x = [1 1 1 1]T . Take
x (0) = [0 0 0 0] .
T
Carl Friedrich Gauss Gauss-Seidel iteration method is improved form of Jacobi method. This
(1777-1855) method is named after the German mathematicians Carl Friedrich
Gauss (1777-1855) and Philipp Ludwig von Seidel (1821-1896).
Consider the system of Eqn. (2) written in form (3). For this system of
equations, we define the Gauss-Seidel method as:
1
x 1( k +1) = − (a 12 x 2( k ) + a 13 x 3( k ) + L + a 1n x n( k ) − b1 )
a 11
1
x 2( k +1) =− (a 21 x 1( k +1) + a 23 x 3( k ) + L + a 2n x n( k ) − b 2 ) (27)
a 22
M
1
Philipp Ludwig Von Seidel x (nk+1) = − (a n1x 1( k +1) + a n 2 x (2k+1) + L + a n ( n−1) x n( k−+11) − b n )
(1821-1896) a nn
218
Unit 7 Iterative Methods
or
1 i −1 n
x i( k +1) = − ij j
( k +1)
a x + a ij x (jk ) − b i , i = 1, 2, K , n and k = 0,1, 2, ...
a ii j=1 j= i +1
You may notice here that in the first equation of system (27), we
substitute the initial approximation ( x 2(0 ) , x 3( 0) , K , x (n0) ) on the right hand
side. In the second equation, we substitute ( x 1(1) , x 3( 0) , K , x n(0) ) on the
right hand side. In the third equation, we substitute
( x 1(1) , x (21) , x 4(0 ) , K , x (n0) ) on the right hand side. We continue in this
manner until all the components have been improved. At the end of this
first iterations, we will have an improved vector ( x 1(1) , x (21) , K , x (n1) ) . The
entire process is then repeated. In other words, the method uses an
improved component as soon as it becomes available. It is for this
reason the method is also called the method of successive
displacements.
and L and U, are respectively the lower and upper triangular matrices
with the zeros along the diagonal and are of the form
0 0 L 0 0 0 a 12 a 13 K a 1n
a 0 0
21
0 K 0 0
a 23 K a 2 n
L = a 31 a 32 0 0 0 and U = 0 0 0 K M
M M M M M M K a ( n−1) n
a n1 a n 2 K a n ( n−1) 0 0 K K K 0
4 0 0 0 0 0 0 − 1 1
D = 0 − 8 0, L = 4 0 0 and U = 0 0 1.
0 0 5 − 2 1 0 0 0 0
H = − (D + L) −1 U
−1
4 0 0 0 − 1 1
= − 4 − 8 0
0 0 1
(31)
− 2 1 5 0 0 0
Let us find the inverse (D + L) −1. Since the inverse of a lower triangular
matrix is also a lower triangular matrix let
−1
l 11 0 0 4 0 0
M = l 21 l 22 0 = 4 − 8 0
l 31 l 32 l 33 − 2 1 5
220 then
Unit 7 Iterative Methods
4 0 0 l 11 0 0 1 0 0
4 − 8 0 l 21 l 22 0 = 0 1 0
− 2 1 5 l 31 l 32 l 33 0 0 1
4l 11 0 0 1 0 0
4l 11 − 8l 21 − 8l 22 0 = 0 1 0
− 2l 11 + l 21 + 5l 31 l 22 + 5l 32 5l 33 0 0 1
1 1
0 4 − 4
= 0 1 − 1
4 8
0 3 − 1
40 10
Therefore, we have
ρ(H ) = max { λ i } = 0.2207
i
Solution: The Gauss-Seidel method as given in Eqn. (27), for the given
system is
1
x 1( k +1) = [ x (2k ) + x (3k ) − 1]
8
1
x (2k +1) = [ x 1( k +1) + x 3( k ) − 16] (34)
5
1
x (3k +1) = [ x1( k +1) + x (2k +1) − 7],
4
where k = 0, 1, 2, K .
1
x 3( 4) = [−0.9966 − 3.9973 − 7] = −2.9985
4
with x ( 0) = [0.5 0.5 0.5 0.5]T . Compare the results with those obtained
in Example 3 after four iterations. The exact solution is x = [1 1 1 1]T .
Starting with the initial approximation x (0) = [0.5 0.5 0.5 0.5]T , we obtain
the following iterations:
Example 9: If Jacobi’s method and Seidel method are used to solve the
system of equation
1 2 − 3 x 1 6
− 3 1 − 1 x = 8
2
2 − 1 1 x 3 9
Jacobi Method:
− 1 0 0 0 2 − 3
H = − D (L + U ) = 0 − 1 0
−1 − 3 0
1
0 0 − 1 2 − 1 0
0 −2 3
= 3 0 − 1
− 2 1 0
0 − 2 2
The eigenvalues are given by
| H − λI | = 0 −λ (λ + 2) 2 = 0 λ = 0, − 2, − 2
The spectral radius ρ(H ) = 2 > 1
Hence, the Seidel method does not converge.
***
λ2 − k 2 = 0
λ = ± k.
Thus, ρ(H ) = | k | or ρ (Jacobi) = | k | .
The method converges if ρ(H ) < 1, i.e., | k | < 1 or − 1 < k < 1 . So, using
Theorem 1, we conclude that the Jacobi method would converge, if
− 1 < k < 1.
−λ ( k 2 − λ ) = 0
λ = 0, k 2 .
Thus, ρ(H ) = | k 2 | = k 2 or ρ (Gauss-Seidel) = k 2 .
The method converges if ρ(H ) < 1, i.e., k 2 < 1 or 0 < k < 1. So, using
Theorem 1, we conclude that the Gauss-Seidel method would
converge, if 0 < k < 1.
Also, we observe that
ρ (Jacobi) = | k |
and ρ (Gauss-Seidel) = | k 2 | = | k |2 .
Thus, [ρ (Jacobi) ]2 = ρ (Gauss-Seidel).
***
E7) Perform four iterations of the Gauss-Seidel method for solving the
system of equations given in E2. Also, compare the results with
exact solution [1 − 1 − 1]T .
E8) Perform four iterations of the Gauss-Seidel method for solving the
system of equations given in E3 using x ( 0) = 0. Also, compare the
result with exact solution [1 1 1]T .
The iterative methods which you studied so far are Jacobi method and
Gauss Seidel method. Both these methods converge when the
coefficient matrix has strictly either diagonally (row/column) dominant. In
the following section, we will discuss an iterative method called
successive over relaxation method. This method is a generalisation of
the Gauss Seidel method.
M
w
x (nk +1) = (1 − w )x (nk ) −
a nn
(
a n1x 1( k +1) + a n 2 x (2k +1) + ... + a n , n−1 x (nk−+11) − b n )
or in general
w i−1 n
x (i k+1) = (1 − w ) x i( k ) − a ij x j + a ij x j − b i , i = 1,2,3,..., n, and
( k +1) (k)
a ii j=1 j=i +1
k = 0,1, 2,K (38)
228
Unit 7 Iterative Methods
where w is a constant called the relaxation factor. You may notice
that this method reduces to Gauss-Seidal method, if w = 1.
If we take the terms with ( x j ) k+1 from RHS of Eqn. (38) to the LHS, we
can write it in the matrix form as
(D + wL )x ( k +1) = (1 − w )Dx ( k ) − w Ux ( k ) + wb (39)
where D, L and U are diagonal matrix, lower triangular matrix and
upper triangular matrix, respectively with zero diagonal elements. From
Eqn. (39), we obtain
x ( k +1) = (D + wL ) −1 (1 − w )Dx ( k ) − (D + wL) −1 w U x ( k ) + (D + wL) −1 wb
x ( k +1) = (D + wL ) −1 [(1 − w )D − wU ] x ( k ) + (D + wL ) −1 wb (40)
which is of the form (5), with
H = (D + wL) −1 [(1 − w )D − w U ] and c = (D + wL) −1 wb. (41)
You may note that this method depends on the value of the relaxation
factor w. Different values of w in Eqn. (41) yield different forms of the
method.
Solution: The SOR method as given in Eqn. (37) for the given system
is
w
x 1( k +1) = (1 − w )x 1( k ) + (− 1 + x (2k ) − x 3( k ) )
3
w
(
x 2( k +1) = (1 − w )x 2( k ) +
3
)
7 + x 1( k +1) − x 3( k ) (45)
w
(
x 3( k +1) = (1 − w )x 3( k ) +
3
)
− 7 − x1( k +1) − x (2k+1)
where, k = 0, 1, 2, K
following iterations:
230
***
Unit 7 Iterative Methods
Example 12: Successive over relaxation method is used to solve the
system of equations as given in Example 2.
4 − 1 1 x1 7
4 − 8 1 x = − 21 (46)
2
− 2 1 5 x 3 5
exact solution x = [2 4 3] .
T
The SOR method when applied to the system of Eqn. (46) becomes
1
x 1( k +1) = (1 − w ) ⋅ x 1( k ) + w ⋅ (7 + x (2k ) − x 3( k ) )
4
−1
x 2( k +1) = (1 − w ) x 2( k ) + w ⋅ ( −21 − 4 x1( k +1) − x 3( k ) ) (47)
8
1
x 3( k +1) = (1 − w ) x 3( k ) + w ⋅ (15 + 2x1( k +1) − x 3( k +1) ),
5
where k = 0, 1, 2, K .
follows.
Remark 3: In Example 2, 6 and 10, you may note that we found the rate
of convergence of the system of linear equations using Jacobi, Gauss-
Seidel and SOR methods, respectively. When we compare the spectral
radius, we get
ρ (Jacobi) = 0.3347
ρ (Gauss-Seidel) = 0.2207
ρ (SOR) = 0.1391
i.e., ρ (Jacobi) > ρ (Gauss-Seidel) > ρ (SOR).
Example 13: Perform four iterations of the SOR method for solving the
following system of equations as given in Example 8:
2 −1 0 0 x 1 1
− 1 2 − 1 0 x 0
2 = (48)
0 − 1 2 − 1 x 3 0
0 0 − 1 2 x 4 1
with x (0) = [0.5 0.5 0.5 0.5] and w = 1.25. Compare the results with
T
Solution: The SOR method, when applied to the system of Eqn. (48)
becomes
1
x 1( k +1) = (1 − w ) x1( k ) + w ⋅ (1 − x 2( k ) )
2
1
x 2( k +1) = (1 − w ) x 2( k ) + w ⋅ ( x1( k +1) + x 3( k ) ) (49)
2
1
x 3( k +1) = (1 − w ) x 3( k ) + w ⋅ ( x 2( k +1) + x 4( k ) )
2
1
x 4( k +1) = (1 − w ) x 4( k ) + w ⋅ (1 − x 3( k +1) )
2
where k = 0, 1, 2, K
Starting with the initial approximation x (0) = [0.5 0.5 0.5 0.5] and
T
Solution: The iterated values for the given system of equations (50) are
1
x 1( k +1) = (1 − w ) x1( k ) + w ⋅ (6 − x 2( k ) − 2 x 3( k ) )
3 233
Block 2 Solutions of Linear Algebraic Equations
1
x (2k +1) = (1 − w ) x 2( k ) + w ⋅ (5 + x1( k +1) − 2 x 3( k ) ) (51)
4
1
x 3( k +1) = (1 − w ) x 3( k ) + w ⋅ (7 − 2 x1( k +1) − x (2k +1) )
4
where, k = 0, 1, 2, K .
ii) Let us now perform 4 iterations with w = 1.1 . Again starting with
x ( 0) = [0 0 0]T we get the following iterations.
E12) Perform four iterations of the SOR method for solving the system
of equations given in E2. Use w = 1.2, and start with
x ( 0) = [0 0 0]T . Also, compare the result with the exact solution
x = [1 − 1 − 1]T .
E13) The SOR method is used to solve the system of equations given in
E6. Obtain the optimal value of w and use it to determine the rate
of convergence and the number of iterations needed to make
max ε i( k ) ≤ 10 −2. Perform four iterations with x ( 0) = [0 0 0]T , and
i
E14) Perform four iterations of the SOR method for solving the system
of equations given in E3. Use w = 1.25 and start with
x ( 0) = [0 0 0]T . Also, compare the result with exact solution
x = [1 1 1]T .
E15) Perform four iterations of the SOR method for solving the system
of equations given in E4. Use w = 1.5 and start with
x = [0 0 0 0]T .
E16) Set up the matrix formulation of the SOR method for solving the
system of equations given in E5. Perform four iterations of the
SOR method. Use w = 1.75 and start with x = [0 0 0 0]T .
7.5 SUMMARY
In this unit we have covered the following:
2. General iterative method for solving the linear system of Eqn. (1)
can be written in the form
x ( k +1) = Hx ( k ) + c, k = 0, 1, K (see Eqn. (5))
where x ( k ) and x ( k +1) are the approximations to the solution vector
x at the kth and the (k + 1) th iterations respectively. H is the
235
Block 2 Solutions of Linear Algebraic Equations
iteration matrix which depends on A and is generally a constant
matrix. c is a column vector and depends on both A and b .
Name Method
of the
Method
Jacobi
1 n
x ( k +1)
i = a ij x j − b i , i = 1, 2, ..., n and k = 0,1,...
(k)
a ii j=1
i≠ j
Gauss-
1 i −1 n
Seidel x i( k +1) = a ij x (jk ) − a ij x (jk +1) −b i , i = 1, 2, ..., n and k = 0, 1, 2,...
a ii j=1 j=1
SOR
w i −1 n
x i( k +1) = (1 − w ) x i( k ) − a ij x (jk +1) − a ij x (jk ) −b i , i = 1, 2, ..., n
a ii j=1 j=1+1
and k = 0,1, 2,...
7.6 SOLUTIONS/ANSWERS
0 0 − 2 − 1
E1) The Jacobi’s method gives x ( k +1)
= 0 0 2 x + 5 , where
(k )
Iteration 1: Putting k = 0,
x (1) = [−3 7 − 3]T
Iteration 2: Putting k = 1,
x ( 2) = [5 − 1 7]T
Iteration 3: Putting k = 2,
x (3) = [−15 19 − 9]T
Iteration 4: Putting k = 3,
x ( 4) = [17 − 13 31]T
Iteration 5: Putting k = 4,
x (5) = [−63 67 − 33]T
Iterations do not converge.
Iteration 1: Putting k = 0
x (1) = [0.2 − 1.2 − 0.8]T
Iteration 2: Putting k = 1
x ( 2 ) = [1.0 − 0.8 − 0.64]T
Iteration 3: Putting k = 2
x (3) = [0.776 − 1.216 − 1.04]T
Iteration 4: Putting k = 3
x ( 4) = [1.1024 − 0.8864 − 0.8672]T
After 4 iterations, the solution vector
x ( 4) = [1.1024 − 0.8864 − 0.8672]T is reasonably close to the exact
solution vector x = [1 − 1 − 1]T .
Iteration 1: Putting k = 0
x (1) = [0.75 0.0 0.25]T
Iteration 2: Putting k = 1
x ( 2) = [0.75 0.625 0.4375]T
Iteration 3: Putting k = 2
x (3) = [0.9063 0.625 0.7188]T
Iteration 4: Putting k = 3
x ( 4) = [0.9062 0.8594 0.7188]T
where k = 0, 1, 2, K .
Iteration 1: Putting k = 0
x (1) = [−0.8 1.2 1.6 3.4]T
Iteration 2: Putting k = 1
x ( 2 ) = [0.44 1.62 2.36 3.6]T
Iteration 3: Putting k = 2
x ( 3) = [0.716 1.84 2.732 3.842]T
238
Unit 7 Iterative Methods
Iteration 4: Putting k = 3
x ( 4 ) = [0.8828 1.9290 2.8796 3.9288]T
Iteration 1: Putting k = 0
x (1) = [0.5 0.5 0.5 0.5]T
Iteration 2: Putting k = 1
x ( 2 ) = [0.75 0.75 0.75 0.75]T
Iteration 3: Putting k = 2
x ( 3) = [0.875 0.875 0.875 0.875]T
Iteration 4: Putting k = 3
x ( 4 ) = [0.9375 0.9375 0.9375 0.9375]
T
Iteration 1: Putting k = 0
x (1) = [0.5 0.3333 − 0.25]T
Iteration 2: Putting k = 1
x ( 2) = [0.625 0.500 − 0.5417]T
Iteration 3: Putting k = 2
x ( 3) = [0.7709 0.6945 − 0.6563]T
Iteration 4: Putting k = 3
x ( 4 ) = [0.8282 0.7709 − 0.7900]T
Iteration 1: Putting k = 0
x (1) = [0.2 − 1.28 − 0.624]T
Iteration 2: Putting k = 1
x 2 = [0.9616 − 1.2102 − 0.9426]T
Iteration 3: Putting k = 2
x 3 = [1.0611 − 1.0589 − 1.0127]T
Iteration 4: Putting k = 3
x ( 4 ) = [1.0286 − 1.0038 − 1.0107]T
Iteration 1: Putting k = 0
x (1) = [0.75 0.5625 0.6719]T
Iteration 2: Putting k = 1
x ( 2 ) = [0.8906 0.8359 0.8769]T
Iteration 3: Putting k = 2
x ( 3) = [0.9590 0.9385 0.9539]T
Iteration 4: Putting k = 3
x ( 4 ) = [0.9846 0.9769 0.9827]T
Iteration 1: Putting k = 0
x (1) = [0.5 0.5 0.75 0.75]T
Iteration 2: Putting k = 1
x ( 2 ) = [0.875 0.875 0.9375 0.9375]T
Iteration 3: Putting k = 2
x ( 3) = [0.9688 0.9688 0.9844 0.9844]T
Iteration 4: Putting k = 3
x ( 4 ) = [0.9922 0.9922 0.9961 0.9961]T
242
Unit 7 Iterative Methods
E10) The iteration matrix H is as follows:
2 0 0 0 0 0 0 0 1
D = 0 3 0, L = 0 0 0 and U = 0 0 2
0 0 4 1 2 0 0 0 0
1
2 0 0
1
(D + L ) −1 = 0 0
3
− 1 − 1 1
8 6 4
1
0 0 − 2
H = (D + L) −1 U = 0 0 − 2
3
0 0 11
24
Eigenvalues of H are given by
11 11
| H − λI | = 0 −λ3 + λ = 0 λ = 0, 0,
24 24
Thus,
11
ρ( H ) = (Spectral radius)
24
ρ(H ) = 0.4583
ν = − log10 ρ(H ) = 0.3388 (Rate of convergence)
2
k= ≈ 6 (Number of iterations)
v
E12) The iteration scheme of the SOR method for the given system of
equations is
1
x 1( k +1) = (1 − w ) x1( k ) + w ⋅ (1 − 2x (2k ) − 2 x 3( k ) )
5
1
x (2k +1) = (1 − w ) x 2( k ) + w ⋅ ( −6 − x 1( k +1) − 3x 3( k ) )
5
1
x 3( k +1) = (1 − w ) x 3( k ) + w ⋅ (−4 − 2 x1( k +1) − x (2k +1) )
5
where k = 0, 1, 2, K .
following iterations:
Iteration 1: Putting k = 0
x (1) = [0.24 − 1.5552 − 0.702]
T
Iteration 2: Putting k = 1
x (2) = [1.2754 − 1.2358 − 1.135 2]
T
Iteration 3: Putting k = 2
x (3) = [1.123 − 0.9145 − 1.0525]
T
Iteration 4: Putting k = 3
x ( 4 ) = [0.9596 − 0.9599 − 0.9797]
T
Table 1
Iteration Iterated values x (i ) using Iterated values x (i ) using Iterated values x (i ) using
(i) Jacobi method Gauss-Seidel method SOR method
1. [0.5 0.3333 − 0.25]T [0.5 0.3333 − 0.5417]T [0.575 0.3833 − 0.6732]T
2. [0.625 0.500 − 0.5417]T [0.7709 0.6945 − 0.7900]T [0.8759 0.842 − 0.9225]T
3. [0.7709 0.6945 − 0.6563]T [0.8950 0.8600 − 0.9038]T [0.975 0.9643 − 09836]T
4. [0.8282 0.7709 − 0.7900]T [0.9519 0.9359 − 0.9559]T [0.9945 0.9928 − 0.9967]T
After 4 iterations
The maximum error in Jacobi method = 0.2291
The maximum error in Gauss-Seidel method = 0.0641
The maximum error in SOR method = 0.0055
E14) w = 1.25, x ( 0) = [0 0 0]
T
E15) w = 1.5, x ( 0) = [0 0 0 0]
T
E16) w = 1.75, x ( 0) = [0 0 0 0]
T
246
UNIT 8
EIGENVALUES AND
EIGENVECTORS
8.1 INTRODUCTION
In Unit 7, you have seen that eigenvalues of the iteration matrix play a
major role in the study of convergence of iterative methods for solving
linear system of equations. Eigenvalues are also of great importance in
many physical problems. The stability of an aircraft is determined by the
location of the eigenvalues of a certain matrix in the complex plane. The
natural frequencies of the vibrations of a beam are actually eigenvalues
of a matrix. Thus, the computation of the absolute largest eigenvalue or
smallest eigenvalue, or even all the eigenvalues of a given matrix is an
important problem.
Objectives
After studying this unit, you should be able to:
• solve simple eigenvalue problems;
• obtain the largest eigenvalue in magnitude and the corresponding
eigenvector of a given matrix by using the power method;
• obtain the smallest eigenvalue in magnitude and an eigenvalue
closest to any chosen number along with the corresponding
eigenvector of a given matrix by using the inverse power method;
• obtain the bounds on the eigenvalues of a given matrix.
The homogeneous system of Eqn. (2) will have a non-zero solution only
when the coefficient matrix (A − λI) is singular, that is,
det(A − λI) = 0 (4)
det(A ) = 0
det(A − 0I) = 0
0 is an eigenvalue of the matrix A
λ is an eigenvalue of A T
Ax = λ i x, i = 1, 2, K, n (6)
Premultiplying Eqn. (6) by A on both sides, we get
A 2 x = Aλ i x = λ i ( Ax) = λ2i x (7)
which gives (1 − λ) (2 − λ) (3 − λ) = 0 .
1− λ 0 0
b) det(A − λI ) = 2 3−λ 0 =0
4 5 6−λ
which gives (1 − λ) (3 − λ) (6 − λ) = 0
Eigenvalues of A are λ1 = 1, λ 2 = 3, λ 3 = 6 .
1− λ 2 3
c) det(A − λI ) = 0 4−λ 5 =0
0 0 6−λ
Therefore, (1 − λ) (4 − λ) (6 − λ) = 0 .
Eigenvalues of A are λ1 = 1, λ 2 = 4, λ 3 = 6 .
***
x1 1
x = k 1
2
Note: In practice we usually omit k and say that [−2 1]T and [1 1]T are
the eigenvectors of A corresponding to the eigenvalues λ = 1 and λ = 4
respectively. Moreover, the eigenvectors in this case are linearly
independent.
x1 i
x = k 1
2
− x2 − 2 x3 = 0
x1 1
x = k
2 2
x 3 1
x 2 − 2 x3 = 0
2 x1 − x2 − 5 x3 = 0
x 1 2
x = k − 1
2
x 3 1
we can take any values for x 1 and x 2 which need not be related
to each other. The two linearly independent solutions can be
written as
1 0
k 0 or k 1
− 2 1
255
Block 2 Solutions of Linear Algebraic Equations
Note that in Eqn. (12), it is not necessary that we always assign
values to x 1 and x 2 . We can assign values to any of the two
variables and obtain the corresponding value of the third variable.
***
1 2 2
E2) A = 2 3 2
2 2 1
− 15 4 3
E3) A = 10 − 12 6
20 − 4 2
− 2 2 − 3
E4) A = 2 1 − 6
1 − 2 0
2 − 1 − 1
E5) A = 3 − 2 1
0 0 1
In the examples considered so far, it was possible for us to find all the
roots of the characteristic equation exactly. But this may not always be
possible. This is particularly true for n > 3. In such cases, some
iterative method like Newton-Raphson method may have to be used to
find a particular eigenvalue or all the eigenvalues from the characteristic
256
Unit 8 Eigenvalues and Eigenvectors
equation. However, in many practical problems, we do not require all
the eigenvalues but need only a selected eigenvalue. For example,
when we use iterative methods for solving a non-homogeneous system
of linear equation Ax = b, we need to know only the largest eigenvalue
in magnitude of the iteration matrix H, to find out whether the method
converges or not. One iterative method, which is frequently used to
determine the largest eigenvalue in magnitude (also called the
dominant eigenvalue) and the corresponding eigenvector for a given
square matrix A is the power method. In this method we do not find
the characteristic equation. This method is applicable only when all the
eigenvalues are real and distinct. If the magnitude of two or more
eigenvalues is the same then the method converges slowly.
y ( k +1) = Ay ( k ) , k = 0, 1, K (13)
Note that in the process of multiplying the matrix A with the vector y ( k ) ,
the elements of the vector y ( k +1) may become very large. To avoid this,
we normalize (or scale) the vector y ( k ) at each step by dividing y ( k ) ,
by its largest element in magnitude. This will make the largest element
in magnitude in the vector y ( k +1) as one and the remaining elements
less than one. Vector for which scaling has been done is called a
scaled vector otherwise, it is unscaled.
y (k+1)
λ1 = lim r (k) , r = 1, 2,...., n.
(16)
k →∞
vr
where r represents the rth component of that vector. Obviously, there
are n ratios of numbers. As k → ∞ all these ratios tend to the same
value, which is the largest eigenvalue in magnitude i.e., λ1 . The
iteration is stopped when the magnitude of the difference of any two
ratios is less than the prescribed tolerance.
Iteration 1: y (0 ) = v (0) = [1 1 1]
T
2 − 1 0 1 2
Iteration 2: y (2)
= Av (1)
= − 1 2 − 1 0 = − 2
0 − 1 2 1 2
m 2 = max { 2 , − 2 , 2 } = 2
2
1 ( 2) 1 ( 2 ) 1
= − 2 = [1 − 1 1]
T
v ( 2) = y = y
m2 2 2
2
2 −1 0 1
Iteration 3: y (3) = Av ( 2) = − 1 2 − 1 − 1 = [3 − 4 3]T
0 − 1 2 1
m3 = 4
3
1 1
v ( 3) = y ( 3) = − 4 = [0.75 − 1 0.75]T
4 4
3
2 − 1 0 0.75
Iteration 4: y ( 4) = Av (3) = − 1 2 − 1 − 1 = [2.5 − 3.5 2.5]T
0 − 1 2 0.75
m 4 = 3.5
2.5
1 ( 4) 1
v ( 4) = y = − 3.5 = [0.7143 − 1 0.7143]T
3. 5 3.5
2.5
Iteration 5:
2 − 1 0 0.7143
y (5) = Av ( 4) = − 1 2 − 1 − 1 = [2.4286 − 3.4286 2.4286]T
0 − 1 2 0.7143
m5 = 3.4286
2.4286
1 1
v (5) = y ( 5) = − 3.4286 = [0.7083 − 1 0.7083]T
3.4286 3.4286
2.4286 259
Block 2 Solutions of Linear Algebraic Equations
Iteration 6:
2 − 1 0 0.7083
y ( 6) = Av (5) = − 1 2 − 1 − 1 = [2.4166 − 3.4166 2.4166]T
0 − 1 2 0.7083
m 6 = 3.4166
2.4166
1 1
v ( 6) = y ( 6) = − 3.4166 = [0.7073 − 1 0.7073]T
3.4166 3.4166
2.4166
Iteration 7:
2 − 1 0 0.7073
y ( 7) = Av (6) = − 1 2 − 1 − 1 = [2.4146 − 3.4146 2.4146]T
0 − 1 2 0.7073
m 7 = 3.4146
2.4146
1 1
v ( 7) = y (7 ) = − 3.4146 = [0.7071 − 1 0.7071]T
3.4146 3.4146
2.4146
(7)
(y r )
After seven iterations, the ratios (6)
for r = 1, 2, 3 are
(v r )
2.4146 − 3.4146 2.4146
, , = 3.4138, 3.4146, 3.4138 , respectively.
0.7071 −1 0.7071
Use initial vector [1 1 1]T . Also, compare the result with the eigenvalue
260 obtained in E3.
Unit 8 Eigenvalues and Eigenvectors
( 0) (0) T
Solution: Starting with y =v = [1 1 1] we perform the following
iterations:
Iteration 1: y ( 0) = v ( 0) = [1 1 1]T .
− 15 4 3 1 − 8
y (1) = Av ( 0) = 10 − 12 6 1 = 4
20 − 4 2 1 18
Now m1 = max{| −8 |, | 4 |, | 18 |} = 18
− 8 − 0.4444
1 (1) 1
and v (1) = y = 4 = 0.2222
m1 18
18 1
− 15 4 3 − 0.4444 10.5556
Iteration 2: y ( 2) = Av (1) = 10 − 12 6 0.2222 = − 1.1111
20 − 4 2 1 − 7.7778
Now, m 2 = 10.5556
10.5556 1
1 ( 2) 1
and v ( 2) = y = − 1.1111 = − 0.1053
m2 10.5556
− 7.7778 − 0.7368
− 15 4 3 1 − 17.6316
Iteration 3: y (3) = Av ( 2) = 10 − 12 6 − 0.1053 = 6.8421
20 − 4 2 − 0.7368 18.9474
Now m 3 = 18.9474
− 17.616 − 0.9306
1 ( 3) 1
and v (3) = y = 6.8421 = 0.3611
m3 18.9474
18.9474 1
− 15 4 3 − 0.9306 18.4028
Iteration 4: y ( 4) = Av ( 3) = 10 − 12 6 0.3611 = − 7.6389
20 − 4 2 1 − 18.0556
Now m 4 = 18.4028
261
Block 2 Solutions of Linear Algebraic Equations
18.4028 1
1 ( 4) 1
and v ( 4) = y = − 7.6389 = − 0.4151
m4 18.4028
− 18.0556 − 0.9811
− 15 4 3 1 − 19.6038
Iteration 5: y (5) = Av ( 4) = 10 − 12 6 − 0.4151 = 9.0943
20 − 4 2 − 0.9811 19.6981
Now m 5 = 19.6981
− 19.6038 − 0.9958
1 (5) 1
and v (5) = y = 9.0943 = 0.4617
m5 19.6981
19.6981 1
− 15 4 3 − 0.9958 19.7749
Iteration 6: y ( 6) = Av (5) = 10 − 12 6 0.4617 = − 9.4923
20 − 4 2 1 − 19.751
Now m 6 = 19.7749
19.7749 1
1
and v (6) = − 9.4923 = − 0.48
19.7749
− 19.751 − 0.9988
E6) Using four iterations of the power method and taking the initial
vector y (0 ) with all its elements equal to one, find the dominant
262
Unit 8 Eigenvalues and Eigenvectors
eigenvalue and the corresponding eigenvector of the following
matrices.
2 −1 0 0
1 2 2
− 1 2 − 1 0
i) A= 2 3 2 ii) A= .
0 − 1 2 − 1
2 2 1
0 0 − 1 2
You must have realised that an advantage of the power method is that
the eigenvector corresponding to the dominant eigenvalue is also
generated at the same time. Usually, for most of the methods of
determining eigevalues, we need to do separate computations to obtain
the eigenvector.
1
Step 3: Compute v ( k +1) = k +1
y ( k +1) .
m
using four iterations of the inverse power method using initial vector
[1 1 1]T . .
Iteration 1: Ay (1) = v ( 0)
or
2 − 1 0 y1 1
− 1 2 − 1 y = 1 (19)
2
0 − 1 2 y3 1
Solving Lz = v ( 0)
And then Uy (1) = z , we obtain
T
3 3
y = 2 = [1.5 2.0 1.5]T
(1)
2 2
m1 = 2.0
1 (1)
∴ v (1) = y = [0.75 1.0 0.75]T
m1
Iteration 2: Ay ( 2) = v (1)
Solving Lz = v (1)
and Uy ( 2) = z, we obtain
y ( 2 ) = [1.25 1.75 1.25]T
m 2 = 1.75
1 (2)
v ( 2) = y = [0.7143 1 0.7143]T
m2
Iteration 3: Ay (3) = v ( 2)
y (3) = [1.2143 1.7143 1.2143]T
m3 = 1.7143
1 ( 3)
v ( 3) = y = [0.7083 1 0.7083]T
m3
Iteration 4: Ay ( 4) = v (3)
y ( 4) = [1.2083 1.7083 1.2083]T
m 4 = 1.7083
1 (4)
v ( 4) = y = [0.7073 1 0.7073]T
m4
( 4)
(y r )
After four iterations, the ratios (3)
for r = 1, 2, 3, K are
(vr )
1.2083 1.7083 1.2083
, , = 1.7059, 1.7083, 1.7059 , respectively. The
0.7073 1 0.7073
maximum error in these ratios is 0.0024. Hence, the dominant
1
eigenvalue of A −1 can be taken as 1.7083. Therefore, = 0.5882
1.7083
265
Block 2 Solutions of Linear Algebraic Equations
is the smallest eigenvalue of A in magnitude and the corresponding
eigenvector is given by [0.7073 1 0.7073]T .
Use initial vector [1 1 1]T and perform four iterations of the inverse
power method. Also, compare the result with the smallest eigenvalue
obtained in E3.
Iteration 1: A y (1) = v ( 0)
− 15 4 3 y1 1
10 − 12 6 y 2 = 1 (21)
20 − 4 2 y 3 1
We solve the system of Eqn. (21), and obtain
y (1) = [0.0400 0.1299 0.3599]T .
m1 = 0.3599
v (1) = [0.1111 0.3609 1]T .
− 1 − 1 0
− 1 − 1 − 1 y ( k+1) = v ( k ) (26)
0 − 1 − 1
Iteration 2: Ay ( 2) = v (1)
y ( 2 ) = [1 − 1 1]T
m2 = 1
1 (2)
v ( 2) = y = [1 − 1 1]T
m2
Iteration 3: Ay (3) = v ( 2)
y ( 3) = [2 − 3 2]T
m3 = 3
1 ( 3)
y = [0.6667 − 1 0.6667]
T
v ( 3) =
m3
Iteration 4: Ay ( 4) = v (3)
m 4 = 2.333
1 ( 4)
y = [0.7143 − 1 0.7143]
T
v ( 4) =
m4
E11) Using four iterations of the inverse power method, find the
eigenvalue which is nearest to 5 and the corresponding
eigenvector for the matrix
3 2
A= (exact eigenvalues are = 1 and 6 )
3 4
with v ( 0) = [1 1]T .
Ax i = λi xi (27)
or
a11 x i ,1 + a 12 x i , 2 + L + a 1n x i , n = λ i x i , 1
a 21x i , 1 + a 22 x i , 2 + L + a 2 n x i, n = λi x i , 2
M M M M
a k1x i , 1 + a k 2 x i , 2 + L + a kn x i , n = λ i x i, k
(28)
M M M M
a n1x i , 1 + a n 2 x i , 2 + L + a nn x i , n = λ i x i , n
x x x
a k1 i , 1 + a k 2 i , 2 + L + a kk + L + a kn i, n = λi (29)
x i, k x i, k x i, k
≤ | a k1 | + | a k 2 | + L + | a kk | + L + | a kn | (30)
x i, j
Since ≤ 1 for j = 1, 2, K , n .
x i, k
Since eigenvalues of A and A T are same (Ref. P2), Eqn. (30) can also
be written as
| λ i | ≤ | a1k | + | a 2 k | + L + | a kk | + L + | a nk | (31)
and
n
| λ | ≤ max | a ij | (maximum absolute column sum) (33)
j
i=1
Again, since A and A T have the same eigenvalues Eqn. (34) can be
written as
n
| λ i − a kk | ≤ | a ij | (35)
i =1
i≠ j
A square matrix A is
Note that since the eigenvalues can be complex, the bounds (32), (33), symmetric if A = A .
T
(34) and (35) represent circles in the complex plane. If the eigenvalaues
are real, then they represent intervals. For example, when A is
symmetric then the eigenvalus of A are real.
Again in Eqn. (34), since k is not known, we replace the circle by the
union of the n circles.
n
| λ − a ii | ≤ | a ij |, i = 1, 2, K , n . (36)
j=1
i≠ j
Similarly from Eqn. (35), we have that eigenvalues of A lie in the union
of circles
271
Block 2 Solutions of Linear Algebraic Equations
n
| λ − a ii | ≤ | a ij | , j = 1, 2, K, n . (37)
i =1
i≠ j
The bounds derived in Eqns. (32), (33), (36) and (37) for eigenvalues
are all independent bounds. Hence the eigenvalues must lie in the
intersection of these bounds. The circles derived above are called the
Gershgorin circles and the bounds are called the Gershgorin
bounds.
Let us now consider the following examples:
using the Gershgorin bounds. Also, draw the rough sketch of the region.
λ − a 22 ≤ ( a 21 + a 23 ) | λ − 1 | ≤ 5
λ − a 33 ≤ ( a 31 + a 32 ) | λ − 2 | ≤ 4
λ − a 22 ≤ ( a 12 + a 32 ) | λ − 1 | ≤ 4
λ − a 33 ≤ ( a 13 + a 23 ) | λ − 2 | ≤ 5
272
Unit 8 Eigenvalues and Eigenvectors
Since all the eigenvalues lie in the union of circles, therefore,
union of circles is | λ − 2 | ≤ 5 (41)
The eigenvalaues lie in all the circles (38), (39), (40) and (41) i.e., in the
intersection of these circles as shown by shaded region in Fig. 1.
Fig. 1
***
i) | λ | = 6 −6 ≤ λ ≤ 6
Note that in Example 10, since the matrix A is symmetric, the bounds
(32) and (33) are same and also the bounds (36) and (37) are same.
***
You may now try the following exercise.
8.6 SUMMARY
In this unit we have covered the following:
ii) we use the inverse power method with the iteration scheme
y ( k+1) = ( A − qI) −1 v ( k )
i.e., ( A − qI) y ( k +1) = v ( k ) , k = 0, 1, 2, K
where y ( 0) = v ( 0) is an arbitrary non-zero vector (not an
eigenvector)
n
ii) The maximum absolute column sum is | λ | ≤ max | a ij |
i
i=1
n
iii) Union of circles | λ − a ii | ≤ | a ij |, i = 1, 2, K , n
j=1
i≠ j
n
iv) Union of circles | λ − a ii | ≤ | a ij | , j = 1, 2, K, n
i =1
i≠ j
275
Block 2 Solutions of Linear Algebraic Equations
The intersection of bounds obtained in (i), (ii), (iii) and (iv) is the
region in which eigenvalues lie.
8.7 SOLUTIONS/ANSWERS
E1) Since λ i (i = 1, 2, K, n ) are the eigenvalues of A, we have
Ax = λ i x, i = 1, 2, K, n.
On subtracting q x both the sides, we get
Ax − q x = λx − q x
( A − qI )x = (λ − q )x
( A − qI ) −1 ( A − qI )x = ( A − qI ) −1 (λ i − q )x
1
x = (A − qI) −1 x.
( λ i − q)
[1 − 2 1]T for λ = 1
[1 2 1]T for λ = 5
[1 1 0]T for λ = 1
[1 1 0]T for λ = 1.
v ( 2) = [0.7169 1 0.7169]T
v ( 4) = [0.7075 1 0.7075]T
(y (4) ) r
After 4 iterations the ratios for r = 1, 2 and 3 are given
( v ( 3) ) r
by 4.9946, 5.0054, 4.9946 respectively. The maximum error in
these ratios is 0.0108. Thus the dominant eigenvalue of A
can be taken as 5.00 and the corresponding eigenvector is
[0.7075 1 0.7075]T
v (1) = [1 0 0 1]T
Iteration 2: y ( 2) = [2 − 1 − 1 2]T ; m 2 = 2
v (1) = [− 1 0.60]
T
v ( 2) = [− 1 0.5238]
T
v (3) = [− 1 0.5176]
T
v ( 4) = [− 1 0.5043]
T
m1 = 0.3171
v (1) = [1 0.1082 1]
T
279
Block 2 Solutions of Linear Algebraic Equations
= [0.5693 − 0.5007 0.5693]
( 2) T
Iteration 2: y
m 2 = 0.5693
v ( 2) = [1 − 0.8795 1]
T
m 3 = 1.0932
m 4 = 1.039
v ( 4) = [0.7204 − 1 0.7204]
T
3 2
E10) It is given that q = −1. Thus, A + qI is [A + I] = .
1 4
3 2 (1) − 1
Iteration 1: Solving y = , we get
1 4 1
v (1) = [− 1 0.6667]
T
v ( 2) = [− 1 0.5625]
T
v (3) = [− 1 0.5244]
T
280
Unit 8 Eigenvalues and Eigenvectors
= [− 0.5049 0.2573] ; m 4 = 0.5049
( 4) T
Iteration 4: y
v ( 4) = [− 1 0.5097]
T
( y (r4) )
After 4 iterations, the ratios for r = 1, 2 are 0.5049, 0.4907,
( v (r3) )
respectively. The maximum error in these ratio is 0.0142. Hence
the dominant eigenvalues of (A + I) −1 can be taken as µ = 0.5 .
The eigenvalue of A which is nearest to − 1 is obtained from
1 1
λ= −1 = −1 = 1
µ 0.5
− 2 2
E11) [A − 5I] =
3 − 1
Starting with v ( 0) = [1 1]T , we get the following iterations:
− 2 2 (1) 1
Iteration 1: Solving y = , we get
3 − 1 1
v (1) = [0.6 1]
T
v ( 2) = [0.6842 1]
T
v (3) = [0.6623 1]
T
v ( 4) = [0.6664 1]
T
( y ( 4) ) r
After 4 iterations, the ratios for r = 1, 2 are 1.005, 0.9968 ,
( v (3) ) r
respectively. The maximum error in these ratios is 0.0082 . Hence
the dominant eigenvalue of ( A − 5I) −1 can be taken as µ = 0.99 .
The eigenvalue of A which is nearest to 5 is obtained from
1
λ= +5
µ
1
= + 5 = 6.0101
0.99
The corresponding eigenvector is [0.664 1] .
T
281
Block 2 Solutions of Linear Algebraic Equations
E12) a) The given matrix A is a symmetric matrix. Thus the
eigenvalue of A lie in the following regions:
i) | λ | ≤ max{3, 4, 3} = 4
a) | λ − 2 | ≤1
b) |λ−2| ≤ 2
c) | λ−2 | ≤1
i) | λ | ≤ 4 −4 ≤ λ ≤ 4
a) −1 ≤ λ − 2 ≤ 1 1 ≤ λ ≤ 3
b) −2≤λ−2≤ 20≤λ ≤4
i) | λ | ≤ {10, 6, 6} | λ | ≤ 10 −10 ≤ λ ≤ 10
a) | λ − 6 | ≤ 4 −4 ≤ λ − 6 ≤ 4 2 ≤ λ ≤ 10
b) | λ − 3 | ≤ 3, and
| λ − 3 | ≤ 3 −3 ≤ λ − 3 ≤ 3 0 ≤ λ ≤ 6
| λ | ≤ max{6, 15, 7} = 15
| λ | ≤ max{10, 10, 8} = 10
282
Unit 8 Eigenvalues and Eigenvectors
iii) Union of circles
| λ − 3 | ≤ 4,
| λ − 6 | ≤ 9,
| λ −3| ≤ 5
Thus, union is | λ − 6 | ≤ 9
Fig.2
Fig.3
284
Block 2 Miscellaneous Examples and Exercises
d1 = − 3 5 1
11 1 3
= 52
3 5 1
d2 = 2 − 3 1
2 11 3
= −52
3 2 5
d3 = 2 5 − 3
2 1 11
= 78
d1 52
∴ x1 = = = 2,
d 26
d − 52
x2 = 2 = = −2
d 26
d 3 78
x3 = = =3
d 26 285
Block 2 Solution of Linear Algebraic Equations
ii) Using the Cramer’s rule, we get
7. 6 0.5 2.4
d = 2.2 9.1 4.4
− 1.3 0.2 5.8
1. 9 0.5 2.4
d1 = 9.7 9.1 4.4
− 1.4 0.2 5.8
= 102 .632
7. 6 1.9 2.4
d 2 = 2.2 9.7 4.4
− 1.3 − 1.4 5.8
= 462 .152
d 3 = 2. 2 9.1 9. 7
− 1. 3 0. 2 − 1. 4
= −93.02
d1 102.632
∴ x1 = = = 0.2475
d 414.678
d 2 462.152
x2 = = = 1.1145
d 414.648
d 3 − 93.02
x3 = = = −0.2243
d 414.648
***
1 1
1 2 3
1
1 1
≈ 0 − 1
12 12 2
0 1 4
− 1 R3 ← R3 − R2
12 45 3
1 1
1 2 3
1
1 1
≈ 0 − 1
12 12 2
1 1
0 0 180 6
1 1 1
x 2 + x3 = −
12 12 2
x 2 = −36
1 1
x1 + x2 + x3 = 1
2 3
x1 = 9
4 1 1 4
1
[A | b] = 1 4 −2 4 R 2 ← R 2 − × R 1
4
3 2 −4 6 R ← R − 3 × R
3 3 1
4
287
Block 2 Solution of Linear Algebraic Equations
4 1 1 4
15 9
≈ 0 4
− 3
4
1
0 5
− 19 3 R 3 ← R 3 − 3 × R 2
4 4
4 1 1 4
15 9
≈ 0 4
− 3
4
0 0 −4 2
1 −4 0 −1 6
1 1 2 3 − 1 R 2 ← R 2 − R 1
[A | b] =
2 3 −1 −1 − 1 R 3 ← R 3 − 2 × R 1
1 2 3 −1 3 R 4 ← R 4 − R 1
1 −4 0 −1 6
0 5 2 4 −7
≈
0 11 −1 1 − 13 R 3 ← R 3 − 2.2 × R 2
0 6 3 0 − 3 R 4 ← R 4 − 1.2 × R 2
1 −4 0 −1 6
0 5 2 4 − 7
≈
0 0 − 5. 4 − 7. 8 2. 4
0 0 0.6 − 4.8 5.4 R 4 ← R 4 + 0.1111 × R 3
1 −4 0 −1 6
0 5 2 4 −7
≈
0 0 − 5.4 − 7. 8 2.4
0 0 0 − 5.6667 5.6667
x 1 = 1, x 2 = −1, x 3 = 1 and x 4 = −1
288
Block 2 Miscellaneous Examples and Exercises
iv) The argument matrix is
x1 + x 2 + x 3 = 1
20 5 3
1 0 −
49 49
−
49
0
20
57 11
≈ 0 1 − 2 0 R1 ← R1 + R3
49 49 49
49
0 0 1 −
1
−2
49
R ← R2 −
57
R3
4 3 12 2 49
1 5
1 0 0 0 −
3 3
≈ 0 1 0 1
4
1 19
− = I|A
4
[ ]-1
0 0 1 −
1
−2
49
4 3 12
1 5
0 −
3 3
Hence, A −1 = 14 1 −
19
4
− 1 −2
49
4 3 12
Let us now solve the system of equations using A −1.
Ax = b x = A -1b
1 5
x1 0 −
3 3 15
x 2 = 14 1 −
19
4
− 11
x 3 − 1 −2
49 1
4 3 12
1 5
(0) (15) + − (−11) + (1) 16
3 3 3
1 19
= (15) + (1) (−11) + − (1) = − 12
4 4 23
1 2 49
− (15) + − (−11) + (1) 3
4 3 12
16 23
i.e. x1 = , x 2 = −12, x 3 = .
3 3
290 ***
Block 2 Miscellaneous Examples and Exercises
Example 4: Find the inverses of the following matrices using Guass
Jordan method with partial pivoting.
0 1 2 − 1 2 0
i) A = 3 5 1 ii) A=1 0 5
6 8 9 3 8 7
0 1 2 1 0 0
Solution: i) [A | I ] = 3 5 1 0 1 0
6 8 9 0 0 1 R 1 ↔ R 3
6 8 9 0 0 1
≈ 3 5 1 0 1 0
0 1 2 1 0 0 R ← R 1
1
6
4 3 1
1 3 2
0 0 6
≈ 3 5 1 0 1 0
0 1 2 1 0 0 R 2 ← R 2 − 3R 1
4 3 1
1 3 2
0 0 6
4
≈ 0 1 − 72 0 1 − 12 R 1 ← R1 − R 2
3
0 1 2 1 0
0 R3 ← R3 − R2
37 4 5
1 0 6
0 −
3 6
≈ 0 1 − 72 0 1 − 12
2
0 0 11
1 −1 1 R3 ← R3
2 2
11
37 5
1 0 6 0 − 43 6
37
≈ 0 1 − 72 0 − 12 R 1 ← R 1 − R 3
1
6
0 0 1 2 − 2 1
R ← R2 + R3
7
11 11 11 2
2
3
1 0 0 − 37
33
7
− 33 11
≈ 0 1 0 7
11
4
11
2
− 11 [
= I | A −1 ]
0 0 1 2 2
− 11 1
11 11
291
Block 2 Solution of Linear Algebraic Equations
37 7 3
− 33 − 33
−1
0 1 2 11
A −1 = 3 5 1 = 11 7 4 2
− 11
11
6 8 9 2 2
− 11 1
11 11
ii) Initial Matrix is
− 1 2 0 1 0 0
[A | I] = 1 0 5 0 1 0
3 8 7 0 0 1 R 1 ← − R 1
1 − 2 0 −1 0 0
≈ 1 0 5 0 1 0 R 2 ← R 2 − R 1
3 8 7 0 0 1 R 3 ← R 3 − 3R 1
1 − 2 0 −1 0 0
≈ 0 2 5 1 1 0
1
0 14 7 3 0 1 R 2 ← R 2
2
1 −2 0 −1 0 0
5
1 1
≈ 0 1 0 R 1 ← R 1 − ( − 2) R 2
2 2 2
0 14 7 3 0 1 R 3 ← R 3 − 14R 2
1 0 5 0 1 0
5
1 1
≈ 0 1 0
2 2 2
1
0 0 − 28 −4 − 7 1 R 3 ← − R 2
28
1 0 5 0 0 0
5 1 1
≈ 0 1 0 R 1 ← R 1 − 5R 3
2 2 2
5
0 0 1 1 1
− 28 1 R2 ← R2 − R3
7 4 2
5
1 0 0 − 57 − 14
28
≈ 0 1 0 1
7
− 18
55
[
5 = I | A −1 ]
0 0 1 1 1 1
− 28
7 4
5 5
− 1 0
−1
− 7 − 14
2 28
5
A −1 = 1 0 5 = 17 − 18 56
3 8 7 1 1 −
1
7 4 28
***
292
Block 2 Miscellaneous Examples and Exercises
Example 5: Use Doolittle LU decomposition method to solve the
following system of equations
x1 + x 2 + x 3 = 3
2x 1 − x 2 + 3x 3 = 16
3x1 + x 2 − x 3 = −3
Solution: Let A = LU
1 1 1 1 0 0 u11 u12 u13
2 − 1 1 = l 21 1 0 0 u 22 u 23
3 1 − 1 l 31 l 32 1 0 0 u 33
1 1 1 u 11 u 12 u13
2 − 1 1 = l 21u11 l 21u12 + u 22 l 21u13 + u 23
3 1 1 l 31u11 l 31u 12 + l 32 u 22 l 32 u 31 + l 32 u 23 + u 33
14 2
u11 = 1, u12 = 1, u13 = 1, u 22 = −3, u 23 = 1, u 33 = − , l 21 = 2, l 31 = 3, l 32 =
3 3
Thus, we have
1 0 0 1 1 1
L = 2 1 0 and U = 0
−3 1
3 2
1 14
3 0 0 −
3
Now, Ax = B,
LUx = B [Q A = LU ]
Let Ux = y , then Ly = B
1 0
0
y1 3
2 1 0 y 2 = 16
3
2
1 y 3 − 3
3
y1 = 3
2 y1 + y2 = 16
2
3 y1 + y 2 + y3 = − 3
3
We use forward substitution method and get
56
y1 = 3, y 2 = 10, y 3 −
3
293
Block 2 Solution of Linear Algebraic Equations
Now using Ux = y , we get
1 1 1 x1 3
0 −3 − 1 × x 2 = 10
56
0 0 − 10 x −
3 3 3
x1 + x 2 + x 3 = 3
− 3x 2 − x 3 = 10
10 56
− =−
3 3
2x 2 + 3x 3 + 2x 4 = 21
2x 3 + 3x 4 = 18
Solution: Let A = LU
l 11 0 0 0 1 u12 u 13 u14
l 21 l 22 0 0 0 1 u 23 u 24
where L = and U =
l 31 l 32 l 33 0 0 0 1 u 34
l 41 l 42 l 43 l 44 0 0 0 1
Now A = LU gives
3 2 0 0 l 11 l 11u12 l12 u13 l 14 u14
2
3 2 0 l 21 l 21u12 + l 22 l 21u13 + l 22 u 23 l 21u14 + l 22 u 24
=
0 2 3 2 l 31 l 31u12 + l 32 l 31u13 + l 32 u 23 + l 33 l 31u14 + l 32 u 24 + l 33 u 34
0 0 2 3 l 41 l 41u12 + l 42 l 41u13 + l 42 u 23 + l 43 l 41u14 + l 42 u 24 + l 43 u 34 + l 44
∴ LU decomposition for A is
3 0 0 0 2
1 3
0 0
2 5
3
0 0
6
0 1 5
0
A=
0 2 3
0
5 0 0 1 10
3
0 − 11 0 1
0 2
3 0 0
Let Ux = y , then Ly = b
3 0 0 0
y1 7
2 5
0 0
3
y 2 14
=
0 2 3
0 y 3 21
5
0 0 2 − 11 y 4 18
3
2 7
1 3
0 0 x1 3
0 1 6
0 x 2 28
5
=5
0 10 x 3 49
0 1 3 3
x 4
0 0 0 1 4
***
4 47
1 0 11 22
4 17
≈ 0 1 11 44
11
0 0 118 − 195 R 3 ← R3
11 11
118
4 47
1 0 11 22
4
4 17
≈ 0 1 11 44
R1 ← R 1 − × R 3
11
0 0 1 − 195 R ← R − 4 × R
118 2
2
11
3
323
1 0 0 118
233
≈ 0 1 0
236
0 0 1 − 195
118
1 1
x 1( 6) = [20 − 2(0.987) − 4(−16526)] = [24.6358] = 2.7373
9 9
1 1
x (26) = [6 − (2.7373) − 4(−1.6526)] = [9.8729] = 0.9873
10 10
1 1
x 3( 6) = [−15 − 2(2.7373) − 4(0.9873)] = [−16.5254] = −1.6525
10 10
x 1 = 2.737
x 2 = 0.987
x 3 = −1.653
Table 1
We compare the results obtained in part (i) and (ii) and observe
that they are reasonably close.
***
Table 2
ii) We now use Gauss Seidel method for the given system of
equations and get
1
x 1( k+1) = (17 − x 2( k ) − 5x 3( k ) )
− 30
1
x (2k+1) = (14 − 10 x1( k +1) − 3x 3( k ) ) (3)
15
1
x 3( k+1) = (3 − x1( k+1) − x (2k +1) )
4
where k = 0,1, 2,...
300
Block 2 Miscellaneous Examples and Exercises
Iteration 3: Put k = 2 in Eqns. (3).
1 1
x 1( 3) = [17 − (1.1036) − 5(0.5827)] = [12.9827] = −0.4328
− 30 − 30
1 1
x (23) = [14 − 10(−0.4328) − 3(0.5827)] = [16.5794] = 1.1053
15 15
1 1
x 3( 3) = [3 − (−0.4328) − (1.1053)] = [2.3275] = 0.5819
4 4
Table 3
302
Block 2 Miscellaneous Examples and Exercises
Iteration 4: Put k = 3 in Eqns. (4)
1 1
x 1( 4) = [6.2 − 5.2(16.0032)] = [−77.0167] = −30.8067
2.5 2.5
1 1
x (24 ) = [3.152 − 1.251(−30.8067)] = [41.6912] = 16.0043
2.605 2.605
***
x 1 + 4 x 2 − 3x 3 = 0
x1 + x 2 + x 3 = 6
Table 4
Example 11: Use power method to find the dominant eigenvalue and
corresponding eigenvector. You may consider decimal upto two places.
2 3 1
0 −1 2
0 0 3
2 3 1
Solution: A = 0 −1 2
0 0 3
Iteration 1: y (0 ) = v ( 0) = [1 1] .
T
1
2 3 1 1 6
y (1) = Av (0) = 0 −1 2 1 = 1
0 0 5 1 3
{ }
Now m1 = max y1(1) , y (21) , y 3(1) = max{6, 1, 3} = 6
6 1
1 (1) 1
and v (1) = y = 1 = 0.17
m1 6
3 0.5
2 3 1 1 3
Iteration 2: y ( 2) = Av (1) = 0 −1 2 0.17 = 0.83
0 0 3 0.5 1.5
m 2 = max{3, 0.83,1.5} = 3
3 1
1 ( 2) 1
v ( 2)
= y = 0.83 = 0.28
m2 3
1.5 0.5
2 3 1 1 3.33
Iteration 3: y (3) = Av ( 2) = 0 −1 2 0.28 = 0.72
0 0 3 0.5 1.5
0.33 1
1 ( 3) 1
v ( 3) = y = 0.72 = 0.22
m3 3.33
1.5 0.46
2 3 1 1 3.1
Iteration 4: y ( 4) = Av (3) = 0 −1 2 0.22 = 0.68
0 0 3 0.45 1.35
3. 1 1
1 ( 4) 1
v ( 4) = y = 0.68 = 0.22
m4 3. 1
1.35 0.44
305
Block 2 Solution of Linear Algebraic Equations
2 3 1 1 3.1
Iteration 5: y (5) = Av ( 4) = 0 −1 2 0.22 = 0.65
0 0 3 0.44 1.31
m5 = 3.1
3.1 1
1 (5) 1
v ( 5) = y = 0.65 = 0.21
m5 3. 1
1.31 0.42
2 3 1 1 3.05
Iteration 6: y (6) = Av (5) = 0 −1 2 0.21 = 0.63
0 0 3 0.42 1.27
m 6 = 3.05
3.05 1
1 (6) 1
v ( 6) = y = 0.63 = 0.21
m6 3.05
1.27 0.41
2 3 1 1 3.04
Iteration 7: y (7 ) = Av (6) = 0 −1 2 0.21 = 0.62
0 0 3 0.41 1.24
m 7 = 3.04
3.04 1
1 ( 7) 1
v (7) = y = 0.62 = 0.2
m7 3.04
1.24 0.41
2 3 1 1 3.02
Iteration 8: y (8) = Av ( 7) = 0 −1 2 0.2 = 0.61
0 0 3 0.41 1.23
m 8 = 3.02
3.02 1
1 (8) 1
v (8) = y = 0.61 = 0.2
m8 3.02
1.23 0.41
306
Block 2 Miscellaneous Examples and Exercises
2 3 1 1 3.02
Iteration 9: y (9) = Av (8) = 0 −1 2 0.2 = 0.61
0 0 3 0.42 1.22
m 9 = 3.02
3.02 1
1 (9 ) 1
v ( 9) = y = 0.61 = 0.2
m9 3.02
1.22 0.4
( y (r9) )
After 9 iterations, the ratios for r = 1, 2, 3 are
( v (r8) )
3.02 0.61 1.22
, , = 3.02, 3.05, 3.05, respectively.
1 0.2 0.4
The maximum error in this case is 0.03 . Hence, the dominant eigenvalue
1
is 3.02 and the corresponding dominant eigenvector is 0.2 .
0.4
***
λ−2 ≤2
λ − 2 ≤1
λ −3 ≤ 3
Hence, union is λ − 3 ≤ 3 .
λ−2 ≤2
λ−2 ≤4
λ −3 ≤3
Hence, union is λ − 2 ≤ 4 .
Fig. 1
***
308
Block 2 Miscellaneous Examples and Exercises
Now you may try the following exercises.
3x 1 + 2 x 2 − 4 x 3 = 6
using Crout LU decomposition method.
2x 1 + 8x 2 + 22 x 3 = 6
3x1 + 22x 2 + 82 x 3 = −10
using Gauss-elimination method with pivoting.
E4) Find the interval which contains all the eigen value of the matrix
1 2 3
A = 2 −3 4
3 4 2
E5) Using four iterations of inverse power method find the least eigen
value and the corresponding eigen vector of the matrix.
2 −1 0
− 1 20 − 2
0 −2 1
309
Block 2 Solution of Linear Algebraic Equations
4 0 2
x 1
4
x = − 3 .
0 5 2
2
5 x 3
4 10 2
E11) Perform three iterations of the inverse power method to obtain the
smallest eigenvalue in magnitude of the matrix
1 1
.
− 3 5
310
Block 2 Miscellaneous Examples and Exercises
− 2 1 5 x 1 15
4 −8 1 x 2 = − 21
4 −1 − 2 x 3 − 1
8x 1 + 2x 2 + 3x 3 = 32
using Gauss elimination method with partial pivoting.
SOLUTIONS/ANSWERS
E1) We take A = LU,
l 11 0 0 1 u12 u13
where L = l 21 l 22 0 and U = 0 1 u 23
l 31 l 32 l 33 0 0 1
4 −1
Suppose Ly = b y1 = 1, y 2 = , y3 =
5 2
1 1
and Ux = y x 3 = − , x 2 = , x1 = 1
2 2
Iteration 1: y (0) = v ( 0) = [1 1]
T
1
2 1 1 1 4
y (1) = A v ( 0) = 1 1 0 1 = 2
1 0 2 1 3
m1 = 4
1
1 (1)
v (1) = y = 0.5
m1
0.75
3.25
Iteration 2: y ( 2) = A v (1) = 1.5
2.5
312
Block 2 Miscellaneous Examples and Exercises
m 2 = 3.25
1
1 ( 2)
v ( 2) = y = 0.4615
m2
0.7692
3.2307
Iteration 3: y (3) = A v ( 2) = 1.4615
2.5384
m 3 = 3.2307
1
1 ( 3)
v ( 3) = y = 0.4523
m3
0.7857
3.2380
Iteration 4: y ( 4) = A v (3) = 1.4523
2.5714
m 4 = 3.2380
1
1 ( 4)
v ( 4) = y = 0.4485
m4
0.7941
1 2 3 5
E3) [A | b ] = 2 8 22 6
3 22 82 − 10 R 1 ← R 3
3 22 82− 10
2
≈ 2 8 22 6 R 2 ← R 2 − R1
3
1 2 3 5 R ← R − R 1
3 3 1
3
3 22 82 − 10
0 − 20 − 98 38
≈ 3 3 3
− 16 − 73 25 4
0 3 3 3 R3 ← R3 − R2
5
313
Block 2 Solution of Linear Algebraic Equations
3 22 82 − 10
0 − 20 − 98 38
≈ 3 3 3
0 0 9 −9
5
5
E4) λ −1 ≤ 5 − 4 ≤ λ ≤ 6
λ + 3 ≤ 6 −9 ≤ λ ≤ 3
λ − 2 ≤ 7 −5 ≤ λ ≤ 9
Iteration 1: v ( 0) = [1 1]
T
1
v (1) = [0.4222 1]
T
0.1555
v ( 2) = [0.2202 1]
T
0.1169
v ( 3) = [1.1413 1]
T
0.1116
v ( 4 ) = [0.1248 1.2793]
T
0.1396
314
Block 2 Miscellaneous Examples and Exercises
Thus, the smallest eigenvalue in magnitude for the matrix A is
1
= 0.7803 and the corresponding eigvenvector is
1.2815
[0.1248 0.1396 1.2793]T .
E6) The Gauss-Seidal iteration method in matrix form is given by
x (n +1) = −(D + L) −1 Ux ( n ) + (D + L) −1 b = Hx ( n ) + c
We obtain
50 0 0 0 0 2 0 0 − 12
1 2
H = −(D + L ) −1 U = − 0 40 0 0 0 2 = 0 0 −
200 5
− 25 − 16 20 0 0 0 0 0 41
100
3 0 0
5
E7) L = 2 0
3
1 4 3
3 5
2 1
1 3 3
4
U = 0 1 5
0 0 1
1
3 0 0
L−1 = − 25 3
5
0
1 − 43 5
3 3
315
Block 2 Solution of Linear Algebraic Equations
1
1 − 23
5
U −1 = 0 1 − 4
5
0 0 1
2 −2 1
1
A −1 = U −1L−1 = − 2 5 − 4
3
1 −4 5
H = − D −1 (L + U )
1 3
4 0 0 0 0 3 0 0 4
= 0 1 0 0 0 2 = − 0 0 2
3 3
0 0 1 3 2 0 3 2
0
5 5 5
i) | λ | ≤ max{4, 3, 5} = 5
ii) | λ | ≤ max{3, 6, 3} = 6
316
Block 2 Miscellaneous Examples and Exercises
Fig. 2
1
x (1) = [17 − y ( 0) + 2z (0) ] = 0.85
20
1
y (1) = [−18 − 3x (1) + z ( 0) ] = −1.0275
20
1
z (1) = [25 − 2x (1) + 3y (1) ] = 1.0109
20
1
x ( 2) = [17 − y (1) + 2z (1) ] = 1.0025
20
1
y ( 2) = [−18 − 3x ( 2 ) + z (1) ] = −0.9998
20
1
z ( 2) = [25 − 2x ( 2) + 3y ( 2) ] = 0.9998
20
317
Block 2 Solution of Linear Algebraic Equations
Iteration 3: Put k = 2 in Eqn. (6)
1
x ( 3) = [17 − y ( 2) − 2z ( 2) ] = 1.0000
20
1
y ( 3) = [−18 − 3x (3) + z ( 2) ] = −1.0000
20
1
z ( 3) = [25 − 2 x (3) + 3y (3) ] = 1.0000
20
z ( 4) = 1
1 1 0.9
E11) Here A = , and v (0) =
− 3 5 1
0.44 0.95
Iteration 1: Ay (1) = v (0) y (1) = , m1 = 0.46, v (1) =
0.46 1
0.47 0.97
Iteration 2: Ay ( 2 ) = v (1) y ( 2 ) = ,
2 m = 0.48, v ( 2)
=
0.48 1
0.47 0.95
Iteration 3: Ay ( 3) = v ( 2) y (3) = , m 3 = 0.49, v ( 3) =
0.49 1
y ( 3)
The ratios (r2) for r = 1, 2 are 0.48, 0.49, respectively. Therefore,
vr
the maximum error is 0.01 . Hence, the smallest eigenvalue in
1
magnitude of the matrix A is µ = ≈ 2.08 and the corresponding
λ
T
eigenvector is [0.95 1] .
1
5
− λ 2
2
1 11
Now, [H − λI ] = 0 4
−λ 8
0 7 69
− λ
8 16
73 1
H − λI = λ λ2 − λ − = 0
16 8
73 1
λ λ2 − λ − = 0
16 8
λ = 0, 4.59, − 0.027
ρ(H ) = 4.59 > 1 (Spectral radius)
1 3
4 0 0 0 0 3 0 0 4
E13) H = −D −1 (L + U) = − 0 1 0 0 0 2 = − 0 0 2
3 3
0 0 1 3 2 0 3 2
0
5 5 5
43
λ = 0, ±
60
43
and ρ( H) = ≈ 0.6466 (Spectral radius)
60
2
Number of Iterations = ≈ 28
v
2 1 3 1 0 0
E14) [A | I] = − 1 −1 2 0 1 0
1
0 2 1 0 0 1 R 1 ← R 1
2
319
Block 2 Solution of Linear Algebraic Equations
1 3 1
1 2 2 2
0 0
≈ − 1 −1 2 0 1 0
0 2 1 0 0 1 R 2 ← R 1 + R 2
1 3 1
1 2 2 2
0 0
≈ 0 −1 2 0 1 0
2
0 1 1 0 0 1 R 2 ← −2 R 2
1 3 1
1 2 2 2 0 0
1
≈ 0 1 −7 − 1 − 2 0 R 1 ← R 1 − 2 R 2
0 2 1 0 0 1 R 3 → R 3 − 2R 2
1 0 5 1 1 0
≈ 0 1 −7 − 1 − 2 0
1
0 0 15 2 4 1 R 3 ← R 3
15
1 0 5 1 1 0
≈ 0 1 −7 −1 − 2 0 R 1 ← R 1 − 5R 3
2 4 1
0 0 1
15 15 15 R 2 ← R 2 + 7 R 3
1
1 0 0 3
− 13 − 1
3
1 2 7
≈ 0 1 0 − 15 − 15 15
= [I | A −1 ]
0 0 1 2 4 1
15 15 1
9.25
E15) Iteration 1: y (1) = Av ( 0) = 9.4
9.25
0.984
m1 = 9.4, and v (1) = 1
0.984
7.9362
Iteration 2: y ( 2) = Av (1) = 7.9202
7.9202
320
Block 2 Miscellaneous Examples and Exercises
1
m 2 = 7.965, and v ( 2) = 0.998
0.998
7.9859
Iteration 3: y (3) = Av ( 2) = 7.992
7.9859
0.9992
m3 = 7.992 and v (3) = 1 .
0.9992
i) Gauss-Seidel Method
1
x ( k +1) = (30 − 4 y ( k ) + z ( k ) )
28
1
y ( k+1) = (27 − 2x ( k +1) − 4z ( k ) ) (7)
17
1
z ( k+1) = (22 + x ( k +1) − 3y ( k +1) )
10
where k = 0,1, 2,...
x ( 4) = 0.9992
y ( 4 ) = 1.0006
z ( 4) = 1.9997
x (1) = 1.0714
y (1) = 1.5882
z (1) = 2.2
x ( 2) = 0.9231
y ( 2 ) = 0.0489
z ( 2) = 2.0089
x ( 3) = 1.0019
y (3) = 1.5564
z (3) = 1.8987
x ( 4) = 0.9933
y ( 4 ) = 0.9977
z ( 4) = 1.9855
iii) Before we use SOR method, let us find the optimal value of
w. The iteration matrix for Jacobi method is
322
Block 2 Miscellaneous Examples and Exercises
H = −D −1 (L + U)
1
− 28 0 0
0 4 − 1
= 0 1
− 17 0 2 0 4
0 1
− 1 3 0
0 − 10
1
0 − 17 28
= − 1 0 − 10
3
3
− 1 − 17 0
2 4
1 0 0 1 1 2
E17) L = 3 1 0, U = 0 −1 −5
1 −3 1 0 0 − 14
Ly = b y1 = 2, y 2 = −7, y 3 = −22
−2 −6 11
Ux = y x1 = , x2 = , x3 =
7 7 7
1 1 1 6
E18) [A | b] = 4 1 5 23
8 2 3 32 R 1 ↔ R 3
8 2 3 32
1
≈ 4 1 5 23 R 1 ← R 2 − R 1
2
1 1 1
6 R ←R −1R
3 3 1
8 323
Block 2 Solution of Linear Algebraic Equations
8 2 3 32
7
≈ 0 0 2
7
0 3 5
2 R2 ↔ R3
4 8
8 2 3 32
3 5
≈ 0 4 8
2
0 0 7
7
2
324