I am doing a problem a problem in Hartshorne (2.3.2) which asks to show that a morphism of schemes $f : X \to Y$ is quasi compact iff for every affine open $U \subseteq Y$, $f^{-1}(U)$ is quasi compact. Now one direction is tautological so for the other direction take $U \subseteq Y$ an affine open subset. Let $\{V_i\}$ be a cover of $Y$ by open affines such that for every $i$, $f^{-1}(V_i)$ is quasi - compact. Then for every $i$ we can write
$$U \cap V_i = \bigcup_{j} V_{ij}$$
where the $V_{ij}$ are open and principal in both $U$ and $V_i$. Since $\bigcup_i (U \cap V_i) = \bigcup_i \bigcup_j V_{ij}$ is an open cover of $U$ and since $U$ is quasi compact, this means $U = \bigcup_{k=1}^n V_{i_k j_k}$ for some indices $i_k,j_k$. Thus $f^{-1}(U)$ is a finite union of the open sets $f^{-1}(V_{i_k,j_k})$. Now if each of these is quasi - compact then $f^{-1}(U)$ being a finite union of quasi - compact sets is quasi - compact.
My question is: Why is each $f^{-1}(V_{i_k,j_k})$ quasi - compact? I know that for every $i_k$, $f^{-1}(V_{i_k})$ can be covered by a finite union of open affine sets by assumption. Does this mean then that $f^{-1}(V_{i_k,j_k})$ is principal in each of these open affines (and thus quasi - compact)?