What does $\{g:\mathbb{R}\rightarrow\mathbb{R}\mid g\circ f=f\circ g\}$ mean? Is the set $\{g:\mathbb{R}\rightarrow\mathbb{R}\mid g\circ f=f\circ g\}$ infinite?
Why?

Let's suppose $f(x)=x^2$
$g(x)$ is an inverse function of $f(x)$.
$g(f(x))=(x^2)^{\frac12}=x$
Therefore, since composition of functions are associative,
$g(f(x))=f(g(x))=x$
The range of $f(x)=x$ is $[0,\infty)$
Since the range is $\infty$, the set is infinite.
My question is: What is the point of ${g:\mathbb{R}\rightarrow\mathbb{R}}$ in $g\circ f=f\circ g$?
 A: If $f,g : \mathbb{R} \to \mathbb{R}$ are two functions, one can consider the two other functions $f\circ g$ and $g\circ f$ defined by $f\circ g (x) = f\left(g(x)\right)$ and $g\circ f (x) = g\left(f(x) \right)$. One can also ask whenever are these two functions the same.
If $f$ is a fixed function, the set $C(f)=\left\{g : \mathbb{R} \to \mathbb{R} | f\circ g = g \circ f \right\}$ is the set of all functions $g$ for which the two functions $f\circ g$ and $g\circ f$ are equal.
For example, if $f = \mathrm{id}$ is the identity function, then $C(f)$ is the whole set of functions, because all function commutes with the identity map.
But if $f(x)=x^2$ for example, then the function $g : x \mapsto -x$ is not in $C(f)$, as $f\circ g = f$ and $g\circ f = -f$. The set $C(f)$ depends on $f$.
Note that for every $n$, $f^{\circ n}=\underbrace{f\circ f \circ \cdots \circ f}_{n \text{ times}}$ is in $C(f)$, because $f^{\circ n} \circ f = f \circ f^{\circ n} = f^{\circ n+1}$, so for general $f$ you know an infinite family of functions in $C(f)$.
Edit
It has been noted that it would be relevant to discuss the case whenever  $\{f^{\circ n} | n \in \mathbb{N} \}$ is finite (with convention $f^{\circ 0} = \mathrm{id}$). As it is non-empty ($f \in C(f)$) one can ask if it can be any positive integer. The answer is yes. Suppose $n \geqslant 1$ and consider the following function :
\begin{align}
f(x) =\begin{cases}
x+1 & \text{if} & x \in \{1,2\ldots,n-1\} \\
1 & \text{if} & x = n \\
x & \text{if} & x \neq 1,\ldots, n
\end{cases}
\end{align}
It is just a cylcic permutation on $\{1,\ldots,n\}$, and the identity on the complementary. It follows that $f^{\circ n}$ is the identity, and that for exery $1\leqslant k,k' \leqslant n-1$, if $k \neq k'$, then $f^{\circ k} \neq f^{\circ k'}$. Consequently, the set $\{ f^{\circ k} | k \in \mathbb{N} \}$ has exactly $n$ elements.
