implement the cached inverse