code for calculating the inverse of the matrix