Sage SSNS Spanning Sets for Null Spaces

We have seen that we can create a null space in Sage with the .right_kernel() method for matrices. We use the optional argument basis='pivot', so we get exactly the spanning set $\set{\vectorlist{z}{n-r}}$ described in Theorem SSNS. This optional argument will overide Sage's default spanning set, whose purpose we will explain fully in Sage SUTH0. Here is Example SSNS again, along with a few extras we will comment on afterwards.









We built the null space as nsp, and then asked for its .basis(). For now, a “basis” will give us a spanning set, and with more theory we will understand it better. This is a set of vectors that form a spanning set for the null space, and with the basis='pivot' argument we have asked for the spanning set in the format described in Theorem SSNS. The spanning set N is a list of vectors, which we have extracted and named as z1 and z2. The linear combination of these two vectors, named z, will also be in the null space since N is a spanning set for nsp. As verification, we have have used the five entries of z in a linear combination of the columns of A, yielding the zero vector (with four entries) as we expect.

We can also just ask Sage if z is in nsp:



Now is an appropriate time to comment on how Sage displays a null space when we just ask about it alone. Just as with a span, the number system and the number of entries are easy to see. Again, dimension should wait for a bit. But you will notice now that the Basis matrix has been replaced by User basis matrix. This is a consequence of our request for something other than the default basis (the 'pivot' basis). As part of its standard information about a null space, or a span, Sage spits out the basis matrix. This is a matrix, whose rows are vectors in a spanning set. This matrix can be requested by itself, using the method .basis_matrix(). It is important to notice that this is very different than the output of .basis() which is a list of vectors. The two objects print very similarly, but even this is different — compare the organization of the brackets and parentheses. Finally the last command should print true for any span or null space Sage creates. If you rerun the commands below, be sure the null space nsp is defined from the code just above.