MBEYA UNIVERSITY OF SCIENCE AND TECHNOLOGY
COLLEGE OF SCIENCE AND TECHNICAL EDUCATION
DEPARTMENT OF MATHEMATICS AND STATISTICS
SEMESTER I ACADEMIC YEAR 2023/2024
MS 8101: LINEAR ALGEBRA AND ADVANCED CALCULUS
/MS 8117:ENGINEERING MATHEMATICS I
UQF 8 FIRST YEAR: CIVIL, TE CIVIL, MECHANICAL & TE
MECHANICAL ENGINEERING
LECTURE 2
PREPARED BY: MOHAMED H. MOHAMED
2.1.2.1: System with No Solution
⇒ A system of linear equations has no solution or inconsistent if it has a row of zeros except
for the last entry when in its row-echelon form.
EXAMPLE
Solve the following system:
x1 − x2 + 2x3 =4
x1 + x3 =6
2x1 − 3x2 + 5x3 =4
3x1 + 2x2 − x3 =1
SOLUTION
⇒ The augmented matrix for this system is:
1 −1 2 | 4
1
0 1 | 6
2 −3 5 | 4
3 2 −1 | 1
Mbeya University of Science and Technology Page 1 of 9
⇒ Applying the elementary row operations, the augmented matrix is reduced to row-echelon
form as:
1 −1 2 |4
0 1 −1 | 2
0 0 1 | 21
2
0 0 0 |2
⇒ The equivalent system of linear equations is:
x1 − x2 + 2x3 = 4
x2 − x3 = 2
2x3 = 21
0=2
⇒ This system is Inconsistent, since the fourth equation is a False Statement.
2.1.2.2: System with Many Solutions
⇒ A system of linear equations has an infinite number of solutions (i.e, has many solutions),
if it has fewer number of equations than the number of variables.
EXAMPLE
Solve the following system:
2x1 + 4x2 − 2x3 = 0
3x1 + 5x2 = 1
SOLUTION
⇒ The augmented matrix for this system is:
2 4 −2 | 0
3 5 0 |1
⇒ Whose row-echelon form is:
1 2 −1 |0
0 1 −3 | −1
⇒ The corresponding system of linear equations is:
x1 + 2x2 − x3 = 0
x2 − 3x3 = −1
Mbeya University of Science and Technology Page 2 of 9
⇒ Here, x1 and x2 are the leading variables, while x3 is the free variable.
⇒ Thus, assigning the parameter t to the free variable, we have;
⇒ x3 = t, hence x2 = −1 + 3t and x1 = −2(−1 + 3t) + t = 2 − 5t.
⇒ Therefore, the solution is:
x1 = 2 − 5t
x2 = −1 + 3t
x3 = t
x1 2 −5
OR x2 = −1 + 3 t
x3 0 1
⇒ Where, t is any real number.
2.1.3: Homogeneous System of Linear Equations
CONCEPTS:
1) Homogeneous system of linear equations is the system of linear equations in which each
of the constant term is zero. That is;
a11 x1 + a12 x2 + · · · + a1n xn = 0
a12 x1 + a22 x2 + · · · + a2n xn = 0
·
·
·
am1 x1 + am2 x2 + · · · + amn xn = 0
2) If all variables in homogeneous system have the value zero, then each of the equation
must be satisfied and such a solution is called Trivial or Obvious Solution.
3) If not all variables are zero, then the solution is called Nontrivial Solution.
EXERCISE
Solve the following system of linear equations:
x1 − x2 + 3x3 = 0
2x1 + x2 + 3x3 = 0
Mbeya University of Science and Technology Page 3 of 9
2.2: Triangulation Method/LU-Factorization
CONCEPTS:
1) Suppose that an n × n matrix A can be written as a product of a matrix L in Lower
triangular form and a matrix U in Upper triangular form. That is;
A = LU
2) In this case, we say that A has an LU-Factorization/LU-Decomposition. The LU-
factorization of a matrix A can be used to solve a linear system AX = B.
⇒ Substituting LU for A in AX = B, we have;
(LU )X = B
or L(U X) = B
⇒ Letting U X = Z, then we have;
LZ = B
3) Since, L is in lower triangular form, we solve directly for Z in LZ = B by Forward
Substitution. Once we determine Z, since U is in upper triangular form, we solve for
X in U X = Z by Back Substitution.
4) In summary, if n × n matrix A has an LU-factorization, then the solution of AX = B can
be determined by a Forward Substitution followed by a Back Substitution.
5) We illustrate this procedure in the following example.
EXAMPLE
Solve the following system of linear equations by LU-factorization:
6x1 − 2x2 − 4x3 + 4x4 =2
3x1 − 3x2 − 6x3 + x4 = −4
−12x1 + 8x2 + 21x3 − 8x4 =8
−6x1 − 10x3 + 7x4 = −43
SOLUTION
⇒ Let A be the coefficient matrix of the given system of linear equations. That is;
6 −2 −4 4
3 −3 −6 1
A= −12 8
21 −8
−6 0 −10 7
Mbeya University of Science and Technology Page 4 of 9
⇒ Now we proceed to ZERO OUT entries below the diagonal entries, using only the row
operation that adds a multiple of one row to a different row.
STEP 1: Zero Out below the first diagonal entry of A. That is;
1
⇒ Add (− ) times the first row of A to the second row of A.
2
⇒ Add (2) times the first row of A to the third row of A.
⇒ Add (1) times the first row of A to the fourth row of A.
⇒ Call the new resulting matrix U1 . That is;
6 −2 −4 4
0 −2 −4 −1
U1 = 0 4
13 0
0 −2 −14 11
⇒ We begin building a lower triangular matrix L1 with 1’s on the main diagonal, to
record the row operations. That is;
⇒ Enter the negatives of the multipliers used in the row operations in the first column
of L1 , below the first diagonal entry of L1 . We have;
1 0 0 0
1 1 0 0
L1 = 2
−2 ∗ 1 0
−1 ∗ ∗ 1
STEP 2: Zero Out below the second diagonal entry of U1 . That is;
⇒ Add (2) times the second row of U1 to the third row of U1 .
⇒ Add (−1) times the second row of U1 to the fourth row of U1 .
⇒ Call the new resulting matrix U2 . That is;
6 −2 −4 4
0 −2 −4 −1
U2 =
0 0 5 −2
0 0 −10 12
⇒ Enter the negatives of the multipliers from the row operations below the second
diagonal entry of L1 .
⇒ Call the new matrix L2 . That is;
1
0 0 0
1 1 0 0
L2 = 2
−2 −2 1 0
−1 1 ∗ 1
Mbeya University of Science and Technology Page 5 of 9
STEP 3: Zero Out below the third diagonal entry of U2 . That is;
⇒ Add (2) times the third row of U2 to the fourth row of U2 .
⇒ Call the new resulting matrix U3 . That is;
6 −2 −4 4
0 −2 −4 −1
U3 =
0 0 5 −2
0 0 0 8
⇒ Enter the negatives of the multipliers below the third diagonal entry of L2 .
⇒ Call the new matrix L3 . That is;
1 0 0 0
1 1 0 0
L3 = 2
−2 −2 1 0
−1 1 −2 1
⇒ Let L3 = L and U3 = U , then the product LU gives the original matrix A. Hence, A has
LU -Factorization, where;
1 0 0 0 6 −2 −4 4
1 1 0 0 0 −2 −4 −1
L= 2
−2 −2 1 0 and U = 0 0
5 −2
−1 1 −2 1 0 0 0 8
⇒ To solve the given system using this LU-factorization, we proceed as follows:
2
−4
⇒ Let B = 8
−43
⇒ Then, we solve AX = B by writing it as LU X = B. First let U X = Z and use Forward
Substitution to solve LZ = B. That is;
1 0 0 0 z1 2
1 1 0 0 z2 = −4
2
−2 −2 1 0 z3 8
−1 1 −2 1 z4 −43
⇒ Whose corresponding system of linear equations is:
z1 = 2
1
z1 + z2 = −4
2
−2z1 − 2z2 + z3 = 8
−z1 + z2 − 2z3 + z4 = − 43
Mbeya University of Science and Technology Page 6 of 9
⇒ Hence, by using forward substitution, we get;
z1 = 2
1
z2 = −4 − z1 = −5
2
z3 = 8 + 2z1 + 2z2 = 2
z4 = −43 + z1 − z2 + 2z3 = −32
z1 2
= −5
z2
OR
z3 2
z4 −32
⇒ Next we solve U X = Z, that is;
6 −2 −4 4 x1 2
0 −2 −4 −1 x2 −5
=
0 0 5 −2 x3 2
0 0 0 8 x4 −32
⇒ Whose corresponding system of linear equations is:
6x1 − 2x2 − 4x3 + 4x4 =2
−2x2 − 4x3 − x4 = −5
5x3 − 2x4 =2
8x4 = −32
⇒ Hence by using back substitution, we get;
32
x4 = − = −4
8
2 + 2x4
x3 = = −1.2
5
−5 + 4x3 + x4
x2 = = 6.9
−2
2 + 2x2 + 4x3 − 4x4
x1 = = 4.5
6
x1 4.5
x2 6.9
OR =
x3 −1.2
x4 −4
⇒ Therefore, the solution to thegiven system of linear equations is:
x1 4.5
x2 6.9
x3 = −1.2
x4 −4
Mbeya University of Science and Technology Page 7 of 9
2.3: Gauss-Seidel Method
CONCEPTS:
1) Gauss-Seidel Method is the Iterative/Numerical/Approximation method for
solving systems of linear equations.
2) With this method, we use the new values of xi as soon as they are known. That is, once
we have determined x1 from the first equation, its value is used in the second equation
to obtain x2 . Similarly, the x1 and x2 are used in the third equation to obtain x3 , and so
on.
3) The procedure is demonstrated in the following example.
EXAMPLE
Use the Gauss-Seidel method to approximate the solution of the following system of linear
equations:
5x1 − 2x2 + 3x3 = −1
−3x1 + 9x2 + x3 = 2
2x1 − x2 − 7x3 = 3
SOLUTION
⇒ Since we do not know the actual solution, then choose the initial approximation to
be:
x01 = 0, x02 and x03 = 0
⇒ We get the new value of x11 as:
1 2 3
x11 = − + (0) − (0) = −0.200
5 5 5
⇒ Now, we use x1 = −0.200 to compute new x12 in the equation (2), we get;
2 3 1
x12 = + (−0.200) − (0) = 0.156
9 9 9
Mbeya University of Science and Technology Page 8 of 9
⇒ Similarly, we use x1 = −0.200 and x2 = 0.156 to compute new x13 . That is;
3 2 1
x13 = − + (−0.200) − (0.156) = −0.508
7 7 7
⇒ Thus, the first iteration/approximation is:
x11 = −0.200, x12 = 0.156 and x13 = −0.508
⇒ For the second iteration, we have;
1 2 3
x21 = − + x12 − x13
5 5 5
1 2 3
= − + (0.156) − (−0.508) = 0.1672
5 5 5
2
=⇒ x1 = 0.167
2 3 1
x22 = + x21 − x13
9 9 9
2 3 1
= + (0.167) − (−0.508) = 0.33433
9 9 9
=⇒ x22 = 0.334
3 2 1
x23 = − + x21 − x22
7 7 7
3 2 1
= − + (0.167) − (0.334) = −0.42857
7 7 7
=⇒ x23 = −0.429
⇒ Continued iterations produce the sequence of approximations as shown in the table
below:
n 0 1 2 3 4 5 6
x1 0.000 −0.200 0.167 0.191 0.187 0.186 0.186
x2 0.000 0.156 0.334 0.334 0.331 0.331 0.331
x3 0.000 −0.508 −0.429 −0.422 −0.422 −0.423 −0.423
⇒ Note that, after the fifth iteration, we get the same solutions.
⇒ Therefore, the approximate solution for the system of linear equations is:
x1 = 0.186
x2 = 0.331
x3 = −0.423
Mbeya University of Science and Technology Page 9 of 9