1.3 Matrices and Matrix Operations 1.3.1 De…Nitions and Notation Matrices Are Yet Another Mathematical Object
Total Page:16
File Type:pdf, Size:1020Kb
20 CHAPTER 1. SYSTEMS OF LINEAR EQUATIONS AND MATRICES 1.3 Matrices and Matrix Operations 1.3.1 De…nitions and Notation Matrices are yet another mathematical object. Learning about matrices means learning what they are, how they are represented, the types of operations which can be performed on them, their properties and …nally their applications. De…nition 50 (matrix) 1. A matrix is a rectangular array of numbers. in which not only the value of the number is important but also its position in the array. 2. The numbers in the array are called the entries of the matrix. 3. The size of the matrix is described by the number of its rows and columns (always in this order). An m n matrix is a matrix which has m rows and n columns. 4. The elements (or the entries) of a matrix are generally enclosed in brack- ets, double-subscripting is used to index the elements. The …rst subscript always denote the row position, the second denotes the column position. For example a11 a12 ::: a1n a21 a22 ::: a2n A = 2 ::: ::: ::: ::: 3 (1.5) 6 ::: ::: ::: ::: 7 6 7 6 am1 am2 ::: amn 7 6 7 =4 [aij] , i = 1; 2; :::; m, j =5 1; 2; :::; n (1.6) Enclosing the general element aij in square brackets is another way of representing a matrix A . 5. When m = n , the matrix is said to be a square matrix. 6. The main diagonal in a square matrix contains the elements a11; a22; a33; ::: 7. A matrix is said to be upper triangular if all its entries below the main diagonal are 0. 8. A matrix is said to be lower triangular if all its entries above the main diagonal are 0. 9. If all the entries of a square matrix are zero, except those entries on the main diagonal, then we say the matrix is a diagonal matrix. 10. The n n identity matrix is an n n matrix having ones on the main diagonal, and zeroes everywhere else. It is usually denoted In. 11. We say that two matrices are equal whenever they have the same dimen- sion, and their corresponding entries are equal. 1.3. MATRICES AND MATRIX OPERATIONS 21 De…nition 51 (row and column vectors) Vectors are special forms of ma- trices. 1. A row vector is a vector which has only one row. In other words, it is an 1 n matrix. 2. A column vector is a vector which has only one column. In other words, it is an m 1 matrix. Example 52 Here are some matrices 1 2 1. 5 2:5 is a 3 2 matrix. 2 0 1 3 4 5 1 2 3 2. 3 5 9 is a square (3 3) matrix. 2 p2 0 3 4 5 1 0 0 3. 0 1 0 is the 3 3 identity matrix. 2 0 0 1 3 4 5 1 3 5 4 0 2 6 4 4. 2 3 is a 4 4 upper triangular matrix. 0 0 2 1 6 0 0 0 5 7 6 7 4 5 1 2 5. 2 3 is a column vector. It is also a 4 1 matrix. 3 6 10 7 6 7 4 5 6. 5 0 2 is a row vector. It is also a 1 3 matrix. In the case of a vector, there is no need to use double subscripts. For example, instead of writing A = a11 a12 a13 a14 , we write A = a1 a2 a3 a4 . In the special case that m = n = 1, the matrix is a 1 1 matrix and may be written A = [a11] = [a] = a. In other words, subscripts are not needed. Since the matrix only has one entry, it is the same as a number (also called a scalar). 1.3.2 Operations on Matrices For each operation, we give the conditions under which the operation can be performed. We then explain how the operation is performed. For the remaining of this section, unless speci…ed otherwise, we assume that A = [aij] B = [bij] C = [cij] 22 CHAPTER 1. SYSTEMS OF LINEAR EQUATIONS AND MATRICES Addition and Subtraction Only matrices having the same size can be added or subtracted. The resulting matrix has the same size. To add (subtract) two matrices having the same size, simply add (sub- tract) the corresponding entries. In other words, if C = A + B, then cij = aij + bij. Same for subtraction. Example 53 Examples of matrix addition/subtraction. 1 3 5 2 4 5 1. 2 5 + 4 1 = 6 6 2 0 1 3 3 2 3 3 4 5 1 2 1 1 1 2. 3 4 2 2 2 Cannot be done, the matrices do not have the 2 5 6 3 2 3 3 3 3 4same dimension.5 4 5 Scalar Multiplication This is multiplication of a matrix by a number. This operation can always be done. The result is a matrix of the same size. Simply multiply each entry of the matrix by the number. Example 54 Examples of multiplication of a matrix by a scalar. 1 0 4 0 1. 4 2 1 = 8 4 2 3 10 3 2 12 40 3 4 5 4 5 a a a a 2. 11 12 = 11 12 a21 a22 a21 a22 Multiplication of a Row Vector by a Column Vector The row and column vector must have the same number of elements. This means that if the …rst vector has n entries (that is is a 1 n matrix), then the second vector must also have n entries (that is must be a n 1 matrix). The result is a 1 1 matrix or a scalar. 1.3. MATRICES AND MATRIX OPERATIONS 23 b1 b2 Suppose that A = a1 a2 ::: an and B = 2 3. Then : 6 bn 7 6 7 4 5 AB = a1b1 + a2b2 + :::anbn n = aibi i=1 X You will note that the result is a scalar. Example 55 Examples of multiplication of a row vector by a column vector. 2 1 1. 1 3 5 7 2 3 = [1 2 + 3 1 + 5 5 + 7 10] = 100 5 6 10 7 6 7 4 5 1 2 2. 1 3 5 . This cannot be done, the vectors do not have the same 2 3 3 6 4 7 6 7 number of elements.4 5 Matrix Multiplication Let us assume that A is m p and B is q n. The product of A and B, denoted AB can be performed only if p = q. In other words, the number of columns of the …rst matrix, A must be the same as the number of rows of the second matrix, B. In the case p = q, then AB is a new matrix. Its size is m n. In summary, if we put next to each other the dimensions of the matrices we are trying to multiply, in this case m p and q n, then we see that we can do the multiplication if the inner numbers (pand q) are equal. The size is given by the outer numbers (m and n). Matrix multiplication is a little bit more complicated than the other oper- ations. We explain it by showing how each entry of the resulting matrix is obtained. Let us assume that A = [aij] is m p and B = [bij] is p n. Let C = [cij] = AB. Then, C is a m n matrix. cij is obtained by multiplying the ith row of A by the jth column of B. In other words, p cij = aikbkj, i = 1; 2; :::; m, j = 1; 2; :::; n k=1 X 24 CHAPTER 1. SYSTEMS OF LINEAR EQUATIONS AND MATRICES Remark 56 Because of the condition on the sizes of the matrices, one can see easily that matrix multiplication will not be commutative. For example, if A is 3 4 and B is 4 5 then one can compute AB. Its size will be 3 5. However, BA cannot be computed. Even in cases when both AB and BA can be computed, they are unlikely to be the same. For example 1 2 3 1 1 1 14 14 14 2 3 4 2 2 2 = 20 20 20 2 3 4 5 3 2 3 3 3 3 2 26 26 26 3 4 5 4 5 4 5 but 1 1 1 1 2 3 6 9 12 2 2 2 2 3 4 = 12 18 24 2 3 3 3 3 2 3 4 5 3 2 18 27 36 3 4 5 4 5 4 5 Example 57 Examples of matrix multiplication. 1 2 3 1 1 1 14 14 14 1. 2 3 4 2 2 2 = 20 20 20 2 3 4 5 3 2 3 3 3 3 2 26 26 26 3 4 5 4 9 3 5 4 5 1 2 3 4 4 1 1 0 0 17 3 2. 3 2 1 4 4 2 = 0 1 0 2 1 3 6 3 2 7 1 1 3 2 0 0 1 3 4 4 4 5 4 5 4 5 1 2 3 x x + 2y + 3z 3. 3 2 1 y = 3x + 2y + z 2 1 3 6 3 2 z 3 2 x + 3y + 6z 3 4 5 4 5 4 5 1 1 1 1 2 3 2 2 2 4. 2 3 4 cannot be done (why?) 2 3 3 3 3 2 3 4 5 3 6 4 4 4 7 4 5 6 7 4 5 1 2 3 1 0 0 1 2 3 5.