Inverting Functions with Restricted Domains