4.6 Matrices Dimensions: Number of Rows and Columns a Is a 2 X 3 Matrix
Total Page:16
File Type:pdf, Size:1020Kb
Matrices are rectangular arrangements of data that are used to represent information in tabular form. 1 0 4 A = 3 - 6 8 a23 4.6 Matrices Dimensions: number of rows and columns A is a 2 x 3 matrix Elements of a matrix A are denoted by aij. a23 = 8 1 2 Data about many kinds of problems can often be represented by Matrix of coefficients matrix. Solutions to many problems can be obtained by solving e.g Average temperatures in 3 different cities for each month: systems of linear equations. For example, the constraints of a problem are represented by the system of linear equations 23 26 38 47 58 71 78 77 69 55 39 33 x + y = 70 A = 14 21 33 38 44 57 61 59 49 38 25 21 3 cities 24x + 14y = 1180 35 46 54 67 78 86 91 94 89 75 62 51 12 months Jan - Dec 1 1 rd The matrix A = Average temp. in the 3 24 14 city in July, a37, is 91. is the matrix of coefficient for this system of linear equations. 3 4 In a matrix, the arrangement of the entries is significant. Square Matrix is a matrix in which the number of Therefore, for two matrices to be equal they must have rows equals the number of columns. the same dimensions and the same entries in each location. •Main Diagonal: in a n x n square matrix, the elements a , a , a , …, a form the main Example: Let 11 22 33 nn diagonal of the matrix. x 4 3 4 •Symmetric matrix:If the corresponding elements X = 1 y Y = 1 6 match when we think of folding the matrix along the main diagonal, then z 0 2 w the matrix is symmetric about the main diagonal. If X = Y, then x = 3, y = 6, z = 2, and w = 0. In a symmetric matrix, aij = aji. 5 6 1 Example: The square matrix Matrix Operations 1 5 7 1. Scalar multiplication: A = 5 0 2 Multiply each entry of a matrix by a fixed single 7 2 6 Main Diagonal number called scalar. ex: The result of multiplying matrix 1 4 5 is symmetric. A = 6 - 3 2 by the scalar r = 3 is Note that a = a = 5 21 12 3 12 15 a = a = 7 A = 31 13 18 - 9 6 a32 = a23 = 2 7 8 2. Addition: 3. Subtraction: Adding the corresponding elements of 2 matrices defined by A – B = A + (-1)B. that have the same dimensions. ex: For In a zero matrix, all entries are 0. An n × m zero matrix is denoted by 0. 1 3 6 0 - 2 8 If A and B are n x m matrices and r and s are A = 2 0 4 B = 1 5 2 scalars, the following matrix equations are true: − 4 5 1 2 3 3 0 + A = A the matrix A+B is A + B = B + A (A + B) + C = A + (B + C) 1 1 14 r(A + B) = rA + rB A + B = 3 5 6 (r + s)A = rA + sA − 2 8 4 r(sA) = (rs)A 9 10 5 3 4. Multiplication of matrices: 2 4 3 Example: Let A = B = 2 2 4 −1 2 A: n × m matrix 6 5 The result C is an n × p matrix. B: m × p matrix 2 × 3 matrix 3 × 2 matrix m 5 3 2(5) + 4(2) + 3(6) 2 4 3 36 __ A • B = C, where cij = aik bkj = 10 + 8 + 18 ∑ 2 2 = k=1 4 −1 2 __ __ = 36 6 5 An entry in row i, column j of A • B is obtained 5 3 by multiplying elements in row i of A by the 2 4 3 36 29 2 2 = corresponding elements in column j of B and adding 4 −1 2 __ __ 6 5 the results. 5 3 Note that A is a 2 × 3 matrix 2 4 3 36 29 2 2 = and B is a 3 × 2 matrix. The To compute A times B, the number of columns in A 4 −1 2 30 20 6 5 product A • B is a 2 × 2 matrix. must equal the number of rows in B. 11 12 2 Example: Compute A • B and B • A for Where A, B and C are matrices of appropriate 1 4 3 6 dimensions and r and s are scalars, the following A = B = 6 − 2 3 4 matrix equations are true: 1(3) + 4(3) 1(6) + 4(4) 15 22 A • B = = (The notation A(B • C) is shorthand for A • (B • C) ) 6(3) + (−2)(3) 6(6) + (−2)(4) 12 28 A(B • C) = (A • B)C 3(1) + 6(6) 3(4) + 6(−2) 39 0 A(B + C) = A • B + A • C B • A = = 3(1) + 4(6) 3(4) + 4(−2) 27 4 (A + B)C = A • C + B • C rA • sB = (rs)(A • B) Note: A • B ≠ B • A . 13 14 Identity matrix An n × n matrix A is invertible if there exists an n × n The n × n matrix with 1s along the main diagonal and 0s matrix B such that elsewhere is called the identity matrix, denoted by I. If A • B = B • A = I we multiply I times any n × n matrix A, we get A as the result. The equation In this case B is called the inverse of A, denoted by A-1. I •A = A •I = A holds. Let −1 2 − 3 − 5 4 − 3 B = 10 − 7 6 A = 2 1 0 1 0 a11 a12 4 − 2 5 8 − 6 5 Let I = A = 0 1 a21 a22 Then, following the rules of matrix multiplication, it can 1(a ) + 0(a ) 1(a ) + 0(a ) a a 11 21 12 22 11 12 -1 I • A = = = A be shown that A • B = B • A = I, so B = A . 0(a11) +1(a21) 0(a12 ) +1(a22 ) a21 a22 Similarly, A • I=A. 15 16 Boolean Matrices Let A and B be Boolean matrices, Matrices with only 0s and 1s as entries are called 1 1 0 1 0 0 Boolean matrices. B = 1 1 1 A = 0 1 0 Boolean multiplication: x ∧ y = min(x,y) 0 0 1 0 0 1 Boolean addition: x ∨ y = max(x,y) Then 1 0 0 1 1 0 Boolean matrix multiplication A × B is defined by A ∧ B = 0 1 0 A ∨ B = 1 1 1 m 0 0 1 0 0 1 Cij = ∨ (aik ∧ bkj) k=1 A ∧ B: corresponding elements are combined using And the Boolean product A ×B is 1 1 1 Boolean multiplication. A× B = 1 1 1 A ∨ B: corresponding elements are combined using 0 0 1 Boolean addition. 17 18 3.