Update cachematrix.R

This is the completed cachematrix file for ProgrammingAssignment2. Note that much of this code has the same structure as the example code given in the assignment description.