Update cachematrix.R

Incorporate comments from peer review.