This question may seem a little silly. Let $f=(G,A,B)$ be a function: i.e. $G$ is a set of ordered pairs such that
- $pr_{1}(G)=A$;
- $pr_{2}(G)\subset B$;
- $(\forall x)(x\in A\implies(\exists!y)((x,y)\in G))$.
Let $Y$ be a subset of $B$ such that $f^{-1}(Y)\ne\emptyset$. Now, which of the functions
(a) $(G\cap (f^{-1}(Y)\times B),\,f^{-1}(Y),\,Y)$
(b) $(G\cap (f^{-1}(Y)\times Y),\,f^{-1}(Y),\,Y)$
is the right choice for the restriction of $f$ to $f^{-1}(Y)$?
You can prove that $G \cap (f^{-1}(Y) \times B) = G \cap (f^{-1}(Y) \times Y)$, so the two functions are in fact the same.
Since $Y \subseteq B$, then $f^{-1}(Y) \times Y \subseteq f^{-1}(Y) \times B$, and so $G \cap (f^{-1}(Y) \times Y) \subseteq G \cap (f^{-1}(Y) \times B)$.
Now, let $(x, y) \in G \cap (f^{-1}(Y) \times B)$. Then $(x, y) \in G$, and so $y = f(x)$. But also $(x, y) \in f^{-1}(Y) \times B$, which implies that $x \in f^{-1}(Y)$, and by definition this means that $y \in Y$. Therefore $(x, y) \in f^{-1}(Y) \times Y$, and so $(x, y) \in G \cap (f^{-1}(Y) \times Y)$. Therefore we conclude that $G \cap (f^{-1}(Y) \times B) \subseteq G \cap (f^{-1}(Y) \times Y)$.