implemented functions to cache matrix inverse