Update cachematrix.R

Solution by Dinh Hung Tu