The rank and nullity of a matrix in Sage could be exactly what you would have guessed. But we need to be careful. The rank is the rank. But nullity in Sage is the dimension of the left nullspace. So we have matrix methods .nullity(), .left_nullity(), .right_nullity(), where the first two are equal and correspond to Sage's preference for rows, and the third is the column version used by the text. That said, a “row version” of Theorem RPNC is also true.