# About proving $f(S \cup T) = f(S) \cup f(T)$

I have an example is like this

Let f be a function from the set A to the set B. Let S and T be subsets of A. Show that $f(S \cup T) = f(S) \cup f(T)$

$answer:$

$y\in f(S\cup T) \rightarrow \exists s \in S \cup T \;such \;that \;y= f(x)$

$if \; x \in S \;then \;y= f(x) \in f(S) \subset f(S) \cup f(T) \rightarrow y \in f(S) \cup f(T)$

$if \; x \notin S \;then \;x \in T \; and \;\;y = f(x) \in f(T) \subset f(S) \cup f(T) \rightarrow y \in f(S) \cup f(T)$

$it \;follows \;that \; f(S \cup T) \subset f(S) \cup f(T)$

$Since \;S,T \subset S \cup T, f(S), f(T) \subset f(S \cup T) \rightarrow f(S) \cup f(T) \subset f(S \cup T)$

$By \;above, \;we \;have \;f(S \cap T) =f(S) \cap f(T)$

I cannot understand why I need to consider $x \in S$ and $x \notin S$? and Why the $f(S)$ is the subset of $f(S) \cup f(T)$? and Why in the step three the $f(T)$ is also the subset of $f(S) \cup f(T)$?

-

If you only consider $x \in S$, then you haven't considered all the elements in $S \cup T$ because there might be elements in $T$ that are not in $S$.
And $f(T)$ is a subset of $f(S) \cup f(T)$ because the union of two sets will have each of the two sets as the subset.