MATRICES (1) Teachingslide
MATRICES (1) Teachingslide
1
Definition:
Matrix is an array of objects arranged in m rows and n columns
5 1 2 30.3 2
A 4 1 0.2 1 4
3 1 5 0 7
2
Matrix A aij and B bij are equal if
3 2 a 3 8
Eg: What is the value of a-c?
6 4 3c 4
Ans: a = 6 ; c = 2
3
Only same sizes of matrices can perform addition / subtraction:
3 2 3 8 3 3 2 8 6 10
6 5 0 4 6 0
5 4 6 9
3 2 4 3 4 2 12 8
4
6 5 4 6 4 5 24 20
4
Product of Matrices:
A B
(m x n) (p x q)
AB Only true if n = p
(m x q)
Eg: A B
(3 x 2) (2 x 4)
AB
(3 x 4)
5
1 2
1 7
1 1 0 1 4
Find AB if A 2 ; B 0
4 5 9 6 3
2X 3 3 X2
Row 1 of A * Column 1 of B Row 1 of A * Column 2 of B
1 2
1 1 1 (0 4) (1 6) (1 7) (0 0) (1 3)
AB = (4 1) (5 4) (9 6) (4 7) (5 0) (9 3)
(2 X 2) 2
Row 2 of A * Column 1 of B Row 2 of A * Column 2 of B
AB = 7 4
70 55
6
Matrix Transposition: Interchanging rows and columns
5 1 2 30.3 2
Eg: A 4 1 0.2 1 4
3 1 5 0 7 Row 1 becomes column 1
Row 2 becomes column 2
5 4 3
1 1 1
Row 3 becomes column 3
AT 2 0.2 5
30.3 1 0
2 4 7
7
Determinant of a square matrix: |A|:
a b
i) Determinant of a 2X2 matrix: |A|: If A then A ad bc
c d
3 4
Eg : A then A (3 2) (4 1) 10
1 2
1 2 0
Eg : A 1 1 0 then A 1(1 3 0 4) 2(1 3 0 2) 0(1 4 1 2) 9
2 4 3
8
Echelon Matrices (pg 13)
If the number of zeros preceding the distinguished element
increases row by row = Echelon matrix
Examples:
2 3 2 0 4 5 6
Distinguished
2 zeros 0 0 7 1 3 2 0
1. element
5 zeros 0 0 0 0 0 6 2
0 0 0
0 0 0 0
9
Echelon Matrices (pg 13)
Examples: Distinguished
element
1 2 3
2 zeros 0 0 4
2.
0 0 0 Distinguished
0 0 element
0
1 zero 0 1 3 0 0 4 0
3 zeros 0 0 0 1 0 3 0
3.
4 zeros 0 0 0 0 1 2 0
0 1
6 zeros 0 0 0 0 0
10
Row Reduced Echelon Matrices (pg 13)
If the distinguished elements are:
a) The only nonzero entries in their respective columns
b) Each equals 1
Examples: 0 1 3 0 0 4 0
0 0 0 1 0 3 0
0 0 0 0 1 2 0
0 1
0 0 0 0 0
1 0 0
0 1 0
0 0 1
0 0
0
11
(pg 14)
12
Elementary Row Operations
Eg : Perform R1 R3
R1 2 3 1 0 0 1
Ans : R2 4 1 6 R1 R3 4 1 6
R3 0 0 1 2 3 1
13
Elementary Row Operations
Eg : Perform R2 3R2
5 6 1 5 6 1
Ans : 2 1 3 R2 3R2 6 3 9
1 9 2 1 9 2
-3X3
2X3 1X3
14
Elementary Row Operations
Replace the ith row by a k times the jth row plus the ith row :
Ri Ri kR j , k 0.
Eg : Perform R1 R1 3R2
1 0 0 1 3 0
Ans : 0 1 0 R1 R1 3R2 0 1 0
0 0 1 0 0 1
1+(3*0) 0+(3*0)
0+(3*1)
15
MATRIX INVERSE A-1
• Invertible Matrices
A square matrix A (nxn) is said to be invertible if there exists
a unique matrix A-1 (nxn) such that A A-1 = A-1 A= I n
(I is an identity matrix)
1 0
Note: I2
0 1
1 0 0
I 3 0 1 0
0 0 1
16
• If A has an inverse, then A is called a nonsingular matrix;
it means
det A A 0
T
iii) If A is the transpose of A, then A T 1
.
A 1 T
iv) A
n 1
, n 0,1,2,...
A 1 n
17
Finding inverse by Gauss-Jordan elimination (pg 16)
18
6 1
Eg: Find the inverse of A by Gauss-Jordan elimination:
3 2
6 0
Ans : A I
11
3 20 1
R2 R2 (1 / 2) R1
6 1 1 0
0 3 / 2 1/ 2 1
R2 (2 / 3) R2
6 1 1 0 2 / 9 1/ 9
1
A
0 1 1 / 3 2 / 3 1/ 3 2 / 3
R1 R1 R2
6 0 4 / 3 2 / 3
0 1 1/ 3 2 / 3
1 0 2 / 9 1/ 9
I A1
0 1 1/ 3 2 / 3
R (1 / 6) R
1 1
19
1 1 0
Eg: Find the inverse of A 1 3 4 by Gauss-Jordan elimination:
0 4 3
1 1 01 0 0 1 1 01 0 0
Ans : A I 1 3 40 1 0 R2 R2 R1 0 4 41 1 0
0 4 30 0 1 0 4 30 0 1
1 1 0 1 0 0 1 0 1 3 / 4 1/ 4 0
R1 R1 1R2
R2 (1 / 4) R2 0 1 1 1/ 4 1/ 4 0 0 1 1 1/ 4 1/ 4 0
0
1 3 2
1
R R 4 R
4 3 0 0 3
0 0 1 1 1
1 0 1 3 / 4 1/ 4 0 1 0 0 7 / 4 3 / 4 1
R1 R1 R3
R3 (1) R3 0 1 1 1 / 4 1 / 4 0 0 1 0 3/ 4 3/ 4 1
0 0 1 1
1 2 3
1
R R 2 1R
1 0 0 1 1 1
7/4 3/ 4 1
A 1 3/ 4 3/ 4 1
1 1
1
20
The inverse for 2X2 square matrix can also be found by: (pg 15)
a b 1 1 d b
If A
; then A
c d ad bc c a
6 1
A Eg: Find the inverse of A :
3 2
1 1 2 1 2 / 9 1 / 9
A
12 3 3 6 1 / 3 2 / 3
21
The inverse for 3X3 and larger square matrices can be found
by using the classical adjoint method too: (pg 18)
A1
1
adjoint A
det A
adjoint A (cofactorA)T
A
a b c
e f d f d e
If A d e f ; A a b c
g h i g i g h
h i
22
Finding cofactor A https://youtu.be/EcI4E15ElK0
1 1 0
Eg: Find the cofactor of A 1 3 4
0 4 3
a11 a12 a13
Eg: Let’s say cofactor A a21 a22 a23
a a32 a33
31
1 1 0
3 4
a11 refer to row 1 and column 1 of matrix A; 7 A 1 3 4
4 3 0 4 3
1 4
1 1 0
a12 refer to row 1 and column 2 of matrix A; - 3 A 1 3
0 3 4
0 4 3
1 3 1 1 0
a13 refer to row 1 and column 3 of matrix A; 4 A 1 3 4
0 4
0 4 3
23
1 1 0
Eg: Find the inverse of A 1 3 4 by cofactor /adjoint method:
0 4 3
3 4 1 4
Ans : det A A 1 1 0 4
4 3 0 3
a11 a12 a13 7 3 4
cofactor A a21 a22 a23 3 3 4
a a32 a33 4 4 4
31
7 3 4
adjoint A (cofactorA)T 3 3 4
4 4 4
7 3 4 7/ 4 3 / 4 1
1
A
1
adjoint A 3 3 4 3 / 4 3 / 4 1
1
det A 4
4 4 4 1 1 1
24
System of Linear Equations
a11 x1 ... a1n xn b1
a21 x1 ... a2 n xn b2
am1 x1 ... amn xn bm Augmented
Matrix
25
Solving system of linear equations by
Gaussian eliminations
In solving a system of linear equations by Gaussian eliminations,
we can perform all the 3 kinds of elementary row operations to the
augmented matrix:
Eg: Solve using Gaussian Elimination:
x1 2 x2 1
x1 x2 5
~ 1 2 1 Augmented
Let A Matrix
1 1 5
Next, Perform the Elementary Row operations
26
Elementary Row Operations
~ 1 2 1
A
1 1 5
R2 R2 R1
1 2 1
0 1 6
Row reduced echelon matrix
R2 R2
1 2 1
0 1 6 By back substitution:
x1 11
R1 R1 2R2
x2 6
1 0 11
Unique solution exist
0 1 6
27
Solve the linear system by Gaussian elimination: (pg 11)
3x1 2 x2 2 x3 5 x4 8
0.6 x1 1.5 x2 1.5 x3 5.4 x4 2.7
1.2 x1 0.3x2 0.3x3 2.4 x4 2.1
3 2 2 5 8
~ Augmented
Let A 0.6 1.5 1.5 5.4 2.7
1.2 0.3 0.3 2.4 2.1 Matrix
28
Elementary Row Operations
3 2 2 5 8 By back substitution:
~ From second row:
Let A 0.6 1.5 1.5 5.4 2.7
1.2 0.3 0.3 2.4 2.1 1.1x2 1.1x3 4.4 x4 1.1
R2 R2 0.2 R1 Simplify : x2 1 x3 4 x4
R3 R3 0.4R1 From first row:
3 2 2 5 8 3x1 2 x2 2 x3 5 x4 8
0 1.1 1.1 4.4 1.1 Substitute x2 into this :
0 1.1 1.1 4.4 1.1
x1 2 x4
R3 R3 R2
x3 and x4 Remains unknown
3 2 2 5 8
Infinitely many solutions
0 1.1 1.1 4.4 1.1
0 0 0 0
0
29
Solving the system of linear equations by Cramer’s Rule :
(pg 20)
Ai
The solution to the system of linear equation AX=B is : xi
A
Where Ai is the matrix obtained by replacing the entries
In the i-th column of A by entries in the matrix B
2 x1 6 x2 4
Eg:
x1 3 x2 8
2 6 x1 4
A ; X ; B
1 3 x2 8
4 6 2 4
A1 A2
8 3 1 8
Replace the second column
Replace the first column of A with B
of A with B
30
Eg: Solve the system by using Cramer’s Rule: ( pg 20)
x1 3 x2 4 x3 1
x1 x2 3 x3 14
x2 3 x3 5
1 3 4 x1 1
Let A 1 1 3 ; X x2 ; B 14
0 1 3 x 5
3
1 3 4 1 1 4 1 3 1
A1 14 1 3 ; A2 1 14 3 ; A3 1 1 14
5 1 3 0 5 3 0 1 5
Replace with B
31
1 3 4 x1 1
Let A 1 1 3 ; X x2 ; B 14
0 1 3 x 5
3
1 3 4 1 1 4 1 3 1
A1 14 1 3 ; A2 1 14 3 ; A3 1 1 14
5 1 3 0 5 3 0 1 5
A1 117
x1 9
A 13
A2 10
x2
A 13
A3 25
x3
A 13
32
Rank of matrix A is the number of nonzero rows in echelon matrix of A.
(pg 21)
1 1 4 2
Let A 0 1 3 2 . Find rank (A).
3 2 15 8
33
Revision: Echelon Matrices (pg 13)
If the number of zeros preceding the first nonzero entry of a row
(distinguished element)
increases row by row
Examples: 2 3 2 0 4 5 6
Distinguished
0 0 7 1 3 2 0
1. element
0 0 0 0 0 6 2
Distinguished 0 0 0
0 0 0 0
element
1 2 3 0 1 3 0 0 4 0
0 0 4 0 0 0 1 0 3 0
2.
0
3.
0 0
0 0 0 0 1 2 0
0
0 0 0 1
0 0 0 0 0
34
1 1 4 2
A 0 1 3 2
3 2 15 8
R3 R3 3R1
1 1 4 2
0 1 3 2
0 1 3 2
R3 R3 R2
There are 2 nonzero
rows in echelon matrix
1 1 4 2
0 1 3 2 Echelon matrix
Therefore, rank (A)=2 0 0 0 0
35
T
rank ( A ) = rank (A ) pg (22)
~
If rank (A ) = rank ( A ) < n, then the system has many solutions.
36
Eg: Does this system have solution? ( pg 22)
2 x1 3 x 2 6
4 x1 6 x 2 18
2 3 ~ 2 3 6
Let A Let A
4 6 4 6 18
R2 R2 2R1 R2 R2 2R1
2 3 2 3 6
Echelon matrix Echelon matrix
0 0 0 0 6
There are 1 nonzero There are 2 nonzero
row in echelon matrix rows in echelon matrix
~
Therefore, rank (A)=1 Therefore, rank (A)= 2
~
Therefore no solution since rank (A ) rank ( A ) .
37
Eg: Does this system have solution?
x 3 y 1
4 x 3 y 11
1 3 ~ 1 3 1
Let A Let A
4 3 4 3 11
R2 R2 4R1
R2 R2 4R1
1 3 1 3 1
Echelon matrix Echelon matrix
0 15 0 15 15
There are 2 nonzero There are 2 nonzero
rows in echelon matrix rows in echelon matrix
~
Therefore, rank (A)=2 A
Therefore, rank ( )= 2
~
rank (A ) = rank ( A) =2 and n=2
Therefore this system has one solution.
38