cachematrix.R modified according to Assignment 2.