Let $f \colon A \rightarrow B$ be a function and $S$ a subset of $A$. Let $f \colon A \rightarrow B$ be a function and $S$ a subset of $A$.
Are the following containments always valid?.
$(1)    f^{-1} (f(S))⊆ S$
$(2)     S⊆f^{-1} (f(S))$
Attempt
$S ⊆ A$
$f^{-1}(S) = \{a ∈ B : f(a) ∈ S\}$
$ a ∈ f^{-1}(S) ⟺ f(a) ∈ S$
$ f^{-1}(S) ⊆ B$
I just need a little help finishing the proof. Am i wrong in the attempt? Thanks.
There is a problem with your proof. $f^{-1}(S)$ doesn't exist. This is because $S$ is a subset of $A$. It only makes sense to take a preimage under $f$ of a subset of $B$. On the other hand, $f(S)$ makes perfect sense. Indeed, $f(S)=\{f(a)\in B|a\in A\}$. Note that $f(S)$ is a subset of $B$. Then, it now makes sense to write $f^{-1}(f(S))=\{a\in A|f(a)\in f(S)\}$. From this it should now be clear that only one of the two options you presented in your question is always true. Can you tell which one it is?
On the other hand, the other option will be true if we add a further assumption on $f$. Can you tell which assumption we need to add? (hint: recall the notion of an injective/surjective function).
Recall that for a function $ f: X \rightarrow Y $, and two subsets $A\subseteq X, B\subseteq Y$ that
$$ (f \circ f^{-1})(B) = I_Y(B)=B \\ (f^{-1} \circ f)(A) = I_X(A)=A $$
Where $I_X, I_Y$ are the identity functions. Do you think you can continue from here?