5 System of Linear Equation
5 System of Linear Equation
Page 1 of 12
MSA / L-7 CSE-3512 - Numerical Methods 18th February, 2005
No Solution
The equations 2x – y = 5 and 3x – 3/2y = 4 have no solution. These two lines are parallel as
shown in Fig 7.1(b). and, therefore, they never meet. Such equations are called inconsistent
equations.
No Unique Solution
The system -2x + 3y = 6 and 4x – 6y = -12 has many different solutions. We can see that
these are two different forms of the same equation and, therefore, they represent the same line
[Fig 7.1(c)]. Such equations are called dependent equations.
Ill-Conditioned Systems
The system x - 2y = -2 and 0.45x – 0.91y = -1 has a solution but it is very difficult to
identify the exact point at which the lines intersect [Fig 7.1(d)]. Such systems are said to be
ill-conditioned. Ill-conditioned systems are very sensitive to roundoff errors and, therefore,
may pose problems during computation of the solution.
Let us consider a general form of a system of linear equations of size m x n.
a11x1 + a12x2 + a13x3 + ... ... + a1nxn = b1
a21x1 + a22x2 + a23x3 + ... ... + a2nxn = b2
... ... ... ... ... ... ... ... ... … …
... ... ... ... ... ... ... ... ... … …
am1x1 + an2x2 + an3x3 + ... ... + amnxn = bm
In order to effect a unique solution, the number of equations m should be equal to the number
of unknowns n. If m < n, the system is said to be under-determined and a unique solution for
all unknowns is not possible. On the other hand, if the number of equations is larger than the
number of unknowns, then the set is said to be over-determined, and a solution may or may
not exist.
The system is said to be homogeneous when the constants bi are all zero. Otherwise, the
system is called a non-homogeneous system (at least one bi ≠ 0).
Overview of Matrices
Matrix
A matrix is a rectangular array of elements arranged in rows and columns. If the matrix
contains m rows and n columns, the matrix is said to be of size m x n. The element in the ith
row and jth column of the matrix A is denoted by aij. For example,
a11 a12 a13
A = a21 a22 a23 is a 3 x 3 matrix.
a31 a32 a33
Square Matrix: A matrix in which rows m is equal to columns n is called square matrix.
Identity Matrix: A square matrix in which all the diagonal elements are one and other
elements are zero is called identity matrix. That is aij = 1 for i = j and aij = 0 for i ≠ j.
Identity matrices are denoted by I.
Row Vector: A matrix with one row and n columns is called row vector.
Column Vector: A matrix with m rows and one column is called column vector.
Transpose Matrix: The matrix AT is called the transpose of A if the element aij in A is equal
to element aji in AT for all i and j. For example, if
1 2
A= 3 4 then AT = 1 3 4
5 6 2 4 6
It is clear that AT is obtained by interchanging the rows and the columns of A.
Page 2 of 12
MSA / L-7 CSE-3512 - Numerical Methods 18th February, 2005
Upper and Lower Triangular Matrix: A square matrix is said to be an upper triangular
matrix if aij = 0 for i > j and a lower triangular matrix if aij = 0 for i < j. For example:
1 2 3 1 0 0
A= 0 2 4 is an upper triangular matrix and B = 2 2 0 an lower triangular matrix.
0 0 3 3 4 3
Matrix Algebra
We can perform only three operations, namely addition, subtraction and multiplication on the
matrices. The division, although not defined, is replaced by the concept of inversion.
Two matrices A and B can be added together (or subtracted from each other) if they are of
the same order. Then, Sum C = A + B can be obtained by adding the corresponding
elements. That is, cij = aij + bij for all i and j
Similarly, Difference E = A – B can be obtained by subtracting the corresponding
elements. That is, cij = aij - bij for all i and j
Two matrices A and B can be multiplied in the order AB if and only if the number of
columns of A is equal to the number of rows of B. That is, if A is of order m x r, then B
should be of order r x n, where m and n are arbitrary values. In such cases, we may obtain,
P = AB which is order of m x n.
r
Elements of the matrix P is given by pij =
k 1
aik bkj for all i and j
Determinants
Every square matrix A is associated with a number called its determinant, which is denoted
by | A |. The determinant of a 2 x 2 matrix, say A, is written in the form a11 a12
a21 a22
and the determinant is computed as | A | = a11 a22 - a12 a21.
Similarly, for a 3 x 3 matrix the determinant is given by
| A | = a11a22a33 + a12a23a31 + a13a21a32 – a11a32a23 – a21a12a33 – a31a22a13
For large matrices, the determinant is much more difficult to define and compute manually.
In general, for n x n matrix, the determinant will contain a sum of n! signed product terms,
each having n elements. [See page-508, Balagurusamy]
For a triangular matrix (in which all the elements below (or above) the diagonal are
zero), the determinant is the product of the diagonal elements.
If | A | = 0, then A said to be a singular matrix; otherwise, it is said to be nonsingular.
Page 3 of 12
MSA / L-7 CSE-3512 - Numerical Methods 18th February, 2005
A is called coefficient matrix and B is known as constant vector. X is the required solution
and, therefore, it is called the solution vector. If we multiply the matrix equation AX = B
By A-1 on the both sides, we get A-1A X = A-1B
A-1 is the inverse matrix of A. We know that A-1A = I is the identity matrix.
Therefore, A-1A X = I X = X is the solution of the system of equations and is obtained from
X = A-1B = CB
If we know the inverse of the matrix A, we can obtain the solution vector X by post-
multiplying it by B.
The inverse A of a square matrix A exists, if and only if, A is nonsingular (i.e. det A ≠ 0).
-1
-1
A is the matrix obtained from A by replacing each element aij by its cofactor dij and then
transposing the resulting matrix and dividing it by the determinant of A.
adj (A)
-1
C = A = -----------
det A
where adj (A) is the adjoint matrix of A and is given by the transpose of the cofactor
matrix of A. Then, adj (A) = DT where
d11 d12 d13 ... ... … d1n
d21 d22 d23 ... ... … d2n
D= ... ... ... ... ... ... ...
... ... ... ... ... ... ...
dn1 dn2 dn3 ... ... … dnn
dij is the cofactor of the element aij and is given by dij = (-1)i+j Mij
Mij is called the minor of aij and is taken as the determinant of matrix A after deleting i th
row and j th column.
This method is obviously unsuitable for solving large systems, since the computation of
A-1by cofactors will then become exceedingly difficult.
Example: Solve the following system of linear equations using matrix inversion method
3x + y + 2z = 3
2x - 3y - z = -3
x + 2y + z = 4
Solution: Here
3 1 2 3
A = 2 -3 -1 B = -3
1 2 1 4
3 1 2
det A = 2 -3 -1 =8 since |A| ≠ 0, hence A-1 exists.
1 2 1
Page 4 of 12
MSA / L-7 CSE-3512 - Numerical Methods 18th February, 2005
3 2 1 -1 3 5 -1 3 5
1
AT = 1 -3 2 adj (A) = -3 1 7 A-1 = -3 1 7
8
2 -1 1 7 -5 -11 7 -5 -11
x -1 3 5 3 8 1
1 1
X= y = A-1 B = -3 1 7 -3 = 16 = 2
8 8
z 7 -5 -11 4 -8 -1
x = 1, y = 2 and z = -1
Cramer’s Rule
A linear system of n equations in n unknowns can be represented in matrix form as AX = B,
where A, X and B are matrices and are given by
a11 a12 a13 ... ... … a1n x1 b1
a21 a22 a23 ... ... … a2n x2 b2
A = ... ... ... ... ... ... ... X= . and B = .
... ... ... ... ... ... ... . .
an1 an2 an3 ... ... … ann xn bn
A is called coefficient matrix and B is known as constant vector. X is the required solution
and, therefore, it is called the solution vector.
According to Cramer’s rule, the solution can be given in terms of determinants, i.e.
det Ai
Xi = ---------------
det A
where Ai is the matrix obtained from A by replacing the ith column with the vector B.
Obviously, Cramer’s rule only works for det A ≠ 0. Onecan show that the system has a
unique solution if and only if det A ≠ 0. Otherwise, the system has either no solution or
infinitely many solutions.
One would not use Cramer’s rule to solve a large system of linear equations, simply
because calculating a single determinant is as time consuming as solving the complete
system by a more efficient algorithm.
Example: Solve the following system of equations using Cramer’s rule:
2x1 + 3x2 = 12
4x1 – x2 = 10
Solution: 12 3
10 -1 -12 - 30 42
x1 = --------- = ------------ = ------- = 3
2 3 -2 - 12 14
4 -1
2 12
4 10 20 - 48 28
x2 = --------- = ------------ = ------- = 2
2 3 -2 - 12 14
4 -1
Triangular Factorization Method (Dolittle Decomposition method)
Self Study. See Page 230 – 235 [E. Balagurusamy].
Page 5 of 12
MSA / L-7 CSE-3512 - Numerical Methods 18th February, 2005
Page 6 of 12
MSA / L-7 CSE-3512 - Numerical Methods 18th February, 2005
Page 7 of 12
MSA / L-7 CSE-3512 - Numerical Methods 18th February, 2005
Page 8 of 12
MSA / L-7 CSE-3512 - Numerical Methods 18th February, 2005
Remember that this condition is sufficient, but not necessary, for convergence. Some
systems may converge even if this condition is not satisfied.
Systems that satisfy the above condition are called diagonally dominant systems.
Convergence of such systems are guaranteed.
Example: Solve the following system of linear equations by Jacobi’s method
5x + 2y + z = 12
x + 4y + 2z = 15
x + 2y + 5z = 20
Solution: The above system is diagonally dominant i.e. in each equation the absolute value of
the largest coefficient is greater than the sum of the absolute values of the other coefficients.
The given equations can be written as
x = 1/5 [12 – 2y –z ]
y = 1/4 [15 – x – 2z]
z = 1/5 [20 – x – 2y]
We start the iteration by putting x = 0, y = 0, z = 0
Page 9 of 12
MSA / L-7 CSE-3512 - Numerical Methods 18th February, 2005
Page 10 of 12
MSA / L-7 CSE-3512 - Numerical Methods 18th February, 2005
This equation, called the characteristic equation of the matrix A, is a polynomial equation of
degree n in , the polynomial being called the characteristic polynomial of A. If The roots of
(3) be given by i (i = 1, 2, ... , n), then for each value of i, there exists a corresponding Xi
such that A Xi = iXi .............................. (4)
The eigenvalues i may be either distinct (i.e. all different) or repeated. The evaluation of
eigenvectors in the case of the repeated roots is a much involved process and will not be
discussed here. The set of all eigenvalues, i, of a matrix A is called the spectrum of A and
the largest of |i | is called the spectral radius of A.
Page 11 of 12
MSA / L-7 CSE-3512 - Numerical Methods 18th February, 2005
- x 1 + x3 = 0
- 8x2 = 0
x1 - x3 = 0
which gives x1 = - x3 and x2 = 0
Choosing, x1 = x3 = 1/2, the normalized eigenvector is given by
1/2
X3 = 0
1/2
The above method for solving eigenvalues problem is unstable for matrices of higher
order and better methods must be applied. For symmetric matrices, in particular, several
methods are available and a recent method, known as Householder’s method, is used.
Page 12 of 12