cachematrix.R Modified for assignment 2