completed cachematrix.R for submission