CacheMatrix, functions and explanation