Update cachematrix.R

Updated cachematrix.R in order to achieve the goals for successfully passing the Programming Assigment 2