Implement the the two functions to cache the inverted matrix