updated cachematrix.R for assignment2