cachematrix.R modified to complete assignment