Cache the calculation of the inverse of matrix