Why are the preimages of these sets open, for any topological spaces $X$ and $Y$? Suppose $X$ and $Y$ are topological spaces and $f: X \times Y \to\mathbb{R}$ is a continuous map (product topology on $X \times Y$, Euclidean topology on $\mathbb{R}$).
Let $g: X \to\mathbb{R}$ be defined by $g(x)= \sup\{f(x,y) \mid y \in Y\}$.
Then if $A=(r,+\infty)$, $r \in \mathbb{R}$, then $g^{-1}(A)$ is open. If $A=(-\infty, r)$,  $r \in \mathbb{R}$, then $g^{-1}(A)$ is not always open.
Why is this? How can I determine whether $g^{-1}(A)$ is open (or not) if I don't know anything about $X$?
I would appreciate any help and clues.
Regards,
J.
 A: Since $f$ is continuous, each function $g_y:X\to\mathbb R$ defined by $g_y(x)=f(x,y)$ is continuous.  Since each $g_y$ is lower semicontinuous, and a pointwise supremum of an arbitrary family of lower semicontinuous functions is lower semicontinuous, $g=\sup\limits_{y\in Y}g_y$ is lower semicontinuous.  Lower semicontinuity of $g$ is equivalent to openness of $g^{-1}(r,\infty)$ for all $r\in \mathbb R$.  As Dylan noted, $g$ may not always be finite valued, but the above holds just as well when the codomain is replaced with $[-\infty,\infty]$.
However, you can't expect $g$ to be upper semicontinuous, because this is not preserved under taking suprema.  To find an example then, it is a good idea to start with a lower but not upper semicontinuous function, and try to work backwards, first expressing it as a supremum of a family of continuous functions. For example, let $X=\mathbb R$, and let $g:\mathbb R\to\mathbb R$ be defined by $g(x)=0$ if $x\neq 0$, $g(0)=-1$.  For each $n\in\mathbb N$, let $g_n:\mathbb R\to\mathbb R$ be the continuous function that vanishes outside $\left(-\frac{1}{n},\frac{1}{n}\right)$, $g_n(0)=-1$, and $g_n$ is linear on $\left(-\frac{1}{n},0\right)$ and $\left(0,\frac{1}{n}\right)$.  Note that $g=\sup\limits_{n\in\mathbb N}g_n$.  Let $Y=\mathbb N$ with the discrete topology.  Define $f:\mathbb R\times\mathbb N\to\mathbb R$ by $f(x,n)=g_n(x)$.  Then $f$ is continuous, $g$ comes from $f$ as in the problem statement, and $g$ is not upper semicontinuous (it is easy to find $r$ such that $g^{-1}(-\infty,r)$ is not open).
