



%		MATLAB Problem Set 1 
%		(due Monday Feb. 13 in section) 


echo on 
% with "echo on", matlab exhibits the commands as well as its output 
format compact 
% "format compact" just squeezes out some extra lines of space 
rand('state',sum(100+clock)) 
% the last command resets the initial state of randomization   

% Problem 1 
% For the matrix A = [2,4,6,8;1,3,5,7;2,9,2,11;1,1,1,1], 
% (i) find the reduced row echelon form using rref(A) 
% (ii)find all solutions to the equation Ax=b where 
%     b is the transpose of [1,1,1,1] by examining the 
%     rref for an augmented matrix. 
% (iii)  find all solutions to the equation Ax=c where 
%     c is the transpose of [6,4,11,2] by examining the 
%     rref for an augmented matrix. 
% [Above: "find all solutions" means to show there is no 
%  solution, or to write the solution in the parametric form 
%  of #4 on p.54 of Lay's book

% 1(i) 

A = [2,4,6,8;1,3,5,7;2,9,2,11;1,1,1,1]
rref(A)

%1(ii) We let B be the appropriate augmented matrix: 

B = [2,4,6,8,1;1,3,5,7,1;2,9,2,11,1;1,1,1,1,1]

% NOW PUT YOUR ANSWER TO 1(ii) HERE. 

% 1(iii) We let C be the appropriate augmented matrix, 
% and compute the RREF: 

C = [2,4,6,8,6;1,3,5,7,4;2,9,2,11,11;1,1,1,1,2]

rref(C)

% NOW PUT YOUR ANSWER TO 1(iii) HERE. 


%Problem 2 
%Solve the same problem, where now A is a random matrix A and a 
%random column vector b of appropriate size. (Here, 
%generate the augmented matrix B as a random matrix B=rand(4,6) and let
%b be the last column. 

B=rand(4,6)
rref(B)

% PUT YOUR ANSWER TO PROBLEM 2 HERE, BY ADDING  * LINES 
% DIARY OUTPUT.  

% Problem 3
% Solve Problem 34 of Section 1.2. 

% FOR THIS ONE YOU WILL HAVE TO WRITE OUT A SLIGHTLY TEDIOUS 
% SYSTEM OF EQUATIONS, AND THEN MAKE IT A MATLAB PROBLEM. 

% Problem 4 
% Generate a random matrix D = rand(4,7). 
% (i)  Examine rref(D) to determine whether the rows of D are linearly 
% independent. 
% (ii) Do you need to know the rref of a 5x7 
% matrix D to know whether the columns of D are linearly independent? 

% PIECE OF CAKE! 

echo off  



