cachematrix.R completed for Assignment2