Implemented functions for caching inverse of matrix