cachematrix.R modified with Assignment2