To find inverse matrix and caches it