finding the inverse of matrix