Professional Documents
Culture Documents
Lecture Notes Chapter 3 Part 2
Lecture Notes Chapter 3 Part 2
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
Description
AIMS
This chapter is aimed to solve small numbers of linear algebraic equations by using direct methods
involving Naïve Gauss elimination method, Gauss elimination as partial pivoting and LU
factorization methods
EXPECTED OUTCOMES
1. Students should be able transform the system of linear equations into matrix form.
2. Students should be able to solve linear algebraic equations by using Naïve Gauss elimination
method, Gauss elimination as partial pivoting and LU factorization.
REFERENCES
1. Norhayati Rosli, Nadirah Mohd Nasir, Mohd Zuki Salleh, Rozieana Khairuddin,
Nurfatihah Mohamad Hanafi, Noraziah Adzhar. Numerical Methods, Second Edition,
UMP, 2017 (Internal use)
2. Chapra, C. S. & Canale, R. P. Numerical Methods for Engineers, Sixth Edition, McGraw–
Hill, 2010.
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
Content
1 Introduction
2 Naïve Gauss Elimination Method
3 Gauss Elimination with Partial Pivoting
4 LU Factorization
4.1 LU as Gauss Elimination Method
4.2 Crout’s Method
4.3 Cholesky Method
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
INTRODUCTION
Solving Linear Algebraic Equations: Direct Methods
1 Naïve Gauss
Elimination Method
Three Types
of Methods
LU Factorization
3 2 Gauss Elimination as
Partial Pivoting
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
NAÏVE GAUSS ELIMINATION
Gauss elimination is a sequential process of eliminate unknowns from a
system of equations by using forward elimination and solving for the
unknown by using backward substitution.
1 Forward
Elimination
Two Major
Backward Steps
Substitution
2
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
NAÏVE GAUSS ELIMINATION
(Cont.)
Naïve Gauss Elimination Procedures
Pivot element
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
NAÏVE GAUSS ELIMINATION
(Cont.)
Backward Substitution
Starting with the last row, solve for the unknown. The results obtained is
back substituted into 𝑛 − 1 equation to solve for 𝑥𝑛−1 by using the
following formula.
bn( n 1)
xn ( n 1)
ann
Solution
Backward substitution:
5
x3 10 x3 4
2
5 15
x2 x2 3
2 2
4 x1 3 3 2 4 13 x1 1
Therefore, 𝑥1 = −1, 𝑥2 = 3, 𝑥3 = 4.
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
GAUSS ELIMINATION WITH
PARTIAL PIVOTING
Two pitfalls involve in Naïve Gauss elimination method:
a) Division by zero – may occur in forward elimination and backward
substitution phases.
b) Large round off errors
2 Two
Division by zero
Pitfalls
Large round off
error Naïve Gauss 1
Elimination
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
GAUSS ELIMINATION WITH
PARTIAL PIVOTING (Cont.)
The simplest remedy to reduce the round–off error is to increase the
number of significant figures in the computation. However, it would
contribute to the computational effort and large memory are required
for the storage.
The technique of pivoting can be used to avoid both division by zero
and minimizes round–off error.
Pivoting involve the rearrangement of the equations so that the pivot
element has the largest magnitude compare to others element in that
similar column.
This technique can be incorporated into Naive Gauss elimination
method and it is frequently known as Gauss elimination with partial
pivoting. It involves the same step as Naïve gauss elimination
method (forward elimination and backward substitution) with an
additional task that we need to ensure the pivot element must have
the largest magnitude before each of the (𝑛 − 1) steps of forward
elimination is performed.
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
GAUSS ELIMINATION WITH
PARTIAL PIVOTING (Cont.)
Example 2 [Chapra & Canale, 2010]
Solve the following equations using Gauss elimination with partial pivoting.
Solution
Identify the largest absolute value in second column and switch between the two
rows (if any).
Backward substitution:
𝐀 = 𝐋𝐔
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
LU FACTORIZATION (Cont.)
For 3 × 3 matrices we may have
l11 0 0 u11 u12 u13 a11 a12 a31
l l22 0 0 u22 u23 a21 a22 a23
21
l31 l32 l33 0 0 u33 a31 a32 a33
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
LU FACTORIZATION (Cont.)
LU Factorization Procedures
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
LU FACTORIZATION (Cont.)
LU Factorization Methods
1 Gauss Elimination
Method as LU
Three Types
of Methods
3 2
Cholesky Method Crout’s Method
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
GAUSS ELIMATION METHOD AS
LU FACTORIZATION
Also known as a Doolittle decomposition (the elements of lower triangular
matrix are 1’s on the main diagonal).
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
GAUSS ELIMATION METHOD AS
LU FACTORIZATION
Gauss Elimination as LU Factorization Procedures
'
a11 a12 a31 R 2 R1 aa21 a11 a12 a31 R 3 R2 aa'32 a11 a12 a31
a a22 a23 0
11
a '22 a 23 0
'
22
a '22 a '23 U
21 a
R 3 R1 31
a31 a32 a33 a11 0 a '32 a '33 0 0 a ''33
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
GAUSS ELIMATION METHOD AS
LU FACTORIZATION (Cont.)
Gauss Elimination as LU Factorization Procedures
𝑎21 𝑎31 𝑎′ 32
where 𝑚21 = , 𝑚31 = and 𝑚32 = 𝑎′
𝑎11 𝑎11 22
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
GAUSS ELIMATION METHOD AS
LU FACTORIZATION (Cont.)
Example 3
Solve the following equations using Gauss elimination as LU Factorization.
4 x 3 y 2 z 13
2 x y z 1
x y 3 z 14
Solution
LU decomposition
2
R 2 R1
4 3
4 2 4 3 2
4 3 2 R R 1 R 3 R2
1/4
2 1 1
3 1
4
0 5 0 0
( 5/2) 5
0 U
2 2
1 1 3 1 5 5
0 0 0
4 2 2
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
GAUSS ELIMATION METHOD AS
LU FACTORIZATION (Cont.)
Solution (Cont.)
Then write
4 3 2
1 0 0
5 1 0 0
U 0 0
L m21 1
2 1 0 1 0
2
5 m31 m32 1
0 0 1 1
2 1
4 10
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
GAUSS ELIMATION METHOD AS
LU FACTORIZATION (Cont.)
Solution (Cont.)
Set up 𝐋𝐝 = 𝐛
1 0 0 d1 13
1/ 2 1 0 d 1
2
1/ 4 1/10 1 d3 14
d1 13
d d 2 15 / 2
d3 10
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
GAUSS ELIMATION METHOD AS
LU FACTORIZATION (Cont.)
Solution (Cont.)
Set up 𝐔𝐱 = 𝐝
4 3 2 x1 13
0 5 / 2 0 x 15 / 2
2
0 0 5 / 2 x3 10
x1 1
x x2 3
x3 4
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CROUT’S METHOD
Executing the matrix multiplication on the right-hand side of the equation
gives:
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CROUT’S METHOD (Cont.)
The elements of the matrices 𝐋 and 𝐔 can be determined by solving
equation (*) by equating the corresponding elements of the matrix 𝐀.
l11 a11
First Row
a13 a12 a14
𝑖 = 1 u13 u12 u14
l11 l11 l11
l21 a21 l22 a22 l21u12
Second Row
a23 l21u13 a24l21u14
𝑖 = 2 u23 u24
l22 l22
Third Row l31 a31 l32 a32 l31u12 l33 a33 l31u13
𝑖 = 3 a34 l31u14 l32u24
u34
l33
Forth Row
l41 a41 l42 a42 l41u12
𝑖 = 4 l43 a43 l41u13 l42u23 l44 a44 l41u14 l42u24 l43u34
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CROUT’S METHOD (Cont.)
Example 4
Solve the following equations using Crout’s method.
12 x 2 y z 16
15 x 12 y z 1
13 x 4 y z 11
Solution
LU decomposition
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CROUT’S METHOD (Cont.)
Solution (Cont.)
Equating the elements of the matrix A with the right–hand side of the multiplication of 𝐋
and 𝐔, yield;
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CROUT’S METHOD (Cont.)
Solution (Cont.)
1 1
1 6 12 12 0 0
U 0 1
9 29
and L 15 0
58 2
37 76
0 0 1 13
6 87
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CROUT’S METHOD (Cont.)
Solution (Cont.)
12 0 0 d1 16 d1 43
15 29
0 d 2 1 d d 2 38
29
2
13 37 76
11 d3 2
6 87 d 3
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CROUT’S METHOD (Cont.)
Solution (Cont.)
Set up 𝐔𝐱 = 𝐝
1 16 1
12 x1 43
0 1 589 x2 38
29
0 0 1 x3 2
x1 1
x x2 1
x3 2
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CHOLESKY METHOD
Cholesky Method: Introduction
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CHOLESKY METHOD (Cont.)
Cholesky Method: Formula
i 1
uii aii uki2
k 1
Cholesky Method Formula i 1
aij uki ukj
uij k 1
for j i 1,..., n
uii
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CHOLESKY METHOD (Cont.)
Cholesky Method: Procedures
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CHOLESKY METHOD (Cont.)
Example 5
Solve the following equations using Cholesky Factorization.
2x y 1
x 2 y z
zy
Solution
2 1 0 x1 1
In Matrix Form 1 2 1 x 0
2
0 1 1 x3 0
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CHOLESKY METHOD (Cont.)
Solution (Cont.)
LU decomposition
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CHOLESKY METHOD (Cont.)
Solution (Cont.)
LU decomposition
k 1
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CHOLESKY METHOD (Cont.)
Solution (Cont.)
Therefore
1.4142 0.7071 0
U 0 1.2247 0.8165
0 0 0.5773
1.4142 0 0
UT 0.7071 1.2247 0
0 0.8165 0.5773
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
CHOLESKY METHOD (Cont.)
Solution (Cont.)
d1 0.7071
d d 2 0.4083
d3 0.5775
x 1.0002
x y 1.0003
z 1.0003 Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
Conclusion
Naïve Gauss elimination method suffers from two pitfall which are may involve
division by zero and large round-off error.
Later can be overcome by performing Gauss elimination method with partial
pivoting.
𝐋𝐔 factorization is designed so that the elimination step involves only
operations on the matrix 𝐀.
It is well suited with the situations where many right hand side of vectors 𝐛 need
to be evaluated for a single matrix 𝐀.
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449
Author Information
MOHD ZUKI SALLEH
Norhayati Binti Rosli, Applied & Industrial Mathematics Research
Senior Lecturer, Group,
Applied & Industrial Mathematics Research Faculty of Industrial Sciences & Technology
Group, (FIST),
Faculty of Industrial Sciences & Technology Universiti Malaysia Pahang,
(FIST), Lebuhraya Tun Razak,
Universiti Malaysia Pahang, 26300 Gambang, Kuantan,
26300 Gambang, Pahang. Pahang, Malaysia
SCOPUS ID: 36603244300 Web: Mohd Zuki Salleh
UMPIR ID: 3449 UMPIR: Mohd Zuki Salleh
Google Google Scolar: Mohd Zuki Salleh
Scholars: https://scholar.google.com/citations ResearchID: F-5440-2012
?user=SLoPW9oAAAAJ&hl=en ORCiD: http://orcid.org/0000-0001-9732-9280
e-mail: norhayati@ump.edu.my SCOPUS ID: 25227025600
E-mail: zuki@ump.edu.my
Numerical Methods
by Norhayati Rosli
http://ocw.ump.edu.my/course/view.php?id=449