functions to cache an inverse matrix