Inverse of a matrix and caching