Created matrix functions for inverse matrix and caching