TITLE: Is the supremum of a continuous function bounded?
QUESTION [6 upvotes]: Let $f:\mathbb{R}\times[a,b]\to \mathbb{R}$ be a continuous function with $a<b$, such that for every $y\in [a,b]$ we have that  $$\sup_x f(x,y)\in \mathbb{R}$$ Does that mean that $$\sup_{y\in [a,b]}\sup_{x\in \mathbb{R}}f(x,y)\in \mathbb{R}$$
I believe it is not true, but I don't know how to prove it.

REPLY [5 votes]: I'll write a counterexample. Let $a=0,b=\frac\pi2$, and we'll use the canonical bump function
$$\Psi(x)=\begin{cases}\exp\left(-\frac1{1-x^2}\right)&\text{if }x\in(-1,1),\\0&\text{otherwise}\end{cases}$$
The function $f(x,y)$ may then be taken to be
$$f(x,y)=\begin{cases}0&\text{if }y=\frac\pi2\\
\Psi(x-\tan(y))\tan(y)&\text{otherwise.}
\end{cases}$$
Since the bump is smooth and bounded, $f$ is continuous and bounded for any fixed $y<b$, but as $y\to b$, we see that $\sup f=\infty$. At $y=b$, the function is still bounded, and for any $x\in\mathbb{R}$, we can find an open ball around $(x,y)$ where the function is constant and equal to $0$ -- simply choose a radius much smaller than $\arctan(x)$, and by that point the bump will have "moved past".