Function is continuous if and only if preimages of elements of a subbase are open. I recently started studying Topology, and functions defined from one topological space to another.
I found on Wikipedia, where I was reading about subbase, that 'continuity of a function need only be checked on a subbase of the range.'
That is, if $\mathcal B$ is a subbase for $Y$, a function  $f  : X \to Y$ is continuous if and only if  $f^{−1}(U)$ is open in $X$ for each $U \in\mathcal B$.
I tried to prove it by taking an open set in $Y$ and showing that its inverse is also open if $f$ is continuous, after that I studied the structure of $O$ and found that each $O$ is in fact union of finite intersections of elements of $\mathcal B$, and I got stuck, how to show that the inverse of unions of finite intersections of elements of $\mathcal B$ to be open?
May be it's very easy,but it's not striking my head, hope to get a help.
Thank you.
 A: 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.
A: 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.
