Implements cacheSolve() and makeCacheMatrix() functions.