Introduction to Matrix Inversion Techniques
Introduction to Matrix Inversion Techniques
Chapter (3)
مقذمة في الجبر الخطي
Introduction to Linear
Algebra
مقذمة في الجبر الخطي الباب الثالث
E 1 E n*n = E n*n E 1 = I n
where A, B, C and D are matrices arbitrary size, but A and D must be square.
Furthermore, A and D − CA−1B must be invertible.
In other form,
82
Chapter 3 Introduction to Linear Algebra
a a
Note. Inverse of 2-dimensional square matrix A 22 11 12 may be
a21 a22
obtained, simply, as
a11 a12
A 22 a11a22 a12 a21
a21 a22
,
a22 a12 a22 a12
a a11 a21 a11
1
A 21
a11 a12 a11a22 a12 a21
a21 a22 .
a22 a12 3 2
a a11 1 1
1 2 1 21
For instant, if A , then, A ,
1 3 a11 a12 1 2
a21 a22 1 3
1 3 2 0.6 0.4
A 1
5 1 1 0.2 0.2
.
1 2 0.6 0.4 1 0
In other, words, A A 1 .
1 3 0.2 0.2 0 1
Example
Find the inverse of the following matrices using partitioning method:
1 2 0
0 1 2 74
1 3 0 0 1 3 2 6
i) E ii) F
0 0 3 2 0 0 3 2
0 0 7/2 1 0 0 7/2 1
1 2 00
2 4 0 1 0
iii) G 0 3 2
3 0
iv) H
4 7 3 2
0 1 0
2 6 7/2 1
Solution
83
مقذمة في الجبر الخطي الباب الثالث
1 2 3 2
where, A and D
1 3 7/2 1
1 3 2 1 1 2
Then, A 1 and D 1
5 1 1 10 7/2 3
0.6 0.4 0 0
0.2 0.2 0 0
E 1
0 0 0.1 0.2
0 0 0.35 0.3
1 2 47
1 3 2 6 A B
-1
A -1 - A -1 B D -1
ii) F
0 0 3 2 O D O D 1 , where,
0 0 7/2 1
1 2 4 7 3 2
A ,B D
7/2 1
.
1 3 2 6
and
1 3 2 1 1 2
A 1 D 1
5 1 1 10 7/2 3
.
Then, and
84
Chapter 3 Introduction to Linear Algebra
1 3 2 4 7 1 1 2 79/100 11/50
- A -1B D-1 =
5 1 1 2 6 10 7/2 3 103/100
27/50
*
F 1
D
.
O O D 1 0 0 0.1 0.2
0 0 0.35 0.3
85
مقذمة في الجبر الخطي الباب الثالث
2 4 0 -1
A B A -1 - A -1 B D -1
iii) G 0 3 2
O D O D 1 .
0 1 0
where,
3 2
A 2, B 4 0 and D
1 0
.
1 1 0 2
Then, A 1 and D 1
2 2 1 3
1 1 0 2
4 0 * 0 - 2
2 1 3
- A -1B D-1 =
2
-1 0.5 0 2
A B A -1 - A -1B D -1
1
1
G 0
D
0
O O D 1 0
0.5 1.5 .
Notes
i) The inverse of a diagonal matrix is diagonal.
ii) The inverse of an upper triangular matrix is upper triangular.
86
Chapter 3 Introduction to Linear Algebra
3.1.2 Inverse Matrix Using Using Pivoting معكوس المصفوفة باستخذام التمركز
Any matrix can be put into row echelon form via a sequence of elementary
row operations (called elimination or Gaussian elimination).
.قٓا ػهٗ انًصفٕفحُُٛصخ ترطثٚ ٙح ػهٗ انصفٕف ٔ انرٛاخ األعاعٛ انؼًهٙهٚ ًاَٛغشد ف
The following Elementary row operations should be applied on the
matrix:
1- Interchange two rows ٍٛم صفٚذثذ
2- Multiply a row by a nonzero constant ٘ش صفشٛ شاتد غٙظشب صف ف
3- Add/Subtract a multiple of one row from a multiple of another.
.جًغ أٔ غشح صف يعشٔب إنٗ أٔ يٍ صف آخش يعشٔب
Example
1 2 1
A 3 2 1
4 4 1
87
مقذمة في الجبر الخطي الباب الثالث
يٍ انصف انصانس ٔ رنك تعشب ػُاصش4 ٔ َذزفَٙ يٍ انصف انصا3- ق رنك َذزف انشقىٛٔ نرذق
ٔ 4- ٙ شى ظشب ػُاصش انصف األٔل ف.َٙ ٔ جًؼّ ػهٗ ػُاصش انصف انصا3 ٙانصف األٔل ف
.جًؼّ ػهٗ ػُاصش انصف انصانس
So we need to get rid of the 2 in the second row and the 3 in the third row. To
get rid of the 2 in the second row, we multiply the first row by 3 and add the
result to the second row; we multiply the first row by -4 and add the result to
the third row. This gives
1 2 1 1 2 1
3 2
1 r2 3r1 0 8 2
4 4 1 r3 4r1 0 12 5
Step 2:
انصفٙ فَٙ ٔ جًؼّ يغ شالشح اظؼاف انصف انصا1 ٙ يٍ انصف انصانس ٔ رنك تعشتّ ف21- َذزف
.َٙانصا
We need to get rid of the (-12) in the third row. This yields:
1 2 1 1 2 1
0 0 8 2
8 2
0 12 5 2r3 3r2
0 0 4
upper triangular matrix
7 0 4
B 0 4 5 (B) =3.
0 1 0
88
Chapter 3 Introduction to Linear Algebra
0 0 0
C 2 4 0 (C) =1.
0 0 0
Example
1 1 2
5 , we can employ the procedure
To find the inverse of A 2 3
1 3 5
introduced above.
1 1 2 1 0 0
2 3 5 0 1 0 r2 2r1 .
1 3 5 0 0 1 r3 r1
1 1 2 1 0 0
0 1 1 2 1 0 r2
0 2 3 1 0 1
1 1 2 1 0 0 r1 r2
0 1 1 2 1 0
0 2 3 1 0 1 r3 2r2
89
مقذمة في الجبر الخطي الباب الثالث
1 0 1 3 1 0 r1 r3
0 1 1 2 1 0 r2 r3
0 0 1 3 2 1
1 0 0 0 1 1
0 1 0 5 3 1
0 0 1 3 2 1
The inverse of A is
0 1 1
A 1
5 3 1
.
3 2 1
90
Chapter 3 Introduction to Linear Algebra
We can check the previous examples and solve problems of higher orders
using programming with MATLAB.
Example: Design a program to solve the following the linear systems Ax=b,
Test the program using the following system
1 -1 2 0
3 -2 5 -1
i) A =
1 0 -2 6
4 0 5 2
b= [-10 -25 21 -12] T
91
مقذمة في الجبر الخطي الباب الثالث
1 - 1 2 0 0 x 1 3
2 4 - 1 0
0 x 2 0
ii) 1 1 3 0 0 x 3 1
0 0 0 1 2 x 4 10
0 0 0 - 2 3 x 5 1
Solution
i)
>> format rat
>> A=[1 -1 2 0;3 -2 5 -1;1 0 -2 6;4 0 5 2]
A=
1 -1 2 0
3 -2 5 -1
1 0 -2 6
4 0 5 2
>> b=[-10 -25 21 -12]'
b=
-10
-25
21
-12
>> x=inv(A)*b
x=
1
3
-4
2
ii)
>> A=[1 -1 2 0 0;2 4 -1 0 0;1 1 3 0 0;0 0 0 1 2;0 0 0 -2 3]
A=
1 -1 2 0 0
2 4 -1 0 0
1 1 3 0 0
92
Chapter 3 Introduction to Linear Algebra
0 0 0 1 2
0 0 0 -2 3
>> b=[3 0 1 10 1]
b=
3 0 1 10 1
>> x=inv(A)*b'; x=x'
x=
2.0000 -1.0000 0.0000 4.0000 3.0000
a11 a 12 a 1n b1
a a 2n b 2
~ 21 a 22
A n( n 1) A b = .
a n1 a n2 a nn b n
.خعغ نصالز إَٔاع يٍ انذمٚ ْٙزا انُظاو انخط
This system has the following cases of solution.
~
i) If A A n , then, the system has a unique solution, )ذٛ(دم ٔد
~
ii) If A A n , has infinite solutions, ) يٍ انذهٕلٙ(ػذد ال َٓائ
~
iii) If A A , the system has no solution. )ظ نّ دمٛ(ن
93
مقذمة في الجبر الخطي الباب الثالث
Example
Solution
1 1 1 8 1 1 1 8
~ 0 5 3 13
A A b 2 3 1 3 r2 2r1
5 0 2 10 r3 5r1 0 5 - 3 30 r3 r2
1 1 1 8
0 5 3 13
0 0 0 - 17
ُٗؼٚ ٔ رنك.) (غير المنطقيًٙكٍ كراترٓا ػهٗ انشكم انرانٚ شجٛالدع أٌ انًؼادنح انًخرصشج األخ
~
. نهذانح انصانصحA ٔ A ٍٛ انًصفٕفرٙ نًطاتقح سذثر.اعرذانح ٔجٕد دم
The last reduced equation may be written as
0 -17 !!!. But this is impossible. In other words, 3 A A 2 .
~
94
Chapter 3 Introduction to Linear Algebra
Multiplying the first equation by -4, then add this to the second equation
(multiplied by 3), we find a new equation.
-12x +20y = -52,
+ 12x +9y = -6.
------------------
0*x+29y = -58
.) (نّ َفظ انذمٙذى انرذٕل إنٗ انُظاو انًكافئ انران
We have the following equivalent system
3x - 5y = 13,
0*x+29y = -58
→y=-2
The value of x may be calculated by back substitution
3x -5*(-2) = 13 →x=3/3=1.
Then, the solution vector is
x 1
y 2
ٕ٘ ذذرٙ ٔ تانران.شج راخ يجٕٓل ٔادذ فرذم يثاششجٛقح ذثذأ تجؼم انًؼادنح األخٚإٌ فكشج ْزِ انطش
.... ٔ ْكزا.عا يثاششجٚانًؼادنح انغاتقح نٓا يجٕٓال ٔادذا فرذم أ
The idea of this method is to reduce unknowns of the last equation to only one.
Then, the last unknown is calculated directly. The other unknowns are
calculated by back substitution. To achieve this target, all zeros below the
diagonal in the coefficients matrix (A).
.قح انصف انًخرصشٚ تاعرخذاو غشU اٛح ػهٛ إنٗ يصفٕفح يصهصA م يصفٕفح انًؼايالخٕٚذى ذذ
In other words, the matrix A will be transformed to an upper triangular matrix
(U) by row echelon procedure. This can be written as
Ax b Ux b or
Ab U b
Where, Ab is called the augmented matrix. )(انًصفٕفح انًٕعِّؼح
Example
95
مقذمة في الجبر الخطي الباب الثالث
Solution
. إنٗ أصفاسٙغٛغ انؼُاصش ذذد انقطش انشئًٛم جٕٚقح نرذٚرى ذكشاس ْزِ انطشٚ
The present operations will performed to transform vlues of second column to
zeros under diagonal. Thus, we multiply the second row by -1 and -4, then add
96
Chapter 3 Introduction to Linear Algebra
the new scaled rows to 3rd and 4th rows, respectively. So, we can write the
following operations.
1 - 1 2 0 - 10
0 1 - 1 -1 5
= U b .
0 0 - 3 7 26
0 0 25
0
50
U
Example
Solution
97
مقذمة في الجبر الخطي الباب الثالث
1 1 1 8 1 1 1 8
~ 3 1 3 r2 2r1 0 5 3 13
A A b 2
5 0 2 27 r3 5r1 0 5 - 3 13 r3 r2
1 1 1 8
0 5 3 13
0 0 0 0
The above example lead us to state an important theorem which classifies the
three cases of solution of linear systems of equations.
98
Chapter 3 Introduction to Linear Algebra
1
Ax b . Multiplying both sides by A , we may write,
1 1
A Ax A b . Then, Ix x
In other words, we may obtain the following transformation.
Ab I x.
.قح انصف انًخرصشٚ ) ىثاعرخذاو غشx ( قٕدَا إنٗ انذم يثاششجٚ إٌ ْزا انرذٕل
By row operations, we can obtain the above formula, which gives, directly, the
required solution vector x .
a11 a 12 a 1n b1
a a 2n b 2
~ 21 a 22
A A b
a n1 a n2 a nn b n
Then, we can transform the augmented matrix to the matrix form,
1 0 0 x1
0 1 0 x 2
I n x
by elementary row operations.
0 0 1 xn
Finally, the solution vector x is the last column of the last reduced matrix.
Solution
The augmented matrix is written as
99
مقذمة في الجبر الخطي الباب الثالث
1 1 1 8
A 2 3 1 3
~
1 1 3 1
Using the reduced echelon (row operations), we can perform the following
steps to obtain the final formula.
1 1 1 8 1 1 1 8
A 2 3 1 3 r2 2r1 0 5 3 13 r2 / 5
~
1 1 3 1 r3 r1 0 2 2 7
1 1 1 8 r1 r2 1 0 2/5 27/5
0 1 3/5 13/5
0 1 3/5 13/5
0 2 2 7 r3 2r2 0 0 16/5 9/5 5r3 /16
.ٙح كانرانٛقح نذم أكصش يٍ َظاو نهًؼادالخ انخطٚش ْزِ انطشًٕٚكٍ ذطٚ :يهذٕظح ْايح
Note. We can solve more than one system which have the same matrix
coefficients A and different residuals b as:
Solution
The modified augmented matrix is written as
100
Chapter 3 Introduction to Linear Algebra
1 1 1 6 8
A 2 3 1 2 3
~
1 1 3 10 1
Using the reduced echelon (row operations), we can perform the following
steps to obtain the final formula
1 1 1 6 8 1 1 1 6 8
A 2 3 1 2 3 r2 2r1 0 5 3 14 13 r2 / 5
~
1 1 3 10 1 r3 r1 0 2 2 4 7
x A b.
-1
-1
The inverse A can be obtained using several methods such as adjoint
method and pivoting method.
101
مقذمة في الجبر الخطي الباب الثالث
a11 a12
i) If n=2: A 22 a11a22 a12 a21 .
a21 a22
3 1
Example: The determinant of the matrix A is:
5 2
A (3)(2) (5)(1) 6 5 11.
2 2
Example: The determinant of the matrix A 4 3 is:
A (2)(3) (4)(2) 6 8 6 8 14.
Example
102
Chapter 3 Introduction to Linear Algebra
n
A akj (1)k j M kj
j1
,
A 33
called minors M kj which is obtained by eliminating the kth row and jth
column.
103
مقذمة في الجبر الخطي الباب الثالث
Example
7 6 5
If A 0 1 5 , then,
0 3 8
det(A) =
7 6 5
1 5 0 5 0 1
A 0 1 5 (1) * 7 * (1) * 6 * (1) * (5) *
3 8 0 8 0 3
0 3 8
=7*(-8-15)-6*(0)+5*(0)=161.
Example
2 3 5 1
3 0 2 0
If A , then, find A .
2 - 1 5 1
1 0 0 - 2
Solution
.ًح انًذذد تاعرخذاو أدذًْاٛفعم دغاب قٚ ٔ نزنك,ش اصفاس أكصشٛ ٔ األخٍَٙ انصاٛالدع ادرٕاء انصف
4
A 4*4 a2j (1)2 j M 2j
j1
2 3 5 1
3 0 2 0
A a21 (1)21 M 21 a23 (1)23 M 23
2 -1 5 1
1 0 0 -2
3 5 1 2 3 1
A 3 * 1 5 1 2 * 2 1 1
0 0 2 1 0 2
3 5 3 1 2 3
3 * (2) * 2 * (1) * (2) *
1 5 1 1 2 1
104
Chapter 3 Introduction to Linear Algebra
Ci j 1
i j
M i j is the cofactor
Example
14 9 12
Consider the matrix: A 3 23 11 . Find:
1 12 16
i) A ,
ii) The adjoint matrix adj(A) .
iii) A1 using adjoint method.
-5
iv) use the above results to solve the system: Ax b , where, b 16 .
16
Solution
=14*23*16-9*11+12*3*12+12*23-14*11*12-9*3*16
=3481.
105
مقذمة في الجبر الخطي الباب الثالث
4 2 1 2 1 4
3 5 1 5 1 3
M11 M12 M13
0 3 4 3 4 0
ii) Let M M 21 M 22 M 23 1
3 5 5 1 3
M 31 M 32 M 33
0 3 4 3 4 0
4 2 1 2 1 4
Thus, the adjoint matrix obtained as
a11 a12 a13 ..... a1n a11 a21 a31 ..... an1
a21 a22 a23 ..... a2 n a12 a22 a32 ..... an 2
At A .
2)
an1 an 2 an 3 ..... ann a1n a2 n a3n ..... ann
1 - 3 1 3 1 -3 1 3
If A AT A 10, AT 10
3 1 - 3 1 3 1 -3 1
106
Chapter 3 Introduction to Linear Algebra
a 11 0 0 0
a 11 0 0 0 a 11 a 12 a 13 a 1n
a2 a 22 0 0
0 a 22 0 0 0 a 22 a 23 a 2n
a 31 a 32 a 33 0 0
0 0 a 33 0 0 0 0 a 33
0 0 0 0 0 0 0
0 a n1 a n2 a nn
0 0 0 0 a nn 0 0 0 0 a nn
a 11 * a 22 * a 33 * ..... * a nn i 1 a ii
n
.
For instant,
1 2 3
0 1 6 1 * (1) * 28 28
.
0 0 28
107
مقذمة في الجبر الخطي الباب الثالث
7) AB BA A B B A
For instant, consider,
1 3 2 1
A
1 0 2
and B
2
2 5 0 7
AB and BA
4 4 4 2
2 5 0 7
AB -28, BA 28
4 4 4 2
1 3 2 1
AB 7 * 4 -28
2 1 0 2
2 1 1 3
BA 4 * (7) -28
0 2 2 1
----------------------
108
Chapter 3 Introduction to Linear Algebra
Exercises (3)
1. Find the inverse of the following matrices using partitioning method:
1 - 1 0 0 1 - 1 2 0
2 3 0 0 2 3 0 5
i) E ii) F
0 0 - 2 2 0 0 - 2 2
0 0 4 1 0 0 4 1
1 2 0
0
3 - 1 0 1 0
iii) G 0 3 - 2
3 0
iv) H
4 7 3 2
0 4 2
2 6 7/2 1
1 - 1 2 0 0
2 4 - 1 0 0
v) 1 1 3 0 0 .
0 0 0 1 2
0 0 0 - 2 3
1 1 2 1
2 2 3 3
4. Find inverse of B using Pivoting method, and adjoint
1 1 1 0
1 1 4 3
method.
109
مقذمة في الجبر الخطي الباب الثالث
1 3 2 3
2 8 7 12
5. Design MATLAB program to find inverse of E .
0 3 15 0
3 4 5 2
1 1 2
5 using Pivoting method
6. Find inverse of A 2 3
1 3 5
1 1 2 1 x 8
2 2 3 3 y 20
1 1 1 0 z 2
1 1 4 3 w 4
110
Chapter 3 Introduction to Linear Algebra
Find whether the system has a unique solution, infinite solutions or no solution
(inconsistent).
12. Design a program to solve the following the linear system Ax=b, using
Gauss-elimination method. Enter the coefficients in the augmented matrix in
one nested loop. Test the program using the following system
1 -1 2 0
3 -2 5 -1
A=
1 0 -2 6
4 0 5 2
b= [9 26 -29 11]T
1 1 2 1
1 1 1 -2 2 -4 2
C 2 2 1 , D
3 - 3 6 - 3 .
5 3 3
- 10 10 - 20 10
- 3 23 12
14. Consider the matrix: A - 14 9 11 . Find:
1 12 16
i) A ,
ii) The adjoint matrix adj(A) .
iii) A1 using adjoint method.
32
iv) use the above results to solve the system: Ax b , where, b 6 .
29
111
مقذمة في الجبر الخطي الباب الثالث
x y z 0
i) 2y 8z 8 ,
4x 5y 9z 9
0 3 -6 4 9
-1 - 2 -1 3 1
A , b
ii) - 2 - 3 0 3 1
1 4 5 - 9 7
2 1 3 - 3
~
iii) A - 3 2 6 7
5 - 3 8 9
.
----------------------
112