updated cachematrix with homework solution