Added code with comments to cachematrix.R