Third commit of cachematrix.R for P Prog assign2

Updated code to fix bug and added more comments on usage.