updated cachematrix.R with my solution