updated cachematrix.R with my own solution