Implement pair of function for calculating and caching the inverse of a matrix.