Let $Z$ be the image of a function $f: X \longrightarrow Y$. If $B \subset Y \backslash Z$, then $f^{-1}(B) = \emptyset$

Let $Z$ be the image of a function $f: X \longrightarrow Y$. If $B \subset Y \backslash Z$, how can I argue formally that $f^{-1}(B) = \emptyset$ once that $B \cap Z = \emptyset$?

Thanks in advance!


$x\in f^{-1}(B)$ if and only if $f(x)\in B$. As $B \subset Y \setminus Z$, $f(x)\in B$ implies that $f(x)\in Y$ and $f(x)\notin Z$. Hence if $f(x)\in B$, then $f(x)\notin Z$ and so, by the definition of $Z$, $f(x)$ is not in the image of $f$, but $f(x)$ is the value of $f$ at $x$, so must be in the image. This is a contradiction, hence there are no $x\in f^{-1}(B)$ and this set is consequently empty.