implemented functions to cache matrix inverses