Matrices
Matrices
Concept:
𝐴 = [𝑎𝑖𝑗 ]
0
The determinant of matrix:
The determinant of a matrix is a scalar value that is used in many matrix
operations. The matrix must be square (equal number of columns and rows) to
have a determinant. The notation for absolute value is used to indicate "the
𝑎 𝑏
determinant of", e.g. |𝑨| means "the determinant of matrix A" and | | means
𝑐 𝑑
to take the determinant of the enclosed matrix. Methods for finding the determinant
vary depending on the size of the matrix.
𝑎 𝑏 a b
where 𝐴 = [ ], det(A) = |A| = | | = ad - bc
𝑐 𝑑 c d
A=
1
The determinant of a 3×3 matrix can be calculated by the following
process:
𝐚𝟏𝟏 𝐚𝟏𝟐 𝐚𝟏𝟑
𝐀 = [𝐚𝟐𝟏 𝐚𝟐𝟐 𝐚𝟐𝟑 ]
𝐚𝟑𝟏 𝐚𝟑𝟐 𝐚𝟑𝟑
Solution:
First method:
𝟐 𝟏 𝟔 𝟐 𝟏
|𝐀| = | 𝟎 𝟐 𝟑| 𝟎 𝟐
−𝟏 𝟎 𝟓 −𝟏 𝟎
- - - + + +
2
Matrices addition and subtraction:
𝑎 𝑏 𝑒 𝑓
For example purposes, let A = [ ] and B = [ ]
𝑐 𝑑 𝑔 ℎ
𝑎±𝑒 𝑏±𝑓
then A ± B = [ ]
𝑐±𝑔 𝑑±ℎ
Ex.: Find addition and subtraction between A and B of the following matrices:
𝟓 −𝟐 𝟐 −𝟐
𝐀 = [−𝟏 𝟑 ] and 𝐁 = [𝟎 𝟏 ]
𝟏 𝟎 𝟒 −𝟏
Solution:
𝟓 −𝟐 𝟐 −𝟐 𝟕 −𝟒
A + B = [−𝟏 𝟑 ] + [𝟎 𝟏 ] = [−𝟏 𝟒]
𝟏 𝟎 𝟒 −𝟏 𝟓 −𝟏
𝟓 −𝟐 𝟐 −𝟐 𝟑 𝟎
A - B = [−𝟏 𝟑 ] − [𝟎 𝟏 ] = [−𝟏 𝟐]
𝟏 𝟎 𝟒 −𝟏 −𝟑 𝟏
H.W.:
Q) Find addition and subtraction between A and B of the following matrices:
𝟏 𝟏. 𝟓 𝟐 𝟏 𝟏 −𝟏
𝐀 = [𝟎 −𝟎. 𝟓 𝟏 ] and 𝐁 = [−𝟐 𝟐 𝟐 ]
𝟏 𝟐. 𝟓 −𝟑 −𝟏 𝟐 𝟏
3
Matrix by Matrix Product:
We now pass to the most general matrix-by-matrix product, and consider the
operations involved in computing the product C of two matrices A and B:
C = AB
AB = [𝒂𝒄 + 𝒃𝒅]
𝟔
For example: 1. 𝐀 = [𝟐 −𝟑] and B = [ ]
𝟓
AB = [𝟏𝟐 − 𝟏𝟓] = [−𝟑]
𝟑
2. 𝐀 = [𝟐 𝟑
−𝟒 𝟑 𝟐] and B = [−𝟐]
𝟓
AB = [𝟔 − 𝟏𝟐 − 𝟔 + 𝟏𝟎] = [−𝟐]
4
Multiplying two 2×2 matrices:
If A and B are two matrices then the product AB is obtained by multiplying
the rows of A with the columns of B in the manner described above.
Solution:
𝟏 𝟐 𝟏 −𝟏 −𝟑 𝟏
𝑪=𝑨×𝑩 = [ ]× [ ]= [ ]
𝟑 𝟒 −𝟐 𝟏 −𝟓 𝟏
H.W.:
Q) 1. Find the product AB where:
𝟏 𝟏 𝟏 −𝟏
𝐀= [ ] and 𝐁 = [ ]
𝟏 𝟏 −𝟏 𝟏
𝐚 𝐛 𝟏 𝟎
2. 𝐀 = [ ] and 𝐁 = [ ]
𝐜 𝐝 𝟎 𝟏
5
Multiplying two 3×3 matrices:
The definition of the product C = AB where A and B are two 3 × 3 matrices
is as follows:
Solution:
𝟏 𝟐 −𝟏 𝟐 −𝟏 𝟑 𝟒 −𝟖 𝟕
𝑪 = 𝑨 × 𝑩 = [𝟑 𝟒 𝟎 ] × [𝟏 −𝟐 𝟏 ] = [𝟏𝟎 −𝟏𝟏 𝟏𝟑]
𝟏 𝟓 −𝟐 𝟎 𝟑 −𝟐 𝟕 −𝟏𝟕 𝟏𝟐
H.W.:
6
Inverse of Matrix:
We must be follow the following steps to calculate inverse matrix:
1. Calculate determinant of matrix.
2. Minors of matrix.
3. Cofactor of matrix (-1)i+jaaij
4. Adjoint matrix (adj) (Transpose of cofactor)
𝑎𝑑𝑗𝐴
5. A-1 = |𝐴|
Solution:
|𝑨| = −𝟏(−𝟒 − 𝟑) − (𝟏𝟐 + 𝟏) + 𝟐(𝟗 − 𝟏) = 𝟕 − 𝟏𝟑 + 𝟏𝟔 = 𝟏𝟎
−𝟕 𝟏𝟑 𝟖
Minors of Matrix A = [−𝟐 −𝟐 −𝟐]
𝟑 −𝟕 −𝟐
−𝟕 −𝟏𝟑 𝟖
Cofactor matrix = [ 𝟐 −𝟐 𝟐]
𝟑 𝟕 −𝟐
−𝟕 𝟐 𝟑
Adjoint matrix = [−𝟏𝟑 −𝟐 𝟕 ]
𝟖 𝟐 −𝟐
−𝟕 𝟐 𝟑
[−𝟏𝟑 −𝟐 𝟕] −𝟎. 𝟕 𝟎. 𝟐 𝟎. 𝟑
-1 𝑨𝒅𝒋𝒐𝒊𝒏𝒕 𝒎𝒂𝒕𝒓𝒊𝒙 𝟖 𝟐 −𝟐
A = |𝑨|
= = [−𝟏. 𝟑 −𝟎. 𝟐 𝟎. 𝟕 ]
𝟏𝟎
𝟎. 𝟖 𝟎. 𝟐 −𝟎. 𝟐
7
H.w.:
Q) Calculate inverse matrix of the following matrix:
𝟏 𝟑 𝟑
A = [𝟏 𝟒 𝟑]
𝟐 𝟕 𝟕
Matrix algebra allows us to write the solution of the system using the inverse
matrix of the coefficients. In practice the method is suitable only for small systems.
Its main use is the theoretical insight into such problems which it provides.
AX= B
X = A-1B
X = variables
A = matrix of coefficient variables
B = matrix of constant
8
Ex.: Solve the following equations using matrix methods:
x1 - 2x2 + x3 = 3
2x1 + x2 - x3 = 5
3x1 - x2 + 2x3 = 12
Solution:
AX = B
X = A-1B
𝟏 −𝟐 𝟏 𝐱 𝟏 𝟑
𝐱
[𝟐 𝟏 −𝟏] [ 𝟐 ] = [ 𝟓 ]
𝟑 −𝟏 𝟐 𝐱 𝟑 𝟏𝟐
𝐱𝟏 𝟏 −𝟐 𝟏 −𝟏 𝟑
[𝐱 𝟐 ] = [𝟐 𝟏 −𝟏] [ 𝟓 ]
𝐱𝟑 𝟑 −𝟏 𝟐 𝟏𝟐
𝟏 −𝟐 𝟏 −𝟏 𝟎. 𝟏 𝟎. 𝟑 𝟎. 𝟏
A-1 = [𝟐 𝟏 −𝟏] = [−𝟎. 𝟕 −𝟎. 𝟏 𝟎. 𝟑]
𝟑 −𝟏 𝟐 −𝟎. 𝟓 −𝟎. 𝟓 𝟎. 𝟓
𝐱𝟏 𝟎. 𝟏 𝟎. 𝟑 𝟎. 𝟏 𝟑
𝐱
[ 𝟐 ] = [−𝟎. 𝟕 −𝟎. 𝟏 𝟎. 𝟑] [ 𝟓 ]
𝐱𝟑 −𝟎. 𝟓 −𝟎. 𝟓 𝟎. 𝟓 𝟏𝟐
x1 = 3
x2 = 1
x3 = 2
H.W.:
Q) Solve the following equations using matrix methods:
2 x1 + x2 - x3 = 0
x1 + x3 = 4
x1 + x2 + x3 = 0
9
Eigen values and Eigenvectors
Ax=λx …. (1)
is known as the Eigen value problem ( eigen in German means proper ) . The
solution of this problem is intimately connected to the question of whether
the matrix can be transformed into a diagonal form .
The value is called the Eigen value ( characteristic value ) and the
corresponding column matrix x is called the eigenvector ( characteristic
vector ) .
a 11 a12 a1n x 1 x1
a 21 a22 a2 n x 2 x2
=
a am 2 amn x n x
m1 n
x1 1 0 0 x 1
x 0 1 0 x2
Since , 2 = = I X
x 0 0 1 x
n n
(A–λI)x=0 …. (2)
This system has nontrivial solutions if and only if the determinant of the
10
Coefficient matrix vanishes;
► If two or more Eigen values are the same , we say that they are degenerate
.
11
1 2
Example (2) : Find the Eigen values and Eigenvectors of A , if A =
2 1
Solution :
1− 2
P( ) = = 2 − 2 − 3
2 1−
2 − 2 − 3 = ( + 1) ( − 3 ) = 0
x
be x 1 = then
11
Let the eigenvector x 1 corresponding to 1 = −1
x12
x 1 must Satisfy :
1 − 1 2 x 11 2 2 x11
= 0 = 0
2 1 − 1 12
x 2 2 x12
This reduces to : 2 x 11 + 2 x 12 = 0
−1
x 1 =
1
12
Any constant , positive or negative , times it will also be a solution , but it
will not be regarded as another distinct eigenvector . With a similar
procedure , we find the eigenvector corresponding to to be : 2 = 3
x 21 1
x 2 = =
x
22 1
3 − 5
Example (3) : Find the Eigen values and Eigenvectors of A , if A = .
1 − 1
Solution:
3− −5
P( ) = = 2 − 2 + 2
1 − 1−
2 − 2 + 2 = 0
2 − 2 + 2 = 0 1, 2 = 1 i
x
Let 1 = 1+ i , and the corresponding eigenvector be x 1 = , then x 1
11
x12
must satisfy :
3 − ( 1 + i ) − 5 x11
= 0
1 − 1 − ( 1 + i ) x12
13
which gives;
5 5 2+i 5( 2 +i ) 2+i
x11 = x12 = x12 = x12 = x12
2−i 2−i 2+i 5 1
x 11 2 + i
= =
x1 x 1
12
x 21 2 − i
x 2 = =
1
x 2 2
Solution:
x.( A − I ) = 0
14
1 0 0
Where: I = 0 1 0
0 0 1
− 2 2 − 3 0 0 − 2 − 2 − 3
A − I = 2 1 − 6 − 0 0 = 2
1 − − 6
− 1 − 2 0 0 0 − 1 − 2 −
−2− 2 −3
P ( ) = 2 1− − 6 = (−2 − ) (1 − ) (− ) − 12 − 2 2 (− ) + 6 − 3 − 4 − (1 − ) = 0
−1 −2 −
= 2 − 22 + 24 + 2 − 3 + 12 + 4 + 12 + 9 + 3 = 0
= −3 − 2 + 21 + 45 = 0
Take = 1 : − 13 − 12 + 21 + 45 0
-1 -1 24 45
-3 0 3 -6 -45
-1 2 15 0
15
( + 3)(−2 + 2 + 15) = 0
1 = − 3
2 = 5
3 = − 3
• At 2 = 5
− 2 − 2 − 3 x1 − 2 − 5 2 − 3 x1 − 7 2 − 3 x1 0
= 2 1 − − 6 x2 = 2 1 − 5 − 6 x2 = 2 − 4 − 6 x2 0
− 1 − 2 − x3 − 1 − 2 − 5 x3 − 1 − 2 − 5 x3 0
-7 x1 +2 x 2 -3 x3 =0 …..(1)
2 x1 - 4 x 2 -6 x3 =0 …..(2)
- x1 -2 x 2 -5 x3 =0 …..(3)
From Eq.(2)
2 x1 - 4 x 2 -6 x3 =0
x1 = 2 x 2 +3 x3 ……(4)
x2 −4 x1 −1
= ….(5) Sub. Eq.(5) within Eq.(1) we obtain =
x3 1 x3 1
• At 3 = − 3
16
− 2 − 2 − 3 x1 − 2 + 3 2 − 3 x1 1 2 − 3 x1 0
= 2 1 − − 6 x2 = 2 1 + 3 − 6 x2 = 2 4 − 6 x2 0
− 1 − 2 − x3 − 1 −2 3 x3 − 1 − 2 3 x3 0
x1 +2 x 2 -3 x3 =0 …..(1)
2 x1 +4 x 2 -6 x3 =0 …..(2)
- x1 -2 x 2 +3 x3 =0 …..(3)
From Eq.(1)
x1 = -2 x 2 +3 x3 ……(4)
2(-2 x 2 +3 x3 )+4 x 2 -6 x3 =0
-4 x 2 +6 x3 +4 x 2 -6 x3 =0 No Solution
-(-2 x 2 +3 x3 )-2 x 2 +3 x3 =0
2 x 2 -3 x3 -2 x 2 +3 x3 =0 No Solution
Eq.(4)
x1 = -2 x 2 +3 x3
Let: x 2 =0 , x3 =1/3
x1 =1
17
0 1 1
Example (5) : Find the Eigen values and Eigenvectors of A , if A = 1 0 1
1 1 0
Solution:
The characteristic polynomial of A is:
1 0 0
x.( A − I ) = 0 Where: I = 0 1 0
0 0 1
0 1 1 0 0 − 1 1
A − I = 1 0 1 − 0 0 = 1 − 1
1 1 0 0 0 1 1 −
− 1 1
P ( ) = 1 − 1 = 3 − 3 − 2 = 0
1 1 −
Trail & Error to find root one to satisfy the result: Take = −1 : (−1) 3 − 3(−1) − 2 = 0
1 0 -3 -2
-1 0 -1 1 2
1 -1 -2 0
( + 1)(2 − − 2) = 0
1 = − 1
2 = − 1
3 = 2
18