Update cachematrix.R

Updated with code and comments