Working solution for programming assignment 2 - caching inverse of a matrix.