213 - A7 - Invertible Equivalents

184 days ago by Professor213

Invertible Equivalents - this sheet takes a given (invertible) matrix $A$ and describes several of the equivalent conditions on $A$.

Students should open this sage worksheet and work through the interactive cells below. Consider what Sage's conclusion in each case means.  For small problems, try to work the problems also by hand to verify sage's conclusion.  Answer (individually) the green questions posed in this worksheet.  Note, that there are a few cells that pertain to stuff in chapter 3.  Ignore these for now.

Finally, when you are finished with it all, go back through the sheet with a much larger value for n.  Recompute all cells and see if the conclusions make sense conceptually. Discuss...

John Travis

Mississippi College

The user will first select the size for the $NxN$ matrix $A$ which will be used for the remainder of this page.

%hide %auto N=2 print html("<font size=+2 color=blue>Enter N below. Click 'Update' twice to change the size. </font>") print html("<br>If so, note that you will have to also re-evaluate the other cells below.") @interact def _(Size_of_System=(2..10), auto_update=False): global N N = Size_of_System html('The size of your square system will be $%s$'%str(N)+' by $ %s$'%str(N),) # show(html("<font size=+2 color=blue>The size of your square system will be</font>")+str(N)+"$x$"+str(N)) 
       
Enter N below. Click 'Update' twice to change the size.
If so, note that you will have to also re-evaluate the other cells below.
Size_of_System 

Click to the left again to hide and once more to show the dynamic interactive window

Now, enter the matrix $A$ below.  You can also have the computer select one with rational entries at random.  If you changed n above, you will likely need to reevaluate this cell first.  This will require that you click on "hide" and then "Shift-Enter" or just quit the sheet and start over from the top.

print html("<font size=+2 color=blue>Enter your data below. You can tab to navigate between cells. Click Update when you are finished.</font> <br><br> <font size=-1 color=blue> If you want a random matrix, click the box and then update and then go on to the remainder of the page</font><p>") @interact def _(Input_Matrix=zero_matrix(QQ,N,N),auto_update=False,Make_it_random=False): global A if Make_it_random: A = random_matrix(QQ,N,N, num_bound=20, den_bound=4) else: A = Input_Matrix if A.det()==0: print html("<font size=+1 color=red>Matrix is Singular. Please pick another!</font>") print html("<font size=+2 color=blue>Using the matrix</font>") html(A) 
       

Click to the left again to hide and once more to show the dynamic interactive window

print "Here is the matrix you are using." print "Cut-and-paste works well with this output." html(A) 
       
Here is the matrix you are using.
Cut-and-paste works well with this output.
[ 0 -19/3 -4 15 -5] [ -2 -1 8 -10/3 14/3] [ 1 -17 5 4 11] [ -7 -3 -2 -8 4] [-19/4 -13 18 -13/2 17/4]

                                
                            
Here is the matrix you are using.
Cut-and-paste works well with this output.
[ 0 -19/3 -4 15 -5] [ -2 -1 8 -10/3 14/3] [ 1 -17 5 4 11] [ -7 -3 -2 -8 4] [-19/4 -13 18 -13/2 17/4]

                                
print "Save your Matrix to a File so that you can use the same one next time" filename = 'MyMatrix' filename_for_saving = SAGE_TMP+filename+'.sobj' print filename_for_saving save(A,filename_for_saving) 
       
Save your Matrix to a File so that you can use the same one next time
/home/sageserver/.sage/temp/euclid/16154MyMatrix.sobj
Save your Matrix to a File so that you can use the same one next time
/home/sageserver/.sage/temp/euclid/16154MyMatrix.sobj
print "Reload your Matrix from the file..." filename = 'MyMatrix' filename_for_loading = SAGE_TMP+filename print filename_for_loading A = load(filename_for_loading) A 
       
Reload your Matrix from the file...
/home/sageserver/.sage/temp/euclid/16154MyMatrix
Reload your Matrix from the file...
/home/sageserver/.sage/temp/euclid/16154MyMatrix

Theorem 5

A matrix is nonsingular provided $Ax=b$ has exactly one solution for any $b$.

%auto show(html("<font size=+2 color=blue>Click on Update to get a new vector b</font>")) @interact def _(auto_update=False): b = random_matrix(QQ,N,1, num_bound=20, den_bound=4) print html("<font size=+2 color=blue>For the vector $b =$</font>") show(b) x = A.inverse()*b print html("<font size=+2 color=blue>the solution is only $x =$</font>") show(x) 
       
Click on Update to get a new vector b

Click to the left again to hide and once more to show the dynamic interactive window

Assignment:  Let sage give you vectors for b and the resulting solutions for x.  Compute all your work on paper to turn in when I get back. 

  • For two different 2x2 problems, compute by hand Ax to verify that Ax = b.
  • For a 3x3 problem (go back to the top and change n and then change the matrix A, show your work in solving Ax = b yielding a unique solution.

Theorem 7

A matrix is nonsingular provided it is row equivalent (and column equivalent) to the identity matrix.  

show(html("<font size=+2 color=blue>Applying row reduction to A yields</font>")) show(A.rref()) show(html("<font size=+2 color=blue>Applying row reduction to $A^T$ yields</font>")) show(A.transpose().rref()) show(html("<font size=+2 color=blue>Since each of these is the identity, the equivalences are shown.</font>")) 
       
Applying row reduction to A yields
Applying row reduction to  yields
Since each of these is the identity, the equivalences are shown.

                                
                            
Applying row reduction to A yields
Applying row reduction to  yields
Since each of these is the identity, the equivalences are shown.

                                

Assignment: 

  • For a 2x2 problem, set up $[A,I]$ and do rref to get $[I, A^{-1}]$.  See that the place where $A$ was is now the identity matrix.
  • Do the same for the problem's transpose. 

A matrix is nonsingular provided the columns of $A$ span $R^n$.  Thus, any vector b$\in R^n$ is in the span of the columns of $A$.

For the interactive cell below, note $A(2)$ refers to column 2 of the matrix $A$ for example.

%auto show(html("<font size=+2 color=blue>Click on Update to get a new vector b</font>")) @interact def _(auto_update=False): b = random_matrix(QQ,N,1, num_bound=20, den_bound=4) # html('$b = %s$'%str(b),) # this needs to be output so that the column vector b looks good and not text show(b) x = A\b At = A.transpose() # need to figure out how to write x1*A1 + x2*A2 + ... + xn*An = b combo = [] html( " $=$ ") for col in range(N-1): html('$%s \cdot $'%str(x[col])+'$A_{%s} + $'%(str(col)),) html('$%s \cdot $'%str(x[N-1])+'$A_{%s}$'%(str(N-1)),) # It would be nice to accumujlate these html strings above and print them all in one string 
       
Click on Update to get a new vector b

Click to the left again to hide and once more to show the dynamic interactive window

 

Theorem 6

A matrix is nonsingular provided $A^{-1}$ exists.

print html("<p><font size=+2 color=blue>$A^{-1} =$</font>") show(A.inverse()) 
       



Theorem 7

A matrix is nonsingular provided $A^T$ is invertible.

print html("<p><font size=+2 color=blue>$A^{-T} =$</font>") show(A.transpose().inverse()) 
       



Chapter 3

A matrix is nonsingular provided its determinant is nonzero.

show(html("<font size=+2 color=blue>The matrix $A$ has determinant</font>")+str(A.det()) ) #html(" $=$ "+str( A.det().n() )) html('$=%s$ '%str(A.det())+' $ \\approx $ $%s $'%str(A.det().n()),) 
       
The matrix  has determinant
     

                                
                            
The matrix  has determinant
     

                                

A matrix is nonsingular provided $Ax=0$ has only the trivial solution $x=0$.  That is, $Null(A)=\left\{{0 }\right\}$.

b = matrix(N,1,0) x = A\b show(x) 
       

                                
                            

                                

Save this for Chapter 3...

A matrix is nonsingular provided $A$ has no zero eigenvalues.

print html("<font size=+2 color=blue>The eigenvalues for $A$ =</font>") eig = A.eigenvalues() all_nonzero = True for k in range(N): if eig[k]==0: all_nonzero = False show(eig[k]) if all_nonzero: print html("<font size=+2 color=blue><b>They are all nonzero.</b></font>") 
       
The eigenvalues for  =

They are all nonzero.
                                
                            
The eigenvalues for  =

They are all nonzero.
                                

The matrix A can be expressed as a finite product of elementary matrices.

This one should be harder to determine (and render) and especially so for larger N.

# future additional feature to be determined later