initial cachematrix code for R coursera class