Created functions to wrap a matrix and cache its inverse