finished the matrix inversion problem