Norwegian University of Science and Technology Institutt for matematiske fag TMA15 Matematikk N Spring 17 Solutions to exercise set 1 1 We begin by writing the system as the augmented matrix.139.38.3 6. 1.1 5.1.5 5.1 1.58.888 1.85 7. We begin by reducing all the terms in the first column below the diagonal to zero. Using partial pivoting, the term of greatest magnitude in the first column is 1.1, from the second row. We therefore swap this with the first row, giving 1.1 5.1.5 5.1.139.38.3 6. 1.58.888 1.85 7. The second row R then becomes mr 1 + R, where m =.139 1.1 =.115, working to 3 significant figures. Similarly, as 1.58 1.1 =.131, the third row is replaced with.131r 1 + R 3. Our augmented matrix is now 1.1 5.1.5 5.1.33.31 6.1. 1.9 6.35 We now do elimination on the second column. Here.33 is greater in magnitude than., so the second row is the pivot row. It remains to compute m =..33 =.681. Then the third row is replaced with.681r + R 3, giving 1.1 5.1.5 5.1.33.31 6.1 3.9 1.5 We now perform back substitution: x 3 = 1.5 3.9 = 3.1. We then have.3x = 6.95 6.1 =.85 x =.66 1.1x 1 = 13.6 + 1.5 + 5.1 = 6.96 x 1 =.575 We first write the equations in matrix form: 1 3 x 1 7 1 x = 1 1 x 3 March, 17 Page 1 of 5
Solutions to exercise set 1 Following Doolittle s method, we know that the first row of U is the first row of A, so u 1 = (, 1, 3). The first column of L is the first column of A divided by the first element of u 1, namely. We have accordingly l 1 = (1,, 1) T. We then compute A l 1 u 1 = 1 8 1 We now repeat the procedure on ( ) 1 8 A 1 =, 1 the matrix obtained from the above by deleting the first row and first column. This gives u = (1, 8) and hence l = (1, 1) T. Then ( ) A 1 l u = 6 Deleting the first row and column gives A = 6, from which we have u 3 = 6 and l 3 = 1. Collecting the l i and u i gives 1 1 3 L = 1, U = 1 8 1 1 1 6 To solve the equation Ax = b, we solve first Ly = b, in this case 1 7 1 y = 1 1 1 1 Back substitution gives y 1 = 7, y = 8, y 3 = 1. We then solve Ux = y, i.e. 1 3 7 1 8 x = 8 6 1 This time back substitution gives x 3 = 3.5, x =, x 1 = 1.75. 3 We apply Cholesky s method to A = 1 13 13 1 First, we take find the square root of the element in the top left of the matrix a11 = =. The first column of L is then the first column of A divided by this number, i.e. l 1 = (, 1, 1) T. We then form A l 1 l1 T = 9 1 1 March, 17 Page of 5
Solutions to exercise set 1 We then repeat the procedure on A 1 = ( 9 ) 1 1 We have a 1 1 = 3, and hence l = (3, ) T, leading to ( ) A 1 l l T = We find A =, and hence l 3 = =. Collecting the l i, we have L = 1 3 1 a) We first write the equations in the form x 1 = x x 3 x = x 1 x 3 + 1 x 3 = 1 ( x 1 x ) The Gauss-Seidel iteration comes from replacing the terms on the right above the diagonal with x (m) (the old values), and those below the diagonal with x (m) (the new values). Replacing the terms on the left with gives 1 = x (m) x (m) 3 = 1 x (m) 3 + 1 3 = 1 ( x(m+1) 1 ) To describe the iteration in matrix form, we first write the equations in matrix form Ax = b, that is 1 1 1 1 x = 1 1 1 We then write the matrix in the form A = L + D + U, where 1 1 L =, D = 1, U = 1 1 1 (Note that the L and U are not the same as those coming from an LU factorization, this is the much simpler additive decomposition where the L simply consists of the elements of A below the diagonal etc.) The Gauss-Seidel iteration is then (L + D) = Ux (m) + b, see Kreyszig.3 for a discussion. Multiplying both sides by (L + D) 1 gives = (L + D) 1 Ux (m) + v, March, 17 Page 3 of 5
Solutions to exercise set 1 where v = (L + D) 1 b. The matrix C asked for in the question is then C = (L + D) 1 U. In this case 1 (L + D) 1 = 1, 1.5.5.5 which can be found by Gauss-Jordan elimination (see Kreyszig.1). It follows that 1 (L + D) 1 U = 16 3 6 1 (Note that is possible to save time by evaluating (L + D) 1 U directly without evaluating (L + D) 1 first; for instance try forming the large augmented matrix of (L + D) and U and then reducing the L + D part to the identity, just as you would to find the inverse but with U on the right instead of I. In matlab this is implemented as ). b) The characteristic polynomial det(c λi) of the above matrix is λ 3 15λ + λ = λ(λ 15λ + ) It follows that the eigenvalues are and the roots of λ 15λ +, which by the quadratic formula are λ = 15 ± 17 The larger of these is approximately 1.87, which is much greater than 1. c) Swapping the first and the second rows gives the system 1 1 1 1 1 x = 1 1 This matrix is diagonally dominant, and hence we will have convergence. d) The Gauss-Seidel scheme is 1 = 1 ( x(m) x (m) 3 + 1) = 1 ( x(m+1) 1 x (m) 3 ) 3 = 1 ( x(m+1) 1 ) We begin with x () = (,, ) T. We then have 1 = 1 ( + 1) =.5 = 1 (.5 ) =.565 3 = 1 (.5 +.565) =.156 March, 17 Page of 5
Solutions to exercise set 1 The second iteration is 1 = 1 (.565.156 + 1) =.3516 e) The Jacobi scheme is The first iteration is hence = 1 (.3516.156 ) =.67 3 = 1 (.3516 +.67) =.1377 1 = 1 ( x(m) x (m) 3 + 1) = 1 ( x(m) 1 x (m) 3 ) 3 = 1 ( x(m) 1 x (m) ) 1 = 1 ( + 1) =.5 The second step is then = 1 ( ) =.5 3 = 1 ( ) = 1 = 1 (.5 +.5 + 1) =.375 = 1 (.5 ) =.565 3 = 1 (.5 +.5) =.15 March, 17 Page 5 of 5