Numerical Methods Learning Module 3 Part 3
Numerical Methods Learning Module 3 Part 3
Methods
This is a property of
PRESIDENT RAMON MAGSAYSAY STATE UNIVERSITY
NOT FOR SALE
CpE 221 – Numerical Methods
Second Edition, 2023
Copyright. Republic Act 8293 Section 176 provides that “No copyright shall subsist in any work of
the Government of the Philippines. However, prior approval of the government agency or office
wherein the work is created shall be necessary for exploitation of such work for profit. Such agency or
office may, among other things, impose as a condition the payment of royalties.
Borrowed materials included in this module are owned by their respective copyright holders. Every
effort has been exerted to reach and seek permission to use these materials from their respective
copyright owners. The University and authors do not claim ownership over them.
Assigned
Title Author
Chapter
Chapter 1: Introduction to Numerical Methods
Chapter 2: Roots of an Equation Dionisio M. Martin Jr.
Chapter 3: System of Linear Equations
Evaluators:
At the end of the semester, 85% of the students have attained 90% level of understanding for
being aware in the engineering economics, locally and globally.
Course Details:
The University LMS will be used for asynchronous learning and assessment. The link and class
code for LMS will be provided at the start of class through the class’ official Facebook Group.
• Edmodo
• Google Classroom
• University LMS
Students will be assessed in a regular basis thru quizzes, assignments, individual/group outputs
using synchronous and/or asynchronous modalities or submission of SLM exercises. Rubrics
are also provided for evaluation of individual/group outputs.
Major examinations will be given as scheduled. The scope and coverage of the examination
will be based on the lessons/topics as plotted in the course syllabus.
0323
Module Overview
Introduction
This module aims to introduce the concepts of numerical analysis in dealing with engineering
problems and techniques in finding the root of an equations, solving linear and non-linear
equations, polynomial approximation and interpolation, and the ordinary differential equations.
Numerical methods are techniques by which mathematical problems are formulated so that
engineers can solved with different arithmetic operations. Although there are many kinds of
numerical methods, they have one common characteristic: they invariably involve large
numbers of tedious arithmetic calculations.
The students will learn how to solve mathematical problems using different arithmetic
operations at the end of each lesson/chapter.
Table of Contents
Chapter 3
Systems of linear equations that have to be solved simultaneously arise in problems that include
several (possibly many) variables that are dependent on each other. Such problems occur not
only in engineering and science, which are the focus of this book, but in virtually any discipline
(business, statistics, economics, etc.). A system of two (or three) equations with two (or three)
unknowns can be solved manually by substitution or other mathematical methods. Solving a
system in this way is practically impossible as the number of equations (and unknowns)
increases beyond three.
In this chapter, we will explore the concept of simultaneous linear equations and learn how to
solve them using different methods of solving. We shall discuss the simultaneous equations
rules and also solve a few examples based on the concept for a better understanding.
Three direct methods for solving systems of equations – Gauss elimination, Gauss-Jordan, and
LU decomposition and two indirect (iterative) methods – Jacobi and Gauss-Seidel are going to
discuss in this chapter.
Specific Objectives
- know the different method use in solving a system of linear equations in iterative
approach
- understand and familiar the convergence of different iterative method uses in solving a
system of linear equations
- solve problems for finding the roots a system of linear equations
Duration
_____________________________________________
Iterative Method
A system of linear equations can also be solved by using an iterative approach. The process,
in principle, is the same as in the fixed-point iteration method used for solving a single
nonlinear equation. In an iterative process for solving a system of equations, the equations are
written in an explicit form in which each unknown is written in terms of the other unknown.
The explicit form for a system of four equations is
[𝑏1 −( 𝑎12 𝑥2 + 𝑎13 𝑥3 + 𝑎14𝑥4 )]
𝑎11 𝑥1 + 𝑎12 𝑥2 + 𝑎13 𝑥3 + 𝑎14 𝑥4 = 𝑏1 𝑥1 = 𝑎11
[𝑏2 −(𝑎21 𝑥1 + 𝑎23𝑥3 + 𝑎24 𝑥4 )]
𝑎21 𝑥1 + 𝑎22 𝑥2 + 𝑎23 𝑥3 + 𝑎24 𝑥4 = 𝑏2 𝑥2 = 𝑎22
[𝑏3 −(𝑎31 𝑥1 + 𝑎32𝑥2 + 𝑎34 𝑥4 )]
𝑎31 𝑥1 + 𝑎32 𝑥2 + 𝑎33 𝑥3 + 𝑎34 𝑥4 = 𝑏3 𝑥3 =
𝑎33
[𝑏4 −(𝑎41 𝑥1 + 𝑎42 𝑥2 + 𝑎43 𝑥3 )]
𝑎41 𝑥1 + 𝑎42 𝑥2 + 𝑎43 𝑥3 + 𝑎44 𝑥4 = 𝑏4 𝑥4 = 𝑎44
The solution process starts by assuming initial values for the unknowns (first estimated
solution). In the first iteration, the first assumed solution is substituted on the right-hand side
of the equations, and the new values that are calculated for the unknowns are the second
estimated solution. In the second iteration, the second solution is substituted back in the
equations to give new values for the unknowns, which are the third estimated solution. The
iterations continue in the same manner, and when the method does work, the solutions that are
obtained as successive iterations converge toward the actual solution. For a system with 𝑛
equations, the explicit equations for the [𝑥𝑖 ] unknowns are:
𝑗=𝑛
1
𝑥𝑖 = [𝑏 − ∑ 𝑎𝑖𝑗 𝑥𝑗 ] 𝑖 = 1, 2, … , 𝑛
𝑎𝑖𝑖 𝑖
𝑗=1, 𝑗≠𝑖
The iterative method is convergence if the arrangement of the three matrixes follows the
RSC (Row Sum Criteria) rule which means diagonally dominant, with the high value of 𝑥, 𝑦
and 𝑧. An 𝑛𝑥𝑛 matrix 𝐴 is strictly diagonally dominant if the absolute value of leading diagonal
entry is greater than the sum of the absolute values of other entries of the row.
|𝑎11 | > |𝑎12 | + |𝑎13 | + ⋯ + |𝑎1𝑛 |
|𝑎22 | > |𝑎21 | + |𝑎23 | + ⋯ + |𝑎2𝑛 |
⋮
|𝑎𝑛𝑛 | > |𝑎𝑛1 | + |𝑎𝑛3 | + ⋯ + |𝑎𝑛𝑛 |
To find the solution to this system of equations 𝐴𝑥 = 𝐵, we assume that the system of
equations has a unique solution and there is no zero entry among the diagonal or pivot elements
of the coefficient matrix 𝐴.
Now, we shall begin to solve equation 1 for 𝑥1 , equation 2 for 𝑥2 and so on equation n for
𝑥𝑛 , we get
[𝑏1 − ( 𝑎12 𝑥2 + 𝑎13 𝑥3 + … + 𝑎1𝑛 𝑥𝑛 )]
𝑥1 =
𝑎11
[𝑏2 − (𝑎21 𝑥1 + 𝑎23 𝑥3 + … + 𝑎2𝑛 𝑥𝑛 )]
𝑥2 =
𝑎22
⋮
[𝑏𝑛 − (𝑎𝑛1 𝑥1 + 𝑎𝑛2 𝑥2 + … + 𝑎𝑛 𝑛−1 𝑥𝑛−1 )]
𝑥𝑛 =
𝑎𝑛𝑛
By making an initial guess for the solution 𝑥 (0) = (𝑥1 (0) , 𝑥2 (0) , … , 𝑥𝑛 (0)) and substituting
these values only to the right hand side of the above equations we get first
approximations 𝑥 (1) = (𝑥1 (1) , 𝑥2 (1) , … , 𝑥𝑛 (1) ). Continuing this process iteratively we get
sequence of approximations {𝑥 (𝑘) } such that as 𝑘 → ∞, this sequence converges to exact
solution of the system of equation up to a given error tolerance.
𝑘 𝑥1 𝑥2 𝑥3 𝑑𝑘 Remarks
0 0 0 0 - Continue
1 0.48462 -0.52963 0.35294 - Continue
2 0.49821 -0.59655 0.38939 - Continue
3 0.50006 -0.59941 0.39960 0.01134 Continue
4 0.50000 -0.59999 0.39989 0.00052 Continue
5 0.50001 -0.60000 0.40000 0.00010 Stop
therefore,
𝒙𝟏 = 𝟎. 𝟓
𝒙𝟐 =– 𝟎. 𝟔
𝒙𝟑 = 𝟎. 𝟒
𝑘 𝑥 𝑦 𝑧 𝑑𝑘 Remarks
0 0 0 0 - Continue
1 3.667 -3.667 2.250 - Continue
2 0.472 -0.944 3.167 - Continue
3 1.982 -1.398 2.250 - Continue
4 1.985 -1.506 2.892 - Continue
5 1.699 -1.077 2.866 - Continue
6 1.993 -1.190 2.830 - Continue
7 1.930 -1.116 2.949 - Continue
8 1.940 -1.057 2.936 - Continue
9 1.983 -1.063 2.956 0.011 Continue
10 1.973 -1.035 2.976 0.008 Continue
11 1.985 -1.025 2.978 0.001 Stop
therefore,
𝒙=𝟐
𝒚 = −𝟏
𝒛=𝟑
Gauss-Seidel Method
The Gauss-Seidel method is an improvisation of the Jacobi method. This method is named
after mathematicians Carl Friedrich Gauss (1777–1855) and Philipp L. Seidel (1821–1896).
This modification often results in higher degree of accuracy within fewer iterations.
In Jacobi method the value of the variables is not modified until next iteration, whereas in
Gauss-Seidel method the value of the variables is modified as soon as new value is evaluated.
For instance, in Jacobi method the value of 𝑥𝑖 (𝑘) is not modified until the (𝑘 + 1)th iteration
but in Gauss-Seidel method the value of 𝑥𝑖 (𝑘) changes in in 𝑘th iteration only.
𝑘 𝑥1 𝑥2 𝑥3 𝑑𝑘 Remarks
0 0 0 0 Continue
1 1.2889 2.3121 2.9122 Continue
2 0.9920 2.0069 3.0017 Continue
3 0.9996 1.9998 3.0001 0.0012 Continue
4 1 2 3 0.0002 Continue
5 1 2 3 0 Stop
therefore,
𝒙𝟏 = 𝟏
𝒙𝟐 = 𝟐
𝒙𝟑 = 𝟑
Example 4: Solve the following system of equations using Gauss-Seidel method. Use
(𝑥, 𝑦, 𝑧)0 = (0, 0, 0).
3𝑥 − 2𝑦 + 𝑧 = 11
𝑥 − 3𝑦 + 2𝑧 = 11
2𝑥 + 𝑦 − 4𝑧 = −9
Obtain the final answer to one decimal place. Use absolute relative error 𝑑 𝑘 ≤ 0.001.
Solution:
Check for the convergence of approximations:
3 > 2+1
3 > 1+2
4 > 2+1
The three equations:
[11 − (−2𝑦 + 𝑧 )]
𝑥=
3
[11 − ( 𝑥 + 2𝑧 )]
𝑦=
−3
[−9 − ( 2𝑥 + 𝑦 )]
𝑧=
−4
𝑘 𝑥 𝑦 𝑧 𝑑𝑘 Remarks
0 0 0 0 - Continue
1 3.667 -2.444 3.473 Continue
2 0.880 -1.058 2.426 Continue
3 2.153 -1.332 2.994 Continue
4 1.781 -1.077 2.871 Continue
5 1.992 -1.089 2.974 Continue
6 1.949 -1.034 2.966 Continue
7 1.989 -1.026 2.988 0.007 Continue
8 1.987 -1.012 2.991 0.005 Continue
9 1.995 -1.008 2.996 0.001 Stop
therefore,
𝒙=𝟐
𝒚 = −𝟏
𝒛=𝟑
Example 5: Solve the system of equations using both Jacobi and Gauss-Seidel Method. Use
(𝑥, 𝑦, 𝑧)0 = (0, 0, 0).
𝑥 + 4𝑦 − 2𝑧 = −2
2𝑥 + 3𝑦 + 8𝑧 = 39
5𝑥 + 𝑦 + 2𝑧 = 19
Obtain the final answer to one decimal place. Use absolute relative error 𝑑 𝑘 ≤ 0.001 to
stop iteration.
Solution:
Rearrange the equations:
5𝑥 + 𝑦 + 2𝑧 = 19
𝑥 + 4𝑦 − 2𝑧 = −2
2𝑥 + 3𝑦 + 8𝑧 = 39
Check for the convergence of approximations,
5 > 1 + 2
4 > 1+2
8 > 2+3
The three equations:
[19 − ( 𝑦 + 2𝑧)]
𝑥=
5
[−2 − (𝑥 − 2𝑧)]
𝑦=
4
[39 − (2𝑥 + 3𝑦)]
𝑧=
8
therefore,
𝒙=𝟐
𝒚=𝟏
𝒛=𝟒
therefore,
𝒙=𝟐
𝒚=𝟏
𝒛=𝟒
_____________________________________________
References/Additional Resources/Readings
S. Chapra & R. Canale (2010). Numerical Methods for Engineers, 7th ed., McGraw-Hill
Education, Inc.
J. Epperson (2013). An Introduction to Numerical Methods and Analysis, 2nd ed., John Wiley
& Sons, Inc.
https://nm.mathforcollege.com/chapter-01.02-measuring-errors/
https://www.cuemath.com/algebra/simultaneous-equations/
Assignment
ASSIGNMENT 5
Direction: Solve the following equations. Obtain the final answer to one decimal place. Use
𝑑𝑘 ≤ 0.001 to stop iteration.
1.) Given:
4𝑦 + 𝑧 = 10.5
𝑥 + 𝑦 + 3𝑧 = 12.9
3𝑥 − 𝑦 + 𝑧 = 3.8
a. Using Jacobi method and (𝑥, 𝑦, 𝑧)0 = { 0, 0, 0 }, find 𝑥, 𝑦, and 𝑧.
b. Using Gauss-Seidel method and (𝑥, 𝑦, 𝑧)0 = { 1, 0.5, 0 }, find 𝑥, 𝑦, and 𝑧.
2.) Solve the system of equations using both Jacobi and Gauss-Seidel Method. Use (𝑥)0 =
{ 0, 0, 0 }.
5𝑥1 − 2𝑥2 + 3𝑥3 = −1
−3𝑥1 + 9𝑥2 + 𝑥3 = 2
2𝑥1 − 𝑥2 − 7𝑥3 = 3
3.) Solve the following set of four linear equations using Jacobi iteration method. Use
(𝑥)0 = { 0, 0 }.
𝑥1 − 5𝑥2 = −4
7𝑥1 − 𝑥2 = 6
4.) Solve the following set of four linear equations using the Gauss-Seidel iteration method.
9𝑥1 − 2𝑥2 + 3𝑥3 + 2𝑥4 = 54.5
2𝑥1 + 8𝑥2 − 2𝑥3 + 3𝑥4 = −14
−3𝑥1 + 2𝑥2 + 11𝑥3 − 4𝑥4 = 12.5
−2𝑥1 + 3𝑥2 + 2𝑥3 + 10𝑥4 = −21
Learner’s Feedback Form
In what particular portion of this learning packet, you feel that you are struggling or lost?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
To further improve this learning packet, what part do you think should be enhanced?
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
NOTE: This is an essential part of course module. This must be submitted to the subject
teacher (within the 1st week of the class).