Updated cacheMatrix.R to implement required functions