two functions to cache and calculate matrix inverse