Update cachematrix.R

write the code for coursera programming assignment 2