updated cachematrix.R for completing its functionalities