Professional Documents
Culture Documents
BSCE-EMNS0323-LM2.1 - Solutions of Linear Equations
BSCE-EMNS0323-LM2.1 - Solutions of Linear Equations
BSCE-EMNS0323-LM2.1 - Solutions of Linear Equations
Learning Module 02
Numerics in General
Learning Packet 01
Solutions of Linear
Systems
4
EMNS0323 – Numerical Solutions to CE Problems
Learning Packet 01
Objectives
• To show the importance of ranking a matrix.
• To use different methods in solving for the unknown values of a linear system.
Duration
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:
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 = 𝑏𝑏𝑚𝑚
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:
• 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.
a.
3𝑥𝑥 + 2𝑦𝑦 − 4𝑧𝑧 = 1
𝑥𝑥 − 3𝑦𝑦 + 2𝑧𝑧 = 3
2𝑥𝑥 + 4𝑦𝑦 + 2𝑧𝑧 = 3
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
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
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
Examples: Solve for the unknown variables of the linear system using Cramer’s rule.
a.
4𝑥𝑥 − 7𝑦𝑦 = 62
3𝑥𝑥 + 2𝑦𝑦 = 3
|𝐷𝐷| = �4 −7� = 29
3 2
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
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
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.
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
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
It transforms the augmented matrix [A: B] into its reduced echelon form by using
elementary row operations.
1 0 … 0 : 𝑎𝑎
0 1 … 0 ∶ 𝑏𝑏 �
� …
⋮ ⋮ ⋮ ∶ ⋮
0 0 … 1 ∶ 𝑧𝑧
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
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.
• 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
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 the elements above the leading coefficient in the last row to zero:
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
We need to arrange the rows in such a way that the leading coefficient is not equal to zero.
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 the elements above the leading coefficient in the last row to zero:
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
c.
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
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
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:
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:
7. Repeat the same process from step 3 to get the approximate solution with
minimum error. The minimum error can be computed as:
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
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
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.
x=5 y= -6
b.
3y + 4z = 12
x − 2z = −10
4x + 5y = −12
x y z
0 3 4 0 ≱ 7 (= 3 + 4)
�1 0 −2� 0 ≱ 3(= 1 + |−2|)
4 5 0 0 ≱ 9(= 4 + 5)
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.
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)
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.
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 −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
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.
w=1 x = -2 y= -3 z= 0
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?
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
Answer Keys
I.
II. Determine if the following linear system of equation is 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
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.
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
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
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?
_____________________________________________________________________________
_____________________________________________________________________________
__________________________________________________________________________