Question: ( 2 points ) In a typical first - year linear algebra course, a commonly - taught method for finding the inverse of a square

(2 points) In a typical first-year linear algebra course, a commonly-taught method for finding the inverse of a square matrix
is to put
into reduced-row echelon form (RREF). If the result is of the form
, then
is the inverse of
. We will see that this method is rather slow compared to the inv function in MATLAB.
We can show the elapsed time by enclosing our command between tic and toc. For example, A = rand(500); tic; inv(A); toc; will show the elapsed time for computing the inverse of the random matrix A.
In MATLAB, define a
matrix
so that all the diagonal entries are equal to 5 and the remaining entries are all equal to
.
Write code to obtain the elapsed time for computing inv(A), the elapsed time for computing the RREF of
, and the elapsed time for computing an LU-decomposition of
. In a comment after the code for this question, report your observations.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!