Show that for any map $g : (Y,T) \to (Z,T'')$, $g$ is continuous iff $g \circ f \colon (X,T') \to (Z,T'')$ is continuous. Let $Y$ be a set, $(X,T')$ be a topological space and $f\colon X\to Y$ be a map.
There is $T = \{\,V \subset  Y \mid f^{-1} (V) \in T'\,\}$.
I have to show that for any map $g : (Y,T) \to (Z,T'')$, $g$ is continuous iff $g \circ f \colon (X,T') \to (Z,T'')$ is continuous.
It is somewhat like associative law, but  I cannot even start the proof. Please help. 
 A: What does it mean for $g$ to be continuous? Precisely that, for every open $U \in T''$ we have $g^{-1}(U)$ open in $T$. This is equivalent to $f^{-1}(g^{-1}(U))$ being open in $T'$, i.e. $g \circ f$ is continuous.
A: To show that $g$ is continuous if $gf$ is.
Notation: For  any function $h$ with domain $H$ and any $S\subset H$ let $h''S=\{h(t):t\in S\}.$ (Note: $ h''S $ is read: $h$ double-prime $S$.)
(i).For $U\in T'$ we have $f^{-1}f''U=U\in T'$. So $f''U\in T$ for all $U\in T'$ by def'n of $T$.
Suppose $gf$ is continuous.
(ii).Case 1. When $f$ is a surjection: For $W\in T''$ let $U=(gf)^{-1}W.$ Then we  have $U\in T'$ by continuity of $ gf. $  So $f''U\in T$ by (i).  $$\text { We have }\quad  g^{-1}W=f''U\in T$$ because,from the def'n of  $U, $ we have $$q\in f''U\iff  \exists p\;( (gf)(p)\in W\land f(p)=q)\iff$$ $$\iff  \exists p\;(f(p)=q\land g(q)\in W)$$ but since $f$ is a surjection the last line above is equivalent to  $g(q)\in W.$ 
(iii). Case 2. When $f$ is not a surjection, the domain of $g$ is $f''X$ and we take the subspace topology $T^*=\{V\cap f''X: V\in T\}$ on $f''X. $ Then with $Y^*=f''X $ and the surjection  $f:X\to Y^*$ we have $T^*=\{V\subset Y^*: f^{-1}V\in T'\}. $ So Case 1 applies with $Y^*$ and $T^*$ in place of $Y$ and $T.$  
