Methods for caching matrix inverse

Implemented 2 methods for caching the inverse of a matrix