Inverse functions and preimages
The notation \(f^{-1}\) usually denotes the compositional inverse function of \(f\), that is, a function \(g\) such that, for all \(x\) in the domain of \(f\), \(g(f(x)) = x\), and, for all \(x\) in the domain of \(g\), \(f(g(x))=x\). This is a special case of the convention that \(f^n\) denotes the \(n\)-fold composition of \(f\) with itself, but, confusingly, it is also used in some contexts where \(f^n\) normally denotes \(n\)-fold pointwise multiplication of \(f\) with itself; see Powers of trigonometric functions. The inverse function does not exist unless \(f\) is injective.
In some contexts, \(f^{-1}\) denotes the preimage function from the power set of the codomain of \(f\) to the power set of the domain of \(f\), defined by \(f^{-1}(Y) = \{x : f(x) \in Y\}\). This exists for all functions, whether or not they are injective.
In other contexts, like when \(f\) is an element of a ring of functions on a space, \(f^{-1}\) can denote the multiplicative inverse of \(f\). This only exists if \(f(x)\) is invertible for all \(x\).
References
Most ambiguous and inconsistent phrases and notations in maths on math.stackexchange