inverse with caching