Download Introduction to Matrices

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
MATH 1046
Introduction to Matrices
(Sections 3.1 and 3.2)
Alex Karassev
Matrices
• An m x n matrix is a rectangular array of
numbers with m rows and n columns
j-th column
 a11

 a21
A   ai1

 am11
 a
 m1
a12
a22
...
...
a1 j
a2 j
...
...
ai 2
...
aij
...
am11
...
am1 j
...
am 2
...
am j
...
a1n 

a2 n 
ain  i-th row

am1 n 
am n 
Some examples
•
•
•
•
•
•
Coefficient matrix of a linear system
Distance matrix
Graph adjacency matrix
Matrices in computer graphics
Matrices in optimization problems
Games
Example: distance matrix (in km)
North Bay
Toronto
Ottawa
North Bay
0
340
360
Toronto
340
0
450
Ottawa
360
450
0
Example: graph adjacency matrix
1

1
0

0

Timmins
1
North Bay 2
Ottawa
3
Toronto
4
1
1
1
1
0
1
1
1
0

1
1

1 
Matrix operations
•
•
•
•
Multiplication by scalars
Addition and subtraction
Multiplication
Transpose
Multiplication by scalars
• Example: distance matrices in km and mi
km
NB
T
O
mi
NB
T
O
NB
0
340
360
NB
0
340/1.6
360/1.6
T
340
0
450
T
340/1.6
0
450/1.6
O
360
450
0
O
360/1.6
450/1.6
0
• All entries are multiplied by 1/1.6
Multiplication by scalars
 a11

 a21
A   ai1

 am 11
 a
 m1
a12
a22
ai 2
am 11
am 2
 ca11

 ca21
cA   cai1

 cam 11
 ca
 m1
ca12
ca22
cai 2
cam 11
cam 2
...
...
...
...
...
...
...
...
...
...
a1 j
a2 j
aij
am 1 j
am j
ca1 j
ca2 j
caij
cam 1 j
cam j
a1n 

a2 n 
ain 

am 1 n 
am n 
...
...
...
...
...
...
...
...
...
...
ca1n 

ca2 n 
cain 

cam 1 n 
cam n 
Addition
First
Apples
Basket
Second
Apples
Basket
Pears
Pears
Red
3
5
Red
1
0
Green
4
6
Green
10
3
Total
Apples
Pears
Red
3+1
5+0
Green
4+10
6+3
Addition
 a11
a
A   21
 ...
a
 m1
a12
a22
...
am 2
... a1n 
... a2 n 
... ... 
... amn 
 a11  b11
 a b
21
21

A B 
 ...
a  b
 m1 m1
 b11 b12 ... b1n 
b

...
b
b
2n 
22
B   21
 ... ... ... ... 
b

b
...
b
mn 
 m1 m 2
a12  b12
a22  b22
...
am 2  bm 2
... a1n  b1n 
... a2 n  b2 n 

... ...
... amn  bmn 
Matrix miultiplication
• Example: 2 x 2 linear system
a11 x1  a12 x 2 c1

a21 x1  a22 x 2 c 2
 a11 a12 


 a21 a22 
• Linear substitution
 x1  b11 y1  b12 y 2

 x2  b21 y1  b22 y 2
 b11 b12 


 b21 b22 
 x1  b11 y1  b12 y 2

 x2  b21 y1  b22 y 2
a11x1a12 x 2 c1

a21x1a22 x 2 c 2
 b11 b12 


 b21 b22 
 a11 a12 


 a21 a22 
Substitution:
a11 (b11 y1b12 y 2 )  a12 (b21 y1  b22 y 2 ) c1

a21 (b11 y1b12 y 2 )  a22 (b21 y1  b22 y 2 ) c 2
What system do we get in terms of y1 and y2?
a11 (b11 y1b12 y 2 )  a12 (b21 y1  b22 y 2 ) c1

a21 (b11 y1b12 y 2 )  a22 (b21 y1  b22 y 2 ) c 2
(a11b11  a12b21 ) y1(a11b12  a12b22 ) y 2 c1

(a21b11  a22b21 ) y1(a21b12  a22b22 ) y 2 c 2
New Coefficient Matrix:
 a11b11  a12b21

 a21b11  a22b21
a11b12  a12b22 

a21b12  a22b22 
Matrix multiplication: 2 x 2 case
 a11
A  
 a21
a12 

a22 
 a11b11  a12b21
AB  
 a21b11  a22b21
 b11 b12 

B  
 b21 b22 
a11b12  a12b22 

a21b12  a22b22 
Matrix multiplication: 2 x 2 case
 a11
A  
 a21
a12 

a22 
Dot product:
 a11b11  a12b21
AB  
 a21b11  a22b21
 b11 b12 

B  
 b21 b22 
a11b12  a12b22 

a21b12  a22b22 
Matrix multiplication: general case
• Let A = (aij) be m x n matrix and B be n x k
matrix
• The product AB = C = (cij) is an m x k matrix
defined as follows
cij = ai1 b1j + ai2 b2j+ ci3 b3j+…+ain bnj
• Note: cij is the dot product of i-th row of A and
j-th column of B
Is it possible that AB≠BA?
Is it possible that AB≠BA?
Yes!
0 1

A  
1 0
 1 1

B  
 0 1
 0 1

AB  
 1 1
1 1 

BA  
1 0 
Square matrix
• A matrix is called square if m=n, i.e. the number
of rows is the same as the number of columns
• A square matrix has the diagonal: all entries of
the form aii
 a11

 a21
a
 31
a12
a22
a32
a13 

a23 

a33 
Zero Matrix and Identity Matrix
• Zero matrix: an n x n matrix such that all
entries are zeros
• Identity matrix: an n x n matrix such that all
diagonal entries are 1, all other entries are 0
0 0 0


O  0 0 0
0 0 0


1 0 0


I  0 1 0
0 0 1


Properties: addition and multiplication by scalars
• Addition of matrices and multiplication by scalars have the same
properties as in the case of vectors or real numbers:
• (A+B)+C=A+(B+C)
• A+B = B+A
• A+O = A
• If -A = (-1)+A then A+(-A) = O
• (cd)A= c(dA)
• 1A = A
• (c+d)A = cA + dA
• c(A+B) = cA +cB
Properties: matrix multiplication
• Assuming the dimension of matrices allow to
perform the operations, we have the following:
•
•
•
•
•
•
(AB)C=A(BC)
A(B+C)= AB+AC
(B+C)A= BA+CA
IA = A I = A
OA = AO = O
(cA)B= A (cB) = c(AB)
Powers
• For a square matrix A, define Ak = A A … A
(product of A with itself k times)
• Question: Is it possible to have A2 = O for a
non-zero A?
Yes!
0 1

A  
0 0
Scalar matrices
• Matrix A is called scalar if A = aI for some real
number a
• Exercise
a) Prove that for a scalar n x n matrix A and for any
n x n matrix B we have AB= BA = aB
b) Prove (at least for 2 x 2 case) that in fact for an
arbitrary square matrix A we have AB= BA for any
B if and only if A is scalar
Matrix Transpose
• AT = B such that bij = aji
• If A is m x n matrix AT is n x m matrix
• If v is a row vector vT is a column vector, and vice versa
• In general:
columns of AT are rows of A
rows of AT are columns of A
• For a square matrix A this can be viewed as a flipping with
respect to the diagonal:
 a11

A   a21
a
 31
a12
a22
a32
a13 

a23 
a33 
 a11

T
A   a12
a
 13
a21
a22
a23
a31 

a32 
a33 
Properties of transpose operation
•
•
•
•
•
(AT)T = ?
(cA) T= ?
(A+B)T = ?
(AB)T = ?
(Ak)T= ?
Properties of transpose operation
•
•
•
•
•
(AT)T = A
(cA) T=cAT
(A+B)T = AT+ BT
(AB)T =BTAT
(Ak)T= (AT) k
• Note: in general AAT ≠ATA (exercise: find an
example!); square matrices that commute
with its transpose are called normal
Symmetric and skew-symmetric
matrices
• A square matrix is called
 Symmetric if AT = A
• Examples: distance matrix, adjacency matrix
 Skew-symmetric (or antisymmetric) if AT = -A
• Examples: matrices of some games
Symmetric and Skew-symmetric matrices
• (A+AT)T= AT + A = A + AT
• (AAT)T=(AT)TAT =AAT
A+AT and AAT are symmetric for any square A
• (A-AT)T=AT - A = -(A - AT)
A-AT is skew-symmetric for any square A
• Note: for any square matrix A we have
A=1/2(A+AT) + 1/2 (A-AT)
Symmetric matrices: Exercise
• Give an example of two symmetric 2x2
matrices whose product is not symmetric
• Prove that the product of two symmetric
square matrices A and B is symmetric if and
only if AB = BA
Related documents