Baixe o app para aproveitar ainda mais
Prévia do material em texto
REVIEW OF MATRIX ALGEBRA MODULE 2 The purpose of this module is to provide a concise review of matrix operations and linear algebra. After studying this module the reader should be able to: Multiply lnatrices Find the transpose of a matrix Find the eigenvalues and eigenvectors of a matrix Understand concepts of rank and singularity The major sections of this module arc: 435 In this module we review only the essentials of matrix operation necessary to understand material presented in the chapters of this textbook. For more detailed explanation:'! and more advanced concepts, please consult any textbook on matrices or linear algebra. MATLAB is very useful for performing matrix operations. Module 1 provides a review of MATLAB. M2.1 M2.2 M2.3 M2.4 Motivation and Notation Common Matrix Operations Square Matrices Other Matrix Operations 436 M2.1 MOTIVATION AND NOTATION Review of Matrix Algebra Module 2 In the study of dynamic systems it is comillon to usc l1l<:ltrix BoUllion. The usc of matrix notation allows the compact representation of a system composed of many variables and equations. Matrices are two-dimensional arrays that contain scalar elements that can be either real or complex. In this module most or our examples involve real matrices. Consider the following matrix, which consists of n rows and In columns: r'" {{II ",.] A a2l (/n ([211I {ll/! {[n2 {fl/Ill where (lij represents the scalar clement in the ilh row andjth column of matrix A. It is a good habit to denote the numbers of rows and columns beneath the matrix as (n,rn) or (n x tn). For example, the following is a 2 x 3 matrix: A .~ I~ ~ ~I (2 X 3) A vec!oris a special case of a two~dimcnsionall1latrix. Normally, the use of the tcnn vec~ tor implies a column vector. The following is an example of a column vector of length :; (a 3 x I matrix), where Vi is an element of the vector: A row vector of length three is W o:c; [-WI 'tV! 'l.03J The convention of this textbook is to usc lower-case bold leUers to represent vectors and upper-case bold letters to represent matrices. Unless stated otherwise, it is assumed that a vector is a column vector. M2.2 COMMON MATRIX OPERATIONS M2.2.1 Matrix Addition Two matrices can be added by simply adding the individual elements of the matrix. The matrices must have the same number of rows and columns. The operation: C=A+B Sec. M2.2 Common Matrix Operations 437 is simply clcmcnt~by-e1cmenladdition to form a new matrix: (ij :,,"_c aij + b ij Clearly the order of matrices docs not matter for the addition operation (A + n :::;; B -I- A). Notice th:'ll the number of columns of B must be equal to the number of rows of A. The cl- clnenl in the ith row andjth colulllll of Cis: Consider an 11 x III matrix A and an r x nmatrix n. An ,. x m matrix C is defined as the product of H times A: (M2.1) 10 1691 IX12 = 14 II A (rxn)(nxm) X II31 [76 + 10 C ::::: (r x 111) 2 5 Cij = Hi] A Ii + Hi2 A 2j -1- ••• + BinAllj n Cij:O:;: 2: BikA kj k .1 c = I: For example, M2.2.2 Matrix Multiplication Notice that we can view this as an operation on row and column vectors within the matri- ces. That is, the ith clement in the jth column of C is equal to the scalar value that is ob- tained from "multiplying" the ith row of B times the jth column of A. C (",111) = H (r.lI) A (1I,1J1 ) Cd ijth clemenl Crm ilh row i jlh column 438 [,'or example, Review of Matrix Algebra Module 2 2 5c ,= [ ~ 1~)j /:11 12 (rows,cols) (3,2) (2,3) [ 7(1) + X(4) 7(2) + X(5) == 9(1) + 10(4) 9(2) + 10(5) 11(1) + 12(4) 11(2) + 12(5) (3,l) 7(3) + X(6) j 9(3) + 10(6) 11(3) + 12(6) [ 39 ~ 49 59 54 6X X2 69 jX7 lOS Clearly the order of the matrices arc important in multiplication. In the example above, BA is a consistent multiplication, while An is not Even for square matrices (where the number of rows is equal to the number of columlls), AU -::F- HA in general. M22.3 Transpose Let D be 11 transpose of the matrix A, then: D ~Af (M22) where (1) represents the transpose operation. The ij clement of Dis theji clement of A til} = {iji Columns become rows and rows become columns. For example, 2 5 3..16 A f ~ [~ ~j 3 6 It caIl he shown that the following property holds: (ABC)f = CTBTAT As noted earlier, we normally think of vectors as being column vectors. The transpose of a column vector is a row vector. Consider an n-dimensional vector x. The transpose of x is xT. and Xtl Diagonal matrices arc commonly used in weighted least squares (regression) problems. Matrix Q is diagonal if 439 n 2: '/l};Zj ;,,--1 Common Matrix Operations 2 1 r 2 2 Z['lD J Zj'lV2 Z l'l()\ ""'·123 ['w, 'W2 IlJtl l Z2~Vl Zz'!D2. 2 2103 Z z1DI/'W3 2,,'101 ZII'WZ Zn?Dj Zll1IJil Zn (II.! ) ( 1.11) (11,11) Notice that multiplication in the opposite order, zw1~ results in ann x n matrix: The vector transpose is often used to calculate a scalar function of two vectors. [)or CXHrll- pic, if wand z are column vectors, of length 11, the operation wTz results in a scalar value: M2.2.4 Diagonal Matrices Sec. M2.2 For example, Q = diag( I,3, 12) represents the following matrix: An identity matrix, I, is a diagonal matrix with ones on the diagonal and zeros off'~diagonal. OJo 12 o 3 o Qij 'Ii for i ~ j ~ 0 for; i j IDENTITY MATRIX [ii ~ I if ; ~ j oit' ; * j 'fhe 5 x 5 identity matrix is: [0= diag(l,I,I,J,I) 1 0 o 1 o 0 o 0 o 0 000 000 I 0 0 010 001 440 M2.3 SQUARE MATRICES Review of Matrix Algebra Module 2 A number of the important matrix operations lIsed in this textbook involve square (num- ber of rows equal number of columns) matrices. M2.3.1 Trace The trace of an n X n (square) matrix is simply the sum of its diagonal clements, " tr A :;0: 2: {lii ; 1. M2.3.2 Determinant (M13) One of the most important properties of a square matrix is the determinant. Consider <l 2 X 2 matrix: A ::::0 la" {/ '.2..1 a 21 an. The determinant of A is det A -_0 allan - {f21{f12 Sometimes the det A is written as IAI. An algorthim for finding the determinant of a larger matrix involves matrix cofactors and is shown below. M2.3.3 Minors and Cofactors of a Matrix The matrix formed by deleting the ith row and the jth column of the matrix A is the m;,/or of the clement aU' c1cnolcdM,j" Consider the 3 x 3 matrix: o [:::' au {I'llA an an•.1 (l31 (f-12 aD The minor of (lj2 of the matrix is obtained by deleting the first row and the second col- umn. In this case: ani o:u __ The detcrminant of the resulting matrix is: del MI2 0::0 (l21a:n - (1:-Han The cqj'actor is thc "signcd" valuc of the minor. That is, the cofactor is dcfined as: c co (- 1)" J del My - q (M2.4) (M2.S) Sec. M2.3 Square Matrices 441 The cofactor e l2 of the 3 X 3 example matrix is: e\2 cc_-., (~lY+jdctM12 =--= (~1)112(a21a:Bm_{{:l1an) = 112[ll:n + (l:lIa}} The determinant of a matrix call be found hy expanding ahout any row or column (this ap- proach is sometimes called the Laplace expansion). (i) Expanding around any columu j: " det A 2: {lijcij i"\ (ii) Expanding around any row i: (M2.6) (M2.7)"det A ::::: 2. {lljCij j.-.--.- 1 As an example, consider the 3 x 3 matrix A. The expansion around row 1 is det A = ([nCII + {f12et2 t- ajJen del A {[" ( .. I) I , I del M" + II 12( -- I)' ' 2 del M 12 + ([ lJ( - I) I ,; del Mil det A = all (az/l:1,J ~ (f12alT) -- aI2(a21ay~ ~ ({Jl{l2.1) -l-- {{lJ (a21 11:JJ. - ((31022) M2.3.4 Matrix Inversion The inverse of a square matrix A,is called A ! and is defined as: (M2.8) The matrix inverse is conceptually useful when finding x to solve the following problem: Ax~y Multiplying each side (onlheleft) by A', we find: A-I A x ~ (11 X 11)(11 X 11)(11 X I) A··' Y (II X 11)(11 X I) wbich yields: Tx~A ' y or, where the a(~i()intmatrix of A (adj A) is the transpose of the matrix of cofactofs of A. ESCOLA DE E,,~CENHARIA L,,,LI0Tt-:A (M2.9) (M2.IO) I adjAA --, del A x ~ A ly An algorithm for finding the inverse of an 11 x n matrix is known as Cramer's rule: In practice, this procedure is not used because the computational time is quite large t()r large matrices. Generally, a method such as Gaussian Elimination or LU decomposition is used. 442 Review of Matrix Algebra Module 2 EXAMPLE !VI2.1 Inversion of a 2 X 2 Matrix Using Cramer's Rule A = [all all] a21 an A I - adj A detA where the cofactofs arc ~ adj A = ,- an dctA .. ~a21 Cll -- (-l)l+ldetMlI = (1n e12 = (--I)) t2 dctMj2 = -a:?1 en -~ (-~"1 fl 1 det M21 -- ~ (l12 cn = (-ti l2 det Mn = all adj A = {c;Jr = [~~: ~~:r' = [~:~ A' The formula for the inverse of a 2 x 2 matrix should be committed to memory: A - [~ b]d [ d - b] 1 ~ d...ct A. a .. detA~E det A -b ]det A ....... 0 ... detA where de! A 00:; ad - be That is, ~wap the diagonal terms, take the negative of the off-diagonal terms, and divide by the determinant. Sec. M2.3 Square Matrices 443 M2.3.5 Other Issues in Matrix Inversion A singular matrix cannot be inverted. A matrix A is singular if det A :::: O. Also, a singular matrix has a rank that is lower than the dimension of the matrix. The rank of a matrix is the number of independent rows or columns. For example, the matrix: det A = 4 - 4 = 0 We note that the matrix inverse of a singular matrix does not exist. For this example, note the division by 0 in the following calculation has rank = I, because the second row is linearly dependent on the first row. The matrix is singular, because -21 1 .. d4 . 0 = undchne-2] I [44. detA = -2AI = I 4 -2 A = I~ ~] The rank of a square matrix is equal to the number of nonzero eigenvalues. Eigenvalues of a square matrix arc disclissed next M2.3.6 Eigenvalues and Eigenvectors Eigenvalue/eigenvector analysis will bc important when studying dynamic systcms. Eigenvalucs dctcrminc how "fast" a dynamic system responds, and thc associated eigen- vector indicates the "direction" of that response. This material is used in Chapter 5. Eigenvalue/eigenvector analysis can only be perrormed on square matrices. The eigenvector/eigenvalue problem is: (M211) where: A = A = ~ = matrix (square, number of rows::::: number of columns) cigenvalue (scalar) eigenvector (vector) Normally, we will usc the notation ~i to rcpresent the eigenvector that is associated v"ith eigenvaluc Ai' There are n eigenvalues and n eigenvectors associated with an II X 11 matrix. The interesting thing about equation (M2.11) is that a matrix times 11 vector is equal to a scalar times a vector. A scalar multiplying a vcctor docs not change its "direction" in n-dimensional space, only its magnitude. In this case, a matrix A times the cigenvector ~ yields the eigenvector ~ hack, scaled by A. Equation (M2.11) can be written as (AI - A)~ = () (M2.12) 444 Review of Matrix Algebra Module 2 where A must be a scalar value for which Al --- A IS singular, otherwise ~ :;;;; 0 (the trivial vector). A requirement for AJ - A to be singular is dctCAJ ~ A) :;;;; 0, where the notation det(AI - A) is used to represent the dctcnninant of l\!- A. EIGENVALUES The eigenvalues of an n X n matrix A arc the n scalars that solve: det(l\! - A) •.. 0 (M2.13) Equation (M2.13) is also known as the characteristic polynomial for the matrix A~ the eigenvalues arc the 1'001,0;; of the c1Ulractcristic polynomial. For an 11 X 11 matrix A, the char- acteristic polynomial will he nth order, so there will be II roots (n eigenvalues). EIGENVECTORS A The corresponding 11- eigenvectors (~) can be found from A ~i l\j ~i ~i is the eigenvector associated with the eigenvalue Ai- For example, consider the general 2 x 2 matrix: 1 1I'.l (Jizi (In (/22_ (M2.14) l\I-A 1 l\-II 11 .. ~(/Zl det(l\I - A) = (l\ - a,,)(l\ - II,,) - all "21 =. 0 det(l\I- A) = l\' - [1111 + lin] l\ + {alia" - a2l1l,,{ ~ 0 Equation CM2J5) can also be written as: det(l\! - A) ~ l\' - triA) l\ + det(A) ~ 0 where: triA) = all + a22 dct(A) = allan - anlln Equation (M2.16) is the characteristic polynomial for a 2 x 2 matrix. (M2.15) (M2.16) It can easily he shown that, if tr(A) < 0 and det(A) > 0, the roots (eigenvalues) of (M2.16) will be negative. Also, if det(A) '= 0, then one root (eigenvalue) will be zero. The reader should derive the following characteristic polynomial for a 3 x 3 matrix. (see student exercise 7). Sec. M2.3 Square Matrices 445 The characteristic equation for a J x 3 matrix is: det(Al- A) = A' - tr(A) A' + M A- dCl(A) = () where: tr(A) = (/Il + (/" + {/11 M c~ det Mil + del M" + det M11 :0::: "ntr:,>:,> -" (lJ211n + {lllaJ3 ~ {fJl((jJ + a lJ a 22 - {{12(f21 det A =0 (l11(a22{f:n - anil lz ) ~ {[12(an llJ:. - ((?,j(ln) + {/u(a2111:12 ~ (l:\1(fn) (M2.17) A The ROllth stability criterion (Chapters 5 and 9) can be Llsed to find the conditions on the polynomial coefficients that will yield negative roots (eigenvalues). The necessary condi- tion is that all of the polynomial coefficcnts arc positive. The necessary condition is then tr(A) < 0, M > 0, and dct(A) < O. The reader can usc the Routh stahility criterion to deter- mine the sufficient conditions for negative roots. EXAMPI..EM2.2 Eigenvalue/Eigellvector Calculation Consider the following matrix: ~ I~ -\ I dCl(,.I~A) ~ A' -[2~ 1[,. 1-[2(-1)-2(1)[ ~ IJ A! ,.~4cO F'rolll the quadratic equation: I I - 4( 4) I VI7 A +2 2 2 so, and A, ~ 2.5616 The first eigenvector is found from (M2.14): where we have lIsed the notation: (M2.1X) 446 Applying equation (M2.1S), I~ Review of Matrix Algebra Iv I1.5616 11'V21 Module 2 So the following fWD equations must be satisfied: 2V11 +V21 1.56J6v11 2V11 -- 021 = - 1.5616 'On which yield: 1J21 3.561 5 ~/)]l If we wish, we call arbitrarily select VII 1.0 and '/)21 = 3.56J5 1 II" I [ 1.0 I~, cc c }}n--- 3..l6!5 1M2. J9) Most complltcl:pal:kag~:"\~il] report cigyllycctors that have a unit norm (length:o:: J). If we divide 1M2. J 9) by V(1)" V+ (1',,)2 VI-:, 12.6841 3.6992, we rind that: o.W)}) 0.9628 An (~qllivalent solution is: 1 - O.2703j. 0.9628 The reader should show that: leads to: ~2 - I. '~I !]tv 10.8719]0.4896 Eigenvector problems arc easily solved used the eig [unction in MA'T'LAB (sec Mod- uleJ), as shO\vn below. a = 2 1 2 -1 v = d 0.8719 0.4896 2.:')616 o -0.2703 0.9628 o -1. 5616 Sec. M2.3 Square Matrices 447 Column i in the v matrix is the eigenvector associated with the ilh eigenvalue (which is the ith diagonal clement ill the d matrix). The trace and determinant can also be f(lUnd using MATLAB commands: » trace(a) an~; - 1 » det (a) ans ··4 M2.3.7 The Similarity Transform The similarity tran.~I()nn is uscful for understanding the dynamic behavior or linear sys- [ellls (sec Chapter 5). Recall the eigenvector/eigenvalue problem for a 2 x 2 matrix: (M2.20) (1112.21 ) Notice that equations (M2.20) and (M2.2l) can be written in the following form: AV VA where V is the matrix of eigenvectors: (1112.22) (M2.23) where: A is the matrix of eigenvalues: 1/)".1 1/)"11)21. and ~2 = v)~ ;\ °1A} .. (1112.24) Multiplying (M2.22) on the right side by VI we find A' V A V I (111225) r~quation (M2.25) will he useful when developing analytical solutions for sets of Iincar differential equations, and can be used for any n x II (square) matrix. 448 Review of Matrix Algebra Module 2 M2.4 OTHER MATRIX OPERATIONS M2.4.1Vector Norms It is quite natural to think of vectors as having a "length" property. This property is called a vector norm. The most common norl11 is the Euclidean norm. In two-dimensional space, the Euclidean norm is: II xII = V~; +~l Sometimes the Euclidian norm is called the 2-nonn, JJ x lb. In n-dimensional space, II X II, =Vx; + xi + ....•~.\;' = ~± xJ ,coj notice that the sum of the squares can be written as xTx , lhalis: and the 2-norm is then: IlxI12=~ M2.4.2 Orthogonality A column vector w is orthogonal to a column vector z if wTz = 0.0. For example, consider the 2-D vector l 1 "Iw= -O.S and the 2-D vector z (0.5,1) w (1,-0.5) xTz = [l ~O.Sl [O;S] = I(O.S) + (-O.S)1 .~ OJ) Notice that orthogonal vectors arc "perpendicular" to each other, as depicted below. Then M2.4.3 Normalized or Sl'aled Vectors Many times, we will scale vectors, so that they are !1onna/ized. A vector is normalized if it has a norm (length) of 1.0. Normalization is pcrformed by multiplying each c1ement_ or thc vector by I/vector norm. For a givcn vector, x, the scaled vector, U is u:::: X l/~ EXAIVIPLE M2.3 Vector Normalization Consider the vector x T = [l 21: Then, And, XIX [I 2JI~I~1+4c5 The normalized vector is F I~I ~ ~ [£;] A vector norm 011 RII is a function I1II :RII 4 R satisfying: 1. x:;t: 0 4 2. II (XX II 3. II X j YiI .,; II x II > 0 I (X III xii II x II + II y II Where CI.. is a scalar 'rriallglc inequality Common Vector Norms " I. II X Iii ~ 2: IXi I j······l 2. II X II, ~ (~ IXi If' 3. II x II,. (~ Ix, I") 1/,. 4. II x"" ~ max Ix, I l-norm (sum of absolute values) 2-norm, Euclidean Norm p-nonn oo-norm Notke that the p-norm includes all other vector norms EXAMPLE M2.4 Comparison of Norms Xl ~ [I -2 31 II x Ii, III I 121 + 131 ~ 6 !I X II, ~ (iJI' I 12/' + Im'/2 ~ 3742 Ilxt ~ max 1111.121, 1311 ~ 3 Ilxll,,, ~ (IJI'" + 1_21 '0 + 131 10)1/10 3.005 Notice that. as p .., =.11 X II" --> II x IL. 450 Review of Matrix Algebra SUMMARY Module 2 In this module we have provided a concise review of matrix operations. This material should be sufficient for most of the matrix operations used in the textbook. It is partiCLI- larly important that the reader understand: Matrix notation How to multiply matrices That an n X 11 matrix has n eigenvalues, which arc the 11 roots to the characteristic equation: det(~[ - A) ~ 0. That a matrix A is singular if the dct(A):::: O. A singular matrix docs not have an in- verse. A singular matrix is not full mnk. That the rank of a square matrix is equal to the number of nonzero eigenvalues STUDENT EXERCISES For problems 1-3, usc x" [~] I. Find x'. 2. l<ind xTx. 3. Find II x Ib 4. Perform the indicated matrix operations for the following matrices: f 3 A ~ 1 a. FindC ~ All b. Find [) ~ IliA c. Find E A 'll B~ [7 9 6 5 5. Solve for x as a fUllction of.y where: 6. Find the determinant of: v ~ [I . 2 1] x -1 7. Derive the characteristic polynomial (del (1\.1- A)) for a general 3 x 3 matrix: ["" 1112 11 11 ]A ... {/21 an ((21 ([-\I {lJ2 {lJl
Compartilhar