Update cachematrix.R

The finished code.
Pending:
a) some more testing
b) check variable names
c) comments