Modified cachematrix.R for programming assigment 2.