Completed cacheMatrix for assignment 2