Update cachematrix.R

updated with solution to ProgrammingAssignment2