completed file cachematrix.R with the solution to Assignment 2