Modified the original functions to cache and solve the inverse of a matrix.