Ex4Data - Mat: 221 Matlab Assignment 4
Ex4Data - Mat: 221 Matlab Assignment 4
In this assignment we will consider one-to-one, onto, and invertible matrices, find a basis for a column space,
and compute an inverse using elementary matrices.
This assignment comes with a file Ex4Data.mat. Import this file as you did in Exercise 1—refer to Exercise 1 if
you can’t remember how.
Exercise 1.
(a) Store the reduced echelon form of A in OneAmat. Is A one-to-one? Store "yes" or "no" in OneAword.
(b) Extract from A a submatrix which has the same column space and for which the associated transformation is
one-to-one. Store it in OneBmat.
(c) There are four vectors a, b, c, d in the file. Consider the matrices you can get by appending some or all of
these vectors to OneBmat, for example [OneBmat a c d] or [OneBmat b c]. At least one of these matrices
is invertible. Store such a matrix in OneCmat.
E LEMENTARY MATRICES
We consider 5 × 5 matrices. We denote by E i j (k) the 5 × 5 matrix that has 1s on the diagonal, k in position i , j —
that is, the entry in row i and column j is k—and 0s elsewhere. It is an example of an elementary matrix. These
matrices can be used to perform row operations on a matrix, as the next exercise demonstrates.
Recall the command
>> eye(n)
which produces the identity matrix of size n*n.
The file contains a 5 × 5 matrix B. The goal is to express its inverse in terms of elementary matrices.
Exercise 2.
(a) Create a 5 × 5 matrix of 0s, with a 1 in position 3,4. Store it in E34. Compute B * E34 and E34 * B and store
them in TwoAmatA and TwoAmatB respectively.
(b) Create a 5×5 matrix, E 3,4 (−2) that has ones on the diagonal, −2 in position 3,4. Find the inverse X = E 3,4 (−2)−1 ,
and store this matrix X in TwoBmat.
1
2 DUE 1 NOVEMBER 2018
(c) Find and store matrices E1, E2, E3, E4 such that E1*E2*E3*E4*B is equal to the reduced echelon form of
B, and each one of these matrices is an elementary matrix as described in the introduction. Hint: each matrix
corresponds to a row-reduction step.1
(d) Find and store elementary matrices F1, F2, F3, F4 such that the inverse of B is F4*F3*F2*F1.
1We will grade this question by looking for matrices named E1, E2, E3, E4.
221 MATLAB ASSIGNMENT 4 3
H ANDING IN
It is now time to turn in your second MATLAB assignment for this course. Again you will be handing in your
assignment as a .mat file—that is a matlab file containing all your variables.
Here’s how:
(1) Check that you have a value stored for each of the questions you were asked this week. Your Workspace
should contain: OneAmat, OneAword, OneBmat, OneCmat, TwoAmatA,TwoAmatB, TwoBmat, E1, E2, E3,
E4, F1, F2, F3, F4. Please be aware that these names are case-sensitive. It is ok if your Workspace
contains other variables as well, we will ignore them.
(2) Save all your variables as a .mat file—do not make a .m file by mistake. There are several ways of doing
this, depending on how you are running MATLAB.
• If you’re using matlab.mathworks.com, you should save your variables using the command
>> save Math221Assignment4
This will save the variables in a file called “Math221Assignment4.mat” in mathworks’ cloud storage.
Then you will have to download it to the computer by selecting the file and using the download button:
• If you are running MATLAB on a computer locally, this is done by clicking the “Save workspace” but-
ton near the top of the screen.
(3) Upload your .mat file to Canvas. This is done by going to the Math 221 Canvas site, going to the Assign-
ments page, and following the instructions there.