Composite functions, piecewise-defined functions and inverse functions