# Equivalence of definitions for upper semicontinuity

I am trying to show that a function is upper semicontinuous if and only if the preimage of any open ray $(-\infty, a)$ is open.

The definition given for upper semicontinuity is that $\lim\limits_{k \to \infty} x_k = x \implies \limsup\limits_{k\to \infty} f(x_k) \leq f(x)$.

I find this definition hard to work with, as I have never been comfortable with $\limsup$ and $\liminf$.

Can anyone give me a hint as to how to approach this? Thank you!

The intuitive idea, I believe, is that $\cup_{\{x_k\le x\}}f^{-1}(-\infty,x_k)=\limsup_{\{x_k \le x\}} f^{-1}(-\infty,x_k)$ (in fact actually equal to the limit, since any subsequence would be monotone), thus if
$f^{-1}(-\infty,x)\supset \limsup_{\{x_k \le x\}} f^{-1}(-\infty,x_k)$
$\limsup_{k→∞}f(x_k)≤f(x)$.