added code for solving the inverse of a matrix