functions to compute and cache the inverse of a matrix