a) To show that #f^{-1}(X cap Y)subseteq f^{-1}(X) cap f^{-1}(Y)#, assume that #a in f^{-1}(X cap Y)#. This means that #f(a) in X cap Y# so that #f(a) in X# and #f(a) in Y#. But this implies that #a in f^{-1}(X)# and #a in f^{-1}(Y)#, leading to the conclusion that #a in f^{-1}(X) cap f^{-1}(Y)#.
The previous logic is reversible to show that #f^{-1}(X) cap f^{-1}(Y) subseteq f^{-1}(X cap Y)#. For if #a in f^{-1}(X) cap f^{-1}(Y)#, then #a in f^{-1}(X)# and #a in f^{-1}(Y)#, implying that #f(a) in X# and #f(a) in Y#. But this means that #f(a) in X cap Y# so that #a in f^{-1}(X cap Y)#.
The last two paragraphs lead to the conclusion that #f^{-1}(X cap Y)= f^{-1}(X) cap f^{-1}(Y)#.
b) Assume that #f# is surjective (onto).
To show that #f(f^{-1}(X))subseteq X#, suppose that #b in f(f^{-1}(X))#. This means that there exists #a in f^{-1}(X)# such that #f(a)=b#. But #a in f^{-1}(X)# implies that #b=f(a) in X#.
The logic of the previous paragraph is not completely reversible since we did not need the fact that #f# is surjective. To reverse the logic, we need that assumption. To show that #X subseteq f(f^{-1}(X))#, suppose that #b in X#. Since #f# is surjective (onto), there exists an #a in A# such that #f(a)=b#, which also means that #a in f^{-1}(X)# (since #b in X#). But this then means that #b in f(f^{-1}(X))#.
The last two paragraphs lead to the conclusion that #f(f^{-1}(X))=X# when #f# is surjective.