Implemented two functions for computing inverse matrix using caching