Working solution to find inverse of square invertible matrix