Professional Documents
Culture Documents
R. Owusu
February 6, 2023
A = (aij )m×n
aii , i = 1, 2, ..., n are called the diagonal elements of the square matrix.
1. A · (B · C) = (A.B).C
2. A · (B + C) = A · B + A · C
1
3. (A + B) · C = A · C + B · C, then n × n diagonal matrix, where aij = I
for all i is called the identity matrix of order n and is denoted by In .
For example,
1 0 0
1 0
I2 = and I3 = 0 1 0
0 1
0 0 1
4. If A is n × n matrix then A · In = In = A
Ap Aq = Ap+q
2
1.2.4 TRIDIAGONAL MATRIX
A square matrix A = (aij )n×n in the form
a11 a12 0 0 0
a21 a22 a23 0 0
..
A = 0 a32 a33
. 0
(4)
0 . .. . ..
0 an−1,n
0 0 0 an,n−1 ann
THEOREM
AA−1 = A−1 A = I
THEOREM
Suppose that A and B are invertible matrices of the same size. Then,
3
If A is an n × n matrix then the following statements are equivalent
1. A is invertible
3. A is row equivalent to In .
2.1 THEOREM
Given a system of n equations and m unknowns, there will be one of three
possibilities for solutions to the system.
4
2. There will be exactly one solution.
5
U x = b has the solution; (Backward Substitution)
bn 1
xn = , xn−1 = (bn − un−1,n xn ) , . . .
unn un−1,n
1
x3 = (b3 − −u34 x4 − . . . − u3n xn − u3n−1 xn−1 )
u3n
Then finally
1
x1 = (b1 − u12 x2 − u13 x3 − · · · − u1,n−1 xn−1 − u1,n xn )
u11
We may not all the time have simple systems of linear equations where A is
a (1) Diagonal matrix, (2) Upper triangular matrix or Lower triangular
matrix.
1. Direct method
(a) Gaussian Elimination Method
(b) Gauss-Jordan Method
(c) Decomposition method (LU and Cholesky)
2. Iterative method
(a) Gauss-Jacobi method
(b) Gauss-Seidel method
3 Gaussian Elimination
How is a set of equations solved numerically? One of the most popular tech-
niques for solving simultaneous linear equations is the Gaussian elimination
method. The approach is designed to solve a general set of n equations and
n unknowns
Gaussian elimination consists of two steps
6
3.1 Gaussian elimination: Without Pivoting - Naive
Assume an n equations and n unknowns as below
• STEP 1:
a21
(a11 x1 + a12 x2 + a13 x3 + · · · + a1n xn = b1 )
a11
a21 a21 a21
a12 x2 + · · · +
a21 x1 + a1n xn = b1
a11 a11 a11
Subtract this equation from the first equation to give
a21 a2 a21
a22 − a12 x2 + · · · + a2n − a1n xn = b2 − b1
a11 a11 a11
or
0 0 0
a22 x2 + · · · + a2n xn = b2
Repeat this process for the third equation to the nth equation to produce
7
a11 x1 + a12 x2 + a13 x3 + · · · + a1n xn = b1
0 0 0 0
a22 x2 + a23 x3 + · · · + a2n xn = b2
0 0 0 0
a32 x2 + a33 x3 + · · · + a3n xn = b3
.. .. ..
. . .
0 0 0 0
an2 x2 + an3 x3 + · · · + ann xn = bn
8
3.3 Back Substitution
From the last step in the Forward Elimination process, proceed by solving
from the last equation. Thus;
(n−1)
bn
xn = (n−1)
ann
(i−1) (i−1) (i−1) (i−1)
bi − ai,i+1 xi+1 − ai,i+2 xi+2 − · · · − ai,n xn
xi = (i−1)
aii
for i = n-1, · · · ,1 or
n
(i−1)
bi−1
P
i − ai,j xj
j=i+1
xi = (i−1)
for i = n − 1, n − 2, · · · , 1
aii
2. Round-off Error
Example
25 5 1 a1 106.8
64 8 1 a2 = 177.2
144 12 1 a3 279.2
to get
[ 64 12.8 2.56 273.408 ]
subtract result from Row 2
[64 8 1 177.2]
− [64 12.8 2.56 273.408]
0 −4.8 −1.56 −96.208
9
Expected Result
25 5 1 a1 106.8
0 −4.8 −1.56 a2 = −96.208
144 12 1 a3 279.2
Expected Result
25 5 1 a1 106.8
0 −4.8 −1.56 a2 = −96.208
0 −16.8 −4.76 a3 −335.968
Expected Result
25 5 1 a1 106.8
0 −4.8 −1.56 a2 = −96.208
0 0 0.7 a3 0.76
10
• Back Substitution From third equation
0.7a3 = 0.76
0.76
a3 = 0.7
= 1.08571
Put value of a3 into second equation
−4.8a2 − 1.56a3 = −96.208
The solution is
−96.208+1.56∗a3
a2 = −4.8
−96.208+1.56∗1.08571
= −4.8
= 19.6905
Put value of a2 and a3 into first equation
25a1 + 5a2 + a3 = 106.8
106.8−5∗a2 −a3
a1 = 25
106.8−5∗19.6905−1.08571
= 25
= 0.290472
Hence the solution vector is
a1 0.290472
a2 = 29.6905
a3 1.08571
The two methods are the same, except in the beginning of each step of
forward elimination, a row switching is done based on the following criterion.
• STEP 1
Take the maximum of
|akk |, |ak−1,k |, · · · · · · , |ank |
at the beginning of each k th step of the forward elimination
11
• STEP 2
Assume |apk | is the maximum in the pth row, swap that row with the
k th row.
• STEP 1
Divide row 1 by 20 and multiply by -3 thus
−3
20
= −0.15
12
Expected Result
20 15 10 x1 45
0 0.001 8.5 x2 = 8.501
5 1 3 x3 9
This gives
[5 3.75 2.5] [11.25]
Subtract result from Row 3
[5 1 3] [9]
− [5 3.75 2.5] [11.25]
0 −2.75 0.5 −2.25
Expected Result
20 15 10 x1 45
0 0.001 8.5 x2 = 8.501
0 −2.75 0.5 x3 −2.25
• STEP 2
The largest in absolute value in the second column
|0.001|, | − 2.75|
is identified and row swapped with the second row −2.75 is the largest
thus row 3 hence swapped with row 2
20 15 10 x1 45
0 −2.75 0.5 x2 = −2.25
0 0.001 8.5 x3 8.501
13
( [0 −2.75 0.5] [−2.25] ∗ −0.0003633 )
This gives
• Back Substitution
8.5001x3 = 8.5001
8.5001
x3 =
8.5001
= 1
−2.25 − 0.5x3
x2 =
−2.75
−2.25 − 0.5 ∗ 1
=
−2.75
−2.25 − 0.5
=
−2.75
−2.75
=
−2.75
= 1
14
Put x3 and x2 into Row 1
So the Solution is
x1 1
[X] = x2 = 1
x3 1
Can we use Naive Gaussian elimination methods to find the determinant
of a square matrix?
One of the more efficient ways to find the determinant of a square matrix
is by taking advantage of the following two theorems on a determinant of
matrices.
Theorem
Let [A] be a n ∗ n matrix,if [B] is a n ∗ n matrix that results from adding or
subtracting a multiple of one row to another row then
det(A) = det(B)
Theorem
Let [A] be an n ∗ n matrix that is either an upper or lower triangular or
diagonal then
det(A) = a11 ∗ a22 ∗ · · · ∗ aii ∗ · · · ∗ ann
Yn
= aii
i=1
What if we cannot find the determinant of the matrix using the Naive
Gaussian elimination method because of division by zero problems during
the Naive Gaussian elimination method?
Then Gaussian elimination with partial pivoting can be applied. However,
the determinant of the resulting upper triangular matrix may differ by a
sign.
15
The following theorem applies in addition to the previous two to find the
determinant of a square matrix.
Theorem
Let [A] be an n ∗ n matrix, if [B] is a matrix resulting from switching one
row with the another row then
det(B) = −det(A)
Key Note
1. [A] is invertible
2. [A]−1 exists
16