implements assignment 2 code for makeCacheMatrix and cacheSolve