Add code to calculate a special matrix and cache the inverse