Proving $f$ is continuous if $f_1$ and $f_2$ are continuous and the reciprocal 
For $i=1,2$ let $(X_i,\tau_i)$ and $(X'_i,\tau_i)$ be topological spaces, and $f_i: X_i\to X'_i$ functions. Consider the function $f:X_1\times X_2\to X'_1\times X'_2$ defined by $f(x_1,x_2)=(f_1(x_1),f_2(x_2))$.
  Show that if $f_1,f_2$ are continuous then $f$ is continuous for the product topologies. Prove the reciprocal. 

I tried to prove the statement in the following way:
$\Rightarrow$ Let $\mathscr{U}$ be an open set such that by definition of product topology $\mathscr{U}=A\times B$. As $f_1$ and $f_2$ are continuous  functions, then $f_1^{-1}(A)\in\tau'_1$ and $f_2^{-1}(B)\in\tau'_2$.
So $f^{-1}(\mathscr{U})=f^{-1}(A\times B)=f_1^{-1}(A)\times f_2^{-1}(B)$so that by definition of open sets in the product topology are open hence $f_1^{-1}(A)\times f_2^{-1}(B)\in\tau'_i$.
$\Leftarrow$ Let's define the following functions $I_1: (X'_i,\tau'_i)\to (X_1\times a_2)$ and $I_2: (X'_i,\tau'_i)\to (a_2\times X_2)$ such that $(a_1,a_2)\in X'_i $ By known theorem $I_1$ and $I_2$ are homeomorphisms.
Using the $p_1$ and $p_2$ as the projection functions. $f_1=p_1\circ f\circ I_1$
 and  $f_2=p_2\circ f\circ I_2$. As the composition of continuous functions is continuous hence $f_1$ and $f_2$ are continuous.
Questions:
1) Is my proof right? Can I give the following step $f^{-1}(A\times B)=f_1^{-1}(A)\times f_2^{-1}(B)$?
2) I was advised to define $I_1$ and $I_2$. Why are the projections not enough? I mean $f_1=p_1\circ f$ and  $f_2=p_2\circ f$.
Thanks in advance!
 A: Firstly, an open set in the product topology is not always of the form $U \times V$, it is a union of such open sets, as these form a base for the product topology. So if $O$ is product open and so $O= \bigcup_{i \in I} (U_i \times V_i)$ we indeed have that $$f^{-1}[U_i \times V_i] = \{(x,x'): f(x,x') \in U_i \times V_i\} =\
 \{(x,x'): (f_1(x), f_2(x') \in U_i \times V_i\} = \{(x,x'): f_1(x) \in U_i \text{ and } f_2(x') \in V_i\} =\
 \{(x,x'): x\in f_1^{-1}[U_i] \text{ and } x' \in f_2^{-1}[V_i]\} =f_1^{-1}[U_i] \times f_2^{-1}[V_i]$$ which is basic product open, and so $f^{-1}[O] = \bigcup_i f^{-1}[U_i \times V_i]$ is a union of open sets and hence open.
The reverse needs the embeddings, as $\pi_1 \circ f$ is a map defined on $X_1 \times X_2$ and not on $X_1$, so is not equal to $f_1$. In order to use $f$ we need two arguments, so fix $a \in X_1$ and $a' \in X_2$ and define $j: X_1 \to X_1 \times X_2 $ by $j(x)=(x,a')$. It's continuous because the composition of $j$ with the two projections are either the identity on $X_1$ or a constant map, so continuous always. And then $(\pi_1 \circ f \circ j)(x)=\pi_1(f(x,a'))=\pi_1(f_1(x), f_2(a'))= f_1(x)$ for all $x\in X_1$ so $f_1$ is then a composition of three continuous maps, hence continuous.
$f_2$ is similarly continuous using $i: X_1 \to X_1 \times X_2$ defined by $i(x)=(a,x)$.
