modifies cachematrix.R as required by programming assignment 2