Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
S YSTEMS
OF
L INEAR E QUATIONS
Introduction
Elimination Methods
Decomposition Methods
Iteration Methods
Chapter 1
1.1 Introduction
The general form of a set of a linear equation having n linear equations and
n unknowns is
(1.1)
M
M
O
M
M
a n1 x1 + a n 2 x 2 + L + a nn x n = bn
Ax = b
(1.2)
3 x1
x1
2.
3.
x2
= 1
+ 3 x2
= 1
x1 = x2 =
No solution e.g.:
x1
x2
x1
x2
= 1
= 1
x2
x1
2 x1
+ 2 x2
= 2
1
4
Chapter 1
Forward elimination to form an upper triangular system via rowbased transformation process,
Back substitution to produce the solution of xj.
an1 x1 + an 2 x2 + L + ann xn = bn
If a11 0 , for i = 2,3,,n, substract the i-th equation with the product of
ai1 a11 with the first equation to produce the first transformed system:
a11 x1 +
a12 x2
(1)
a22
x2
M
(1)
a n 2 x2
+ L + a1n xn
+ L + a2(1n) xn
O
M
(1)
+ L + ann xn
= b1
= b2(1)
M
= bn(1)
where
aij(1) = aij
ai1
a1 j
a11
for i, j = 2,3,,n
bi(1) = bi
ai1
b1
a11
for i = 2,3,,n
The process can be repeated for (n1) times until the (n1)-th transformed
system is formed as followed, which completes the forward eliminations:
a11 x1 +
a12 x2
(1)
a22
x2
+
+
a13 x3
(1)
a23
x3
(2 )
a33
x3
+ L +
+ L +
+ L +
O
a1n xn
a2(1n) xn
a3(2n) xn
M
(n 1)
ann xn
=
=
=
b1
b2(1)
b2(2 )
M
(n 1)
= bn
(1.3)
Chapter 1
where
(k )
(k 1)
(k )
(k 1)
aij = aij
bi
= bi
aik(k 1) (k 1)
(k 1) akj
akk
aik(k 1) (k 1)
(k 1) bk
akk
for i, j = k+1,,n
(1.4a)
for i = k+1,,n
(1.4b)
bn(n1)
xn = (n1)
ann
(1.5a)
1 ( k 1)
xk = ( k 1) bk akj(k 1) x j for k = n1,,1
akk
j = k +1
(1.5b)
The above method can fail if akk 0, the row has to be interchanged,
which is referred to as pivoting:
x1
x2
= 2
x2
= 3
Pivoting
x1
x2
= 3
x2
= 2
where the new diagonal element akk is called a pivot, which can be selected
among the maximum absolute value of aik.
0.708 0.632
444.184 443.908
0 .0
x2 = 0.999
x1 = 1.125
0.00126
0.417 0.418
0.418 0.417
0.0
x2 = 0.998
x1 = 0.999
Exact solution:
x1 = 1
x2 = 1
Chapter 1
Example 1.1
+
+
x2
4 x2
+
+
3 x3
7 x3
=
=
2 x1
5x2
9 x3
= 3
1
1
Solution
2 5 9 x3 3
or
2 1 3 1
[A b] 4 4 7 1
2 5 9 3
1
2 1 3
3) 2 ( 2 ) ( 3)
(
0 2 1 1
0 0 4 4
Hence, the transformed upper triangular system is:
2 x1
x2
2 x2
+
+
3 x3
x3
4 x3
1
= 1
4
x2 =
Chapter 1
Example 1.2
Perform the pivotal Gauss elimination to the system given in Example 1.1.
Solution
4
7
4 4
2 1 3 1
4 4 7 1
2
(
3 ) (1)(3 )
4 4 7 1 (
1) ( 2 )
4
2 1 3 1
0 1 12
11
0 3
2 5 9 3
2 5 9 3
2
1
1
2
5
2
7 1
4 4 7 1
4 4
(3 ) 1(2 )(3 )
5
11
3
0 3 112 52
0 3
2
2
0 0 43 43
0 1 12 12
Hence, the upper triangular system is:
( 2 )(3 )
4 x1 + 4 x2
3 x2
7 x3
11
2
4
3
x3
x3
= 1
=
=
5
2
4
3
4
3
5
2
4
3
= 1,
112 (1)
= 1 ,
3
1 4( 1) 7(1)
x1 =
= 12 .
4
Chapter 1
In some cases, the left-hand side matrix A is frequently used while the
right-hand side vector b is changed depending on the case.
A = LU
(1.6)
where L and U are the lower and upper triangular matrices, respectively:
a11
a
21
a31
a12
a22
a32
a13 1 0
a23 = l21 1
a33 l31 l32
u11 u12
l21 u 22
l31 l32
u13
u 23
u33
0 u11 u12
0 0 u 22
1 0
0
u13
u 23 (in memory)
u33
A x = b LU x = b
By taking an intermediate vector y:
Ux = y
(1.7)
Ly = b
(1.8)
Hence,
The elements for L and U can be obtained from the Gauss elimination:
a11
U = 0
0
a12
(1)
a22
0
a13
(1)
a23
(2 )
a33
1
L = a21 a11
a31 a11
0
1
(1)
(1)
a32
a22
0
0
1
Chapter 1
li1 = ai1
u1 j =
a1 j
l11
for i = 1,2,,n
(1.9a)
for j = 2,3,,n
(1.9b)
for i = j, j+1,,n
(1.9c)
(1.9d)
For j = 2,3,,n1:
j 1
j 1
u jk =
a jk l ji uik
i =1
l jj
dan,
n 1
(1.9e)
k =1
(1.10)
lki =
lii
for i = 1,2,,k1
(1.11a)
k 1
(1.11b)
Chapter 1
Example 1.5
2 1 3
A = 4 4 7
2 5 9
Solution
2 1 3
U = 0 2 1 ,
0 0 4
0 0 1 0 0
1
L = 4 2 1 0 = 2 1 0 .
2 2 4 2 1 1 2 1
`
Example 1.7
2 1 3
A = 1 4 5
3 5 9
Solution
l11 = a11 = 2 ,
2,
Maka,
L = 1 2
3 2
0
0 1.41421
0
0
7 2 0 = 0.70712 1.87083 0
7 2 1 2.12132 1.87083 1
`
Chapter 1
(1.12)
(1) ( 2 )
(n )
If all columns of A1 are written as x , x ,K, x and the columns of the
(1) (2 )
(n )
I as e , e ,K, e , respectively, thus Eq. (1.12) can be rewritten as:
) (
A x (1) = e (1)
A x (2 ) = e (2 )
M
(1.13)
A x (n ) = e (n )
(1) ( 2 )
( n 1)
= ( 1)
a(
i =1
i 1)
ii
(1.14)
Chapter 1
Example 1.8
Determine the inverse of the following matrix using the Gauss elimination:
4 2 1
A = 1 1 1
2 1 1
Solution
4 2 1 1 0 0
1 1 1 0 1 0
2 1 1 0 0 1
4 2 1 1
0 12 54 14
0 0 92 32
Gauss
forward
elimination
0 0
1 0
4 1
x (1)
0
= 13
13
x ( 2)
13
= 92
89
x ( 3)
13
= 59
92
A 1 = 13
13
1
3
92
8
9
95
2
9
1
3
`
Example 1.9
det(A ) = 1
2
1
4 2 1
1 = ( 1) 0
2 1 1
1
2
5
4
0 0
9
2
= (4)( 12 )( 92 ) = 9
`
Chapter 1
e = x x
(1.16)
r = A e
(1.17)
r = A x A x = b A x
or,
= x1 + x2
+ L + xn
p 1 p
n
p
= xi
i =1
1 p
(1.20)
If p = 1, it is known as 1-norm:
n
x 1 = x1 + x2 + L + xn = xi
(1.19)
i =1
x e = x 2 = x + x +L+ x =
2
1
2
2
2
n
x
i =1
2
i
(1.18)
1i n
(1.21)
Ae=
a
i =1 j =1
2
ij
(1.22)
Chapter 1
and, the equivalent 1-norm and maximum norm for a matrix are defined as
n
i =1
(1.23)
j =1
(1.24)
A 0
2.
cA = c A
3.
A+B A + B
4.
AB A B
Ae r
and
e A 1 r
r
e A 1 r
A
b
x A 1 b
A
Ax b
and
x A 1 b
Thus, the combination of both inequality relations yields the range of the
relative error e x , i.e.
r
e
r
1
1
A
A
x
b
A A 1 b
(A ) = A A 1
(1.25)
Chapter 1
r
e
r
1
(A )
(A ) b
x
b
(1.26)
(A )
EA
A
e
e
(A ) b
b
x
(1.27)
(1.28)
Therefore, from Eqs. (1.26-8), it can be seen that the condition number can
determine the range of error and thus the health of a system.
Chapter 1
For large systems (size > 200), the elimination and decomposition methods
are not efficient due to increasing number of arithmetic operations.
In the Jacobi iteration, Eq. (1.1) can be written for xi from the i-th equation:
x1 =
1
(a12 x2 + a13 x3 + L + a1n xn b1 )
a11
x2 =
1
(a21 x1 + a23 x3 + L + a2 n xn b2 )
a22
(1.29)
M
xn =
1
(an1 x1 + an 2 x2 + L + an,n1 xn1 bn )
ann
(0)
( 0)
( 0)
(0)
Eq. (1.29) needs initial values x = (x1 , x 2 ,K, x n ) , which yield
T
x (1) = x1(1) , x2(1) ,K, xn(1) , and the computation continues as followed:
x1( k +1) =
1
a12 x2( k ) + a13 x3( k ) + L + a1n xn( k ) b1
a11
x2( k +1) =
1
a21 x1( k ) + a23 x3( k ) + L + a2 n xn( k ) b2
a22
)
(1.30)
M
xn( k +1) =
1
an1 x1( k ) + an 3 x3( k ) + L + an ,n 1 xn( k1) bn
ann
for i = 1, 2 , K , n
(1.31)
and the matrix which follows this condition is called a diagonal domain
matrix.
Chapter 1
x (k +1) x (k ) <
(1.32)
The Gauss-Siedel iteration method uses the most current known solution
after each arithmetic operation in order to speed up convergence:
x1( k +1) =
1
a12 x2( k ) + a13 x3( k ) + L + a1n xn( k ) b1
a11
x2( k +1) =
1
a21 x1( k +1) + a23 x3( k ) + L + a2 n xn( k ) b2
a22
)
(1.33)
M
xn( k +1) =
1
an1 x1( k +1) + an 3 x3( k +1) + L + an ,n 1 xn( k1+1) bn
ann
As of the Jacobi method, the Gauss-Siedel method must also observe the
diagonal domain condition for convergence to be possible (see Fig. 1.1).
x1
2 x1
2 x2
+
x2
x2
= 2
=
2
2 x1
x1
+
x2
2 x2
x2
=
2
= 2
2x1 + x2 = 2
x1 2x2 = 2
( 52 , 65 )
( 52 , 65 )
x1
x1 2x2 = 2
2x1 + x2 = 2
FIG. 1.1
x1
Chapter 1
Example 1.10
64 x1
x1
2 x1
3 x2
+
x2
90 x2
x3
+ 40 x3
+
x3
= 14
= 20
= 5
Solution
64 x1
2 x1
x1
3 x2
90 x2
+
x2
x3
+
x3
+ 40 x3
= 14
= 5
= 20
x1(k +1) =
1
3x 2(k ) x3(k ) 14
64
1
x 2(k +1) = +
+ 2 x1(k ) + x3(k ) + 5
90
1
x3(k +1) =
+ x1(k ) + x 2(k ) 20
40
By taking an initial values x(0) = (0, 0, 0)T, thus the method converges
within 5 iterations:
Iteration no. 1:
Iteration no. 2:
Iteration no. 3:
Iteration no. 4:
Iteration no. 5:
Chapter 1
Example 1.11
64 x1
2 x1
x1
3 x2
90 x2
+
x2
x3
+
x3
+ 40 x3
= 14
= 5
= 20
By taking an initial values x(0) = (0, 0, 0)T, the first solution in the first
iteration:
x1(1) =
1
[ 3(0) 0 14] = 0.21875
64
(1)
(1)
Use x1 to calculate x2 and so on, i.e.
x2(1) =
x3(1) =
1
[2(0.21875) + 0 + 5] = 0.06042
90
1
(0.21875 + 0.06042 20) = 0.49302
40
Chapter 1
For redundant system, a unique solution is not possible, and the system has
to be optimised via least square method (also known as linear regression):
S= e
2
e
= eTe ,
= (b A x ) (b A x ) ,
T
= b T b ( A x )T b b T ( A x ) + ( A x ) T ( A x ) ,
= (A x ) (A x ) ( A x ) b .
T
T
T T
Using the identity (AB ) = B A :
S = xT AT A x xT AT b
Minimising S:
S
x
= 0 = AT A x AT b
(1.34)
where the left-hand side matrix ATA is symmetry and the standard deviation
can be calculated from the Euclidean norm of e, i.e.:
S
=
mn
mn
(1.35)
Chapter 1
Example 1.12
x2
3 x3
4 x1
2 x1
+
+
4 x2
5x2
+
+
7 x3
9 x3
=
=
1
3
5 x1
7 x1
+ 5x2
+ 10 x 2
+ 9 x3
+ 15 x3
= 2
= 4
1 1
2 5 9 x 2 = 3
5 5 9 x 3 2
7 10 15
4
2 1 3
2 4 2 5 7 4 4 7 x1
1 4 5 5 10 2 5 9 x =
2
3 7 9 9 15 5 5 9 x 3
7 10 15
98
123
202
123
167
271
1
2 4 2 5 7 1
1 4 5 5 10 3
3 7 9 9 15 2
4
202 x1 50
271 x 2 = 70
445 x3 100
x 2 = 0.01996 ,
x 3 = 0.42914 .
Chapter 1
The standard deviation can be obtained from the Euclidean norm of the
error e:
1 2 1 3
1 4 4 7 0.34930
e = 3 2 5 9 0.01996 =
2 5 5 9 0.42914
4 7 10 15
0.43114
0.52695
0.06387
0.01597
0.20758
Therefore,
0.71483
53
= 0.50546
Chapter 1
Exercises
1.
1
0
1
a.
b.
c.
2.
2
1
1
1
4 8 x1 1.2
2 3 x2 0.2
=
4 12 x3 0.8
1 1 x4 1.5
2 + 2i 1 + 2i z1 1 4i
=
3i
3 2i z 2 2 + 4i
2 x2
x3
x1
x1
3x 2
+
x2
x3
x3
=
=
5
5
x3
= 2
=
2
2 x1
2 x1
a.
b.
x2
x2
Derive an approximate system of linear equations and solve it via the Gauss
elimination.
Calculate the corresponding standard deviation.