functions that cache the calculations of inverting a matrix