Let \(X=\{1,2,3\}\) have the trivial topology and \(Y=\{a,b\}\) have \(\mathcal{T}=\{\varnothing,\{a\},Y\}\). How many continuous functions \(X\to Y\) are there?
We need \(f^{-1}(\{a\})\) open in the trivial topology, i.e. \(\varnothing\) or \(X\): \(f\) is constant. There are exactly two constants (all \(a\) or all \(b\)), out of \(2^3=8\) functions.
A function \(f:X\to Y\) between topological spaces \((X,\mathcal{T}_X)\) and \((Y,\mathcal{T}_Y)\) is continuous if the preimage of every open set \(V\) of \(Y\) is an open set of \(X\).