updated cachematrix.R with implementation for programming assignment 2