USE MATLAB: 9. Set A = magic(8) and then compute its reduced row echelon form. T
ID: 672030 • Letter: U
Question
USE MATLAB:
9. Set A = magic(8) and then compute its reduced row echelon form. The leading 1's should correspond to the first three variables x1, X2 and X3 and the remaining five variables are all free.
(a) Set c = [1:8]' and determine whether the system Ax = c is consistent by computing the reduced row echelon form of [ A c]. Does the system turn out to be consistent? Explain.
(b) Set b = [8 -8 -8 8 8 -8 -8 8]';
and consider the system Ax = b . This system should be consistent. Verify that it is by computing U = rref([A b]). We should be able to find a solution for any choice of the five free variables. Indeed, set x2 = floor(10 * rand(5,1)). If x2 represents the last five coordinates of a solution of the system then we should be able to determine x1 = ( x1,x2, x3)^(T) in terms of x2. To do this, set U = rref([A b]). The nonzero rows of U correspond to a linear system with block from [ I V ] [ x1] = c
x2
To solve equation (1), set
V = U(1: 3, 4:8), c = U(1:3, 9) and use MATLAB to compute x1 in terms of x2, c and V. Set x = [ x1; x2] and verify that x is a solution of the system.
Explanation / Answer
Solution a) Yes, the system Ax = c is consistent by computing the reduced row echelon form of [A c]. Yes, the system turn out to be consistent as when we reduce the system to row echelon form, there are less pivots than variables. Thus there are always free variables and there are no rows enough such that one has a pivot position in the last column.
b) We may also use MATLAB’s linspace command:
>> x = linspace(0,1,5) (ret)
x = 0 0.2500 0.5000 0.7500 1.0000
Thus, we have created a row vector x of size n (n = 5 in this case).
Thus, it is verified that x is a solution of the system.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.