BSCE-EMNS0323-LM2.1 - Solutions of Linear Equations

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 24

EMNS0323 – Numerical Solutions to CE Problems

Learning Module 02
Numerics in General

Learning Packet 01
Solutions of Linear
Systems

4
EMNS0323 – Numerical Solutions to CE Problems

Learning Packet 01

Solutions of Linear Systems


Introduction
In a system of linear equations, we will solve two or more equations at the same time. When the system
only contains two variables, it can be easily solve using basic algebra skills: either by substitution or
elimination method. If the system contains more than two variables, we can use different methods such
as Cramer’s Rule, Gauss-Jordan Method and Gauss-Seidel Method. These methods will be discussed in
this learning packet.

Objectives
• To show the importance of ranking a matrix.
• To use different methods in solving for the unknown values of a linear system.

Duration

• Topic 01: Cramer’s Rule = 2 hours


• Topic 02: Gauss – Jordan Method = 2 hours
• Topic 03: Gauss – Seidel Method = 2 hours

(6 hours self-directed learning with practical exercises and 9 hours of assessment)

Delivery Mode
Online (synchronous or asynchronous)

Readings
• Free Downloadable E-Book “Advanced Engineering Mathematics” by Kreyszig, E. page 298-309.
Retrieved from (PDF) Advanced.Engineering.Mathematics.10th.Edition.By.ERWIN.KREYSZIG.pdf |
Luis José Santander Pavajeau - Academia.edu

• “Applied Numerical Methods with MATLAB ® for Engineers and Scientists” by Chapra S. page
284-291. Retrieved from (PDF) Applied Numerical Methods With MATLAB for Engineers & Scientists,
third Edition | Eliot Wen - Academia.edu

Pre-Assessment Questions:

1. What is the significance of ranking a matrix?


2. How does Cramer’s rule work?
3. Compare and contrast Gaussian method and Gauss-Jordan method.
4. Compare and contrast Jacobi method and Gauss- Seidel method.

Numerics in General Solutions of Linear System 5


EMNS0323 – Numerical Solutions to CE Problems

INTRODUCTION

A matrix can serve as a device for representing and solving a system of equations.
Given a system of linear equation:
𝑎𝑎11 𝑥𝑥1 + 𝑎𝑎12 𝑥𝑥2 + 𝑎𝑎13 𝑥𝑥3 = 𝑏𝑏1
𝑎𝑎21 𝑥𝑥1 + 𝑎𝑎22 𝑥𝑥2 + 𝑎𝑎23 𝑥𝑥3 = 𝑏𝑏2

𝑎𝑎𝑚𝑚1 𝑥𝑥1 + 𝑎𝑎𝑚𝑚2 𝑥𝑥2 + 𝑎𝑎𝑚𝑚3 𝑥𝑥3 = 𝑏𝑏𝑚𝑚

There are two ways to express a system in matrix form:

1. Augmented Matrix- a matrix derived from a system of linear equations each


written in standard from with the constant term on the right side

𝑎𝑎11 𝑎𝑎12 … 𝑎𝑎1𝑛𝑛 : 𝑏𝑏1


𝑎𝑎 𝑎𝑎22 … 𝑎𝑎2𝑛𝑛 ∶ 𝑏𝑏2
� 21 𝑎𝑎𝑖𝑖𝑖𝑖 �
⋮ ⋮ ⋮ ∶ ⋮
𝑎𝑎𝑚𝑚1 𝑎𝑎𝑚𝑚2 … 𝑎𝑎𝑚𝑚𝑚𝑚 ∶ 𝑏𝑏𝑚𝑚

2. Coefficient Matrix- a matrix derived from a system of linear equation written


in standard form which does not include constant terms.

𝑎𝑎11 𝑎𝑎12 … 𝑎𝑎1𝑛𝑛


𝑎𝑎21 𝑎𝑎22 … 𝑎𝑎2𝑛𝑛
� 𝑎𝑎𝑖𝑖𝑖𝑖 �
⋮ ⋮ ⋮
𝑎𝑎𝑚𝑚1 𝑎𝑎𝑚𝑚2 … 𝑎𝑎𝑚𝑚𝑚𝑚

The rank of the augmented and coefficient matrix gives a complete information
about existences, uniqueness and general structure of the solution set of linear
systems as follows:

• A linear system of equation in n unknowns has a unique solution if the


coefficient matrix and the augmented matrix have the same rank n.

• The system has an infinitely many solutions if the common rank of the
coefficient matrix and the augmented matrix is less than n.

• The system has no solution if those two matrices have different rank.

Numerics in General Solutions of Linear System 6


EMNS0323 – Numerical Solutions to CE Problems

Example: Describe the solution set of the following linear system:

a.
3𝑥𝑥 + 2𝑦𝑦 − 4𝑧𝑧 = 1
𝑥𝑥 − 3𝑦𝑦 + 2𝑧𝑧 = 3
2𝑥𝑥 + 4𝑦𝑦 + 2𝑧𝑧 = 3

Augmented Matrix Coefficient Matrix


3 2 −4: 1 3 2 4
�1 −3 2 : 3� �1 −3 2�
2 4 2: 3 2 4 2

All rows are unique; Therefore, the rank of All rows are unique; Therefore, the rank of
the matrix is 3. the matrix is 3.

The linear system of equation with 3 unknowns has unique solution because the rank of
augmented and coefficient matrix is equal to the number of unknowns. (3 = 3)

b.
3𝑥𝑥 + 2𝑦𝑦 − 4𝑧𝑧 = 1
6𝑥𝑥 + 4𝑦𝑦 − 8𝑧𝑧 = 2
9𝑥𝑥 + 6𝑦𝑦 − 12𝑧𝑧 = 3

Augmented Matrix Coefficient Matrix


3 2 −4 : 1 3 2 −4
�6 4 −8 : 2� �6 4 −8 �
9 6 −12: 3 9 6 −12

Row 2 and Row 3 is twice and thrice of the Row 2 and Row 3 is twice and thrice of the
value of Row 1, respectively; Therefore, value of Row 1, respectively; Therefore,
there is only 1 linearly independent row. there is only 1 linearly independent row.
The rank of the matrix is 1. The rank of the matrix is 1.

The linear system of equation with 3 unknowns has an infinitely many solutions because the
rank of augmented and coefficient matrix is less than the number of unknowns. (1 < 3)

c.
3𝑥𝑥 + 2𝑦𝑦 − 4𝑧𝑧 = 1
3𝑥𝑥 + 2𝑦𝑦 − 4𝑧𝑧 = 3
2𝑥𝑥 + 4𝑦𝑦 + 2𝑧𝑧 = 3

Numerics in General Solutions of Linear System 7


EMNS0323 – Numerical Solutions to CE Problems

Augmented Matrix Coefficient Matrix


3 2 −4: 1 3 2 −4
�3 2 −4: 3� �3 2 −4�
2 4 2: 3 2 4 2
Row 2 is twice the value of Row 1,
All rows are unique; Therefore, the rank of respectively; Therefore, there are 2 linearly
the matrix is 3. independent rows. The rank of the matrix is
2.

The linear system of equation with 3 unknowns has no solution because the rank of
augmented and coefficient matrix is not the same.
(3 < 2)

In the rest of this learning packet, we will discuss the different methods to solve for
linear equations that has unique solution.

CRAMER’S RULE

It is a way of solving linear equations using determinants. It says that:

�𝐷𝐷𝑥𝑥1 � �𝐷𝐷𝑥𝑥2 � … �𝐷𝐷𝑥𝑥𝑖𝑖 � … �𝐷𝐷𝑥𝑥𝑚𝑚 �


𝑥𝑥1 = ; 𝑥𝑥2 = ; 𝑥𝑥𝑖𝑖 = ; 𝑥𝑥𝑚𝑚 =
|𝐷𝐷| |𝐷𝐷| |𝐷𝐷| |𝐷𝐷|

D = determinants of the coefficients of the variables


Dxi = determinants taken from D, replacing the coefficients of xi with the
corresponding constant terms

NOTE: The linear equations should be in their standard form (Ax + By = C)

Examples: Solve for the unknown variables of the linear system using Cramer’s rule.

a.
4𝑥𝑥 − 7𝑦𝑦 = 62
3𝑥𝑥 + 2𝑦𝑦 = 3

Its augmented matrix is:


4 −7 : 62
� �
3 2 : 3

We first solve for the determinant of the coefficient matrix,

|𝐷𝐷| = �4 −7� = 29
3 2

Numerics in General Solutions of Linear System 8


EMNS0323 – Numerical Solutions to CE Problems

To solve for x, we must replace the coefficient of x with the constant in the coefficient
matrix:
|𝐷𝐷𝑥𝑥 | = �62 −7� = 145
3 2
|𝐷𝐷𝑥𝑥 | 145
𝑥𝑥 = = =5
|𝐷𝐷| 29

To solve for y, we must replace the coefficient of y with the constant in the coefficient
matrix:
4 62
�𝐷𝐷𝑦𝑦 � = � � = −174
3 3
�𝐷𝐷𝑦𝑦 � −174
𝑦𝑦 = = =6
|𝐷𝐷| 29

b.

3𝑦𝑦 + 4𝑧𝑧 = 12
𝑥𝑥 − 2𝑧𝑧 = −10
4𝑥𝑥 + 5𝑦𝑦 = −12

Its augmented matrix is:


0 3 4 : 12
�1 0 −2 : −10�
4 5 0 : −12

We first solve for the determinant of the coefficient matrix,


0 3 4
|𝐷𝐷| = �1 0 −2� = −4
4 5 0

To solve for x, we must replace the coefficient of x with the constant in the coefficient
matrix:
12 3 4
|𝐷𝐷𝑥𝑥 | = �−10 0 −2� = 8
−12 5 0

|𝐷𝐷𝑥𝑥 | = 8
𝑥𝑥 = = =2
|𝐷𝐷| −4
To solve for y, we must replace the coefficient of y with the constant in the coefficient
matrix:
0 12 4
�𝐷𝐷𝑦𝑦 � = �1 −10 −2� = 16
4 −12 0

�𝐷𝐷𝑦𝑦 � 16
𝑦𝑦 = = = −4
|𝐷𝐷| −4

Numerics in General Solutions of Linear System 9


EMNS0323 – Numerical Solutions to CE Problems

To solve for z, we must replace the coefficient of z with the constant in the coefficient
matrix:

0 3 12
|𝐷𝐷𝑧𝑧 | = �1 0 −10� = −24
4 5 −12

|𝐷𝐷𝑧𝑧 | −24
𝑧𝑧 = = =6
|𝐷𝐷| −4

c.

7𝑤𝑤 − 3𝑥𝑥 + 4𝑦𝑦 = 1


8𝑥𝑥 − 3𝑦𝑦 + 4𝑧𝑧 = −7
𝑤𝑤 − 5𝑥𝑥 − 10𝑦𝑦 + 𝑧𝑧 = 41
2𝑤𝑤 + 𝑥𝑥 + 3𝑧𝑧 = 0

Its augmented matrix is:


7 −3 4 0 : 1
0 8 −3 4 : −7
� �
1 −5 −10 1 : 41
2 1 0 3 : 0

We first solve for the determinant of the coefficient matrix,


7 −3 4 0
|𝐷𝐷| = � 0 8 −3 4
� = −1343
1 −5 −10 1
2 1 0 3

To solve for w, we must replace the coefficient of w with the constant in the coefficient
matrix:
1 −3 4 0
−7 8 −3 4
|𝐷𝐷𝑤𝑤 | = � � = −1343
41 −5 −10 1
0 1 0 3

|𝐷𝐷𝑤𝑤 | −1343
𝑤𝑤 = = =1
|𝐷𝐷| −1343
To solve for x, we must replace the coefficient of x with the constant in the coefficient
matrix:
7 1 4 0
|𝐷𝐷𝑥𝑥 | = �0 −7 −3 4
� = 2686
1 41 −10 1
2 0 0 3

|𝐷𝐷𝑥𝑥 | 2686
𝑥𝑥 = = = −2
|𝐷𝐷| −1343

Numerics in General Solutions of Linear System 10


EMNS0323 – Numerical Solutions to CE Problems

To solve for y, we must replace the coefficient of y with the constant in the coefficient
matrix:

7 −3 1 0
0 8 −7 4
�𝐷𝐷𝑦𝑦 � = � � = 4029
1 −5 41 1
2 1 0 3

�𝐷𝐷𝑦𝑦 � 4029
𝑦𝑦 = = = −3
|𝐷𝐷| −1343

To solve for z, we must replace the coefficient of z with the constant in the coefficient
matrix:

7 −3 4 1
|𝐷𝐷𝑧𝑧 | = � 0 8 −3 −7
�=0
1 −5 −10 41
2 1 0 0

|𝐷𝐷𝑧𝑧 | 0
𝑧𝑧 = = =0
|𝐷𝐷| −1343

GAUSS-JORDAN ELIMINATION METHOD

It transforms the augmented matrix [A: B] into its reduced echelon form by using
elementary row operations.

𝑎𝑎11 𝑥𝑥1 + 𝑎𝑎12 𝑥𝑥2 + 𝑎𝑎13 𝑥𝑥3 = 𝑏𝑏1


𝑎𝑎21 𝑥𝑥1 + 𝑎𝑎22 𝑥𝑥2 + 𝑎𝑎23 𝑥𝑥3 = 𝑏𝑏2

𝑎𝑎𝑚𝑚1 𝑥𝑥1 + 𝑎𝑎𝑚𝑚2 𝑥𝑥2 + 𝑎𝑎𝑚𝑚3 𝑥𝑥3 = 𝑏𝑏𝑚𝑚
Steps:
1. Write the augmented matrix of the system.

𝑎𝑎11 𝑎𝑎12 … 𝑎𝑎1𝑛𝑛 𝑥𝑥1 𝑏𝑏1


𝑎𝑎21 𝑎𝑎22 … 𝑎𝑎2𝑛𝑛 𝑥𝑥2 𝑏𝑏
� 𝑎𝑎𝑖𝑖𝑖𝑖 �� � = � 2�
⋮ ⋮ ⋮ … …
𝑎𝑎𝑚𝑚1 𝑎𝑎𝑚𝑚2 … 𝑎𝑎𝑚𝑚𝑚𝑚 𝑥𝑥𝑚𝑚 𝑏𝑏𝑚𝑚

2. Use row operations to transform the augmented matrix in reduced row


echelon form as shown below.

1 0 … 0 : 𝑎𝑎
0 1 … 0 ∶ 𝑏𝑏 �
� …
⋮ ⋮ ⋮ ∶ ⋮
0 0 … 1 ∶ 𝑧𝑧

Numerics in General Solutions of Linear System 11


EMNS0323 – Numerical Solutions to CE Problems

Reduced row echelon form has the following criteria:

a. It is in row echelon form.


b. The leading entry in each non zero row is a 1.
c. Each column containing a leading 1 has zeros in all of its other entries.

3. Stop the process in step 2 if you obtain a row whose elements are all zeros
except the last one on the right. In that case, the system is inconsistent and
has no solutions. Otherwise, finish step 2 and read the solutions of the
systems from the final matrix.

x1 = a ; x2 = b; …; xm = z

Steps on Reducing Echelon Form:

1. Transform the element/s under the leading coefficient in the first row to zero. Then
do the same for the element/s under the leading coefficient of 2nd row, then 3rd row and
so on.

• TIP: Subtract each element by the product of a constant and the corresponding
element in the row of the leading coefficient. The constant is the element (of the
same row) under the leading coefficient divided by the leading coefficient.

2. Transform all the value of the leading coefficient into one.

• TIP: Divide all the elements (including the leading coefficient) by their leading
coefficient.

3. Transform the element/s above the last leading coefficient to zero. Then do the same
for the element/s under the leading coefficient of 2nd to the last row, then 3rd to the last
row until the first row.

• TIP: Subtract each element by product of the element (of the same row) above
the leading coefficient by the corresponding element in the row of the leading
coefficient.

Example: Solve for the unknown variables of the linear system using Gauss- Jordan
Method.

a.
4𝑥𝑥 − 7𝑦𝑦 = 62
3𝑥𝑥 + 2𝑦𝑦 = 3

Its augmented matrix is:


4 −7 : 62
� �
3 2 : 3

Numerics in General Solutions of Linear System 12


EMNS0323 – Numerical Solutions to CE Problems

We transform the elements under the leading coefficient in the first row to zero:
4 −7 : 62
� 3 � 3
3 − (4) = 0 29�4 : −87�2 𝑅𝑅2 − 𝑅𝑅1 𝑜𝑜𝑜𝑜 𝑅𝑅2
4 4

Transform all the value of the leading coefficient into one:


𝑅𝑅1�
4� = 1 −7� : 31�2 4
� 4 4 � 𝑅𝑅2
29 4 4𝑅𝑅2�
0 �4 � �29� = 1 : −6 �29 𝑜𝑜𝑜𝑜 29
�4

Transform the elements above the leading coefficient in the last row to zero:

1 −7� + 7 (1) = 0 : 5 𝑅𝑅1 − �−7� 𝑅𝑅2 𝑜𝑜𝑜𝑜𝑅𝑅1 + 7 𝑅𝑅2


� 4 4 � 4 4
0 1 : −6

We get,
1 0 : 5
� �
0 1 : −6

Converting back the augmented matrix into the linear equation, we will obtain:

x=5 y= -6

b.

3𝑦𝑦 + 4𝑧𝑧 = 12
𝑥𝑥 − 2𝑧𝑧 = −10
4𝑥𝑥 + 5𝑦𝑦 = −12

Its augmented matrix is:


0 3 4 : 12
�1 0 −2 : −10�
4 5 0 : −12

We need to arrange the rows in such a way that the leading coefficient is not equal to zero.

1 0 −2 : −10 𝑅𝑅2 → 𝑅𝑅1


�4 5 0 : −12� 𝑅𝑅3 → 𝑅𝑅2
0 3 4 : 12 𝑅𝑅1 → 𝑅𝑅3

Numerics in General Solutions of Linear System 13


EMNS0323 – Numerical Solutions to CE Problems

Now, we transform the elements under the leading coefficient in the first row to zero:

1 0 −2 : −10 4
𝑅𝑅 − 𝑅𝑅 𝑜𝑜𝑜𝑜 𝑅𝑅2 − 4𝑅𝑅1
�4 − 4(1) = 0 5 8 : 28 � 2 1 1
0 3 4 : 12 0
𝑅𝑅3 − 𝑅𝑅1 𝑜𝑜𝑜𝑜 𝑅𝑅3
1

Now, we transform the elements under the leading coefficient in the second row to zero:
1 0 −2 : −10
0 5 8 : 28
� 3 � 3
0 3 − (5) = 0 −4�5 : −24�5 𝑅𝑅3 − 𝑅𝑅2
5 5

Transform all the value of the leading coefficient into one:


𝑅𝑅1�
1 0 −2 : −10 1 𝑜𝑜𝑜𝑜𝑅𝑅1
5
�0 �5 = 1
8�
5 : 28�5� 𝑅𝑅2�
5
0 0 −4� �−5� � = 1 : 6 𝑅𝑅3 −5𝑅𝑅2�
5 4 �−4 𝑜𝑜𝑜𝑜 4
�5

Transform the elements above the leading coefficient in the last row to zero:

1 0 −2 + 2(1) = 0 : 2 𝑅𝑅1 − (−2)𝑅𝑅3 𝑜𝑜𝑜𝑜𝑅𝑅1 − 2𝑅𝑅3


8 8
�0 1 8� − (1) = 0 : −4� 𝑅𝑅2 − 𝑅𝑅3
5 5 5
0 0 1 : 6

The element above the leading coefficient in the second row is already zero. Now, we get:
1 0 0 : 2
�0 1 0 : −4�
0 0 1 : 6

Converting back the augmented matrix into the linear equation, we will obtain:

x=2 y= -4 y= 6

Numerics in General Solutions of Linear System 14


EMNS0323 – Numerical Solutions to CE Problems

c.

7𝑤𝑤 − 3𝑥𝑥 + 4𝑦𝑦 = 1


8𝑥𝑥 − 3𝑦𝑦 + 4𝑧𝑧 = −7
𝑤𝑤 − 5𝑥𝑥 − 10𝑦𝑦 + 𝑧𝑧 = 41
2𝑤𝑤 + 𝑥𝑥 + 3𝑧𝑧 = 0

Its augmented matrix is:

7 −3 4 0 : 1
0 8 −3 4 : −7
� �
1 −5 −10 1 : 41
2 1 0 3 : 0

We transform the elements under the leading coefficient in the first row to zero:

7 −3 4 0 : 1 0
⎡ 0 8 −3 4 : −7 ⎤ 𝑅𝑅2 − 𝑅𝑅1 𝑜𝑜𝑜𝑜 𝑅𝑅2
⎢ 1 ⎥ 7
⎢1 − (7) = 0 −32� −74� 1 : 286�7⎥ 1
⎢ 7 7 7 ⎥ 𝑅𝑅3 − 7 𝑅𝑅1
⎢ 2 ⎥
(7) = 0 13�7 −8� : −2�7 ⎦ 2
⎣2 − 7 7 3 𝑅𝑅4 − 𝑅𝑅1
7

We transform the elements under the leading coefficient in the second row to zero:

7 −3 4 0 : 1
⎡0 8 −3 4 : −7 ⎤
⎢ 4 ⎥ �−32�7� 4
⎢0 −32� + (8) = 0 −86� 23� : 258�7⎥ 𝑅𝑅3 − 𝑅𝑅2 𝑜𝑜𝑜𝑜 𝑅𝑅3 + 𝑅𝑅2
⎢ 7 7 7 7 ⎥ 8 7
⎢ 13� − 13 (8) = 0 −25� 29� ⎥ 13
: 75�56⎦ 𝑅𝑅 − �7 𝑅𝑅 𝑜𝑜𝑜𝑜 𝑅𝑅 − 13 𝑅𝑅
⎣0 7 56 56 14 4 2 4
8 56 2

We transform the elements under the leading coefficient in the third row to zero:

7 −3 4 0 : 1
⎡0 8 −3 4 : −7 ⎤
⎢ −86� 23� ⎥
⎢0 0 7 7 : 258�7⎥
25 −86 �−25�56� 25
⎢ −25 1343 ⎥ 𝑅𝑅 − 𝑅𝑅3 𝑜𝑜𝑜𝑜𝑅𝑅4 − 𝑅𝑅
⎣0 0 �56 − � �7� = 0 �688 : 0 ⎦ 4 −86� 688 3
688 7

Numerics in General Solutions of Linear System 15


EMNS0323 – Numerical Solutions to CE Problems

Transform all the value of the leading coefficient into one:


7 −3� 4� 1� 𝑅𝑅1�
⎡ �7 = 1 7 7 0 : 7⎤ 7
8� = 1 −3� 1� 𝑅𝑅
⎢ 0
8 8 2 : −7�8⎥ 2�8
⎢ ⎥
−86� 𝑅𝑅 −7𝑅𝑅3�
⎢ 7� −23� ⎥ 3�−86 𝑜𝑜𝑜𝑜 86
0 0 −86� = 1 86 : −3 �7
⎢ ⎥
⎢ 7 ⎥ 𝑅𝑅4 688𝑅𝑅4�
1343� 688� 0 ⎦ �1343� 𝑜𝑜𝑜𝑜
⎣ 0 0 0 688 � 1343� = 1 : 1343
688

Transform the elements above the leading coefficient in the last row to zero:
−3� 4� 1� 𝑅𝑅1 − 0𝑅𝑅4
⎡1 7 7 0 : 7⎤
⎢ 1 ⎥ 1
⎢0 1 −3�
8
1� − (1) = 0
2 2 : −7�8⎥ 𝑅𝑅2 − 2 𝑅𝑅4
⎢ ⎥ −23 23
⎢0 0 1 −23� + 23 (1) = 0 : −3 ⎥⎥ 𝑅𝑅3 − � 86 � 𝑅𝑅4 𝑜𝑜𝑜𝑜𝑅𝑅3 + 86 𝑅𝑅4
⎢ 86 86
⎣0 0 0 1 : 0 ⎦

Transform the elements above the leading coefficient in the third row to zero:
4 4
⎡1 −3�7 4�7 − (1) = 0 0 : 13�7⎤ 𝑅𝑅1 − 𝑅𝑅3
⎢ 7 ⎥ 7
⎢0 −3 3 ⎥ −3 3
1 �8 + (1) = 0 0 : −2 𝑅𝑅2 − � � 𝑅𝑅3 𝑜𝑜𝑜𝑜𝑅𝑅2 + 𝑅𝑅3
⎢ 8 ⎥ 8 8
⎢0 0 1 0 : −3 ⎥
⎣0 0 0 1 : 0 ⎦

Transform the elements above the leading coefficient in the second row to zero:
3 −3 3
⎡1 −3�7 + (1) = 0 0 0 : 1 ⎤ 𝑅𝑅1 − � � 𝑅𝑅2 𝑜𝑜𝑜𝑜 𝑅𝑅1 + 𝑅𝑅3
⎢ 7 ⎥ 7 7
⎢0 1 0 0 : −2⎥
⎢0 0 1 0 : −3⎥
⎣0 0 0 1 : 0⎦

We get,
1 0 0 0 : 1
0 1 0 0 : −2
� �
0 0 1 0 : −3
0 0 0 1 : 0

Converting back the augmented matrix into the linear equation, we will obtain:

w=1 x = -2 y= -3 z= 0

Numerics in General Solutions of Linear System 16


EMNS0323 – Numerical Solutions to CE Problems

GAUSS-SEIDEL METHOD
(𝑘𝑘)
With the Jacobi method, the values of 𝑥𝑥𝑖𝑖 obtained in the kth iteration remain
unchanged until the entire (k +1)th iteration has been calculated. With the Gauss-Seidel
method, we use the new values as soon as they are known.

Steps:

1. Given n equation, determine if your system is strictly diagonally dominant.


This means that for all rows, the absolute value of the diagonal element in a
row is strictly greater than or equal to the sum of absolute value of the rest of
the elements in that row:

|𝐴𝐴𝑖𝑖𝑖𝑖 | ≥ ∑𝑖𝑖≠𝑗𝑗�𝐴𝐴𝑖𝑖𝑖𝑖 � for all i

NOTE: a. You can rearrange the rows to make your system strictly diagonally
dominant.
b. Sometimes, you can still get the values of xi even though your system
is not strictly diagonally dominant.

2. Isolate the variable of the diagonal element on the left side of the equation.
3. Assume that the solution of given equation is:

(0, 0, ..., 0)

4. We put the value of ∑𝑛𝑛𝑖𝑖=2 𝑥𝑥𝑖𝑖 in the first equation and get the value of x1 and
update the value of x1 as:

(x1, 0, …, 0)

5. Putting the updated value of x1 and assumed value of ∑𝑛𝑛𝑖𝑖=3 𝑥𝑥𝑖𝑖 in equation 2 to
get x2 and their updated solution as:

(x1, x2, …, 0)

6. Continue getting the value of the remaining variables using the updated
preceding values until we get the value of xn and their updated solution as:

(x1, x2, …, xn)

7. Repeat the same process from step 3 to get the approximate solution with
minimum error. The minimum error can be computed as:

𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 = �𝑥𝑥𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝𝑝 − 𝑥𝑥𝑢𝑢𝑢𝑢𝑢𝑢𝑢𝑢𝑢𝑢𝑢𝑢𝑢𝑢 �

Numerics in General Solutions of Linear System 17


EMNS0323 – Numerical Solutions to CE Problems

Examples: Solve for the unknown variables of the linear system using Gauss- Jordan
Method. The allowable error is 0.0001

a.
4𝑥𝑥 − 7𝑦𝑦 = 62
3𝑥𝑥 + 2𝑦𝑦 = 3

Its coefficient matrix is:


4 −7
� �
3 2
Check if your system is strictly diagonally dominant:

x y
4 −7 4 ≱ |−7|
� �
3 2 2≱3

The absolute value of the diagonal elements is not greater than/equal to the sum of absolute
value of the rest of the elements in their respective row. However, we can rearrange the row
to still make our system strictly diagonally dominant:

x y
3 2 3≥2
� �
4 −7 |−7| ≥ 4

Now, we can isolate the variable of the diagonal element on the left side of the equation.

3 − 2𝑦𝑦 4𝑥𝑥 − 62
𝑥𝑥 = 𝑦𝑦 =
3 7

Assume that our solution the to the system is (0, 0, ). We substitute these values on our first
equation to update the value of x.
3 − 2(0)
𝑥𝑥 = =1
3
𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 = |0 − 1| = 1

Our updated solution to the system is (1, 0). We substitute these values on our second
equation to update the value of x.
4(1) − 62 −58
𝑦𝑦 = =
7 7

𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 = �0 − �−58�7�� = 8.286

Numerics in General Solutions of Linear System 18


EMNS0323 – Numerical Solutions to CE Problems

Our updated solution to the system is �1, −58�7 �. We substitute these values back to first
equation, repeating the process until we get a minimum error of 0.0001. The table summarizes
the process of getting the value of the unknown variables.

iteration x x/error y y/error


1 0.0000 - 0.0000 -
2 1.0000 1.0000 -8.2857 8.2857
3 6.5238 5.5238 -5.1293 3.1564
4 4.4195 2.1043 -6.3317 1.2024
5 5.2211 0.8016 -5.8737 0.4580
6 4.9158 0.3053 -6.0481 0.1744
7 5.0321 0.1163 -5.9817 0.0664
8 4.9878 0.0443 -6.0070 0.0253
9 5.0047 0.0169 -5.9973 0.0097
10 4.9982 0.0065 -6.0010 0.0037
11 5.0007 0.0025 -5.9996 0.0014
12 4.9997 0.0010 -6.0002 0.0006
13 5.0001 0.0004 -5.9999 0.0003
14 4.9999 0.0002 -6.0001 0.0002

x=5 y= -6

b.

3y + 4z = 12
x − 2z = −10
4x + 5y = −12

Its coefficient matrix is:


0 3 4
�1 0 −2�
4 5 0
Check if your system is strictly diagonally dominant:

x y z
0 3 4 0 ≱ 7 (= 3 + 4)
�1 0 −2� 0 ≱ 3(= 1 + |−2|)
4 5 0 0 ≱ 9(= 4 + 5)

Numerics in General Solutions of Linear System 19


EMNS0323 – Numerical Solutions to CE Problems

The absolute value of the diagonal elements is not greater than/equal to the sum of absolute
value of the rest of the elements in their respective row. However, we can rearrange the row
to still make our system strictly diagonally dominant:

x y z
0 3 4 0 ≱ 7 (= 3 + 4)
�4 5 0 � 5 ≥ 4(= 0 + 4)
1 0 −2 |−2| ≥ 1(= 1 + 0)

4 5 0 4 ≱ 5 (= 5 + 0)
�0 3 4 � 3 ≱ 4(= 0 + 4)
1 0 −2 |−2| ≥ 1(= 1 + 0)

4 5 0 4 ≱ 5 (= 5 + 0)
�1 0 −2� 0 ≱ 3(= 1 + |−2|)
0 3 4 4 ≥ 3(= 0 + 3)

1 0 −2 1 ≱ 2 (= 0 + |−2|)
�0 3 4 � 3 ≱ 4(= 0 + 4)
4 5 0 0 ≱ 9(= 4 + 5)

1 0 −2 1 ≱ 2 (= 0 + |−2|)
�4 5 0 � 5 ≥ 4(= 4 + 0)
0 3 4 4 ≥ 3(= 0 + 3)

Rearranging rows does not make the system strictly diagonally dominant. Therefore,
Gauss-Seidel method is not applicable in solving this system.

c.

7𝑤𝑤 − 3𝑥𝑥 + 4𝑦𝑦 = 1


8𝑥𝑥 − 3𝑦𝑦 + 4𝑧𝑧 = −7
𝑤𝑤 − 5𝑥𝑥 − 10𝑦𝑦 + 𝑧𝑧 = 41
2𝑤𝑤 + 𝑥𝑥 + 3𝑧𝑧 = 0

Its coefficient matrix is:


7 −3 4 0
0 8 −3 4
� �
1 −5 −10 1
2 1 0 3

Check if your system is strictly diagonally dominant:

w x y z
7 −3 4 0 7 ≥ 7 (= |−3| + 4 + 0)
0 8 −3 4 8 ≥ 7 (= 0 + |−3| + 4)
� �
1 −5 −10 1 |−10| ≥ 7(= 1 + |−5| + 1)
2 1 0 3 3 ≥ 3(= 2 + 1 + 0)

Numerics in General Solutions of Linear System 20


EMNS0323 – Numerical Solutions to CE Problems

Since all the absolute value of the diagonal element are greater than/equal to the sum of
absolute value of the rest of the elements in their respective row, we can continue the process.
Now, we isolate the variable of the diagonal element on the left side of the equation.

3𝑥𝑥 − 4𝑦𝑦 + 1 3𝑦𝑦 − 4𝑧𝑧 − 7 𝑤𝑤 − 5𝑥𝑥 + 𝑧𝑧 − 41 −2𝑤𝑤 − 𝑥𝑥


𝑤𝑤 = 𝑥𝑥 = 𝑦𝑦 = 𝑧𝑧 =
7 8 10 3

Assume that our solution the to the system is (0, 0, 0, 0). We substitute these values on our
first equation to update the value of w.
3(0) − 4(0) + 1 1
𝑤𝑤 = =
7 7
𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 = �0 − 1�7� = 0.143

1
Our updated solution to the system is � , 0, 0, 0�. We substitute these values on our second
7
equation to update the value of x.
3(0) − 4(0) − 7 −7
𝑥𝑥 = =
8 8
𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 = �0 − �−7�8�� = 0.875

1 −7
Our updated solution to the system is � , , 0, 0�. We substitute these values on our third
7 8
equation to update the value of y.

�1�7� − 5�−7�8� + (0) − 41 −2043


𝑦𝑦 = =
10 560

𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 = �0 − �−2043�560�� = 3.648

1 −7 −2043
Our updated solution to the system is � , , , 0�. We substitute these values on our
7 8 560
last equation to update the value of z.

−2�1�7� − �−7�8� 11
𝑧𝑧 = =
3 56

𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒𝑒 = �0 − 11�56� = 0.196

1 −7 −2043 11
Our updated solution to the system is � , , , �. We substitute these values back to
7 8 560 56
first equation, repeating the process until we get a minimum error of 0.0001. The table
summarizes the process of getting the value of the unknown variables.

Numerics in General Solutions of Linear System 21


EMNS0323 – Numerical Solutions to CE Problems

# w w/error x x/error y y/error z z/error


1 0.0000 - 0.0000 0.0000 0.0000
2 0.1429 0.1429 -0.8750 0.8750 -3.6482 3.6482 0.1964 0.1964
3 1.8525 1.7096 -2.3413 1.4663 -2.7245 0.9237 -0.4546 0.6510
4 0.6963 1.1562 -1.6694 0.6719 -3.2411 0.5166 0.0923 0.5469
5 1.2795 0.5832 -2.1366 0.4672 -2.8945 0.3466 -0.1408 0.2331
6 0.8812 0.3983 -1.8900 0.2466 -3.0810 0.1865 0.0425 0.1833
7 1.0934 0.2122 -2.0516 0.1616 -2.9606 0.1204 -0.0451 0.0876
8 0.9554 0.1380 -1.9627 0.0889 -3.0276 0.0670 0.0173 0.0624
9 1.0318 0.0764 -2.0190 0.0563 -2.9856 0.0420 -0.0149 0.0322
10 0.9836 0.0482 -1.9872 0.0318 -3.0095 0.0239 0.0067 0.0216
11 1.0109 0.0273 -2.0069 0.0197 -2.9948 0.0147 -0.0050 0.0117
12 0.9941 0.0168 -1.9956 0.0113 -3.0033 0.0085 0.0025 0.0075
13 1.0038 0.0097 -2.0025 0.0069 -2.9981 0.0052 -0.0017 0.0042
14 0.9978 0.0060 -1.9984 0.0041 -3.0012 0.0031 0.0009 0.0026
15 1.0014 0.0036 -2.0009 0.0025 -2.9993 0.0019 -0.0006 0.0015
16 0.9992 0.0022 -1.9994 0.0015 -3.0004 0.0011 0.0003 0.0009
17 1.0005 0.0013 -2.0003 0.0009 -2.9998 0.0006 -0.0002 0.0005
18 0.9998 0.0007 -1.9998 0.0005 -3.0001 0.0003 0.0001 0.0003
19 1.0001 0.0003 -2.0001 0.0003 -2.9999 0.0002 0.0000 0.0001
20 0.9999 0.0002 -2.0000 0.0001 -3.0000 0.0001 0.0001 0.0001

w=1 x = -2 y= -3 z= 0

Numerics in General Solutions of Linear System 22


EMNS0323 – Numerical Solutions to CE Problems

Activity Sheet
I. Describe the solution set of the system by comparing the rank of its augmented and
coefficient matrix; Is it unique, has infinite solutions or has no solution?

a. 3x+ 2y – 5z = 3 b. 2x – 3y – 4z = 15 c. 6x – 10y + 14z = 54


-3x – 2y – 5z = -3 -4x + 6y + 8z = -30 3x – 5y + 7z = -27
6x + 4y – 10z = 5 -x + y – 9z = 9
II. Determine if the following linear system of equation is strictly diagonally dominant:

1. 3x – 5y = 15
6x + 16y = 5

2. 2x+ 3y – 4z = 15
3x – 5y + 7z = -27
-x + y – 9z = 9

3. w – 4x + z = 2
-4w + x + 2y = -5
x + 3y – 4z = 3
2w + x – 5y + 2z = -4

4. v + 6w + x -2y = 6
v + 2x – 3y + 7z = 16
4w – 20x + 4y + 8z = 33
16v + 4w – 4y + 4z = 9
8v – 12w + 32y + 12z = -37

III. Solve for the unknown values using Cramer’s rule, Gauss- Jordan elimination method and
Gauss-Seidel method (use (0, 0, … ,0) as your initial solution).

1. 2x - 15y = -14
3x – 2y = 1

2. 3y – 4z = 16
7x – 5y + z = -21
-x – 4y + 9z = -25

3. -4w + x + y = -10
w – 4x + z = 1
w – 4y + z = -7
x + y – 4z = 10

4. v + 6w + x – 2y = 6
v + 2x – 3y + 7z = 16
4w – 20x + 4y + 8z = 33
16v + 4w – 4y + 4z = 9
8v – 12w + 32y + 12z = -37

Numerics in General Solutions of Linear System 23


EMNS0323 – Numerical Solutions to CE Problems

Answer Keys
I.

a. n = 3; augmented matrix = rank 3; coefficient matrix = rank 3 ∴ unique solution

b. n = 2; augmented matrix = rank 1; coefficient matrix = rank 1 ∴ infinite solution

c. n = 2; augmented matrix = rank 3; coefficient matrix = rank 2 ∴ no solution

II. Determine if the following linear system of equation is strictly diagonally dominant:

1. Not strictly diagonally dominant


2. Not strictly diagonally dominant

3. -4w + x + 2y = -5
w – 4x + z = 2
2w + x – 5y + 2z = -4
x + 3y – 4z = 3
Strictly diagonally dominant

4. 16v + 4w – 4y + 4z = 9
v + 6w + x -2y = 6
4w – 20x + 4y + 8z = 33
8v – 12w + 32y + 12z = -37
v + 2x – 3y + 7z = 16
Strictly diagonally dominant

III.

1. x = 1.0488
y = 1.0732

2. x=0
y=4
z = -1

3. w=3
x=0
y=2
z = -2

4. v= -1/2
w = 3/4
x = -1
y = -1.5
z=2

Numerics in General Solutions of Linear System 24


EMNS0323 – Numerical Solutions to CE Problems

Assessment
Group Work. Per bloc, group yourselves into 5 with 8-10 members.

1. Look for one (1) civil engineering problem where we can apply the numerical analysis
on system of linear equation (with at least 5 unknown variables). NOTE: No same
problems shall be shared among the groups and other blocs.

2. Show your problem and solution on Google docs and your numerical analysis on
Google sheets.

Numerics in General Solutions of Linear System 25


EMNS0323 – Numerical Solutions to CE Problems

Assignment
Solve for the unknown values using Cramer’s rule, Gauss- Jordan elimination method and
Gauss-Seidel method (use (0, 0, … ,0) as your initial solution).

1. 5y – 3z = -15
3x – 4y = -27
5x + 6z = 35

2. 150w – 30x – 60y – 30z= -283


20y + 15w – 5z = 52
30z + 52= 60x – 15y
20x + 15y – 40z = 71

3. 18v – 3x + 9y – 3z = -64
12v – 42w – 18x – 6z = -47
2w – 6y – 3z = 18
3v + 6w + 3y – 15z = -17
6v + 6w – 36x – 12y + 12z = 31

4. u=1+x
w – x – 2y + 6z = 8 + v – u
v – 3w + 4x – y – z = -4
2 + 3w + x + z = u
u – v + w – x – z = 15 – 5y
2v – w – y + 6 = 0

Numerics in General Solutions of Linear System 26


EMNS0323 – Numerical Solutions to CE Problems

Learner’s Feedback Form


Name of Student: __________________________________________________________
Program : __________________________________________________________
Year Level : ______________ Section : __________________
Faculty : Engr. Ranier C. Santos______________________________________
Schedule : __________________________________________________________

Learning Packet : Code : _________ Title :


__________________________________

How do you feel about the topic or concept presented?


o I completely get it. o I’m struggling.
o I’ve almost got it. o I’m lost.

In what particular portion of this Learning Packet, you feel that you are struggling or lost?
_____________________________________________________________________________
_____________________________________________________________________________
__________________________________________________________________________

Did you raise your concern to you instructor? o Yes o No

If Yes, what did he/she do to help you?


_____________________________________________________________________________
_____________________________________________________________________________
__________________________________________________________________________

If No, state your reason?


_____________________________________________________________________________
_____________________________________________________________________________
__________________________________________________________________________

To further improve this Learning Packet, what part do you think should be enhanced?
_____________________________________________________________________________
_____________________________________________________________________________
__________________________________________________________________________

How do you want it to be enhanced?


_____________________________________________________________________________
_____________________________________________________________________________
__________________________________________________________________________

Numerics in General Solutions of Linear System 27

You might also like