inverse matrix with cache