Successfully reported this slideshow.
Matrix Algebra Basics       By Nittaya NoinanKanchanapisekwittayalai phechabun              M.4
Algebra
Matrix Algebra• Matrix algebra is a means of expressing large  numbers of calculations made upon ordered sets of  numbers....
Matrix (Basic Definitions)    An m × n matrix A is a rectangular array ofnumbers with m rows and n columns. (Rows arehoriz...
MatrixA matrix is any doubly subscripted array ofelements arranged in rows and columns.       a11 , , a1n       a 21 , , a...
Definitions - Matrix• A matrix is a set of rows and columns of  numbers           1 2 3                  4 5 6• Denoted wi...
Definitions - scalar• scalar - a number  – denoted with regular type as is scalar algebra  – [1] or [a]
Definitions - vector• vector - a single row or column of numbers   – denoted with bold small letters   – row vector a =   ...
Row Vector[1 x n] matrix     A a1 a2 , , an    aj
Column Vector[m x 1] matrix                 a1                 a2        A             ai                 am
Special matrices• There are a number of special matrices  – Square  – Diagonal  – Symmetric  – Null  – Identity
Square matrix• A square matrix is just what it sounds like, an nxn matrix                  a11   a12   a13   a14          ...
Square MatrixSame number of rows andcolumns             5 4 7    B        3 6 1             2 1 3
Diagonal Matrices– A diagonal matrix is a square matrix that has  values on the diagonal with all off-diagonal  entities b...
Symmetric Matrix• All of the elements in the upper right portion of  the matrix are identical to those in the lower  left....
Identity Matrix• The identity matrix I is a diagonal matrix  where the diagonal elements all equal one.  It is used in a f...
Null Matrix• A square matrix where all elements equal zero.                      0     0   0   0                      0   ...
Types of Matrix• Identity matrices - I                • Symmetric                      1   0    0   0            ab c     ...
TheIdentity
Identity MatrixSquare matrix with ones on thediagonal and zeros elsewhere.            1 0 0 0            0 1 0 0    I     ...
Operations with Matrices (Transpose)TransposeThe transpose, AT , of a matrix A is the matrix obtained from A bywriting its...
The Transpose of a Matrix At• Taking the transpose is an operation that  creates a new matrix based on an existing  one.• ...
Transpose Matrix     Rows become columns and     columns become rows    a11 , a12 ,    , a1n             a11 , a 21 , , an...
Example of a transpose      1 4               t   1 2 3  A   2 5 ,A                   4 5 6      3 6
The Transpose of a Matrix At• If A = At, then A is symmetric (i.e. correlation matrix)• If A AT = A then At is idempotent ...
Transpose Matrix    Ex 1     1     2                           T   1 3   1A    3     0           A      1 4               ...
Transpose Matrix    Ex 2    4   1    4 3                4   0   2B   0    1 3 1             BT   1    1 7    2   7 5 2    ...
Matrix Equality• Two matrices are equal iff (if and only if) all of  their elements are identical• Note: your data set is ...
Matrix EqualityEx1. Assume A = B             find x , y ,z               1       2             x    2       A       3 0   ...
Matrix EqualityEx2. Assume C = D               find x , y ,z      x         y   1     4 3              4     1    4 3C    ...
Matrix Operations•   Addition and Subtraction•   Multiplication•   Transposition•   Inversion
Matrix Addition   A new matrix C may be defined as the   additive combination of matrices A and   B where: C = A + B   is ...
Addition             a11 a12       AIf           a 21 a 22             b11 b12and    B             b 21 b 22              ...
If A and B are both m n matrices then the sum of Aand B, denoted A + B, is a matrix obtained by addingcorresponding elemen...
Matrix Addition Example          3 4   1 2     4 6A    B                         C          5 6   3 4     8 10
A B   B    A A (B C)       ( A B) C
Addition and Subtraction (cont.)                a11   b11    c11• Where         a12   b12    c12                a21   b21 ...
Matrix Subtraction       C = A - B       Is defined byCij                 Aij               BijNote: all three matrices ar...
Subtraction                a11 a12       AIf              a 21 a 22                b11 b12and    B                b 21 b 2...
Addition and Subtraction (cont.)                a11    b11   c11• Where         a12    b12   c12                a 21   b21...
Operations with Matrices (Scalar Multiple)Scalar MultipleIf A is a matrix and r is a number (sometimescalled a scalar in t...
Scalar Multiplication• To multiply a scalar times a matrix, simply  multiply each element of the matrix by the  scalar qua...
If A is an m n matrix and s is a scalar, then we let kA denote the matrix obtained by multiplying every element of A by k....
The m n zero matrix, denoted 0, is the m   nmatrix whose elements are all zeros.  0 0                          0 0 0  0 0 ...
Operations with Matrices (Product)ProductIf A has dimensions k × m and B has dimensions m × n, then the productAB is defin...
Matrix Multiplication (cont.)• To multiply a matrix times a matrix, we write     • A times B as AB• This is pre-multiplyin...
Matrix Multiplication (cont.)• In order to multiply matrices, they must be  conformable (the number of columns in A  must ...
Matrix Multiplication (cont.)• The general rule for  matrix multiplication  is:      Ncij         aik bkj wherei 1,2,...,M...
Matrix MultiplicationMatrices A and B have these dimensions:      [r x c] and [s x d]
Matrix MultiplicationMatrices A and B can be multiplied if:         [r x c] and [s x d]                 c=s
Matrix MultiplicationThe resulting matrix will have the dimensions:           [r x c] and [s x d]                   rxd
Computation: A x B = C             a11 a12    A                        [2 x 2]             a 21 a 22            b11 b12 b1...
Computation: A x B = C         2 3                                           111A       11        and B                   ...
Computation: A x B = C         2 3                                        111A       11        and B                      ...
The multiplication of matrices is easier shown than put into words. You multiply the rows of the first matrix with the col...
Find AB                                            2     4            3      2    1      A                             B  ...
To multiply matrices A and B   look at their dimensions    m n                n p          MUST BE          SAME          ...
Now let’s look at the product BA.                2     4             3    2    1                                A         ...
PROPERTIES OF MATRIX               MULTIPLICATION            A BC  AB C            A B C AB AC            A B C AC BC     ...
2   1 2          Multiplying a        What is AI?       0   1 5    A    matrix by the                          1 0 0      ...
Matrix multiplication is not             Commutative• AB does not necessarily equal BA• (BA may even be an impossible oper...
Yet matrix multiplication is Associative• A(BC) = (AB)C
Laws of Matrix Algebra• The matrix addition, subtraction, scalar multiplication and matrix  multiplication, have the follo...
An example - cont• Since the matrix product is a scalar found by  summing the elements of the vector squared.
Determinants• Determinant is a scalar    – Defined for a square matrix    – Is the sum of selected products of the element...
Determinants                                                                              a b• The determinant of a 2 ×2 m...
The Determinant of a Matrix• The determinant of a matrix A is denoted by  |A|.• Determinants exist only for square matrice...
The Determinant for a 2x2 matrix• If A =              a11   a12              a21 a22• Then              A       a11a22 a12...
The Determinant for a 3x3 matrix• If A =                      a11   a12   a13                      a21   a22   a23        ...
Determinants• For 4 x 4 and up dont try. For those  interested, expansion by minors and cofactors  is the preferred method...
Properties of Determinates• Determinants have several mathematical properties  which are useful in matrix manipulations.  ...
Properties of Determinates– 6.     |A| remains unchanged if each element of  a row or each element multiplied by a constan...
Matrix DivisionWe have seen that for 2x2 (“two by two”)matrices A and B then AB BATo divide matrices we need to definewhat...
Inverse MatrixIn numbers, the inverse of 3 is 1/3 = 3-1In algebra, the inverse of a is 1/a = a-1In matrices, the inverse o...
Inverse MatrixIn matrices, the inverse of A is A-1A-1 is defined so that A A-1 = A-1 A = IHowever, for a square matrix A t...
Inverse MatrixIn matrices, the inverse of A is A-1A-1 is defined so that A A-1 = A-1 A = IA square matrix A has an inverse...
Inverse MatrixA-1 is defined so that A A-1 = A-1 A = IIf A-1 does exist the the solution to AX=B is                       ...
Inverse Matrix                        AX = BPre-multiply by A-1         A-1AX = A-1BBut A-1A = I so          IX = A-1B    ...
Inverse MatrixIf the inverse of A is A-1 then the inverseof A-1 is A. This is because if AC = I thenCA = I, and also any m...
General Inverse Matrix     a b                   1   u v   1 d     bC                  let C     c d                      ...
Inverse of a Matrix• Definition. If A is a square matrix, i.e., A has dimensions n×n. Matrix A is  nonsingular or invertib...
Calculation of Inversion using DeterminantsDef: For any n n matrix A, let Cij denote the (i,j)thcofactor of A, that is, (-...
Calculation of Inversion using Determinants                                                                               ...
Calculation of Inversion using Gaussian Elimination Elementary row operations:     o Interchange two rows of a matrix    ...
Calculation of inversion using Gaussian elimination       a11 ,     , a1n                       a11 ,   , a1n 1 0  0     ...
Example            1 1      1                                                       1 1 1 |1 0 0     A     12 2       3   ...
Can we find a matrix to multiply the firstmatrix by to get the identity?                               1             3    ...
If A has an inverse we say that A is nonsingular.If A-1 does not exist we say A is singular. To find the inverse of a matr...
1     3                  7    3A                       A   1        2     7                  2    1    Check this answer b...
Inversion
We can use A-1 to solve a system of equationsx 3y 1            To see how, we can re-write a                  system of eq...
Ax               b         left multiply both                                 sides by the                                ...
x 3y 1                      1 3   find the                        A     2x 5 y 3                    2 5   inverse         ...
Systems of Equations in Matrix FormThe system of linear equations          a11 x1 a12 x2 a13 x3  a1n xn b1               ...
Example: solve the linear system       4x y 2z 4                                       5x 2 y z 4                         ...
Matrix Inversion    1                    1B B                 BB               ILike a reciprocal        Like the number o...
Linear System of Simultaneous Equations  First precinct: 6 arrests last week equally divided  between felonies and misdeme...
Solution                 Note:                                            11                                            21...
General Form n equations in n variables: n     aij xj      bi     or     Ax            bj 1unknown values of x can be foun...
งานนำเสนอMatrix
งานนำเสนอMatrix
Upcoming SlideShare
Loading in …5
×

งานนำเสนอMatrix

632 views

Published on

presentation Matrix

Published in: Technology, Education
  • Be the first to comment

งานนำเสนอMatrix

  1. 1. Matrix Algebra Basics By Nittaya NoinanKanchanapisekwittayalai phechabun M.4
  2. 2. Algebra
  3. 3. Matrix Algebra• Matrix algebra is a means of expressing large numbers of calculations made upon ordered sets of numbers.• Often referred to as Linear Algebra• Many equations would be completely intractable if scalar mathematics had to be used. It is also important to note that the scalar algebra is under there somewhere.
  4. 4. Matrix (Basic Definitions) An m × n matrix A is a rectangular array ofnumbers with m rows and n columns. (Rows arehorizontal and columns are vertical.) The numbersm and n are the dimensions of A. The numbers inthe matrix are called its entries. The entry in row iand column j is called aij . a11 , , a1n a21 , , a2 n A Aij ak 1 , , akn 4
  5. 5. MatrixA matrix is any doubly subscripted array ofelements arranged in rows and columns. a11 , , a1n a 21 , , a 2nA Aij am1 , , am n
  6. 6. Definitions - Matrix• A matrix is a set of rows and columns of numbers 1 2 3 4 5 6• Denoted with a bold Capital letter• All matrices (and vectors) have an order - that is the number of rows x the number of columns.• Thus A = 1 2 3 4 5 6 2x3
  7. 7. Definitions - scalar• scalar - a number – denoted with regular type as is scalar algebra – [1] or [a]
  8. 8. Definitions - vector• vector - a single row or column of numbers – denoted with bold small letters – row vector a = 1 2 3 4 5 – column vector x = x1 x2 x3 x4 x5
  9. 9. Row Vector[1 x n] matrix A a1 a2 , , an aj
  10. 10. Column Vector[m x 1] matrix a1 a2 A ai am
  11. 11. Special matrices• There are a number of special matrices – Square – Diagonal – Symmetric – Null – Identity
  12. 12. Square matrix• A square matrix is just what it sounds like, an nxn matrix a11 a12 a13 a14 a21 a22 a23 a24 a31 a32 a33 a34 a41 a42 a43 a44• Square matrices are quite useful for describing the properties or interrelationships among a set of things – like a data set.
  13. 13. Square MatrixSame number of rows andcolumns 5 4 7 B 3 6 1 2 1 3
  14. 14. Diagonal Matrices– A diagonal matrix is a square matrix that has values on the diagonal with all off-diagonal entities being zero. a11 0 0 0 0 a22 0 0 0 0 a33 0 0 0 0 a44
  15. 15. Symmetric Matrix• All of the elements in the upper right portion of the matrix are identical to those in the lower left.• For example, the correlation matrix
  16. 16. Identity Matrix• The identity matrix I is a diagonal matrix where the diagonal elements all equal one. It is used in a fashion analogous to multiplying through by "1" in scalar math. 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
  17. 17. Null Matrix• A square matrix where all elements equal zero. 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0• Not usually ‘used’ so much as sometimes the result of a calculation. – Analogous to “a+b=0”
  18. 18. Types of Matrix• Identity matrices - I • Symmetric 1 0 0 0 ab c 1 0 0 1 0 0 bd e 01 0 0 1 0 c e f 0 0 0 1 – Diagonal matrices are (of• Diagonal course) symmetric – Identity matrices are (of 1 0 0 0 course) diagonal 0 2 0 0 0 0 1 0 0 0 0 4
  19. 19. TheIdentity
  20. 20. Identity MatrixSquare matrix with ones on thediagonal and zeros elsewhere. 1 0 0 0 0 1 0 0 I 0 0 1 0 0 0 0 1
  21. 21. Operations with Matrices (Transpose)TransposeThe transpose, AT , of a matrix A is the matrix obtained from A bywriting its rows as columns. If A is an k×n matrix and B = AT thenB is the n×k matrix with bij = aji. If AT=A, then A is symmetric.Example: T a11 a21 a11 a12 a13 a12 a22 a21 a22 a23 a13 a23 It it easy t overify: (A B)T AT B T , (A B)T AT BT , (AT )T A, (rA)T rAT where A and B are k n and r is a scalar. Let C be a k m mat rixand D be an m n mat rix. hen, T (CD)T DT C T ,
  22. 22. The Transpose of a Matrix At• Taking the transpose is an operation that creates a new matrix based on an existing one.• The rows of A = the columns of At• Hold upper left and lower right corners and rotate 180 degrees.
  23. 23. Transpose Matrix Rows become columns and columns become rows a11 , a12 , , a1n a11 , a 21 , , an1 a 21 , a 22, , a 2n a12 , a 22 , , an 2A A t am1 , am 2 , amn a1m, a 2 m , , anm
  24. 24. Example of a transpose 1 4 t 1 2 3 A 2 5 ,A 4 5 6 3 6
  25. 25. The Transpose of a Matrix At• If A = At, then A is symmetric (i.e. correlation matrix)• If A AT = A then At is idempotent – (and A = A)• The transpose of a sum = sum of transposes• The transpose of a product = the product of the transposes in reverse order (A B C) t At Bt Ct
  26. 26. Transpose Matrix Ex 1 1 2 T 1 3 1A 3 0 A 1 4 2 0 4 (3 2) (2 3)
  27. 27. Transpose Matrix Ex 2 4 1 4 3 4 0 2B 0 1 3 1 BT 1 1 7 2 7 5 2 4 3 5 (3 4) 3 1 2 (4 3)
  28. 28. Matrix Equality• Two matrices are equal iff (if and only if) all of their elements are identical• Note: your data set is a matrix.
  29. 29. Matrix EqualityEx1. Assume A = B find x , y ,z 1 2 x 2 A 3 0 ,B 3 y 1 4 z 4Solution. If A = B that mean x = 1 y = 0 z = -1
  30. 30. Matrix EqualityEx2. Assume C = D find x , y ,z x y 1 4 3 4 1 4 3C 0 1 3 1 ,D 0 1 3 1 2 7 5 2 y 7 5 zSolution. If C = D that mean y = 2 , z = 2 and x + y = 4 thus x + 2 = 4 then x = 2
  31. 31. Matrix Operations• Addition and Subtraction• Multiplication• Transposition• Inversion
  32. 32. Matrix Addition A new matrix C may be defined as the additive combination of matrices A and B where: C = A + B is defined by: Cij Aij BijNote: all three matrices are of the same dimension
  33. 33. Addition a11 a12 AIf a 21 a 22 b11 b12and B b 21 b 22 a11 b11 a12 b12then C a 21 b 21 a 22 b22
  34. 34. If A and B are both m n matrices then the sum of Aand B, denoted A + B, is a matrix obtained by addingcorresponding elements of A and B.corresponding elements of A and B. add addadd add add these add these these 0 4 3 111 these 222 22theseB 2these 33 300 0 44 4 AA 1 A 0 1 22 22 111 333 B B 2 33 00 444 B 1 B 2 21 1 4 4 A 00 A 0 B 2 1 4 11 33 2 1 4 0 2 1 4 2 2 22 22 6 A AA B BB 22 2 2 2 6 66 A AA B BB 2 0 1 22 0
  35. 35. Matrix Addition Example 3 4 1 2 4 6A B C 5 6 3 4 8 10
  36. 36. A B B A A (B C) ( A B) C
  37. 37. Addition and Subtraction (cont.) a11 b11 c11• Where a12 b12 c12 a21 b21 c 21 a22 b22 c 22 a31 b31 c31 a32 b32 c32• Hence 1 2 4 6 5 8 3 4 4 6 7 10 5 6 4 6 9 12
  38. 38. Matrix Subtraction C = A - B Is defined byCij Aij BijNote: all three matrices are of the same dimension
  39. 39. Subtraction a11 a12 AIf a 21 a 22 b11 b12and B b 21 b 22then a11 b11 a12 b12 C a 21 b21 a 22 b22
  40. 40. Addition and Subtraction (cont.) a11 b11 c11• Where a12 b12 c12 a 21 b21 c 21 a 22 b22 c 22 a 31 b31 c31 a 32 b32 c32• Hence 1 2 4 6 3 4 3 4 4 6 1 2 5 6 4 6 1 0
  41. 41. Operations with Matrices (Scalar Multiple)Scalar MultipleIf A is a matrix and r is a number (sometimescalled a scalar in this context), then the scalarmultiple, rA, is obtained by multiplying everyentry in A by r. In symbols, (rA)ij = raij .Example: 3 4 1 6 8 2 2 6 7 0 12 14 0 41
  42. 42. Scalar Multiplication• To multiply a scalar times a matrix, simply multiply each element of the matrix by the scalar quantity a11 a12 2a11 2a12 2 a21 a22 2a21 2a22
  43. 43. If A is an m n matrix and s is a scalar, then we let kA denote the matrix obtained by multiplying every element of A by k. This procedure is called scalar multiplication. 1 2 2 31 3 2 3 2 3 6 6A 3A 0 1 3 30 3 1 33 0 3 9 PROPERTIES OF SCALAR MULTIPLICATION k hA kh A k h A kA hA k A B kA kB
  44. 44. The m n zero matrix, denoted 0, is the m nmatrix whose elements are all zeros. 0 0 0 0 0 0 0 1 3 2 2 A 0 A A ( A) 0 0 A 0
  45. 45. Operations with Matrices (Product)ProductIf A has dimensions k × m and B has dimensions m × n, then the productAB is defined, and has dimensions k × n. The entry (AB)ij is obtainedby multiplying row i of A by column j of B, which is done by multiplyingcorresponding entries together and then adding the results i.e., b1 j b2 j ( ai1 ai 2 ... aim ) ai1b1 j ai 2b2 j ... aimbmj .  bmj Exam ple a b aA bC aB bD A B c d . cA dC cB dD C D e f eA fC eB fD 1 0 0 0 1 0 Ident it ym at rixI for any m n m at rixA, AI A and for    0 0 1 n n any n m m at rixB, IB B.
  46. 46. Matrix Multiplication (cont.)• To multiply a matrix times a matrix, we write • A times B as AB• This is pre-multiplying B by A, or post- multiplying A by B.
  47. 47. Matrix Multiplication (cont.)• In order to multiply matrices, they must be conformable (the number of columns in A must equal the number of rows in B.)• an (mxn) x (nxp) = (mxp)• an (mxn) x (pxn) = cannot be done• a (1xn) x (nx1) = a scalar (1x1)
  48. 48. Matrix Multiplication (cont.)• The general rule for matrix multiplication is: Ncij aik bkj wherei 1,2,...,M , and j 1,2,...,P k 1
  49. 49. Matrix MultiplicationMatrices A and B have these dimensions: [r x c] and [s x d]
  50. 50. Matrix MultiplicationMatrices A and B can be multiplied if: [r x c] and [s x d] c=s
  51. 51. Matrix MultiplicationThe resulting matrix will have the dimensions: [r x c] and [s x d] rxd
  52. 52. Computation: A x B = C a11 a12 A [2 x 2] a 21 a 22 b11 b12 b13 B [2 x 3] b 21 b 22 b 23 a11b11 a12b21 a11b12 a12b22 a11b13 a12b23C a 21b11 a 22b21 a 21b12 a 22b22 a 21b13 a 22b23 [2 x 3]
  53. 53. Computation: A x B = C 2 3 111A 11 and B 1 0 2 1 0 [3 x 2] [2 x 3] A and B can be multiplied 2 *1 3 *1 5 2 *1 3 * 0 2 2 *1 3 * 2 8 528C 1*1 1*1 2 1*1 1* 0 1 1*1 1* 2 3 213 1*1 0 *1 1 1*1 0 * 0 1 1*1 0 * 2 1 111 [3 x 3]
  54. 54. Computation: A x B = C 2 3 111A 11 and B 1 0 2 1 0 [3 x 2] [2 x 3] Result is 3 x 3 2 *1 3 *1 5 2 *1 3 * 0 2 2 *1 3 * 2 8 528C 1*1 1*1 2 1*1 1* 0 1 1*1 1* 2 3 213 1*1 0 *1 1 1*1 0 * 0 1 1*1 0 * 2 1 111 [3 x 3]
  55. 55. The multiplication of matrices is easier shown than put into words. You multiply the rows of the first matrix with the columns of the second adding products Find AB 2 4 3 2 1 A B 1 3 0 4 1 3 13 22 3 22 11 1 3 5First we multiply across the first row and down thefirst column adding products. We put the answer inthe first row, first column of the answer.
  56. 56. Find AB 2 4 3 2 1 A B 1 3 0 4 1 3 1 5 77 5 AB AB 0034 4 442313 3 1 1 3 7 1 0 24 4 3 3 4 0 2 2 1 1 11 1 1 11Notice the sizes of A and B and the size of the product AB.Now we multiplyacross first first androw and downNow we multiply across the row rowrow and down We multiplied across the second down first the second and downthe second column we’ll put the the answerthe thesecond column andand we’ll put answer in the firstthe first column and the answer inanswer in in column so we put we’ll put the the firstsecond row, first column.row, second second column.second row, column. row, first column.
  57. 57. To multiply matrices A and B look at their dimensions m n n p MUST BE SAME SIZE OF PRODUCTIf the number of columns of A does notequal the number of rows of B then the product AB is undefined.
  58. 58. Now let’s look at the product BA. 2 4 3 2 1 A B 1 3 0 4 1 3 1 32232 2 3 10404 1012 1111 3 21 3340 4 962 321 1 4 11 43 4 14 3 2 2 3across third row 66 12 6 12 6 12 12 12 222 2as we first rowacrossgo down across first row third row secondthird asgodownas wecoluacross row we go as wego down BA BA BA BA 33 14 BA 3 14 14 44 4first column: as secondrowsecondfirst first second downcolumn: thirdcolumn: column:we go downcolumn: column: 9 10 9 10 4 Commuters Beware!third column:mn:Completely different than AB! AB BA
  59. 59. PROPERTIES OF MATRIX MULTIPLICATION A BC AB C A B C AB AC A B C AC BC AB BAIs it possible for AB = BA ? ,yes it is possible.
  60. 60. 2 1 2 Multiplying a What is AI? 0 1 5 A matrix by the 1 0 0 2 2 3 identity gives the matrix back I3 2011 0 2 again. What is IA? 0 1 5 A 1 0 0 2 1 2 20 2 0 3 1A 0 1 5 I3 0 1 0 2 2 3 0 0 1 an n n matrix with ones on the main diagonal and zeros elsewhere
  61. 61. Matrix multiplication is not Commutative• AB does not necessarily equal BA• (BA may even be an impossible operation)
  62. 62. Yet matrix multiplication is Associative• A(BC) = (AB)C
  63. 63. Laws of Matrix Algebra• The matrix addition, subtraction, scalar multiplication and matrix multiplication, have the following properties. Associat iv Laws : e A (B C) (A B) C, (AB)C A(BC). Commutativ Law for Addit ion: e A B B A Dist ributi Laws : ve A(B C) AB AC, (A B)C AC BC.
  64. 64. An example - cont• Since the matrix product is a scalar found by summing the elements of the vector squared.
  65. 65. Determinants• Determinant is a scalar – Defined for a square matrix – Is the sum of selected products of the elements of the matrix, each product being multiplied by +1 or -1 a11 a12  a1n a21 a22  a2 n n i j n det( A) aij ( 1) M ij aij ( 1)i j M ij     j 1 i 1 an1 an 2  ann • Mij=det(Aij), Aij is the (n-1) (n-1) submatrix obtained by deleting row i and column j from A.
  66. 66. Determinants a b• The determinant of a 2 ×2 matrix A is det(A) ad bc c d• The determinant of a 3 ×3 matrix is a11 a12 a13 11 a22 a23 12 a21 a23 13 a21 a22 a21 a22 a23 a11 ( 1) a12 ( 1) a13 ( 1) a32 a33 a31 a33 a31 a32 a31 a32 a33 Example 1 2 3 5 6 4 6 4 5 4 5 6 1( 1)1 1 2( 1)1 2 3( 1)1 3 8 10 7 10 7 8 7 8 10 50 48 2(40 42) 3(32 35) 3 • In Matlab: det(A) = det(A)
  67. 67. The Determinant of a Matrix• The determinant of a matrix A is denoted by |A|.• Determinants exist only for square matrices.• They are a matrix characteristic, and they are also difficult to compute
  68. 68. The Determinant for a 2x2 matrix• If A = a11 a12 a21 a22• Then A a11a22 a12a21• That one is easy
  69. 69. The Determinant for a 3x3 matrix• If A = a11 a12 a13 a21 a22 a23 a31 a32 a33• Then A a11a22a33 a11a23a32 a12a23a31 a12a21a33 a13a21a32 a13a22a31
  70. 70. Determinants• For 4 x 4 and up dont try. For those interested, expansion by minors and cofactors is the preferred method.• (However the spaghetti method works well! Simply duplicate all but the last column of the matrix next to the original and sum the products of the diagonals along the following pattern.)
  71. 71. Properties of Determinates• Determinants have several mathematical properties which are useful in matrix manipulations. – 1 |A|=|A|. – 2. If a row of A = 0, then |A|= 0. – 3. If every value in a row is multiplied by k, then |A| = k|A|. – 4. If two rows (or columns) are interchanged the sign, but not value, of |A| changes. – 5. If two rows are identical, |A| = 0.
  72. 72. Properties of Determinates– 6. |A| remains unchanged if each element of a row or each element multiplied by a constant, is added to any other row.– 7. Det of product = product of Dets |AB| = |A| |B|– 8. Det of a diagonal matrix = product of the diagonal elements
  73. 73. Matrix DivisionWe have seen that for 2x2 (“two by two”)matrices A and B then AB BATo divide matrices we need to definewhat we mean by division!With numbers or algebra we use b/a tosolve ax=b. The equivalent in 2x2matrices is to solve AX=B where A, Band X are 2x2 matrices.
  74. 74. Inverse MatrixIn numbers, the inverse of 3 is 1/3 = 3-1In algebra, the inverse of a is 1/a = a-1In matrices, the inverse of A is A-13-1 is defined so that 3 x 3-1 = 3-1 x 3 = 1a-1 is defined so that a x a-1 = a-1 x a = 1A-1 is defined so that A A-1 = A-1 A = IHowever, for a square matrix A there isnot always an inverse A-1
  75. 75. Inverse MatrixIn matrices, the inverse of A is A-1A-1 is defined so that A A-1 = A-1 A = IHowever, for a square matrix A there isnot always an inverse A-1If A-1 does not exist then the matrix issaid to be singularIf A-1 does exist then the matrix is said tobe non-singular
  76. 76. Inverse MatrixIn matrices, the inverse of A is A-1A-1 is defined so that A A-1 = A-1 A = IA square matrix A has an inverse if, andonly if, A is non-singular.If A-1 does exist the the solution to AX=Bis X = A-1 B
  77. 77. Inverse MatrixA-1 is defined so that A A-1 = A-1 A = IIf A-1 does exist the the solution to AX=B is AX = BPre-multiply by A-1 A-1AX = A-1BBut A-1A = I so IX = A-1B X = A-1B
  78. 78. Inverse Matrix AX = BPre-multiply by A-1 A-1AX = A-1BBut A-1A = I so IX = A-1B X = A-1BIf the inverse of A is A-1 then the inverse of A-1is A. This is because if AC = I then CA = I, andalso any matrix inverse is unique.
  79. 79. Inverse MatrixIf the inverse of A is A-1 then the inverseof A-1 is A. This is because if AC = I thenCA = I, and also any matrix inverse isunique. 2 1 B 0 3What is the inverse of 1 u v let B 1 1 3 1 w x B 6 0 2Then solve for u, v, w, x
  80. 80. General Inverse Matrix a b 1 u v 1 d bC let C c d w x D c a where D ad bc au bw 1 c acu bcw c cu dw 0 a cau daw 0 av bx 0 Subtract: cv dx 1 (ad bc) w c
  81. 81. Inverse of a Matrix• Definition. If A is a square matrix, i.e., A has dimensions n×n. Matrix A is nonsingular or invertible if there exists a matrix B such that AB=BA=In. For example. 2 1 2 1 1 1 1 1 3 3 3 3 3 3 1 0 1 2 1 1 2 2 1 2 0 1 3 3 3 3 3 3 Common notation for the inverse of a matrix A is A-1 The inverse matrix A-1 is unique when it exists. If A is invertible, A-1 is also invertible  A is the inverse matrix of A-1. (A-1)-1=A. • Matrix division:  If A is an invertible matrix, then (AT)-1 = (A-1)T A/B = AB-1 • In Matlab: A-1 = inv(A)
  82. 82. Calculation of Inversion using DeterminantsDef: For any n n matrix A, let Cij denote the (i,j)thcofactor of A, that is, (-1)i+j times the determinant ofthe submatrix obtained by deleting row i andcolumn j form A, i.e., Cij = (-1)i+j Mij . The n n matrixwhose (i,j)th entry is Cji, the (j,i)th cofactor of A iscalled the adjoint of A and is written adj A. Thm: Let A be a nonsingular matrix. Then, 1 A-1 adj A. det A thus
  83. 83. Calculation of Inversion using Determinants 2 4 5Example: find the inverse of the matrix A 0 3 0Solve: 1 0 1 3 0 0 0 0 3 C11 3, C12 0, C13 3, 0 1 1 1 1 0 4 5 2 5 2 4 C21 4, C22 3, C23 4, 0 1 1 1 1 0 4 5 2 5 2 4 C31 15, C32 0, C33 6, 3 0 0 0 0 3 det A 9, C11 C21 C31 3 4 15 adjA C12 C22 C32 0 3 0 . C13 C23 C33 3 4 6 3 4 15 So, A 1 1 0 3 0 . thus Determinants to find the Using 9 inverse of a matrix can be very 3 4 6 complicated. Gaussian elimination is more efficient for high dimension matrix.
  84. 84. Calculation of Inversion using Gaussian Elimination Elementary row operations: o Interchange two rows of a matrix o Change a row by adding to it a multiple of another row o Multiply each element in a row by the same nonzero number• To calculate the inverse of matrix A, we apply the elementary row operations on the augmented matrix [A I] and reduce this matrix to the form of [I B]• The right half of this augmented matrix B is the inverse of A
  85. 85. Calculation of inversion using Gaussian elimination a11 , , a1n a11 , , a1n 1 0  0 a21 , , a2 n a21 , , a2 n 0 1 0A [A I] an1 , , ann an1 , , ann 0 0  1I is the identity matrix, and use Gaussian elimination toobtain a matrix of the form 1 0  0 b11 b12 b1n 0 1 0 b21 b22 b2 n 0 0  1 bn1 bn 2 bnn The matrix b11 b12 b1n b21 b22 b2 n B is then the matrix inverse of A bn1 bn 2 bnn
  86. 86. Example 1 1 1 1 1 1 |1 0 0 A 12 2 3 [A| I] 12 2 3 | 0 1 0 3 4 1 3 4 1 |0 0 1(ii)+(-12) (i), (iii)+(-3) (i), (iii)+(ii) 3 1 (1/10) 1 0 0 | 0.4 1 1 1 | 1 0 0 35 7 2 3 0 10 15 | 12 1 0 0 1 0 | 0.6 35 7 0 0 3.5 | 4.2 0.1 1 1 2 0 0 1 | 1.2 35 7 3 1 The matrix 0.4 35 7 is then the matrix inverse of A 2 3 0.6 35 7 1 2 1.2 35 7
  87. 87. Can we find a matrix to multiply the firstmatrix by to get the identity? 1 3 1 1 1 0 ? 32 4 2 2 0 1 2 1 1 3 1 1 0 2 3 4 2 0 1 2 2 Let A be an n n matrix. If there exists a matrix B such that AB = BA = I then we call this matrix the inverse of A and denote it A-1.
  88. 88. If A has an inverse we say that A is nonsingular.If A-1 does not exist we say A is singular. To find the inverse of a matrix we put the matrix A, a To find the inverse of a matrix we put the matrix A, a line and then the identity matrix. We then perform row line and then the identity matrix. We then perform row operations on matrix A to turn it into the identity. We operations on matrix A to turn it into the identity. We carry the row operations across and the right hand side carry the row operations across and the right hand side will turn into the inverse. inverse. 1 3 A 2 7 1 3 1 0 1 3 1 0 2 7 0 1 r2 0 1 2 1 1 3 1 0 r 1 r2 1 0 7 32r1+r 0 1 2 1 0 1 2 1
  89. 89. 1 3 7 3A A 1 2 7 2 1 Check this answer by multiplying. We should get the identity matrix if we’ve found the inverse. 1 1 0 AA 0 1
  90. 90. Inversion
  91. 91. We can use A-1 to solve a system of equationsx 3y 1 To see how, we can re-write a system of equations as2x 5 y 3 matrices. Ax b coefficien variable constant t matrix matrix matrix 1 3 x 1 2 5 y 3
  92. 92. Ax b left multiply both sides by the inverse of A 1 1 A Ax A bThis is just the identity but the identity 1 times a matrix just Ix A b gives us back the matrix so we have:This then gives us a formula 1for finding the variablematrix: Multiply A inverseby the constants. x A b
  93. 93. x 3y 1 1 3 find the A 2x 5 y 3 2 5 inverse 1 3 1 0 1 3 1 0 2 5 0 1 - 0 1 2 1 2r1+r2 1 3 1 0 r 1- 1 0 5 3 3r2- 0 1 2 1 0 1 2 1r2 1 5 3 1 4 x This is theA b answer to 2 1 3 1 y the system
  94. 94. Systems of Equations in Matrix FormThe system of linear equations a11 x1 a12 x2 a13 x3  a1n xn b1 a21 x1 a22 x2 a23 x3  a2 n xn b2  ak1 x1 ak 2 x2 ak 3 x3  akn xn bkcan be rewritten as the matrix equation Ax=b, where x1 b1 a11  a1n x2 b2 A    , x , b .   ak1  akn xn bkIf an n n matrix A is invertible, then it is nonsingular, and the uniquesolution to the system of linear equations Ax=b is x=A-1b.
  95. 95. Example: solve the linear system 4x y 2z 4 5x 2 y z 4 x 3z 3 Matrix Inversion AX b d 4 1 2 x 4 A 5 2 1 ;X y ;b 4 1 0 3 z 3 X A 1b 6 -3 -3 1 A -1 -14 10 6 6 -2 1 3 x 6 -3 -3 4 1 y -14 10 6 4 6 z -2 1 3 3 x 1 2; y 1 3; z 56
  96. 96. Matrix Inversion 1 1B B BB ILike a reciprocal Like the number onein scalar math in scalar math
  97. 97. Linear System of Simultaneous Equations First precinct: 6 arrests last week equally divided between felonies and misdemeanors. Second precinct: 9 arrests - there were twice as many felonies as the first precinct. 1st Precinct : x1 x2 6 2nd Pr ecinct : 2x1 x2 9
  98. 98. Solution Note: 11 21 i 11 2 1 Inverse of s 11 x1 6 * 21 x2 9 11 11 x1 11 6 Premultiply both sides * * *2 1 21 x2 2 1 9 by inverse matrix 10 x1 3 A square matrix * multiplied by its inverse 01 x2 3 results in the identity matrix. x1 3 A 2x2 identity matrix x2 3 multiplied by the 2x1 matrix results in the original 2x1 matrix.
  99. 99. General Form n equations in n variables: n aij xj bi or Ax bj 1unknown values of x can be found using theinverse of matrix A such that 1 1x A Ax A b

×