completed two cachematrix.R functions