Function is continuous if and only if preimages of elements of a subbase are open.

You use the fact that, for a family of sets $(A_i\,:\,i\in I)$, $$f^{-1}\left(\bigcap_{i\in I}A_i\right)=\bigcap_{i\in I} f^{-1}(A_i)\\ f^{-1}\left(\bigcup_{i\in I}A_i\right)=\bigcup_{i\in I} f^{-1}(A_i)$$

Let's prove the first one. \begin{align}x\in f^{-1}\left(\bigcap_{i\in I}A_i\right)&\iff f(x)\in\bigcap_{i\in I}A_i\iff \forall i\in I,\ f(x)\in A_i\\&\iff \forall i\in I,\ x\in f^{-1}(A_i)\iff x\in \bigcap_{i\in I} f^{-1}(A_i)\end{align} The other one is similar. Once you know that, you're done: preimage of an open set is union of finite intersections of preimages of elements of the subbasis, thus union of finite intersections of open sets, thus open.


You can check it directly using the fact that the open sets are unions of finite intersections of the subbasis, but here is an approach which is also useful for other contexts (like measure theory, where measurable sets are not so easily described).

Firstly, we let the definition of topology generated by a subbasis be the natural one: it is the smallest topology containing the elements of the subbasis. It should be an easy exercise to check that this is equivalent to whatever definition you have.

Let $f: (X,\tau) \to (Y,\tau')$ be such that $f^{-1}(S)$ is open for every $S$ an element of the subbasis $\mathcal{S}$ of $(Y,\tau')$. Note now that it suffices to show that the set $$\mathcal{O}:=\{A \subset Y \mid f^{-1}(A) \in \tau\}$$ is a topology on $Y$. Since it contains the elements of $\mathcal{S}$ by hypothesis, we will have that $\tau' \subset \mathcal{O}$ by definition of subbasis. Consequently, $f$ is continuous.

But that $\mathcal{O}$ is a topology follows readily from the equations involving $f^{-1}$ and intersections/unions, and the fact that $\tau$ is a topology.