Académique Documents
Professionnel Documents
Culture Documents
Jan 2016
Introduction
Many practical applications of engineering and science lead to a system
of linear algebraic equations. A set of simultaneous linear algebraic
equation can be expressed in matrix form:
a11 a12 a1n
x1
b1
x2
a21 a22 a2n
b2
=
(1)
..
..
.
.
.
..
..
..
..
.
.
.
xn
bn
an1 an2 ann
In symbolic notation, we write Ax = b where A is called the
coefficient matrix of the system. Also, the augmented matrix of
is the matrix
A, denoted A
a11 a1n b1
a21 a2n b2
[A | b] = .
(2)
..
..
..
..
.
.
.
an1
ann bn
By Ng Tin Yau (PhD) 2/36
Theorem
Let A be a square matrix with real entries. Then the following
statements are equivalent:
1
A is invertible
det(A) 6= 0
Linear Circuit
A simple electrical network contains a number of resistances and a
single DC source as shown in the figure.
Using Kirchhoffs laws and Ohms law, we can write a system of linear
equations that govern the circuit.
(7 + 2 + 6)i1 2i2 6i3 = 300
2i1 + (2 + 5 + 1 + 4)i2 4i3 i4 = 0
6i1 4i2 + (4 + 9 + 6)i3 9i4 = 0
i2 9i3 + (1 + 11 + 9)i4 = 0
By Ng Tin Yau (PhD) 4/36
Linear Circuit
Simplify the equations yield the system
15i1 2i2 6i3 = 300
2i1 + 12i2 4i3 i4 = 0
6i1 4i2 + 19i3 9i4 = 0
i2 9i3 + 21i4 = 0
In matrix form, we have
300
15 2 6 0
i1
2 12 4 1 i2 0
6 4 19 9 i3 = 0
i4
0 1 9 21
0
The solution to the system is
i1 = 26.5
i2 = 9.35 i3 = 13.3
i4 = 6.13
By Ng Tin Yau (PhD) 5/36
Theorem
Row-equivalent linear systems have the same set of solutions
Row Operations
Try to perform row operations on the following system:
5x1 2x2 = 1
()
x1 + 8x2 = 15
()
Clearly, interchanging Eq. and Eq. will not changing the solution
of the system. Now five times Eq. gives
5x1 2x2 = 1
5x1 + 40x2 = 75
Add Eq. to the new Eq. yields to another new Eq. , namely
38x2 = 76 x2 = 2
To solve for x1 , we use Eq. .
x1 =
1 + 2x2
=1
5
By Ng Tin Yau (PhD) 7/36
a21
a11
and m31 =
a31
a11
and E3 E3 + m31 E1
By Ng Tin Yau (PhD) 9/36
Forward Elimination
Now
(1)
(1)
(1)
(1)
(1)
0 a22 a23 b2 0 a22 a23
(1)
(1)
(1)
(2)
0 a32 a33 b3
0
0 a33
(1)
(1)
= a32 /a22
b1
(1)
b2
(2)
b3
In the first step of the elimination process, the first equation E1 of the
system is called the pivot equation and a11 is called the pivot. We
(0)
(0)
use this pivot equation to eliminate x1 from E2 to E3 . In the second
(1)
step we take the new second equation E2 as the pivot equation and
(1)
use it to eliminate x2 of equation E3 .
By Ng Tin Yau (PhD) 10/36
Backward Substitution
In short, we perform row operations on the original system to make it
becomes an equivalent triangular form.
(2)
x3 = b3 /a33
(1)
(1)
(1)
b1
a11 a12 a13 a1n
x1
..
..
.
.
.
.
.
0
a
a
=
33
3n
..
..
..
..
..
..
..
.
.
.
.
.
.
.
bn
xn
0
0
0 ann
Now if we set aj,n+1 = bj where 1 j n, then
an,n+1
xn =
ann
and for i = n 1, . . . , 1 we have
n
X
1
xi =
ai,n+1
aij xj
aii
(3)
(4)
(5)
j=i+1
Example 1
Consider the following linear system
2 1 1 x1 4
4 3 1 x2 = 6
3 2
2
x3
15
Put it in the form of augmented matrix and perform row operations on
this matrix.
2 1 1
4
2 1 1
4
2E1 +E2
4 3 1 6
0 5 3 2
3/2E1 +E3
1
9
3 2
2 15
0 27
2
2 1 1
4
7/10E2 +E3
0 5 3 2
52
13
0 0
5
5
To this end, we finished the so-called forward elimination. Next
procedure called the back substitution. That is, we have x3 = 4 and
the solve for x2 = 2 and finally x1 = 1.
By Ng Tin Yau (PhD) 13/36
Example 2
Example
Solve the following system using Gauss elimination method (3 decimal
places).
3x1 + 2x2 + x3 4x4 = 5
x1 5x2 + 2x3 + x4 = 18
5x1 + x2 3x3 + 2x4 = 4
2x1 + 3x2 + x3 + 5x4 = 11
Put the system in augmented matrix form:
3 2
1 4 5
1 5 2
1 18
5 1 3 2 4
2 3
1
5 11
By Ng Tin Yau (PhD) 14/36
Example 2 cont
With
Thus,
3
1
5
2
E2 E2 + m21 E1
E3 E3 + m31 E1
E4 E4 + m41 E1
2
1 4 5
3
2
1
4
5
5 2
1 18
16.35
0 5.666 1.667 2.332
Example 2 cont
With
m32 = 2.334/5.666 = 0.412
m42 = 1.666/5.666 = 0.294
E3 E3 + m32 E2
E4 E4 + m42 E2
Thus,
3
2
1
4
5
0 5.666 1.667 2.332
16.35
3
2
1
4
5
0 5.666 1.667 2.332
16.35
0
0
5.354 7.707 19.065
0
0
0.823 8.354 12.467
Example 2 cont
With
m43 = 0.823/5.354 = 0.154
E4 E4 + m43 E3
Thus,
3
2
1
4
5
0 5.666 1.667 2.332
16.35
0
0
5.354 7.707 19.065
0
0
0.823 8.354 12.467
3
2
1
4
5
0 5.666 1.667 2.332
16.35
0
0
5.354 7.707 19.065
0
0
0
9.541
9.531
Example 2 cont
In short, the forward
3 2
1 4
1 5 2
1
5 1 3 2
2 3
1
5
elimination yields
3
2
1
4
5
5
16.35
18
0
0
5.354 7.707 19.065
4
0
0
0
9.541
9.531
11
Back Substitution:
x4 = 9.531/93531 = 0.999
x3 = [19.065 (7.707)(0.999)]/(5.354) = 4.999
x2 = [16.335 (2.332)(0.999) (1.667)(4.999)]/(5.666) = 1.001
x1 = [5 + (4)(0.999) (1)(4.999) (2)(1.001)]/3 = 2.000
The exact answer is x1 = 2, x2 = 1, x3 = 5 and x4 = 1.
By Ng Tin Yau (PhD) 18/36
0 8 2 x1 7
3 5 2 x2 =
8
26
x3
6 2 8
In this case, we have a11 = 0, therefore, pivoting is necessary. The
greatest coefficient in column 1 is |a31 | = 6, in this case we interchange
E1 and E3 to give the system as in problem 1.
(6)
where ei = xi x
i . Notice that e2 = 0.0007 which gives e1 = 2.4535.
By Ng Tin Yau (PhD) 20/36
(7)
Iteration Methods
Vectors in Rn
Denote x = (x1 , x2 , . . . , xn )T Rn where xi R. Then Rn becomes a
vector space if for all elements x, y of Rn and scalars R we have
1
x + y = (x1 + y1 , x2 + y2 , . . . , xn + yn )T
x = (x1 , x2 , . . . , xn )T
(8)
i=1
2
Infinity norm:
kxk = max {|xi |}
1in
(9)
Example
Let x = (1, 1, 2)T R3 . Calculate kxk2 and kxk .
Ans:
kxk2 =
(1)2 + 12 + (2)2 = 6
and
kxk = max{| 1|, |1|, | 2|} = 2
By Ng Tin Yau (PhD) 24/36
nkxk
(10)
Then
kxk2 = |xj |2 = x2j
n
X
x2i = kxk22
(11)
(12)
i=1
n
X
i=1
x2i
n
X
(13)
i=1
nkxk .
By Ng Tin Yau (PhD) 25/36
Convergent Sequences
n
A sequence {x(k) }
k=0 of vectors in R is said to converge to x with
respect to the norm k k if, given any > 0, there exists an integer
N () such that
kx(k) xk < k N ()
(14)
Theorem
The sequence of vectors {x(k) } converges to x in Rn with respect to
(k)
k k if and only if limk xi = xi for each i = 1, 2, . . . , n.
(k)
Example 3
Let x(k) R4 be defined by
T
1 3 k
(k)
x = 1, 2 + , 2 , e sin k
k k
(15)
n
X
(aij xj ) + bi
for i = 1, 2, . . . , n
(16)
j=1,j6=i
(k)
n
X
1
(k)
(k1)
xi =
aij xj
+ bi for i = 1, 2, . . . , n
aii
(17)
j=1,j6=i
Example 4
Given a linear system Ax = b as follows:
10x1 x2 + 2x3 + x4 = 6
x1 + 11x2 x3 + 3x4 = 25
2x1 x2 + 10x3 x4 = 11
3x2 x3 + 8x4 = 15
Use Jacobis iterative technique to find approximations x(k) to x
starting with x(0) = (0, 0, 0, 0)T until
kx(k) x(k1) k
< 0.0002
kx(k) k
x1 =
(1)
x2 =
(1)
x3 =
(1)
x4 =
Since
(0)
(0)
(0)
1
10 (x2 2x3 x4 + 6) = 0.6000
(0)
(0)
(0)
1
11 (x1 + x3 3x4 + 25) = 2.2727
(0)
(0)
(0)
1
10 (2x1 + x2 + x4 11) = 1.1000
(0)
(0)
1
8 (3x2 + x3 + 15) = 1.8750
kx(1) x(0) k
= 1 > 0.0002
kx(1) k
By Ng Tin Yau (PhD) 30/36
x1 =
(2)
x2 =
(2)
x3 =
(2)
x4 =
Now
(1)
(1)
(1)
1
10 (x2 2x3 x4 + 6) = 0.8598
(1)
(1)
(1)
1
11 (x1 + x3 3x4 + 25) = 1.7159
(1)
(1)
(1)
1
10 (2x1 + x2 + x4 11) = 0.8052
(1)
(1)
1
8 (3x2 + x3 + 15) = 0.8852
kx(2) x(1) k
= 0.5768 > 0.0002
kx(2) k
(k)
x1
0.6000
0.8598
0.8441
0.8929
0.8868
0.8944
0.8932
0.8943
0.8941
0.8943
0.8943
(k)
x2
2.2727
1.7159
2.0363
1.9491
1.9987
1.9842
1.9920
1.9896
1.9909
1.9905
1.9907
(k)
x3
1.1000
0.8052
1.0118
0.9521
0.9852
0.9750
0.9802
0.9785
0.9794
0.9791
0.9792
(k)
x4
1.8750
0.8852
1.1309
0.9849
1.0251
1.0023
1.0090
1.0055
1.0066
1.0060
1.0062
ek
1.0000
0.5768
0.1573
0.0582
0.0249
0.0147
0.0039
0.0018
0.0006
0.0003
0.0001
Since e11 = 0.0001 < 0.0002, therefore the approximate solution is x(11)
and Matlab gives (0.8943, 1.9906, 0.9792, 1.0061)T .
By Ng Tin Yau (PhD) 32/36
j=n
X
|aij |
(18)
j=1,j6=i
Inverse of a 2 2 Matrix
Given a matrix
A=
a b
c d
Then
det(A) = ad bc
and
1
1
d b
=
det(A) c a
(19)
Determinant of an n n Matrix
ij to be the
Given A Mnn (K), for n 2, we define A
(n 1) (n 1) matrix obtained from A by deleting row i and column
j.
If n = 1, so that A = A11 , we define det(A) = A11 . For n 2, we
define the determinant of A recursively as
det(A) =
n
X
1j )
(1)1+j A1j det(A
(20)
j=1
This formula is called cofactor expansion along the first row of A. The
ij ) is called the cofactor of the entry of A in row
scalar (1)i+j det(A
i, column j.
Exercises
(1) Solve the following system using Gauss elimination method with
partial pivoting.
x1 x2 + 2x3 x4 = 8
2x1 2x2 + 3x3 3x4 = 20
x1 + x2 + x3 = 2
x1 x2 + 4x3 + 3x4 = 4
(2) Suppose that z = x y. Compute kzk5 and kzk if = 3 and
= 2, and x = (5, 3, 8)T and y = (0, 2, 9)T .
(3) Perform five iterations to the following linear system using the
Jacobi method. (Using x(0) = 0 as the initial approximation.)
4x1 + x2 x3 = 5
x1 + 3x2 + x3 = 4
2x1 + 2x2 + 5x3 = 1
By Ng Tin Yau (PhD) 36/36