basic implementation of caching the inversed matrix