# Homework #4 # # Due: April 18th, @ 23:45 # # Name: KEY # # Grade: 39/39 # # Do the following problems showing all of your work. You do not have # to use # Maple commands for all your computations, but you are encoraged to # explore # the linalg package and use it for your computations. > > with(linalg): Warning, the protected names norm and trace have been redefined and unprotected # Problem 1: # # Given the matrix: # # A = matrix([[1, 3, 2, 0], [4, -1, 20, 4], [7, 8, 26, 4]]) # # and vector # # b = [-12, 28, -8] > # a) Find a basis for the null space of A. > > A := matrix([[1, 3, 2, 0], [4, -1, 20, 4], [7, 8, 26, 4]]); [1 3 2 0] [ ] A := [4 -1 20 4] [ ] [7 8 26 4] > nullspace(A); {[-2, 0, 1, -3], [-3, 1, 0, 13/4]} > # 3/3 # b) Find a basis for the column space of A. > > basis(A, colspace); [[1, 4, 7], [3, -1, 8]] > > # 3/3 # c) Find a basis for the row space of A. > > basis(A, rowspace); [[1, 3, 2, 0], [4, -1, 20, 4]] > > # 3/3 # d) Find one solution to A x = b. > b := vector([-12, 28, -8]); t := seq(0,i=1..3); b := [-12, 28, -8] t := 0, 0, 0 > linsolve(A,b,'foo',t); [-12, 0, 0, 19] > # 3/3 # e) Find an explicit representation for /all/ solutions to A x = b # using the # basis for the null space. > # Every solution must be in the following form: > x0 := vector([-12, 0, 0, 19]) + a[1]*vector([-2, 0, 1, -3]) + a[2] * > vector([-3, 1, 0, 13/4]); x0 := [-12, 0, 0, 19] + a[1] [-2, 0, 1, -3] + a[2] [-3, 1, 0, 13/4] > evalm(A&*x0-b); [0, 0, 0] > > # 3/3 # Problem 2: # # Let u = [3, 6, 7, 8, 0], v = [6, 7, 8, 0, 3], w = [-3,8,-7,5,6]. # # Compute the following: > # a) The scalar products: u^T v, v^T u, w^T v. > > u := vector([3, 6, 7, 8, 0]); v := vector([6, 7, 8, 0, 3]); w := > vector([-3,8,-7,5,6]); u := [3, 6, 7, 8, 0] v := [6, 7, 8, 0, 3] w := [-3, 8, -7, 5, 6] > dotprod(u,v);dotprod(u,w);dotprod(w,v); 116 30 0 > # 3/3 # b) Are u and v orthogonal? Are v and w? Are u and w? > # u and v are not orthogonal. # u and w are not orthogonal # v and w are orthogonal # c) The Euclidean norm of u,v, and u-v: ||u||, ||v||, ||u-v||. > > norm(u,2); sqrt(158) > norm(v,2); sqrt(158) > norm(u-v,2); 2 sqrt(21) > # 3/3 # d) The angle between u and v. > > arccos(dotprod(u,v)/(norm(u,2)*norm(v,2))); 58 arccos(--) 79 > evalf(%); # in radians .7463422759 > evalf(% *180/Pi); # in degrees 42.76226248 > # 3/3 # e) The projection of u onto v. > proju_v := evalm(dotprod(u,v)/dotprod(v,v) * v); [348 406 464 174] proju_v := [---, ---, ---, 0, ---] [79 79 79 79 ] > # 3/3 > # f) The projection of u onto span(w,v). > > # Note w is orthogonal to v so we can just add the projections of u to > w and to v. > proju_vw := evalm(proju_v + dotprod(u,w)/dotprod(w,w) *w); [18858 31086 22774 50 15354] proju_vw := [-----, -----, -----, --, -----] [4819 4819 4819 61 4819 ] > # 3/3 # g) The orthogonal compliment of the space V = span(u,v,w). > > V := matrix([u,v,w]); [ 3 6 7 8 0] [ ] V := [ 6 7 8 0 3] [ ] [-3 8 -7 5 6] > nullspace(V); [73 ] {[--, 0, -15/4, 1, -13/6], [8/3, 1, -2, 0, -7/3]} [12 ] > # 3/3 # Problem 3 (Theory): > # a) Show that if for vectors u,v, and w, that if w is orthogonal to # both u and v then w is orthogonal to every vector in span(u,v). > # If = 0 and = 0, and x is in span(u,v) then x can be # written as x = a*u + b*v. So, = = a* + # b* = 0. Thus w is orthogonal to every element in span(u,v). # > 3/3 # b) Show that if w in a vector space V (a subspace of R^n) and w is # also in the othogonal compliment of V, then w=0. > # If w is in both V and its orthogonal compliment, then = 0. If # w = [w1, .... , wn], then this means that w1^2 + ... + wn^2 = 0. But # this is a sum of non-negative numbers, hence they all must be zero. # So w = [0, ...., 0]. > # > 3/3