# Prove $f(A \cap B) = f(A) \cap f(B)$ if and only if $f$ is injective

elementary-set-theoryproof-explanation

I'm trying to prove that for sets $$A,B \subset S$$ a function $$f: S \to Y$$ is injective if and only if $$f(A \cap B) = f(A) \cap f(B)$$.

The first inclusion is clear and always true, but I'm trying to understand a proof of the latter direction: assuming $$f(A \cap B) = f(A) \cap f(B)$$ and proving that $$f$$ is injective. I can understand most of the steps of the proof, reproduced below.

Suppose $$f(a) = f(b)$$ for $$a,b \in S$$, and let $$A = \{a\}$$ and $$B = \{b\}$$. Then $$f(A) = f(B) = \{f(a)\} = \{f(b)\}$$. In particular, $$f(A) \cap f(B) = \{f(a)\}$$. By assumption, $$f(A \cap B) = f(A) \cap f(B)$$, so $$f(a) \in f(A \cap B)$$. So $$a \in A \cap B$$, so $$a \in B$$, so $$a = b$$.

The step I don't understand is where we argue that $$f(a) \in f(A \cap B)$$ implies $$a \in A \cap B$$. $$f(a)$$ is just some element $$y$$ of $$Y$$, so we could have $$y = f(x)$$ for some $$x \in A \cap B$$ where $$x \neq a$$. The sets are defined so narrowly that I can see why this can't be the case, by why does this imply, directly, that $$a \in A \cap B$$?

Here we have that $$f(A \cap B) = f(A) \cap f(B) = \{ f(a) \} \neq \emptyset.$$
On the other hand, if $$a \neq b$$, then $$A \cap B = \emptyset$$ and then $$f(A \cap B) = f(\emptyset) = \emptyset$$. Thus $$A \cap B \neq \emptyset$$. Hence since $$A$$ and $$B$$ are both sets with a single elements, these elements must be equal, as they must be the single element in $$A \cap B$$.