Homework/Programming 7. (Solution) Math. 417 I will give the solution for the work out problems in this note. Problem 1. (Workout) A symmetric matrix is always diagonalizable (this is a spectral theorem). This problem involves the explicit form of the eigenvectors for A3 and the computation of the corresponding eigenvaluess. (a) Show that the vectors φj ∈ Rn given by φj = (sin(πj/(n + 1)), sin(2πj/(n + 1)), . . . , sin(nπj/(n + 1)))t , for j = 1, 2, . . . , n, are the n eigenvectors of A3 . Hint: compute the l′ th entry of A3 φj and, using trigonometric identities, show that it equals a multiple (not depending on l) times (φj )l . (b) Compute the corresponding eigenvalues (the multiple appearing in in Part (a) above). (c) Let G be the matrix corresponding to the Jacobi method applied to the problem A3 x = b with x, b ∈ Rn . Show that ρ(G) is less than one. (Hint: Write G as a linear combination of the matrix A3 and the identity matrix so that the eigenvalues of G can be trivially calculated from those of A3 .) Solution: Part(a): Note that it is important to keep the indices straight in this problem. There is the index j which enumerates the eigenvectors, j = 1, . . . , n. There are also indices which refer to components in the vectors. The first thing to do is to apply the matrix A3 to the vector φj . After studing the structure of A3 and φj , you should obtain 2 sin(πj/(n + 1)) − sin(2πj/(n + 1)) when l = 1, − sin((l − 1)πj/(n + 1)) + 2 sin(lπj/(n + 1)) − sin((l + 1)πj/(n + 1)) (1.1) (A3 φj )l = when l = 2, . . . , n − 1, − sin((n − 1)πj/(n + 1)) + 2 sin(nπj/(n + 1)) when l = n. Here the subscript l on the right denotes the l’th entry of the vector A3 φj . We need to show that (1.2) (A3 φj )l = λj (φj )l 1 2 for some constant λj not depending on l. We consider the intermediate case, i.e., l = 2, . . . , n − 1. Using the trigonometric identity: sin(a + b) = sin(a) cos(b) + cos(a) sin(b) we find sin((l−1)πj/(n+1)) = sin(lπj/(n+1)) cos(πj/(n+1))−cos(lπj/(n+1)) sin(πj/(n+1)) (here we took a = lπj/(n + 1) and b = −πj/(n + 1) and used the identities cos(−x) = cos(x) and sin(−x) = − sin(x)). Similarly, sin((l+1)πj/(n+1)) = sin(lπj/(n+1)) cos(πj/(n+1))+cos(lπj/(n+1)) sin(πj/(n+1)) (here we took a = lπj/(n + 1) and b = πj/(n + 1) and used the identities cos(−x) = cos(x) and sin(−x) = − sin(x)). Adding the above two equations and multiplying by minus one shows that (A3 φj )l = − sin((l − 1)πj/(n + 1)) + 2 sin(lπj/(n + 1)) − sin((l + 1)πj/(n + 1)) = (2 − 2 cos(πj/(n + 1))) sin(lπj/(n + 1)) so that (1.2) holds with λj = 2 − 2 cos(πj/(n + 1)) when l = 2, . . . , n − 1. We need only show that (1.2) holds for l = 1 and l = n (with the same value of λj ). We note that 2 sin(πj/(n + 1)) − sin(2πj/(n + 1)) = − sin(0πj/(n + 1)) + 2 sin(1πj/(n + 1)) − sin(2πj/(n + 1)) as the first term on the right hand side is zero. Now that right hand side has the same form as the intermediate value case (it is just l = 1) so the argument for the intermediate value case implies that (1.2) holds for l = 1. Similarly, − sin((n − 1)πj/(n + 1)) + 2 sin(nπj/(n + 1)) = − sin((n − 1)πj/(n + 1)) + 2 sin(nπj/(n + 1)) − sin((n + 1)πj/(n + 1)) since the last term on the right is sin(πj) = 0. This again reduces to the intermediate case with l = n. This completes part (a). Part(b): There is really nothing to do here except observe that the constants of part (a) are the eigenvalues, i.e., the eigenvalues of A3 are {2 − 2 cos(πj/(n + 1)) : j = 1, . . . , n}. Part(c): This was done in class. GJ = −D−1 (L + U ) = −D−1 (L + D + U − D) = I − D−1 A3 . 3 As D = 2I, GJ = (I − 1/2A3 ). It follows that GJ and A3 share the same eigenvectors and λj (GJ ) = 1 − 1/2λj = cos(πj/(n + 1)). Now, n ρ(GJ ) = max | cos(πj/(n + 1))|. j=1 As cos(x) is a decreasing function on [0, π], it absolute value takes on the maximum at one of the two endpoints, i.e., ρ(GJ ) = max{cos(π/(n + 1)), | cos(πn/(n + 1))|}. Now, using the trigonometic identity for cos(a + b) gives cos(πn/(n + 1)) = cos(π[(n + 1) − 1]/(n + 1)) = cos(π) cos(π/(n + 1)) + sin(π) sin(π/(n + 1)) = − cos(π/(n + 1)), i.e, ρ(Gj ) = cos(π/(n + 1)). Problem 2. (Workout) Write down the arrays VAL, CIND and RIND corresponding to the matrix A3 when n = 6. Solution: I will write down the matrices in modified CRS structure. (i) VAL={2,-1,2,-1,-1,2,-1,-1,2,-1,-1,2,-1,-1,2,-1} (ii) CIND={1,2,2,1,3,3,2,4,4,3,5,5,4,6,6,5} (iii) RIND={1,3,6,9,12,15,17}