# Linear algebra with MATLAB

*label*Other

*timer*Asked: Feb 4th, 2014

**Question description**

I have an assignment that requires MATLAB. If you don't have access to it don't bother replying. I need this done in the next 6 hours. If you can't do it then don't bother either. For someone who knows how it's done, it should take a fraction of that time. Assignment is below. It is for problems 2-6. Please break them up and number them and please include all work and printouts of matlab. If you need to do screenshots then include those. I don't care how long it is.

2. (Span, 6pt) How do we test whether a vector b lies in the span of U = {u_{1, ... }, u_{n} }? Easily, by testing whether Ux = b has a solution (where U is the matrix whose columns are the u_{i}). But how do we do that in general, if U is not invertible, or not even a square matrix? Decide whether b lies in span(U) in the following examples:

a) U = [4 4 2; 4 1 1; 4 4 1; 2 1 5]; b = [ 1 3 4 2]

b) U = [4 4 2; 4 1 1; 4 4 1; 2 1 5]; b = [ 2 14 -1 18]

*Hint*: You can use Matlab's rank, of rref (but do not use linsolve).

3. (Solving Ax = b, 5pt) In class we saw that the set of solutions of a non-homogenous system Ax = b can be written as x_{0} + u, where x_{0} is a (fixed, but arbitrary) solution of Ax = b, and u is any (varying) solution of the homogenous system Ax = 0. Since the solution set of a homogenous system is a vector space, we can write the general solution of Ax = b as x_{0} + λ_{1} u_{1} + ... + λ_{k} u_{k} , where u_{1}, ..., u_{k }is a basis of that vector space (the nullspace of A), and the λ_{i }are real numbers. Write down the general solution of Ax = b in this form for

A = [1 7 4 11 6; 3 1 2 3 -2; 5 1 3 4 -4]; b = [7; 11; 18].

*Hint*: You can use linsolve() and null(), or any other Matlab function you may find useful.

4. (Linear Independence, 9pt). Are the following sets of vectors linearly independent? Use Matlab or any other reasoning, and, briefly, explain your reasoning/method.

a) u1 = [4;1;3], u2 = [-10;17;3]; u3 = [99; 4; 1]; u4 = [33; 6;-4].

b) u1 = [4;3;1;2], u2 = [2;26;6;11], u3 = [-10; 17; 3; 5].

c) u1 = [2;2;2;5], u2 = [6;6;4;4], u3 = [2;3;3;4], u4 = [5;2;3;6].

5. (Coordinates, 6pt). You are given an orthonormal basis: O = [-0.5610 0.5197 0.3152 0.5620; -0.5956 -0.3176 -0.7298 0.1085; -0.3759 -0.7012 0.6024 -0.0645; -0.4351 0.3705 0.0723 -0.8174].

a) Verify that O actually represents an orthonormal basis. *Hint*: easy, we saw how to do it in class.

b) Represent the standard vector e2 = [0;1;0;0] in the basis O. That is, find x so that Ox = e2. However, do not use linsolve or matrix inversion, but use the methods of Fourier coefficients instead. Since O is orthonormal, the Fourier coefficients are particularly easy to determine.

6. (Finding a Basis, 14pt). You are given a set of vectors U = { [3;4;1;2], [-6; -8; -2; -4], [1;4;4;1], [-1;4;7;0], [2;4;2;3]}.

a) Use the row-space algorithm to find a basis of the span(U).

b) Use the casting-out algorithm to find a basis of span(U) which consists of vectors of U.

c) What is the dimension of span(U)?

You can use Matlab for any of the steps in this problem.