Existence of lim sup and lim inf of a function I'm learning lim sup and lim inf of a function f. I have learned that for a function $f:\mathbb R\rightarrow \mathbb R, x_0\in \mathbb R $,
$$\lim \inf_{x\rightarrow x_0} f(x)$$ and $$\lim \sup_{x\rightarrow x_0} f(x)$$ always exist and may be $-\infty, \infty$.
I don't understand why it always has to exist.
Also can $\lim \inf$, $\lim\sup$ be $\infty$, $-\infty$, respectively?
 A: Let us take a look at the definition of limit superior and limit inferior. And to make things easier, we will look at sequences instead of functions. In the end, it is the same thing.
For a real sequence $(x_n)_{n\geq 0}$, we can look at the two following sequences:
$$
y_n := \inf_{m\geq n} x_m\qquad\text{ and }\qquad z_n := \sup_{m\geq n} x_m.
$$
This might look confusing at the beginning, but it may be easier to describe it in English: $y_n$ describes the smallest term that will be found in the future and $z_n$ describes the biggest term that will be found in the future. (That is not totally true, because those $\inf$ and $\sup$ do not necessarily appear in the sequence; consider $1/n$ for example. The $\inf$ always will be $0$, but is never reached.)
The interesting thing is that $y_n$ is non decreasing, because we take the $\inf$ over less and less of elements. So it can only become bigger. For the same reason, $z_n$ is non increasing. That means that we have to monotone sequences, which necessarily converge (if we include $\pm \infty$ as possible limits). Those limits are called limit inferior and limit superior:
$$
\liminf_{n\to\infty} x_n := \lim_{n\to\infty} y_n = \lim_{n\to\infty} \left(\inf_{m\geq n} x_m\right)
$$
and
$$
\limsup_{n\to\infty} x_n := \lim_{n\to\infty} z_n = \lim_{n\to\infty} \left(\sup_{m\geq n} x_m\right).
$$
That should answer your first question. For the second: First note that if $(x_n)$ has a limit, then the limits inferior and superior coincide and are equal to that limit. So if $(x_n)$ diverges to $\infty$, then $\liminf_n x_n = +\infty$ and if it diverges to $-\infty$, then $\limsup_n x_n = -\infty$. So, yes to your second question. BUT you always have
$$
\liminf_n x_n \leq \limsup_n x_n.
$$
(Clear? If not, try to figure it out!) That means that it is not possible to have $\liminf_n x_n = +\infty$ and $\liminf_n x_n = -\infty$ at the same time! (Although it is possible to have $\liminf_n x_n = -\infty$ and $\limsup_n x_n = +\infty$ at the same time. [Try to find a sequence which gives that!].)
If you want to come back to function, the easiest way is probably to understand that
$$
\lim_{x\to \xi} f(x) = c
$$
is only a shortcut for "For every sequence $(x_n)_n$ with $\lim x_n = \xi$, the sequence $(f(x_n))_n$ has a limit which is given by $c$. So all limit definitions for functions can be understood as limits of sequences.
A: For example, $$\liminf_{x\to x_0}f(x):=\lim_{\delta \to 0^+}\inf_{|x-x_0|<\delta }f(x).$$
Set $$g(\delta )=\inf_{|x-x_0|<\delta }f(x).$$
This is an increasing function, and it's well known that for any increasing function $h:\mathbb R\to \mathbb R$, $$\lim_{x\to a^+}h(x)\quad \text{and}\quad \lim_{x\to a^-}h(x),$$
always exist. If you don't know it, prove it !
