Modified cachematrix.R file to provide the functionality requested on the assigment