cachematrix.R updated with my solution