Computes the inverse of a Matrix by Caching