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 i-th row
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 340 360 450
Example: graph adjacency matrix Timmins 1 North Bay 2 Ottawa 3 4 Toronto
Matrix operations Multiplication by scalars Addition and subtraction Transpose
Multiplication by scalars Example: distance matrices in km and mi All entries are multiplied by 1/1.6 km NB T O 340 360 450 mi NB T O 340/1.6 360/1.6 450/1.6
Multiplication by scalars
Addition First Basket Apples Pears Red 3 5 Green 4 6 Second Basket 1 Green 10 3 Total Apples Pears Red 3+1 5+0 Green 4+10 6+3
Addition
Matrix miultiplication Example: 2 x 2 linear system Linear substitution
What system do we get in terms of y1 and y2? Substitution: What system do we get in terms of y1 and y2?
New Coefficient Matrix:
Matrix multiplication: 2 x 2 case
Matrix multiplication: 2 x 2 case Dot product:
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!
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
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
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!
Scalar matrices Matrix A is called scalar if A = aI for some real number a Exercise Prove that for a scalar n x n matrix A and for any n x n matrix B we have AB= BA = aB 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:
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