filled in cachematrix.R code skeleton