MA 305 Spring 2K Homework 3 Solutions > read("/afs/eos.ncsu.edu/users/k/kaltofen/www/courses/LinAlgebra/Maple/initlib.mpl"): > with(refpkg): > with(linalg): Problem 1 (a.) We are looking for a matrix A; and vector b; such that with the vector x = [x[1], x[2], x[3]]^T;, the linear system described by problem 1 can be written as A*x = b;. The following matrix and vector do just that. > A := matrix(3,3,[2,-1,1,4,-1,4,-2,1,2]); [ 2 -1 1] [ ] A := [ 4 -1 4] [ ] [-2 1 2] > b := vector(3,[-1,-2,-2]); b := [-1, -2, -2] (b.) We know we can use a series of elementary matrices to reduce A; to row echelon form: E[k]*`...`*E[2]*E[1]*A = U;. Then the transformation matrix T; is T = E[k]*`...`*E[2]*E[1];. The following two matrices are the U; and T;, respectively, such that T*A = U; and U; is in row echelon form. > U:=xref(A,3,'T','L'); [2 -1 1] [ ] U := [0 1 2] [ ] [0 0 3] > print(T); [ 1 0 0] [ ] [-2 1 0] [ ] [ 1 0 1] Problem 2 Because T; is a product of elementary matrices, and all elementary matrices are invertible, T; must be invertible, and A = T^(-1)*U; or A = L*U; where L; is the inverse of T;. The following two matrices are the corresponding L; and U;. > print(L); [ 1 0 0] [ ] [ 2 1 0] [ ] [-1 0 1] > print(U); [2 -1 1] [ ] [0 1 2] [ ] [0 0 3] Problem 3 Now, from the original matrix system A*x = b; and the L*U; factorization of A;, we have L*U*x = b; or the two equations L*y = b; and U*x = y; which are easier to solve than the original system. Using these two equations we find the following solution to the system. > y:=linsolve(L,b); y := [-1, 0, -3] > x:=linsolve(U,y); x := [1, 2, -1] Thus the solution to this system is x = [1, 2, -1]^T;. Problem 4 Cramer's rule give us the solution to the same system using a different method. Here we use the matrix A; and three other matrices A[1];, A[2];, andA[3]; such that A[j]; is created by replacing the j;-th column of A; by the column vector b;. Then the i;-th component of the solution is x[i] = det(A[i])/det(A);. > A1 := matrix(3,3,[-1,-1,1,-2,-1,4,-2,1,2]); [-1 -1 1] [ ] A1 := [-2 -1 4] [ ] [-2 1 2] > A2 := matrix(3,3,[2,-1,1,4,-2,4,-2,-2,2]); [ 2 -1 1] [ ] A2 := [ 4 -2 4] [ ] [-2 -2 2] > A3 := matrix(3,3,[2,-1,-1,4,-1,-2,-2,1,-2]); [ 2 -1 -1] [ ] A3 := [ 4 -1 -2] [ ] [-2 1 -2] > x[1] := det(A1)/det(A); x[1] := 1 > x[2] := det(A2)/det(A); x[2] := 2 > x[3] := det(A3)/det(A); x[3] := -1 > print(x); [1, 2, -1] Thus the solution to this system is x = [1, 2, -1]^T;.