I need help with this problem:
Let $f:S\in\mathbb{R}^m\rightarrow\mathbb{R}$ be continuous. Prove that the level sets of f are closed in S.
I know that for a real valued function $f:S\in\mathbb{R}^m\rightarrow\mathbb{R}$ to be continous on $\mathbf{p}\in S$ means that if $f(\mathbf{a_k})\rightarrow f(\mathbf{p})$ then $\mathbf{a_k}\rightarrow \mathbf{p}$. $\mathbf{a_k}\in S$.
I also know that a level set corresponding to c is $f^{-1}(c)=\{\mathbf{x}\in S |f(\mathbf{x})=c\}$. I don't know how to use this two definitios to prove the above statement. Please help me.
If $x_n \in f^{-1} (c)$ and $x_n \to x$ then $f(x_n)=c$ for all $n$ so (taking limit) $f(x)=c$ or $x \in f^{-1}(c)$. So $f^{-1}(c)$ is closed.