$f\colon X \to Y \times Z$ is continuous iff its component functions are I have a homework question that asks me to prove that a given function $f : X \rightarrow Y \times Z$ is continuous if and only if its component functions $f_Y : X \rightarrow Y$ and $f_Z : X \rightarrow Z$ are continuous.  I think I solved it, and looking around online, I see that my proof is the same as the one given in various textbooks, so it must be right.  But thinking about it further, I'm no longer convinced it is.
My question regards the reverse direction: if the component functions are continuous then $f$ is.  My thought was that $f^{-1}(U \times V) = f_Y^{-1}(U) \cap f_Z^{-1}(V)$, so it will be open if $U$ and $V$ are and $f_Y$ and $f_Z$ are continuous, thus showing that $f$ is continuous.  This answer seems to be the same answer given in various places online.  However, it looks to me that this only works for open sets of the form $U \times V$.  The definition of a continuous function (at least the one we're using in class) states that "A function is continuous iff every open set in the range has an open preimage."  So why is this proof acceptable?  It only considers "rectangular" open sets in the range, not all of them.
 A: The reason it suffices to consider only the "rectangular open sets" is that the rectangular open sets are a basis for the product topology: every open set in $X\times Y$ is a union of "rectangular open sets". So it suffices to check for the rectangular ones:
If $O$ is an arbitrary open set of $X\times Y$, we can find rectangles $U_i\times V_i$ with $U_i$ open in $X$ and $V_i$ open in $Y$, such that
$$O = \bigcup_{i\in I} (U_i\times V_i).$$
Then
$$f^{-1}(O) = f^{-1}\left(\bigcup_{i\in I}U_i\times V_i\right) = \bigcup_{i\in I}f^{-1}(U_i\times V_i).$$
So $f^{-1}(O)$ is a union of open sets (since we already established that the inverse image of a "rectangular open set" is open), hence open.
One can verify continuity of a function by checking the inverse image of basic open sets only (in fact, it suffices to consider sub-basic open sets, which are a family of sets such that all finite intersections of them form a basis), because the inverse image map is very well-behaved with respect to set operations.
