Completed two functions in 'cachematrix' for Programming Assignment 2