Matrix introduction and matrix operations.

RachitVerma25 1,819 views 52 slides Aug 13, 2020
Slide 1
Slide 1 of 52
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52

About This Presentation

Matrix is the structure squares of information science. They show up in different symbols across dialects. From Numpy clusters in Python to data frames in R, to lattices in MATLAB. The Matrix in its most essential structure is an assortment of numbers masterminded in a rectangular or cluster like th...


Slide Content

MatrixIntroduction
Data science and AI Certification Course
Visit: Learnbay.co

Matrices -Introduction
Matrix algebra has at least twoadvantages:
•Reduces complicated systems of equations tosimple
expressions
•Adaptable to systematic method of mathematicaltreatment
and well suited tocomputers
Definition:
A matrix is a set or group of numbers arranged in a squareor
rectangular array enclosed by twobrackets
[1-1]ëê-3ûëû0úêcdúé42ùéabù
Visit: Learnbay.co

Matrices -Introduction
Properties:
•A specified number of rows and a specified numberof
columns
•Two numbers (rows x columns) describe thedimensions
or size of thematrix.
Examples:
3x3matrix
2x4matrix
1x2matrix
ú
úû
ê
êë
5úê4
é124ù
-1
333ûë2úê0
é113-3ù
03[1-1]
Visit: Learnbay.co

Matrices -Introduction
A matrix is denoted by a bold capital letter and theelements
within the matrix are denoted by lower caseletters
e.g. matrix [A] with elementsaij
ú
úê
êë mnúûaaaêam2m1
éa11
êa21

aijainù
aija2nú!
ij
a12...
a22...
!ê!
i goes from 1 tom
j goes from 1 ton
mxnA=
mAn
Visit: Learnbay.co

Matrices -Introduction
TYPES OFMATRICES
1.Column matrix orvector:
The number of rows may be any integer but the numberof
columns is always1
êú
êë2úû
ê4ú
ëûê-3úé1ù
êë
êúa m1 úû
êa21
é1ùéa11ùúêú!
Visit: Learnbay.co

Matrices -Introduction
TYPES OFMATRICES
2. Row matrix orvector
Any number of columns but only onerow
[0352]
a1n]
[116]
a12[a11a13!
Visit: Learnbay.co

Matrices -Introduction
TYPES OFMATRICES
3. Rectangularmatrix
Contains more than one element and number of rows isnot
equal to the number ofcolumns
ûë6úê7
ú
-7úê
ê7
ê37úé11ù
ûë0úê2
é11100ù
033
m ¹n Visit: Learnbay.co

Matrices -Introduction
TYPES OFMATRICES
4. Squarematrix
The number of rows is equal to the number ofcolumns
Ahas an order ofm)
ë30û
(a squarematrix
é11ù
êúú
1úû
ê
êë6
0úê9
é111ù
9
6
m xm
The principal or main diagonal of a square matrix is composed ofall
elements aij for whichi=j
Visit: Learnbay.co

Matrices -Introduction
TYPES OFMATRICES
5. Diagonalmatrix
A square matrix where all the elements are zero except thoseon
the maindiagonal
ú
1úû
êêë0
0úê0
é100ù
2
0 ûë9úê0
ú

ê
ê0
0úê0
é3000ù
30
05
00
i.e. aij =0 for all i =j
aij = 0 for some or all i =j
Visit: Learnbay.co

Matrices -Introduction
TYPES OFMATRICES
6. Unit or Identity matrix -I
A diagonal matrix with ones on the maindiagonal
ëû1úê0
ú

ê
ê0
0úê0
é1000ù
10
01
00
ë01û
é10ù
êú
i.e. aij =0 for all i =j
aij = 1 for some or all i =j
ê
ij
aijûë0
éa0ù
ú
Visit: Learnbay.co

Matrices -Introduction
TYPES OFMATRICES
7. Null (zero) matrix -0
All elements in the matrix arezero
êú
êë0úû
ê0úé0ù
ú
0úû
ê
êë0
0úê0
é000ù
0
0
aij=0For alli,j Visit: Learnbay.co

Matrices -Introduction
TYPES OFMATRICES
8. Triangularmatrix
A square matrix whose elements above or below themain
diagonal are allzero
ú
3úû
ê
êë5
0úê2
é100ù
1

êë5
ê2ú
3úû
6ú0úê0
é100ùé189ù
1úê1
23úûêë00
Visit: Learnbay.co

Matrices -Introduction
TYPES OFMATRICES
8a. Upper triangularmatrix
A square matrix whose elements below themain
diagonal are allzero
i.e. aij = 0 for all i >j
ù
ú
3úû
ê
êë0
8úê0
187
1
0ûë3úê0
ú

ê
ê0
4úê0
é1744ù
17
07
00
ê
ëijû
ijijijúé

aéaaù
aijaijú
0ê0
ê0
Visit: Learnbay.co

Matrices -Introduction
TYPES OFMATRICES
8b. Lower triangularmatrix
A square matrix whose elements above the main diagonal areall
zero
i.e. aij = 0 for all i <j
ú
3úû
ê
êë5
0úê2
é100ù
1
2
êijijúêëaijaijaijúû
aêa
éaij
0ú0ù0
Visit: Learnbay.co

Matrices –Introduction
TYPES OFMATRICES
9. Scalarmatrix
A diagonal matrix whose main diagonal elementsare
equal to the samescalar
A scalar is defined as a single number orconstant
ú
1úû
ê
êë0
0úê0
00ù
1
0
ûë6úê0


ê0
ê0
é6000ù
ê60ú
06
00i.e.a= 0 for all i =jijaij = a for all i =j
ijú
aijúû
a
éaij
0
ê
êë0
0úê0
0ù0é1
Visit: Learnbay.co

Matrices
´MatrixOperations
Visit: Learnbay.co

Matrices -Operations
EQUALITY OFMATRICES
Two matrices are said to be equal only whenall
corresponding elements areequal
Therefore their size or dimensions are equal aswell
ú
3úû
ê
êë5
ê2 ú
3úû
ê
êë5
0ú0úê2
é100ùé100ù
11
22
A=B=A =B
Visit: Learnbay.co

Matrices -Operations
Some properties ofequality:
•If A = B, then B = A for all A andB
•If A = B, and B = C, then A = C for all A, B andC
ú
3úû
ê
êë5
0úê2
é100ù
1
2
A=B=ê2123ú
b33úûêëb31
búbb
éb11b12b13ù
ê
22
b32
If A = Bthenaij=bij Visit: Learnbay.co

Matrices -Operations
ADDITION AND SUBTRACTION OFMATRICES
The sum or difference of two matrices, A and B of the same
size yields a matrix C of the samesize
+bijcij=aij
Matrices of different sizes cannot be added orsubtracted
Visit: Learnbay.co

Matrices -Operations
Commutative Law:
A + B = B +A
AssociativeLaw:
A + (B + C) = (A + B) + C = A + B +C
ûûëûëë 9úê-23ú56ùé885ù
ê-4-2=-76úê2
é73-1ù+é1
-5
A
2x3
B
2x3
C
2x3Visit: Learnbay.co

Matrices -Operations
A + 0 = 0 + A =A
A + (-A) = 0 (where –A is the matrix composed of –aij aselements)
ûûëûëë -1ú8úê27úê1ê3
é642ù-é120ù=é522ù
202
Visit: Learnbay.co

Matrices -Operations
SCALAR MULTIPLICATION OFMATRICES
Matrices can be multiplied by a scalar (constant orsingle
element)
Let k be a scalar quantity;then
kA =Ak
Ex.If k=4and
ëû1úê4
ú
-3úê2
é3-1ù
ê21ú
A =ê
Visit: Learnbay.co

Matrices -Operations
úê
ú=ê
ëûëû
é12-4ù
ú´4=êú
-3úê8-12ú
ë164û
ê2
1úê84úé3-1ù
ê41úê41ú-3úê2
é3-1ù
ê21úê24´ê
Properties:
•k (A + B) = kA +kB
•(k + g)A = kA +gA
•k(AB) = (kA)B =A(k)B
•k(gA) =(kg)A Visit: Learnbay.co

Matrices -Operations
MULTIPLICATION OFMATRICES
The product of two matrices is anothermatrix
Two matrices A and B must be conformable for multiplicationto
bepossible
i.e. the number of columns of A must equal the number of rows
ofB
Example.
AxB=C
(1x3)(3x1)(1x1)
Visit: Learnbay.co

Matrices -Operations
BxA=Notpossible!
(2x1)(4x2)
=Notpossible!AxB
(6x2)(6x3)
Example
AxB
(2x3)(3x2)
=C
(2x2)
Visit: Learnbay.co

Matrices -Operations
úùú=úêë2122û
1211
ë32û31
21ë212223û
131211
cêc
écc
êbúb
bêbùéb11b12ù
22úaaêa
éaaa
(a11´b11)+(a12´b21)+(a13´b31)=c11
(a11´b12)+(a12´b22)+(a13´b32)=c12
(a21´b11)+(a22´b21)+(a23´b31)=c21
(a21´b12)+(a22´b22)+(a23´b32)=c22
Successive multiplication of row i of A with column jof
B –row by columnmultiplicationVisit: Learnbay.co

Matrices -Operations
úúë(4´4)+(2´6)+(7´5)
(1´8)+(2´2)+(3´3)ù
(4´8)+(2´2)+(7´3)û
é(1´4)+(2´6)+(3´5)
êë53úû
2ú=êúê67ûêë4
3ùé48ùé12
ê2
=é3121ùê6357ú
ëû
ê0
Rememberalso:
IA =A
é1
ûëûë1úê6357ú
0ùé31
ûëê6357ú
21ù=é3121ù
Visit: Learnbay.co

Matrices -Operations
Assuming that matrices A, B and C are conformablefor
the operations indicated, the following aretrue:
1.AI = IA =A
2.A(BC) = (AB)C=ABC-(associativelaw)
3.A(B+C) = AB+AC-(first distributivelaw)
4.(A+B)C=AC+BC-(second distributivelaw)
Caution!
1.AB not generally equal to BA, BA may not beconformable
2.If AB = 0, neither A nor B necessarily =0
3.If AB = AC, B not necessarily =C Visit: Learnbay.co

Matrices -Operations
AB not generally equal to BA, BA may not beconformable
ûëûëûë0úê10
û
2ù=é236ùê02úê50ú
ëûëûë
4ùé1
ê1520úê50úê02ú
ëû
2ùé34ù=é38ù
ê02ú
ëû

ê50ú2ù
ST =é3
TS =é1
S =é3
T =é1
Visit: Learnbay.co

Matrices -Operations
ûëûëûë0úê-2-3úê0ê00ú
If AB = 0, neither A nor B necessarily =0
é11ùé23 ù=é00ù
Visit: Learnbay.co

Matrices -Operations
TRANSPOSE OF AMATRIX
If:
ëû
é
1úê5
247ù
3
3
2A=A=
2x3
êú
êë71úû
3ú3
2
TTA=ê4A=
Then transpose of A, denoted ATis:
é25ù
jiija=aTFor all i andj
Visit: Learnbay.co

Matrices -Operations
Totranspose:
Interchange rows andcolumns
The dimensions of AT are the reverse of the dimensions ofA
ûë
é
1úê5
247ù
3
3
2A=A=
êú
êë71úû
2
3
é25ù
Tê3úTA=4A=
2 x3
3 x2
Visit: Learnbay.co

Matrices -Operations
Properties of transposedmatrices:
1.(A+B)T = AT +BT
2.(AB)T = BTAT
3.(kA)T =kAT
4.(AT)T =A
Visit: Learnbay.co

Matrices -Operations
1.(A+B)T = AT +BT
ûûëûëë 9ú3ú=ê-2
56ùé885ù
-2-76ú+ê-4ê2
é73-1ùé1
-5 êú
êë59úû
-7úê8
é8-2ù
úêú
3úûêë59úû
-2ú=ê8-7úúê
6úûêë6ê
êë-1
-5ú+ê5ê3
2ùé1-4ùé8-2ùé7
Visit: Learnbay.co

Matrices -Operations
(AB)T = BTAT
2ú=[28][112]ê1êú
êë03úû
é10ù
ë8û
é2ù
êë2úû
úê1ú=êúÞ[28]3ûêú
0ùé1ù
ë0
é11
ê2
Visit: Learnbay.co

Matrices -Operations
SYMMETRICMATRICES
A Square matrix is symmetric if it is equal toits
transpose:
A =AT
ëûêbdú
ëû
=éabù
êbdúbùA =éa
AT
Visit: Learnbay.co

Matrices -Operations
When the original matrix is square, transposition doesnot
affect the elements of the maindiagonal
ëûêbdú
ëû
=éacù
êcdúbùA =éa
AT
The identity matrix, I, a diagonal matrix D, and a scalar matrix,K,
are equal to their transpose since the diagonal isunaffected.
Visit: Learnbay.co

Matrices -Operations
INVERSE OF AMATRIX
Consider ascalark.The inverse is the reciprocal or division of1
by thescalar.
Example:
k=7the inverse of k or k-1 = 1/k =1/7
Division of matrices is not defined since there may be AB =AC
while B =C
Instead matrix inversion isused.
The inverse of a square matrix, A, if it exists, is the uniquematrix
A-1where:
AA-1= A-1 A =I Visit: Learnbay.co

Matrices -Operations
Example:
û
é
3úê-2
ëû
-1ù
ê21ú
31ù2
2
A-1 =é1
A=A=
ûëûëûë3úê01ú
-1ù=é1
1úê-2ê2
ëûëûëû
é31ùé10ù
1ú=ê01ú3 úê2ê-2
ë
é1-1ùé31ùé10ùBecause:
Visit: Learnbay.co

Matrices -Operations
Properties of theinverse:
( AB)-1 =B-1A-1
( A-1 )-1 =A
( AT )-1 =(A-1 )T
(kA)-1 =1A-1
k
A square matrix that has an inverse is called a nonsingularmatrix
A matrix that does not have an inverse is called a singular matrix
Square matrices have inverses except when the determinant iszero
When the determinant of a matrix is zero the matrix issingularVisit: Learnbay.co

Matrices -Operations
DETERMINANT OF AMATRIX
To compute the inverse of a matrix, the determinant is required
Each square matrix A has a unit scalar value calledthe
determinant of A, denoted by det A or|A|
2
65
2ùê65úëû
A=1
A =é1If
then
Visit: Learnbay.co

Matrices -Operations
If A = [A] is a single element (1x1), then the determinantis
defined as the value of theelement
Then |A| =detA=a11
IfAis(n x n), itsdeterminantmaybe definedintermsoforder
(n-1) orless.
Visit: Learnbay.co

Matrices -Operations
MINORS
If A is an n x n matrix and one row and one column aredeleted,
the resulting matrix is an (n-1) x (n-1) submatrix ofA.
The determinant of such a submatrix is called a minor of A and
is designated by mij , where i and j correspond to thedeleted
row and column,respectively.
mij is the minor of the element aij inA.
Visit: Learnbay.co

Matrices -Operations
úê212223ú
éa11a12a13ù
A=êaaa
êëa31a32a33úû
Each element in A has a minor
Delete first row andcolumnfromA.
The determinant of the remaining 2 x 2 submatrix is theminor
ofa11
eg.
32
11aam=a22a23
33 Visit: Learnbay.co

Matrices -Operations
Therefore the minor of a12is:
And the minor for a13is:
31
12aam=a21a23
33
31
13aam=a21a22
32
Visit: Learnbay.co

Matrices -Operations
COFACTORS
The cofactor Cij of an element aij is definedas:
C=(-1)i+jmijij
When the sum of a row number i and column j is even, cij = mij and
when i+j is odd, cij=-mij
c(i =1, j =1) =(-1)1+1m=+m11 1111
c(i =1, j =2) =(-1)1+2m=-m12 1212
c(i =1, j =3) =(-1)1+3m=+m13 1313Visit: Learnbay.co

Matrices -Operations
DETERMINANTSCONTINUED
The determinant of an n x n matrix A can now be definedas
A =det A =a11c11 +a12c12 +"+a1nc1n
The determinant of A is therefore the sum of the products of the
elements of the first row of A and their correspondingcofactors.
(It is possible to define |A| in terms of any other row orcolumn
but for simplicity, the first row only isused)
Visit: Learnbay.co

Matrices -Operations
Therefore the 2 x 2 matrix:
úë2122ûaêa
a12ùA =éa11
=a22
Has cofactors:
c11 =m11 =a22
And:
2121c12 =-m12 =-a=-a
And the determinant of Ais:
-a12 a21A =a11c11 +a12c12=a11a22 Visit: Learnbay.co

Matrices -Operations
Example1:
ëû2úê1
1ùA =é3
A =(3)(2) -(1)(1) =5
Visit: Learnbay.co

Matrices -Operations
For a 3 x 3matrix:
úê212223ú
éa11a12a13ù
A=êaaa
êëa31a32a33úû
The cofactors of the first roware:
22312132
31
13
31
12
23322233
32
11
aac
aac
aac
=aa-aa=a21a22
32
=-(a21a33 -a23a31)=-a21a23
33
=aa-aa=a22a23
33
Visit: Learnbay.co

Matrices -Operations
The determinant of a matrix Ais:
A =a11c11 +a12c12=a11a22-a12a21
Which by substituting for the cofactors in this caseis:
-a22a31)-a23a32)-a12(a21a33-a23a31)+a13(a21a32A =a11 (a22 a33
Visit: Learnbay.co

Matrices -Operations
Example2:
ú
1úû
3úé101ù
A =ê02êêë-10
A=(1)(2-0)-(0)(0+3)+(1)(0+2)=4
-a22a31)-a23a31)+a13(a21a32-a23a32)-a12(a21a33A =a11 (a22 a33
Visit: Learnbay.co