code: def is_invertible(self,X):
          
          if len(X.shape) == 2:
              return X.shape[0] == X.shape[1] and np.linalg.matrix_rank(X) == X.shape[0]
          else:
              return False
docs: checks if Z is invertible