My solution:Caching the Inverse of a Matrix