b = np.random.rand(10, 10)
b[-1] = b[0] + b[1]
np.linalg.matrix_rank(a)
np.linalg.matrix_rank(b)

def is_invertible(a):
    return a.shape[0] == a.shape[1] and np.linalg.matrix_rank(a) == a.shape[0]
is_invertible(a)
is_invertible(b)
How to decide a whether a matrix is singular in python-numpy?