-- Solutions to Matlab #1 >> rand('state',sum(100*clock)); -- Problem 1 >> A = rand(5,7); >> rref(A) ans = 1.0000 0 0 0 0 0.5495 -1.5588 0 1.0000 0 0 0 0.1922 -0.0387 0 0 1.0000 0 0 -0.2642 0.8816 0 0 0 1.0000 0 0.1217 2.3727 0 0 0 0 1.0000 0.0616 -0.0866 -- Since there are columns (6 and 7) without pivots the columns of A are linearly dependent. -- This also follows from Theorem 8 on page 69 since there are more columns than rows. -- By Theorem 4 page 43 the Span of the columns of A is all of R^5 since there is a pivot in each row. -- Problem 2 >> u = rand(7,1) u = 0.3968 0.0669 0.6684 0.9432 0.4518 0.2227 0.1300 >> b = A*u; >> x = A\b x = 1.1566 0.1255 0.2491 0 0.5010 0 0.5389 -- Note that x is not equal to u, yet both are solutions to Ax=b. -- This happened because there is more than one solution to Ax=b, -- since there are free variables -- To get all solutions put the augmented matrix in reduced echelon form. >> rref([A b]) ans = Columns 1 through 7 1.0000 0 0 0 0 0.5495 -1.5588 0 1.0000 0 0 0 0.1922 -0.0387 0 0 1.0000 0 0 -0.2642 0.8816 0 0 0 1.0000 0 0.1217 2.3727 0 0 0 0 1.0000 0.0616 -0.0866 Column 8 0.3165 0.1047 0.7242 1.2788 0.4543 -- From this we can read off the solution: -- x1 = 0.3165 - 0.5495 x6 + 1.5588 x7 -- x2 = 0.1047 - 0.1922 x6 + 0.0387 x7 -- x3 = 0.7242 + 0.2642 x6 - 0.8816 x7 -- x4 = 1.2788 - 0.1217 x6 - 2.3727 x7 -- x5 = 0.4543 - 0.0616 x6 + 0.0866 x7 -- x6 = any scalar -- x7 = any scalar -- By the way, here is an alternative. -- The following command gives two linearly independent vectors -- which span the set of solutions to the homogeneous equation Ax = 0. >> N = null(A) N = -0.4194 0.4484 -0.1623 -0.0078 0.1976 -0.2585 -0.1770 -0.7840 -0.0497 0.0216 0.8509 0.1059 0.0309 0.3250 -- Then the general solution is x + s * N(:,1) + t * N(:,2) where s and t are arbitrary. -- Problem 3 -- First set up the augmented matrix and then find its reduced echelon form. >> C = [1+i, 2-i, 3i, 7-5i; 2, 0, 1-i, 4i; 1, 4i, 1+3i, -5+7i]; >> rref(C) ans = 1.0000 0 0 1.0000 + 1.0000i 0 1.0000 0 3.0000 + 1.0000i 0 0 1.0000 -2.0000 -- From this we see there is just one solution x1 = 1+i, x2 = 3+i, x3 = -2. -- Problem 4 -- Again take rref of the augmented matrix. >> rref([ 1+i, -3i, 1, 5-4i; 3-i, -6-i, 3, 1+2i]) ans = 1.0000 0 3.5000 - 0.5000i 15.5000 + 4.5000i 0 1.0000 1.0000 - 1.0000i 8.0000 - 2.0000i -- In this case we have a free variable x3 and there will be infinitely many solutions. -- We can read off the solutions: -- x1 = 15.5 + 4.5i - (3.5-.5i) x3 -- x2 = 8 - 2i - (1-i) x3 -- x3 = any complex number.