How to reverse an optical system