Update cachematrix.R

As partial requirement for Coursera's R Programming rprog-005.