added function to get inverse of matrix