create a matrix and cache its inverse