Update cachematrix.R

These are my codes for Programming Assignment 2. I have tested them on my R console, and they seem to work.