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 x \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)$?