Update cachematrix.R

I couldn't come up with a better or faster way :(