Given Definition:
Function $f$ on metric space $M$ is called lower semicontinuous if, for each real $a$ the set $\{x \in M: f(x) \leq a\}$ is closed in $M$.
Question:
Prove that $f$ is lower semicontinuous if and only if $f(x)\leq \liminf\limits_{n\rightarrow \infty} f(x_n)$ whenever $x_n\to x$ in $M$.
Hint Given:
For the forward implication, suppose that $x_n\to x$ and $m = \liminf\limits_{n\rightarrow \infty} f(x_n) \lt \infty$. Then, for every $e>0$, the set $\{t \in M: f(t) \leq m + \epsilon \}$ is closed and contains infinitely many $x_n$.
This is from a Real Analysis book I am trying to read.
I would really like to share my work on this, but I do not seem to understand how to even begin with the proof, using only the definition given.
Suppose that $x_n$ converges to $x$. Let $\epsilon>0$, then the set $G_\epsilon=\{y\in M:\, f(y)>f(x)-\epsilon\}$ is open in $M$. Since, $x_n$ converges to $x$ there is an $m$ such that $x_n\in G_\epsilon$ for every $n\geq m$. In other words, $$f(x_n)>f(x)-\epsilon$$ for every $n\geq m$. This implies that $\liminf_{n}f(x_n)\geq f(x)-\epsilon$. As $\epsilon>0$ was arbitrary we have $\liminf_nf(x_n)\geq f(x)$. For the converse, suppose that whenever $x_n\to x$ we have $\liminf_{n}f(x_n)\geq f(x)$. We wish to show that the set $$F_\alpha=\{x\in M:\, f(x)\leq \alpha\}$$ is closed in $M$. We will show that the complement $$M\setminus F_\alpha=\{x\in M:\, f(x)>\alpha\}$$ is open. Pick $x\in M\setminus F_\alpha$, then $f(x)>\alpha$. If there is no $\rho>0$ such that the ball centered at $x$ with radius $\rho>0$ belongs to $M\setminus F_\alpha$ then we would be able to find a sequence $x_n\in F_\alpha$ such that $x_n\to x$. Then, since $x_n\in F_\alpha$ means that $f(x_n)\leq \alpha $ for all $n$, which implies $\liminf_n f(x_n)\leq \alpha$, contradicting our hypothesis $\liminf_n f(x_n)\geq f(x)>\alpha$. Hence, there is a $\rho>0$ such that the ball centered at $x$ with radius $\rho$ is contained on $M\setminus F_\alpha$. This means, that $M\setminus F_\alpha$ is open, hence $F_\alpha$ is closed as we wanted.