You are on page 1of 22

Numerical Analysis

Third Level / Second Semester


2023 – 2024
Numerical methods in linear equations:
The following linear system of equation:
a11 x1+ a12 x2+ a13 x3 +………+ a1n xn = b1
a21 x1+ a22 x2+ a23 x3+………+ a2n xn = b2
a31 x1+ a32 x2+ a33 x3+………+ a3n xn = b3
.
.
.
am1 x1+ am2 x2+ am3 x3+………+ amn xn=bm
where:
aij i=1,2, 3,……….m
j =1,2,3,………. n
X1, X2, X3,……. Xn variable
b1, b2, b3,……… bm constant
The above system can be written in the form:

𝒂𝟏𝟏 𝒂𝟏𝟐 …. 𝒂𝟏𝒏 𝒙𝟏 𝒃𝟏


𝒂𝟐𝟏 𝒂𝟐𝟐 … 𝒂𝟐𝒏 𝒙𝟐 𝒃𝟐
[ .
. .. …. .. ] [ .. ] = [ .. ]
….
𝒂𝒎𝟏 𝒂𝒎𝟐 …. 𝒂𝒎𝒏 𝒙𝒏 𝒃𝒎

[A] {X} = {b}

Method to Solve of linear equations:


1. Direct Method:
A. Gauss elimination.
B. Gauss Jordan elimination.
C. Inverse matrix elimination method.
D. Lu factorization.
2. Indirect method (Iteration method):
A. Gauss – Seidel Iteration.
B. Jacobi method iteration.
Eigen value and Eigen vector

1
Types of matrix:
1. Upper Triangular Matrix.
𝑎11 𝑎12 𝑎13
[𝟎 𝑎22 𝑎23 ]
𝟎 𝟎 𝑎33

2. Lower Triangular Matrix.

𝑎11 𝟎 𝟎
[𝑎21 𝑎22 𝟎 ]
𝑎31 𝑎32 𝑎33

3. Diagonal Matrix.
𝟏 𝑎12 𝑎13
[𝑎21 𝟏 𝑎23 ]
𝑎31 𝑎32 𝟏

4. Unit Matrix I:

𝟏 0 0
[0 𝟏 0]
0 0 𝟏

Addition of matrices:

A+B=C
𝑎11 𝑎12 𝑎13 𝑏11 𝑏12 𝑏13 𝑎 + 𝑏11 𝑎12 + 𝑏12 𝑎13 + 𝑏13
[𝑎 𝑎22 𝑎23 ] + [ ] = [ 11 ]
21 𝑏21 𝑏22 𝑏23 𝑎21 + 𝑏21 𝑎22 + 𝑏22 𝑎23 + 𝑏23

Product by scalar
𝑎 𝑎 𝑎 𝑐𝑎 𝑐𝑎 𝑐𝑎
cA = c [𝑎11 𝑎12 𝑎13 ] = [𝑐𝑎11 𝑐𝑎12 𝑐𝑎13 ]
21 22 23 21 22 23

Multiplication of matrices
A(m x n) x B(n x r) = C(n x r)

𝑏11 𝑏12 𝑏13


𝑎11 𝑎12 𝑎13 𝒄 𝒄𝟏𝟐 𝒄𝟏𝟑
[𝑎 𝑎22 𝑎23 ] + [𝑏21 𝑏22 𝑏23 ] = [𝒄 𝟏𝟏 𝒄𝟐𝟐 𝒄𝟐𝟑 ]
21 𝟐𝟏
𝑏31 𝑏32 𝑏33

2
𝒄𝟏𝟏 = 𝑎11 𝑏11 + 𝑎12 𝑏21 + 𝑎13 𝑏31
𝒄𝟏𝟐 = 𝑎11 𝑏12 + 𝑎12 𝑏22 + 𝑎13 𝑏32
𝒄𝟏𝟑 = 𝑎11 𝑏13 + 𝑎12 𝑏23 + 𝑎13 𝑏33

𝒄𝟐𝟏 = 𝑎21 𝑏11 + 𝑎22 𝑏21 + 𝑎23 𝑏31


𝒄𝟐𝟐 = 𝑎21 𝑏12 + 𝑎22 𝑏22 + 𝑎23 𝑏32
𝒄𝟐𝟑 = 𝑎21 𝑏13 + 𝑎22 𝑏23 + 𝑎23 𝑏33

Example: Find the product of:


3 2
2 6 4 74 96
[ ]∗[4 10] = [ ]
1 9 7 116 148
11 8
Class work: Find the product of:

5 2 8 −1
1 4 −2
[ ]∗[ 3 6 4 5 ]=[ ]
3 5 −6
−2 9 7 −3

Determinant of a Matrix |A|:


𝑎11 𝑎12
If A = [𝑎 𝑎22 ] is a 2-order matrix, its determinant is calculated as follows:
21

𝑎11 𝑎12
det A = |𝑎
21 𝑎22 | = (𝑎11 𝑥 𝑎22 ) − (𝑎12 𝑥 𝑎21 )
𝑎11 𝑎12 𝑎13
If A = [𝑎21 𝑎22 𝑎23 ] is a 3-order matrix, its determinant is calculated as
𝑎31 𝑎32 𝑎33
follows:

+ − +
𝑎 𝑎12 𝑎13 𝑎22 𝑎23 𝑎21 𝑎23 𝑎21 𝑎22
det A = |𝑎11 𝑎22 𝑎23 | = 𝒂𝟏𝟏 |𝑎32 𝑎33 | − 𝒂𝟏𝟐 |𝑎31 𝑎33 | + 𝒂𝟏𝟑 | 𝑎32 𝑎32 |
21
𝑎31 𝑎32 𝑎33

= 𝒂𝟏𝟏 (𝑎22 𝑥 𝑎33 − 𝑎23 𝑥 𝑎32 ) − 𝒂𝟏𝟐 (𝑎21 𝑥 𝑎33 − 𝑎23 𝑥 𝑎31 )
+ 𝒂𝟏𝟑 (𝑎21 𝑥 𝑎32 − 𝑎22 𝑥 𝑎32 )

Example: Calculate the determinant of the following matrix:


2 1
𝐴=[ ]
3 −2
2 1
det A = | | = (2 𝑥 − 2) − (1 𝑥 3) = −7
3 −2
3
Example: Calculate the determinant of the following matrix:
2 1 3
𝐴 = [1 0 2 ]
2 0 −2
+ − +
1 3 0 2 1 2 1 0
det A = | 2 | = 𝟐| | − 𝟏| | + 𝟑| |
1 0 2 0 −2 2 −2 2 0
2 0 −2

= 𝟐(0 − 0) − 𝟏(−2 − 4) + 𝟑(0 − 0) = 𝟔

Class work: Calculate the determinant of the following matrix:


2 −3 −4
𝐴 = [1 0 −2]
0 −5 −6

Transpose of Matrix AT
𝑎11 𝑎12 𝑎13 𝑎11 𝑎21 𝑎31
A = [𝑎21 𝑎22 𝑎23 ] A = [𝑎12
T 𝑎22 𝑎32 ]
𝑎31 𝑎32 𝑎33 𝑎13 𝑎23 𝑎33

Example: Determine the transpose of the matrix:


2 4 2 5
A=[ ] AT = [ ]
5 8 4 8
3 4 6 3 9 7
T
A = [ 9 2 4] A = [4 2 3]
7 3 1 6 4 1

4
Inverse of matrices A-1
If a matrix 𝐴 is non−singular, we can compute its inverse from the
following relation:
𝟏
𝑨−𝟏 = 𝒂𝒅𝒋 𝑨 [ Cofactor method]
𝒅𝒆𝒕 𝑨

Where: adj A: is the adjoint matrix


The procedure for finding the adjoint matrix is given below:
1. Find the transpose of A, which is denoted by AT.
2. The minor of any element is found by covering up the elements in its row and
column and finding the determinant of the remaining matrix. By replacing each
element of AT by its minor, we can write down a matrix of minors of AT.
3. The cofactor of any element is found by taking its minor and imposing a place
sign according to the following rule:
+ − + ⋯
[− + + ⋯
+ − + ⋯]
⋮ ⋮ ⋮ ⋱
-1
Example: Find the inverse A of the matrix A:

1 −2 0
A=[ 3 1 5]
−1 2 3
𝟏
𝑨−𝟏 = 𝒂𝒅𝒋 𝑨
𝒅𝒆𝒕 𝑨

1. Finding the determinate of the matrix:


+ − +
−2 0 1 5 3 5 3 1
det A = | 1 | = 𝟏| | + 𝟐| | + 𝟎| |
3 1 5 2 3 −1 3 −1 2
−1 2 3

= 𝟏(3 − 10) + 𝟐(9 + 5) + 𝟎(6 + 1) = 𝟐𝟏


2. Finding the adjoint (adj) matrix:
Transpose of the matrix:

1 3 −1
𝑇
𝐴 = [−2 1 2]
0 5 3

5
1 2 −2 2 −2 1
𝛼11 = | | = −𝟕 , 𝛼12 = | | = −𝟔 , 𝛼13 = | | = −𝟏𝟎
5 3 0 3 0 5
3 −1 1 −1 1 1
𝛼21 = | | = 𝟏𝟒 , 𝛼22 = | | = 𝟑 , 𝛼23 = | |= 𝟓
5 3 0 3 0 5
3 −1 1 −1 1 3
𝛼31 = | | = 𝟕 , 𝛼32 = | | = 𝟎 , 𝛼33 = | |= 𝟕
1 2 −2 3 −2 1
−7 −6 −10 + − +
𝑇
Matrix of minors of 𝐴 [ 14 3 5 ] , [− + −]
7 0 7 + − +

−7 6 −10
𝑎𝑑𝑗 𝐴 = [−14 3 −5 ]
7 0 7
𝟏
𝑨−𝟏 = 𝒂𝒅𝒋 𝑨
𝒅𝒆𝒕 𝑨
𝟏 𝟐 𝟏𝟎
− −
𝟑 𝟕 𝟐𝟏
𝟏 −7 6 −10 𝟐 𝟏 𝟓
∴ 𝑨−𝟏 = [−14 3 −5 ] = − −
𝟐𝟏 𝟑 𝟕 𝟐𝟏
7 0 7
𝟏 𝟏
[ 𝟑 𝟎 𝟑 ]
-1
Class work: Find the inverse A of the following matrix:

1 3 2
A=[ 0 5 1]
−1 3 0

6
Solve of linear equations:
Direct Method:
A. Gauss elimination:

a11 x1+ a12 x2+ a13 x3 +………+ a1n xn = b1


a21 x1+ a22 x2+ a23 x3+………+ a2n xn = b2
a31 x1+ a32 x2+ a33 x3+………+ a3n xn = b3
.
.
.
An1 x1+ an2 x2+ an3 x3+………+ ann xn=bn

Gauss elimination method: The matrix [a] is converted into an upper


triangular matrix, so that the value of a last variable can be obtained directly.
The reaming variables are obtained by back substitution.

𝑎11 𝑎12 𝑎13 𝒙𝟏 𝒃𝟏


[𝑎21 𝑎22 𝑎23 ] [𝒙𝟐 ] = [𝒃𝟐 ]
𝑎31 𝑎32 𝑎33 𝒙𝟑 𝒃𝟑

𝑎11 𝑎12 𝑎13 𝒙𝟏 𝒃𝟏


[𝟎 𝑎22 ′ 𝑎23 ′ ] [𝒙𝟐 ] = [ 𝒃𝟐 ′ ]
𝟎 𝟎 𝑎33 ′′ 𝒙𝟑 𝒃𝟑 ′′

𝑏3 ′′ 𝑏2′ −𝑎23
′ 𝑥
3 𝑏1 −𝑎12 𝑥2− 𝑎13 𝑥3
𝒙𝟑 = , 𝒙𝟐 = , 𝒙𝟏 =
𝑎33 ′′ 𝑎22 ′ 𝑎11

Example: Use the Gauss elimination method to solve the following system
of equations:
2𝑥1 − 4𝑥2 + 6𝑥3 = 5
𝑥1 + 3𝑥2 − 7𝑥3 = 2
7𝑥1 + 5𝑥2 + 9𝑥3 = 4
Solution:
2 −4 6 𝑥1 5
[1 3 −7] [𝑥2 ] = [2]
7 5 9 𝑥3 4
2 −4 6 ⋮ 5 2 −4 6 ⋮ 5
2𝑅2 − 𝑅1
[1 3 −7 ⋮ 2] [0 10 −20 ⋮ −1 ] 5𝑅3 − 19𝑅2
7 5 9⋮4 2𝑅3 − 7𝑅1 0 38 −24 ⋮ −27
7
2 −4 6 ⋮ 5
[0 10 −20 ⋮ −1 ] Back substitution
0 0 260 ⋮ −116

2 −4 6 𝑥1 5
[0 10 −20] [𝑥2 ] = [ −1 ]
0 0 260 𝑥3 −116
−116
𝑥3 = = −𝟎. 𝟒𝟒𝟔
260
10𝑥2 − 20(−0.446) = −1
−1−8.91
𝑥2 = = −𝟎. 𝟗𝟗𝟐
10
2𝑥1 − 4(−0.992) + 6(−0.446) = 5
𝑥1 = 𝟏. 𝟖𝟓𝟒

Class work: Use the Gauss elimination method to solve the following system
of equations:
3𝑥1 − 𝑥2 + 2𝑥3 = 12
𝑥1 + 2𝑥2 + 3𝑥3 = 11
2𝑥1 − 2𝑥2 − 𝑥3 = 2

8
B. Gauss Jordan elimination
‫( اي تصفير العناصر‬Unit matrix) ‫تتلخص هذه الطريقة بتحويل المصفوفة الى مصفوفة احادية‬
.1 ‫اسفل و اعلى القطر الرئيسي و من ثم جعل القطر الرئيسي يساوي‬
Example: Use the Gauss Jordan method to solve the following system of
equations:
2𝑥1 − 4𝑥2 + 6𝑥3 = 5
𝑥1 + 3𝑥2 − 7𝑥3 = 2
7𝑥1 + 5𝑥2 + 9𝑥3 = 4
Solution:
2 −4 6 𝑥1 5
𝑥
[1 3 −7] [ 2 ] [2]=
7 5 9 𝑥3 4
2 −4 6 ⋮ 5 2 −4 6 ⋮ 5
2𝑅2 − 𝑅1
[1 3 −7 ⋮ 2] [0 10 −20 ⋮ −1 ] 5𝑅3 − 19𝑅2
7 5 9⋮4 2𝑅3 − 7𝑅1 0 38 −24 ⋮ −27

2 −4 6 ⋮ 5 20 −10 0 ⋮ 47
[0 10𝑅1 + 3𝑅2 13𝑅1 + 𝑅2
10 −20 ⋮ −1 ] [0 130 0 ⋮ −129 ]
0 0 260 ⋮ −116 13𝑅2 + 𝑅3 0 0 260 ⋮ −116

260 0 0 ⋮ 482 𝑅1 𝑅2 𝑅3
[ 0 130 0 ⋮ −129 ] , ,
260 130 260
0 0 260 ⋮ −116

1 0 0 ⋮ 1.854
[0 1 0 ⋮ −0.992 ]
0 0 1 ⋮ −0.446

𝒙𝟏 = 𝟏. 𝟖𝟓𝟒
𝒙𝟐 = −𝟎. 𝟗𝟗𝟐
𝒙𝟑 = −𝟎. 𝟒𝟒𝟔

9
Class work: Use the Gauss Jordan elimination method to solve the
following system of equations:
3𝑥1 − 𝑥2 + 2𝑥3 = 12
𝑥1 + 2𝑥2 + 3𝑥3 = 11
2𝑥1 − 2𝑥2 − 𝑥3 = 2

10
C. Inverse matrix elimination method.

Inverse matrix method:


[A] {X} = {b}

{X} = [A]-1 {b}

Example: Use the Inverse matrix method to solve the following system of
equations:
2𝑥1 − 4𝑥2 + 6𝑥3 = 5
𝑥1 + 3𝑥2 − 7𝑥3 = 2
7𝑥1 + 5𝑥2 + 9𝑥3 = 4
Solution:
2 −4 6 𝑥1 5
𝑥
[1 3 −7] [ 2 ] = [2]
7 5 9 𝑥3 4

𝟏
Find the A-1: 𝑨−𝟏 = 𝒂𝒅𝒋 𝑨
𝒅𝒆𝒕 𝑨

+ − +
−4 6 | = 𝟐 |3 −7| + 𝟒 |1 −7| + 𝟔 |1 3| = 𝟐𝟔𝟎
det A = | 2
1 3 −7 5 9 7 9 7 5
7 5 9
2 1 7
𝑇
𝐴 = [−4 3 5]
6 −7 9

3 5 −4 5 −4 3
𝐶11 = | | = 𝟔𝟐 , 𝐶12 = | | = −𝟔𝟔 , 𝐶13 = | | = 𝟏𝟎
−7 9 6 9 6 −7
1 7 2 7 2 1
𝐶21 = | | = 𝟓𝟖 , 𝐶22 = | | = −𝟐𝟒 , 𝐶23 = | | = −𝟐𝟎
−7 9 6 9 6 −7
1 7 2 7 2 1
𝐶31 = | | = −𝟏𝟔 , 𝐶32 = | | = 𝟑𝟖 , 𝐶33 = | | = 𝟏𝟎
3 5 −4 5 −4 3

11
62 −66 10 + − +
𝑇
matrix of minors of 𝐴 [ 58 −24 −20] , [− + −]
−16 38 10 + − +

62 66 10
𝑎𝑑𝑗 𝐴 = [−58 −24 20]
−16 −38 10

𝟏
𝑨−𝟏 = 𝒂𝒅𝒋 𝑨
𝒅𝒆𝒕 𝑨
𝟑𝟏 𝟑𝟑 𝟏
𝟏𝟑𝟎 𝟏𝟑𝟎 𝟐𝟔
𝟏 62 66 10 𝟐𝟗 𝟔 𝟏
∴ 𝑨−𝟏 = [−58 −24 20] = − −
𝟐𝟔𝟎 𝟏𝟑𝟎 𝟔𝟓 𝟏𝟑
−16 −38 10
𝟒 𝟏𝟗 𝟏

[ 𝟔𝟓 −
𝟏𝟑𝟎 𝟐𝟔]

{X} = [A]-1 {b}


𝟑𝟏 𝟑𝟑 𝟏
𝑥1 𝟏𝟑𝟎 𝟏𝟑𝟎 𝟐𝟔 5
𝟐𝟗 𝟔 𝟏
[𝑥2 ] = − 𝟏𝟑𝟎 −
𝟔𝟓 𝟏𝟑
[ 2]
𝑥3 𝟒 𝟏𝟗 𝟏 4
[ − 𝟔𝟓 −
𝟏𝟑𝟎 𝟐𝟔]

𝒙𝟏 = 𝟏. 𝟖𝟓𝟒
𝒙𝟐 = −𝟎. 𝟗𝟗𝟐
𝒙𝟑 = −𝟎. 𝟒𝟒𝟔

12
Class work: Use the Inverse matrix method to solve the following system of
equations:
3𝑥1 − 𝑥2 + 2𝑥3 = 12
𝑥1 + 2𝑥2 + 3𝑥3 = 11
2𝑥1 − 2𝑥2 − 𝑥3 = 2

13
Example: Use the Inverse matrix elimination method to solve the following
system of equations:
2𝑥1 − 4𝑥2 + 6𝑥3 = 5
𝑥1 + 3𝑥2 − 7𝑥3 = 2
7𝑥1 + 5𝑥2 + 9𝑥3 = 4
Solution:
2 −4 6 𝑥1 5
𝑥
[1 3 −7] [ 2 ] = [2]
7 5 9 𝑥3 4

2 −4 6 | 1 0 0 2 −4 6 | 1 0 0
2𝑅2 − 𝑅1
[1 3 −7 | 0 1 0] [0 10 −20 | −1 2 0 ] 5𝑅3 − 19𝑅2
2𝑅3 − 7𝑅1
7 5 9 | 0 0 1 0 38 −24 | −7 0 2

2 −4 6 | 1 0 0
10𝑅1 + 3𝑅2
[0 10 −20 | −1 2 0]
0 0 260 | −16 −38 10 13𝑅2 + 𝑅3

20 −10 0 | 7 3 0
[ 0 130 0 | −29 −12 10] 13𝑅1 + 𝑅2
0 0 260 | −16 −38 10

260 0 0 | 62 66 10 𝑅1 𝑅2 𝑅3
[ 0 130 0 | −29 −12 10] , ,
260 130 260
0 0 260 | −16 −38 10

𝟑𝟏 𝟑𝟑 𝟏
1 0 0 |
𝟏𝟑𝟎 𝟏𝟑𝟎 𝟐𝟔
𝟐𝟗 𝟔 𝟏
0 1 0 | − −
𝟏𝟑𝟎 𝟔𝟓 𝟏𝟑
𝟒 𝟏𝟗 𝟏
[0 0 1 | −
𝟔𝟓

𝟏𝟑𝟎 𝟐𝟔]

14
𝟑𝟏 𝟑𝟑 𝟏
𝟏𝟑𝟎 𝟏𝟑𝟎 𝟐𝟔
𝟐𝟗 𝟔 𝟏
∴ 𝑨−𝟏 = − −
𝟏𝟑𝟎 𝟔𝟓 𝟏𝟑
𝟒 𝟏𝟗 𝟏
[ − 𝟔𝟓 − 𝟏𝟑𝟎 𝟐𝟔]

{X} = [A]-1 {b}


𝟑𝟏 𝟑𝟑 𝟏
𝑥1 𝟏𝟑𝟎 𝟏𝟑𝟎 𝟐𝟔 5
𝟐𝟗 𝟔 𝟏
[𝑥2 ] = − 𝟏𝟑𝟎 −
𝟔𝟓 𝟏𝟑
[ 2]
𝑥3 𝟒 𝟏𝟗 𝟏 4
[ − 𝟔𝟓 −
𝟏𝟑𝟎 𝟐𝟔]

𝒙𝟏 = 𝟏. 𝟖𝟓𝟒
𝒙𝟐 = −𝟎. 𝟗𝟗𝟐
𝒙𝟑 = −𝟎. 𝟒𝟒𝟔
Class work: Use the Inverse matrix elimination method to solve the
following system of equations:
3𝑥1 − 𝑥2 + 2𝑥3 = 12
𝑥1 + 2𝑥2 + 3𝑥3 = 11
2𝑥1 − 2𝑥2 − 𝑥3 = 2

15
D. Lu factorization (Lu Decomposition method):
An LU factorization of a matrix involves writing the given matrix as the
product of a lower triangular matrix L which has the main diagonal consisting
entirely of ones, and an upper triangular matrix U in the indicated order.
The L goes with (lower) and the U with (upper).

[A] {X} = {b} [L][U]{X} = {b}

Where:
L = Lower triangular matrix.
U = Upper triangular matrix.

1. We assume that we can write.


[A] = [L][U]

𝑎11 𝑎12 𝑎13 𝑙11 0 0 𝑢11 𝑢12 𝑢13


[𝑎21 𝑎22 𝑎23 ] = [𝑙21 𝑙22 0 ][ 0 𝑢22 𝑢23 ]
𝑎31 𝑎32 𝑎33 𝑙31 𝑙32 𝑙33 0 0 𝑢33

𝑎11 𝑎12 𝑎13 𝑙11 𝑙11 𝑢12 𝑙11 𝑢13


[𝑎21 𝑎22 𝑎23 ] = [𝑙21 𝑙21 𝑢12 + 𝑙22 𝑙21 𝑢13 + 𝑙22 𝑢23 ]
𝑎31 𝑎32 𝑎33 𝑙31 𝑙31 𝑢12 + 𝑙32 𝑙31 𝑢13 + 𝑙32 𝑢23 +𝑙33

2. [L] {y} = {b} Forward substitution {y}


3. [U] {x} = {y} Backward substitution {x}

There are three methods of LU:


1. Doolittle’s method,
𝑎11 𝑎12 𝑎13 1 0 0 𝑢11 𝑢12 𝑢13
[𝑎21 𝑎22 𝑎23 ] = [𝑙21 1 0] [ 0 𝑢22 𝑢23 ]
𝑎31 𝑎32 𝑎33 𝑙31 𝑙32 1 0 0 𝑢33
2. Crout’s method,
𝑎11 𝑎12 𝑎13 𝑙11 0 0 1 𝑢12 𝑢13
[𝑎21 𝑎22 𝑎23 ] = [𝑙21 𝑙22 0 ] [0 1 𝑢23 ]
𝑎31 𝑎32 𝑎33 𝑙31 𝑙32 𝑙33 0 0 1

16
3. Choleskie’s method: For square symmetric matrix:
A = L LT
𝑎11 𝑎12 𝑎13 𝑙11 0 0 𝑙11 𝑙21 𝑙31
[𝑎21 𝑎22 𝑎23 ] = [𝑙21 𝑙22 0 ] [ 0 𝑙22 𝑙32 ]
𝑎31 𝑎32 𝑎33 𝑙31 𝑙32 𝑙33 0 0 𝑙33

Example: Use the Doolittle’s method to solve the following system of


equations:
2𝑥1 − 4𝑥2 + 6𝑥3 = 5
𝑥1 + 3𝑥2 − 7𝑥3 = 2
7𝑥1 + 5𝑥2 + 9𝑥3 = 4

[A]{x} = {b}

2 −4 6 𝑥1 5
𝑥
[1 3 −7] [ 2 ] = [2]
7 5 9 𝑥3 4

1. [A]= [L][U]
2 −4 6 1 0 0 𝑢11 𝑢12 𝑢13
[1 3 −7] = [𝑙21 1 0] [ 0 𝑢22 𝑢23 ]
7 5 9 𝑙31 𝑙32 1 0 0 𝑢33

𝑎11 = 2 = 1 𝑥 𝑢11 → 𝑢11 = 𝟐


𝑎12 = −4 = 1 𝑥 𝑢12 → 𝑢12 = −𝟒
𝑎13 = 6 = 1 𝑥 𝑢13 → 𝑢13 = 𝟔

𝑎21 = 1 = 𝑙21 𝑥 2 + 0 + 0 → 𝑙21 = 𝟎. 𝟓


𝑎22 = 3 = 𝑙21 (0.5)𝑥 𝑢12 (−4) + 𝑢22 𝑥1 + 0 → 𝑢22 = 𝟓
𝑎23 = −7 = 𝑙21 (0.5)𝑥 𝑢13 (6) + 𝑢23 𝑥1 + 0 → 𝑢23 = −𝟏𝟎

𝑎31 = 7 = 𝑙31 𝑥 𝑢11 (2) + 0 + 0 → 𝑙31 = 𝟑. 𝟓


𝑎32 = 5 = 𝑙31 (3.5)𝑥 𝑢12 (6) + 𝑙32 (3.8) 𝑥 𝑢23 (−10) + 1𝑥𝑢23 → 𝑢33 = 𝟑. 𝟖
𝑎33 = 9 = 𝑙31 (3.5)𝑥 𝑢13 (−4) + 𝑙32 𝑥 𝑢22 (5) + 0 → 𝑙32 = 𝟐𝟔

17
2 −4 6 1 0 0 2 −4 6
[1 3 −7] = [0.5 1 0] [0 5 −10]
7 5 9 3.5 3.8 1 0 0 26

2. [L] {y} = {b} Forward substitution {y}


1 0 0 𝑦1 5
𝑦
[0.5 1 0] [ 2 ] = [2]
3.5 3.8 1 𝑦3 4
𝑦1 = 5
𝑦2 = −0.5
𝑦3 = −11.6
3. [U] {x} = {y} Backward substitution {x}
2 −4 6 𝑥1 5
𝑥
[0 5 −10] [ 2 ] = [ −0.5 ]
0 0 26 𝑥3 −11.6
𝒙𝟑 = −𝟎. 𝟒𝟒𝟔
𝒙𝟐 = −𝟎. 𝟗𝟗𝟐
𝒙𝟏 = 𝟏. 𝟖𝟓𝟒
Class work: Use the Doolittle’s method to solve the following system of
equations:
3𝑥1 − 𝑥2 + 2𝑥3 = 12
𝑥1 + 2𝑥2 + 3𝑥3 = 11
2𝑥1 − 2𝑥2 − 𝑥3 = 2

18
Example: Use the Crout’s method to solve the following system of
equations:
2𝑥1 − 4𝑥2 + 6𝑥3 = 5
𝑥1 + 3𝑥2 − 7𝑥3 = 2
7𝑥1 + 5𝑥2 + 9𝑥3 = 4

[A]{x} = {b}

2 −4 6 𝑥1 5
𝑥
[1 3 −7] [ 2 ] = [2]
7 5 9 𝑥3 4

[A]= [L][U]
2 −4 6 𝑙11 0 0 1 𝑢12 𝑢13
[1 3 −7] = [𝑙21 𝑙22 0 ] [0 1 𝑢23 ]
7 5 9 𝑙31 𝑙32 𝑙33 0 0 1
1.
2 −4 6 2 0 0 1 −2 3
[1 3 −7] = [1 5 0 ] [0 1 −2]
7 5 9 7 19 26 0 0 1

2. [L] {y} = {b} Forward substitution {y}

2 0 0 𝑦1 5
[1 5 0 ] [𝑦2 ] = [2]
7 19 26 𝑦3 4
𝑦1 = 2.5
𝑦2 = −0.1
𝑦3 = −0.446
3. [U] {x} = {y} Backward substitution {x}
1 −2 3 𝑥1 2.5
[0 1 −2] [𝑥2 ] = [ −0.1 ]
0 0 1 𝑥3 −0.446
𝒙𝟑 = −𝟎. 𝟒𝟒𝟔
𝒙𝟐 = −𝟎. 𝟗𝟗𝟐
𝒙𝟏 = 𝟏. 𝟖𝟓𝟒

19
Class work: Use the Crout’s method to solve the following system of
equations:
3𝑥1 − 𝑥2 + 2𝑥3 = 12
𝑥1 + 2𝑥2 + 3𝑥3 = 11
2𝑥1 − 2𝑥2 − 𝑥3 = 2

20
Example: Use the method of Cholesky to solve the following system of
equations:
4𝑥1 − 2𝑥2 + 14𝑥3 = 14
2𝑥1 + 17𝑥2 − 5𝑥3 = −101
14𝑥1 − 5𝑥2 + 83𝑥3 = 155

[A]{x} = {b}

4 2 14 𝑥1 14
𝑥
[ 2 17 −5] [ 2 ] = [−101]
14 −5 83 𝑥3 155

[A]= [L][U]
2 −4 6 𝑙11 0 0 𝑙11 𝑙21 𝑙31
[1 3 −7] = [𝑙21 𝑙22 0 ] [ 0 𝑙22 𝑙32 ]
7 5 9 𝑙31 𝑙32 𝑙33 0 0 𝑙33
1.
2 −4 6 2 0 0 2 1 7
[1 3 −7] = [1 4 0] [0 4 −3]
7 5 9 7 −3 5 0 0 5

2. [L] {y} = {b} Forward substitution {y}


2 0 0 𝑦1 14
𝑦
[1 4 0] [ 2 ] = [−101]
7 −3 5 𝑦3 155
𝑦1 = 7
𝑦2 = −27
𝑦3 = 5

3. [U] {x} = {y} Backward substitution {x}


2 1 7 𝑥1 7
𝑥
[0 4 −3] [ 2 ] = [−27]
0 0 5 𝑥3 5
𝒙𝟑 = 𝟑
𝒙𝟐 = −𝟔
𝒙𝟏 = 𝟑

21
Class work: Use the Choleskie’s method to solve the following system of
equations:
2𝑥1 + 3𝑥2 + 𝑥3 = 1
3𝑥1 + 5𝑥2 + 2𝑥3 = −2
𝑥1 + 2𝑥2 + 2𝑥3 = 3

22

You might also like