Example where an inverse function does not equal the elements I'm trying to find an example of a function $f: A \to B$ and $X \subset A$ so that $f^{-1}(f(X)) \ne X$, and similarly where $Y \subset B$ so that $f(f^{-1}(Y)) \ne Y$.
I thought to have $f = x^2$, which has no inverse, thus making it vacuously true that $f^{-1}(f(X)) \ne X$ and $f(f^{-1}(Y)) \ne Y$, but that seems like a copout. Any help is greatly appreciated.

Consider $f : \mathbb{R} \rightarrow \mathbb{R}$ defined for all $x \in \mathbb{R}$ by $f(x)=0$, and $X = \lbrace 0 \rbrace$ and $Y = \mathbb{R}$.
