# The pre-image of the co-domain

I was solving a problem of set theory and applications then suddenly I faced this problem:

Let $$f: X \to Y$$ be a function, and let $$B \subseteq Y$$. Prove that: \begin{align*} f^{-1}(Y-B) = X - f^{-1}(B) \end{align*}

I proved that:

\begin{align*} f^{-1}(Y-B) = f^{-1}(Y) - f^{-1}(B) \end{align*}

Now I think It is enough to show that $$f^{-1}(Y) = X$$.
A friend of mine told me that the equality $$f^{-1}(Y) = X$$ is always true, but I have doubt. What does that mean? Is it really true that the pre-image of a co-domain is always the domain?! if not what is the counterexample?

• For $f$ to be a function and $X$ to be its domain, every point of the domain must be mapped to a point in the co-domain. Therefore if you try to compute the "inverse" of any point in the co-domain, it will either not exist and if it does, it has to be in the domain. Since all points in the domain have an image in the co-domain, you get what you want. – Iguana Oct 28 '19 at 7:19

Remember what it means for $$f$$ to be a function from $$X$$ to $$Y$$. Since $$X$$ is the domain of $$f$$ and $$Y$$ is the codomain, for every value $$x\in X$$, we have that $$f(x)=y$$ for some $$y\in Y$$. This is just what it means for $$f$$ to be a function from $$X$$ to $$Y$$, or for $$f$$ to "pass the vertical line test" as it is sometimes said in introductory courses.
When we say $$f^{-1}(Y)$$, we're talking about the subset of elements in the domain $$X$$ that get mapped into $$Y$$ by $$f$$. But every element in $$X$$ gets mapped into $$Y$$ by $$f$$ because that's precisely what it means for $$f$$ to be a function from $$X$$ to $$Y$$. Your friend is certainly correct that $$f^{-1}(Y)=X$$.
In fact, the image of $$f$$, $$\mathrm{Im}(f)\subset Y$$ has the property that $$f^{-1}(\mathrm{Im}(f)) = X$$, so any set that contains the image also has this property (this includes $$Y$$). If it helps, maybe you can think of this as being because $$f^{-1}(Y) = f^{-1}\left(\mathrm{Im}(f) \cup (Y-\mathrm{Im}(f))\right) = f^{-1}(\mathrm{Im}(Y)) \cup f^{-1}(Y-\mathrm{Im}(Y)) = X \cup \emptyset = X$$.
• Thanks to you, I got it, but I didn't understand the last line you wrote about the image of $Y$, and if I suppose you meant to write the pre-image of $Im(f)$ why it would be $Y$ ? I think you should've written $X$ instead. – Reza Oct 28 '19 at 7:47
Let $$x\in f^{-1}(Y-B)$$ then $$\exists$$some $$y\in Y-B$$ such that $$y=f(x)$$ Now $$f(x)\notin B$$ so $$x\notin f^{-1}(B)$$ so $$x \in X-f^{-1}(B)$$.Now conversely$$x\notin f^{-1}(B)$$ implies $$f(x)\notin B$$ so $$f(x)\in Y-B$$ thus $$x\in f^{-1}(Y-B)$$.Trivial case where $$f^{-1}(Y-B)$$ is empty is not discussed.I think you can do it from above. And for your doubt,check the definition, $$f^{-1}(Y)=\{x\in X : f(x) \in Y\}$$ which is obviuously $$X$$,because for any element of $$X$$,the property is true.