An example of why $f(f^{-1}(B))\neq B$ Let $f:X\rightarrow Y$ be a function and $B\subseteq Y$ a subset of $Y$. I know (and have proven) that $f(f^{-1}(B))\subseteq B$. I've also found an example where $f(f^{-1}(B))\neq B$ for $B= \mathbb{R}$. I want to find another example, because I find my example very silly. Any help?
 A: Hint: The relation $f(f^{-1}(B)) = B$ holds for all $B \subset Y$ iff $f$ is onto.
A: Let $X=Y=\Bbb R$, $f(x)=x^2$ and $B=(-1,\infty)$.
Now,
$$f(f^{-1}(B))=f(\Bbb R)=[0,\infty)\subsetneq (-1,\infty).$$
A: The simplest example would be $f:\{1\}\to\{1,2\}$ with $f(1)=1$ and $B=\{2\}$.
A: Here is a way to calculate all examples, in some sense.$
\newcommand{\calc}{\begin{align} \quad &}
\newcommand{\op}[1]{\\ #1 \quad & \quad \unicode{x201c}}
\newcommand{\hint}[1]{\mbox{#1} \unicode{x201d} \\ \quad & }
\newcommand{\endcalc}{\end{align}}
\newcommand{\ref}[1]{\text{(#1)}}
\newcommand{\then}{\Rightarrow}
$
First, we try to simplify $\;f[f^{-1}[B]]\;$, by calculating which $\;y\;$ it contains.  Implicitly, we let $\;x\;$ range over $\;X\;$.
$$\calc
    y \in f[f^{-1}[B]]
\op\equiv\hint{definition of $\;\cdot[\cdot]\;$}
   \langle \exists x :: x \in f^{-1}[B] \;\land\; f(x) = y \rangle
\op\equiv\hint{definition of $\;\cdot^{-1}[\cdot]\;$}
   \langle \exists x :: f(x) \in B \;\land\; f(x) = y \rangle
\op\equiv\hint{logic: substitute RHS of $\;\land\;$ in LHS}
   \langle \exists x :: y \in B \;\land\; f(x) = y \rangle
\op\equiv\hint{logic: extract non-$\;x\;$ clause out of $\;\exists x \;$}
   y \in B \;\land\;\langle \exists x :: f(x) = y \rangle 
\op\equiv\hint{definition of $\;\cdot[\cdot]\;$}
   y \in B \;\land\; y \in f[X]
\endcalc$$
Now we calculate all examples:
$$\calc
    f[f^{-1}[B]] \not= B
\op\equiv\hint{definition of set equality}
    \lnot \langle \forall y :: y \in f[f^{-1}[B]] \;\equiv\; y \in B \rangle
\op\equiv\hint{by the previous calculation}
    \lnot \langle \forall y :: y \in B \land y \in f[X] \;\equiv\; y \in B \rangle
\op\equiv\hint{logic: simplify}
    \lnot \langle \forall y :: y \in B \then y \in f[X] \rangle
\op\equiv\hint{definition of $\;\subseteq\;$}
\tag{*}
    B \not\subseteq f[X]   
\endcalc$$
So every $\;f,X,B\;$ that satisfy $\ref{*}$ is an example you could use.
