Completed cachematrix.R for assignment