Show that a compactness preserving $f: \mathbb{R}^2 \to \mathbb{R}$ with “directional” continuity is continuous Let $f: \mathbb{R}^2 \to \mathbb{R}$ satisfy the following properties.
For each fixed $x_0$ and $y_0$, $y \mapsto f(x_0, y)$ and $x \mapsto f(x, y_0)$ are continuous. Plus for any compact subset $K \subset \mathbb{R}^2$, $f(K)$ is compact. Prove that $f$ is continuous.
This problem is from Pugh’s Real Mathematical Analysis, 3rd edition, Chapter 2, Prelim Problems no. 4. My professor assigned it as practical question for the final, but I do not have any clue about it.
Here is one of my idea. Fix $\epsilon > 0$, and pick a compact ball $K_0$ containing a fixed $p \in \mathbb{R}^2$. If $f(K_0) \subset (f(p) - \epsilon, f(p) + \epsilon)$, we are done. If not, I can pick the worst outliner, namely $q \in K_0$ such that $|f(q) - f(p)|$ attains maximum. Thus, we can work with a smaller ball $K_1$, etc. Next, consider an open set covers $K_i \setminus K_{i + 1}$. Somehow, if all such open sets cover $K_0$, then by compactness we seem to be done. Nevertheless, I feel something wrong about this idea, and I have no other clue. Anyone gives me some hint?
 A: HINT: Fix $p=\langle x,y\rangle\in\Bbb R^2$, and let $\langle p_n:n\in\Bbb N\rangle$ be any sequence converging to $p$. For $n\in\Bbb N$ let $p_n=\langle x_n,y_n\rangle$. You need to show that $\langle f(p_n):n\in\Bbb N\rangle$ converges to $f(p)$. Suppose not.


*

*Show that there are an $\epsilon>0$ and an infinite $M_0\subseteq\Bbb N$ such that $|f(p_n)-f(p)|\ge\epsilon$ for each $n\in M_0$.  

*Show that there is an infinite $M_1\subseteq M_0$ such that $\langle f(p_n):n\in M_1\rangle$ converges to some $\alpha\in\Bbb R$.


Suppose first that there is is an infinite $M_2\subseteq M_1$ such that $x_n=x$ for each $n\in M_2$.


*

*Use the separate continuity of $f$ to get a contradiction by showing that $\langle f(p_n):n\in M_2\rangle$ converges to $f(p)$.  


Make a similar argument in case there is an infinite $M_2\subseteq M_1$ such that $y_n=y$ for each $n\in M_2$.
Now suppose that neither of these cases obtains.


*

*Show that there is an infinite $M_2\subseteq M_1$ such that $x_m\ne x_n$ and $y_m\ne y_n$ whenever $m,n\in M_2$ and $m\ne n$.  

*Show that we can further assume that $f(n)\ne\alpha$ for each $n\in M_2$. 


Let $K=\{p_n:n\in M_2\}\cup\{p\}$.


*

*Show that $K$ is compact.  

*Get a contradiction by showing that $f[K]$ is not compact.

