Page 103 - Applied Numerical Methods Using MATLAB
P. 103

92    SYSTEM OF LINEAR EQUATIONS
                       (2)    (2)
           second row r  and r  to get
                      1       2
             (2)      (3)        (3)  (3)  (3)  (3)                     (3)
            r   − 0 × r     →    a   a    a    b        1 001 = x 1      : r
             1        3           11  12   13   1                           1
             (2)         (3)     (3)  (3)  (3)                          (3)
            r   − (−1) × r  →    a  a    a    b  (3)   =              : r
             2           3      21   22   23   2       0 101 = x 2      2
             (2)                  (3)  (3)  (3)  (3)                        (3)
            r               →    a   a    a    b                         : r
             3                    31  32   33   3       0 011 = x 3         3
                                                                       (2.2.30c)
           After having the identity matrix–vector form like this, we take the RHS vector
           as the solution.
              The general formula applicable for Gauss–Jordan elimination is the same as
           Eq. (2.2.5), except that the index set is m  = k—that is, all the numbers from
           m = 1to m = M except m = k. Interested readers are recommended to make
           their own routines to implement this algorithm (see Problem 2.3).



           2.3  INVERSE MATRIX
           In the previous section, we looked over some algorithms to solve a system of
           linear equations. We can use such algorithms to solve several systems of linear
           equations having the same coefficient matrix

                             Ax 1 = b 1 ,Ax 2 = b 2 ,...,Ax NB = b NB

           by putting different RHS vectors into one RHS matrix as

                                           b 2 ··· b NB ],  AX = B
                    A[ x 1  x 2 ··· x NB ] = [ b 1
                                                                         (2.3.1)
                                       −1
                                 X = A B
           If we substitute an identity matrix I for B into this equation, we will get the matrix
                        −1
                               −1
           inverse X = A I = A . We, however, usually use the MATLAB command
           inv(A) or A^-1 to compute the inverse of a matrix A.

           2.4  DECOMPOSITION (FACTORIZATION)

           2.4.1  LU Decomposition (Factorization): Triangularization
           LU decomposition (factorization) of a nonsingular (square) matrix A means
           expressing the matrix as the multiplication of a lower triangular matrix L and
           an upper triangular matrix U, where a lower/upper triangular matrix is a matrix
           having no nonzero elements above/below the diagonal. For the case where some
           row switching operation is needed like in the Gauss elimination, we include a
           permutation matrix P representing the necessary row switching operation(s) to
           write the LU decomposition as
                                        PA = LU                          (2.4.1)
   98   99   100   101   102   103   104   105   106   107   108