Completed cachematrix.R file for programming assignment 2