this file calculates the inverse of a matrix and caches it