Perform matrix inverse by caching the inverse of a matrix