Simple question about closed sets I have two functions $f,g: \mathbb{R} \rightarrow \mathbb{R}$ which are continuous. Now in a proof one step that is not further explained says that the set
$$M = \{x \in \mathbb{R}| f(x) \leq g(f(x))\}$$ is closed.
I thought about it but could not find a short formal argument and I fear the answer is very trivial because the book explains all others steps very detailed. I noticed that if you instead say $f(x) < g(f(x))$ it is not true anymore because you could set $f(x)=\frac{1}{|x|+1}$ and $g(x)=1$ getting a contradiction for a sequence with $x_n \rightarrow 0$. Thank you in advance.
 A: Look at $h(x) = g(f(x)) - f(x)$ and observe that $M = h^{-1}[0,\infty)$ is closed because $h$ is continuous.
A: Both $f$ and $g$ are continuous, so the  function $f - g\circ f$ is continuous. Hence $\{x| f(x) - g\circ f(x) \le 0\}$ is closed. 
In your case, $$g(x) - g\circ f(x) = 1 = {1\over |x| + 1|} = {|x|\over |x| + 1}. $$
This is continuous everywhere.
A: The following exercise might be useful. In every case, either prove or give a counterexample:
Exercise 1: If $f,g,h$ are continuous functions $\mathbb{R}\to\mathbb{R}$, which of the following sets is closed: 
(a) $\{x:f(x)g(x)\leq h(x)\}$,
(b) $\{x:\frac{f(x)}{g(x)}\leq h(x)\}$ (if $g\neq 0$ everywhere),
(c) $\{-1\leq x\leq 1: f(x)\leq g(x)\}$?
Exercise 2: If we have continuous functions $f_N,g_N:\mathbb{R}\to\mathbb{R}$ for each positive integer $N$, is the following set closed: $\{x:\text{for all positive integers }N\text{ we have } f_N(x)\leq g_N(x)\}$?
Exercise 3: If $f_N:\mathbb{R}\to\mathbb{R}$ is continuous for each positive integer $N$ and if $g,h:\mathbb{R}\to\mathbb{R}$ are also continuous, then is the following set closed: $\{x:\text{for some positive integer }N\text{ we have } g(x)\leq f_N(x) + h(x)\}$? 
Exercise 4: In the notation of Exercise 3 is the set $\{x:\text{for all positive integers }N\text{ we have } f_N(x)-\sin(h(x)g(x))+e^{f(x)\tan{x}}\leq g(x)\}$ closed?
Exercise 5: If $f,g:\mathbb{R}\to\mathbb{R}$ are continuous, is the set $\{x:\sin(\cos(f(x))g(x))\leq \cos(\sin(g(x))f(x))\}$ closed?
I hope this helps!
