Update cachematrix.R

committing both functions as part of the R programming homework 2