Update cachematrix.r

Both function bodies and comments are added. This is a working and tested code.