updating assignment 3 cachematrix.R code