Show that $X$ has a unique smallest topology for which $f$ is continuous. The question is:
Let $X$ be a set (without a topology as yet), let $Y$ be a topological space, and suppose $f: X \rightarrow Y$ is a function (of sets).


*

*Show that $X$ has a unique smallest topology for which $f$ is
continuous.

*Show that with this topology, a function $g: W \rightarrow X $ from
 some topological space $W$ to $X$ is continuous iff $f \circ g: W
\rightarrow Y$ is continuous.


Could anyone give me a hint on how to generate this topology ?
 A: It's the initial topology:
$\{ f^{-1}(U) : U\text{ open within }Y \}$
A: Define $\mathcal{T}_X=\{f^{-1}[O]: O \subseteq Y \text{ open }\}$ and note
that this is a topology on $X$ by the standard identities
$$f^{-1}[\bigcup_{i \in I} O_i]=\bigcup_{i \in I} f^{-1}[O_i]$$
and 
$$f^{-1}[\bigcap_{i \in I} O_i]=\bigcap_{i \in I} f^{-1}[O_i]$$
Minimality is trivial: if $\mathcal{T}$ is a topology such that $f$ is continuous as a map $(f:X,\mathcal{T}) \to Y$, for each set of the form $f^{-1}[O]$ with $O$ open in $Y$, $f^{-1} \in \mathcal{T}$ by continuity.
So $\mathcal{T}_X \subseteq \mathcal{T}$ and $\mathcal{T}$ has the required minimality.
And for 2. one direction follows from compositions of continuous functions being continuous and the other is not too hard either: if $(f \circ g): W \to Y$ is continuous then if $U$ is open in $\mathcal{T}_X$, so $U=f^{-1}[O]$ with $O$ open in $Y$, then 
$$g^{-1}[U]= g^{-1}[f^{-1}[U]]=(f \circ g)^{-1}[O]$$ 
and the right hand side is open by continuity of $f \circ g$. So $g$ is continuous.
It's the exact dual proof to your earlier question on the final topology.
