Added code to calculate and cache the inverse of a matrix.