added code and comments to cachematrix.R