completed two functions in cachematrix.R