added functions for invertible matrix with cached inverse