The system can be written in matrix form as Here is an M-file to generate the LU decomposition without pivoting

88 ⎪⎭ ⎪ ⎬ ⎫ ⎪⎩ ⎪ ⎨ ⎧ − − = ⎪⎭ ⎪ ⎬ ⎫ ⎪⎩ ⎪ ⎨ ⎧ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − − = 11111 . 32 5 . 53 27 351852 . 5 7 . 1 4 . 5 1 2 10 } { 3 2 1 x x x x 6 351852 . 5 11111 . 32 3 − = − = x 8 4 . 5 6 7 . 1 4 . 53 2 = − − − − = x 5 . 10 6 1 8 2 27 1 = − − − − = x For the alternative right-hand-side vector, forward substitution is implemented as ⎪⎭ ⎪ ⎬ ⎫ ⎪⎩ ⎪ ⎨ ⎧ − ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − − = 6 18 12 1 148148 . 1 . 1 3 . 1 } {d 12 1 = d 6 . 21 12 3 . 18 2 = + = d 4 18 148148 . 12 1 . 6 3 − = − − − − = d Back substitution: ⎪⎭ ⎪ ⎬ ⎫ ⎪⎩ ⎪ ⎨ ⎧ − ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − − = 4 6 . 21 12 351852 . 5 7 . 1 4 . 5 1 2 10 } {x 747405 . 351852 . 5 4 3 − = − = x 235294 . 4 4 . 5 747405 . 7 . 1 6 . 21 2 − = − − − = x 972318 . 1 10 747405 . 1 235294 . 4 2 12 1 = − − − − − = x

9.5 The system can be written in matrix form as

⎪⎭ ⎪ ⎬ ⎫ ⎪⎩ ⎪ ⎨ ⎧ − − − = ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − − − − − − = 20 34 38 } { 2 1 8 7 1 3 1 6 2 ] [ b A Partial pivot: 89 ⎪⎭ ⎪ ⎬ ⎫ ⎪⎩ ⎪ ⎨ ⎧ − − − = ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − − − − − − = 38 34 20 } { 1 6 2 7 1 3 2 1 8 ] [ b A Forward eliminate f 21 = −3−8 = 0.375 f 31 = 2 −8 = −0.25 5 . 1 75 . 5 75 . 7 375 . 1 2 1 8 ] [ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − − − − − = A Pivot again ⎪⎭ ⎪ ⎬ ⎫ ⎪⎩ ⎪ ⎨ ⎧ − − − = ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − − − − − = 34 38 20 } { 75 . 7 375 . 1 5 . 1 75 . 5 2 1 8 ] [ b A f 21 = −0.25 f 31 = 0.375 Forward eliminate f 32 = −1.375−5.75 = 0.23913 ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − − − − = 108696 . 8 5 . 1 75 . 5 2 1 8 ] [ A Therefore, the LU decomposition is ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − − − − ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − = 108696 . 8 5 . 1 75 . 5 2 1 8 1 23913 . 375 . 1 25 . 1 ] ]{ [ U L Forward elimination ⎪⎭ ⎪ ⎬ ⎫ ⎪⎩ ⎪ ⎨ ⎧ − − − ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − = 34 38 20 1 23913 . 375 . 1 25 . 1 } {d 20 1 − = d 43 20 25 . 38 2 − = − − − − = d 21739 . 16 43 23913 . 20 375 . 34 3 − = − − − − − = d Back substitution: 90 ⎪⎭ ⎪ ⎬ ⎫ ⎪⎩ ⎪ ⎨ ⎧ − − − = ⎪⎭ ⎪ ⎬ ⎫ ⎪⎩ ⎪ ⎨ ⎧ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎣ ⎡ − − − − 21739 . 16 43 20 108696 . 8 5 . 1 75 . 5 2 1 8 3 2 1 x x x 2 108696 . 8 21739 . 16 3 − = − = x 8 75 . 5 2 5 . 1 43 2 = − − − − − = x 4 8 2 2 8 1 20 1 = − − − − − − = x

9.6 Here is an M-file to generate the LU decomposition without pivoting

function [L, U] = LUNaiveA LUNaiveA: LU decomposition without pivoting. input: A = coefficient matrix output: L = lower triangular matrix U = upper triangular matrix [m,n] = sizeA; if m~=n, errorMatrix A must be square; end L = eyen; U = A; forward elimination for k = 1:n-1 for i = k+1:n Li,k = Ui,kUk,k; Ui,k = 0; Ui,k+1:n = Ui,k+1:n-Li,kUk,k+1:n; end end Test with Prob. 9.3 A = [10 2 -1;-3 -6 2;1 1 5]; [L,U] = LUnaiveA L = 1.0000 0 0 -0.3000 1.0000 0 0.1000 -0.1481 1.0000 U = 10.0000 2.0000 -1.0000 0 -5.4000 1.7000 0 0 5.3519 91 Verification that [L][U] = [A]. LU ans = 10.0000 2.0000 -1.0000 -3.0000 -6.0000 2.0000 1.0000 1.0000 5.0000 Check using the lu function, [L,U]=luA L = 1.0000 0 0 -0.3000 1.0000 0 0.1000 -0.1481 1.0000 U = 10.0000 2.0000 -1.0000 0 -5.4000 1.7000 0 0 5.3519

9.7 The result of Example 9.4 can be substituted into Eq. 9.14 to give