PA2: Cached matrix inverse