'Returns list of vectors (Matrix objects) that span nullspace of self
Examples
>>> from sympy.matrices import Matrix
>>> m = Matrix(3, 3, [1, 3, 0, -2, -6, 0, 3, 9, 6])
>>> m
Matrix([
[ 1,  3, 0],
[-2, -6, 0],
[ 3,  9, 6]])
>>> m.nullspace()
[Matrix([
[-3],
[ 1],
[ 0]])]
See Also
columnspace
rowspace'

def nullspace(self, simplify=False):

    (reduced, pivots) = self.rref(simplify=simplify)
    free_vars = [i for i in range(self.cols) if (i not in pivots)]
    basis = []
    for free_var in free_vars:
        vec = ([S.Zero] * self.cols)
        vec[free_var] = S.One
        for (piv_row, piv_col) in enumerate(pivots):
            for pos in (pivots[(piv_row + 1):] + (free_var,)):
                vec[piv_col] -= reduced[(piv_row, pos)]
        basis.append(vec)
    return [self._new(self.cols, 1, b) for b in basis]
