r script with functions to cache the inverse of a matrix