Update cachematrix.R

Completed the functions as described in the README.md using the samples provided.