Revert "Revert "Update cachematrix.R""

This reverts commit edbc9f3e89677c851fdb56c7d18cd8d8f1feb2c2.