# functional equality of unions/intersections [duplicate]

I came across a statement which said that if we have a function $f:X\rightarrow Y$ where $A\subset X$ and $B\subset X$, then its true that $f(A\cup B)=f(A)\cup f(B)$, however its false that $f(A\cap B)=f(A)\cap f(B)$. I do not understand how this is so. Any help?

-

## marked as duplicate by Martin Sleziak, user127.0.0.1, Claude Leibovici, Davide Giraudo, Sami Ben Romdhane Mar 9 '14 at 9:38

Another fact woth knowing is that the second equality $f(A\cap B)=f(A)\cap f(B)$ is true if $f$ is injective. – Martin Sleziak Oct 28 '11 at 10:02
See this question: math.stackexchange.com/questions/239783/… – Martin Sleziak Mar 9 '14 at 7:59

Remember that $A=B$ if and only if $x\in A\iff x\in B$, so to verify an equality of sets we need to see that the elements are on both sets, and to show that two sets are different we can just point out an element in one and not in the other.

To see that $f(A\cup B)=f(A)\cup f(B)$, note that:

\begin{align} f(x)\in f(A\cup B) &\iff x\in A\cup B\\ &\iff x\in A\text{ or } x\in B\\ &\iff f(x)\in f(A)\text{ or } f(x)\in f(B)\\ &\iff f(x)\in f(A)\cup f(B) \end{align}

On the other hand, if $f(x)\in f(A)\cap f(B)$ it just means that for some $a\in A$ we have $f(a)=f(x)$ and for some $b\in B$ we have $f(b)=f(x)$. We can use this to show that this is not the same set.

That is, we can find a function $f\colon X\to Y$, and two sets $A,B\subseteq X$ with some $x\in A$ and $x\notin B$, and $y\in B$ for which $y\notin A$ such that $f(x)=f(y)$. Now try to see why $f(A\cap B)\neq f(A)\cap f(B)$.

-
@Srivatsan: Of course! Many thanks for catching that mistake! :-) – Asaf Karagila Oct 24 '11 at 0:36
It is not necessarily the case that $f(x)\in f(A) \implies x\in A$. For example here we could have $x$ coming from some other set $C$ which happens to satisfy $f(C)=f(A)=f(B)$. Therefore to prove $f(x)\in f(A)\cup f(B) \implies f(x)\in f(A\cup B)$ we should argue (wlog) $y\in f(A) \implies$ there exists $x\in A$ with $f(x)=y$. This $x$ certainly is in $A\cup B$. Hence $y=f(x)\in f(A\cup B)$. – massy255 Jul 3 '15 at 4:43

Well, to prove the first note that if $y\in f(A\cup B)$ then there exists $x\in A\cup B$ such that $f(y)=x$, but then it may happen that $x\in A$, and in this case $y\in f(A)$ or $x\in B$, and so $y\in f(B)$, in any case $y\in f(A)\cup f(B)$. Viceversa let $y\in f(A)\cup f(B)$. Then $y$ is in either $f(A)$ or in $f(B)$. Then there exists $x\in A\cup B$ such that $y=f(x)$ and so $y\in f(A\cup B)$.

To prove the other statement, note first that if $y\in f(A\cap B)$, then there exists $x\in A\cap B$, such that $y=f(x).$ Hence $y\in f(a)$ and $y\in f(B)$ so that $f(A\cap B)\subseteq f(A)\cap f(B)$.

To prove that the converse may not hold, consider $A=\{1\}$, $B=\{2\}$ and define $f(1)=f(2)=\{3\}.$ Then $f(A\cap B)=\emptyset$ while $f(A)\cap f(B)=\{3\}.$

-
Ha! that's even simpler than the example I tried to get OP to construct in my answer! – Gerry Myerson Oct 24 '11 at 0:42

It should be easy for you to construct an example of sets $A$ and $B$, and a function $f$, such that $f(A\cap B)\ne f(A)\cap f(B)$. You can do it with $A$ and $B$ having 2 elements each, one in common. Try it!

-