Al-Farabi University College
Computer Engineering Department
First Stage
Lectures (4)
Matrices
Assist. Prof. Dr. Ali H. Kashmar
2023-2024
Lecture 4
Matrix Inversion
Simple 2 x 2 case
Simple 2 x 2 case
Let
and
a b w x
1
A A
c d y z
Since it is known that
A A-1 = I
then
a b w x 1 0
c d y z 0 1
Simple 2 x 2 case
Multiplying gives
aw by 1
ax bz 0
cw dy 0
cx dz 1
It can simply be shown that
A ad bc
Simple 2 x 2 case
thus
1 aw
y
b
cw
y
d
1 aw cw
b d
d d
w
da bc A
Simple 2 x 2 case
ax
z
b
1 cx
z
d
ax 1 cx
b d
b b
x
da bc A
Simple 2 x 2 case
1 by
w
a
dy
w
c
1 by dy
a c
c c
y
ad cb A
Simple 2 x 2 case
bz
x
a
1 dz
x
c
bz 1 dz
a c
a a
z
ad bc A
Simple 2 x 2 case
So that for a 2 x 2 matrix the inverse can be constructed
in a simple fashion as
d b
A A 1 d b
1w x
A c a A c a
y z A
A
•Exchange elements of main diagonal
•Change sign in elements off main diagonal
•Divide resulting matrix by the determinant
Simple 2 x 2 case
Example
2 3
A
4 1
1 1 1 3 0.1 0.3
A
10 4 2 0.4 0.2
Check inverse
A-1 A=I
1 1 3 2 3 1 0
I
10 4 2 4 1 0 1
Matrices and Linear Equations
Linear Equations
Linear Equations
Linear equations are common and important for survey
problems
Matrices can be used to express these linear equations and
aid in the computation of unknown values
Example
n equations in n unknowns, the aij are numerical coefficients,
the bi are constants and the xj are unknowns
a11x1 a12 x2 a1n xn b1
a21x1 a22 x2 a2 n xn b2
an1 x1 an 2 x2 ann xn bn
Linear Equations
The equations may be expressed in the form
AX = B
where
a11 a12 a1n x1 b1
a21 a22 a2 n x2 b2
A , X , and B
an1 an1 ann xn bn
nxn nx1 nx1
Number of unknowns = number of equations = n
Linear Equations
If the determinant is nonzero, the equation can be solved to produce
n numerical values for x that satisfy all the simultaneous equations
To solve, premultiply both sides of the equation by A-1 which exists
because |A| = 0
A-1 AX = A-1 B
Now since
A-1 A = I
We get
X = A-1 B
So if the inverse of the coefficient matrix is found, the unknowns,
X would be determined
Linear Equations
Example
3x1 x2 x3 2
2 x1 x2 1
x1 2 x2 x3 3
The equations can be expressed as
3 1 1 x1 2
2 1 0 x 1
2
1 2 1 x3 3
Linear Equations
When A-1 is computed the equation becomes
0.5 0.5 0.5 2 2
X A1 B 1.0 2.0 1.0 1 3
1.5 3.5 2.5 3 7
Therefore
x1 2,
x2 3,
x3 7
Linear Equations
The values for the unknowns should be checked by substitution
back into the initial equations
x1 2, 3x1 x2 x3 2
x2 3, 2 x1 x2 1
x3 7 x1 2 x2 x3 3
3 (2) (3) (7) 2
2 (2) (3) 1
(2) 2 (3) (7) 3