Created functions for caching of inverse matrix