completed the code of the cachematrix.r script.