An Simple Analysis Problem $\varphi:\textrm{R}\rightarrow\textrm{R}$ is continuous, $\lim_{x\rightarrow\infty}\varphi(x)-x=\infty$, and $\{x\in\textrm{R}|\varphi(x)=x\}$ is a finite non-empty set. If $f:\textrm{R}\rightarrow\textrm{R}$ is continuous and $f\circ\varphi=f$, prove that $f$ is a constant function.
I think maybe we can prove it by contradiction, assume that $f$ isn't a constant function, considering $f$ is continuous, it's easy to see that $f$ has an infinite number of different values in some $[a,b](a,b\in\textrm{R})$. Note that $\varphi$ has finite fixed points, perhaps contradictions can be launched from here. But I failed to make any further progress.
 A: For a function $g$ we denote $g_{1} = g$, $g_{k+1} = g(g_{k})$.
Let us suppose that $\varphi$ has fixed points at $a_{1}<a_{2}<...<a_{m}$ (these are all the fixed points) and set $a_{0} = - \infty$.
We will call a sequence of real numbers $(x_{j})_{j \in \mathbb{N}}$ a $\varphi$ path if $x_{j+1} = \varphi(x_{j})$ or $x_{j+1} \in \varphi^{-1}(x_{j})$.
$\textbf{Observation:} $ Note that in an $\varphi$ path $f(x_{1}) = f(x_{2}) = ...$
$\textbf{Claim:}$ For every $x \in \mathbb{R}$ there exists a $\varphi$ path $(x_{j})_{j \in \mathbb{N}}$ with $x_{1} = x$ such that $\lim_{j \rightarrow \infty} x_{j} = a_{k}$ for some $k = 1,...,m$.
Case $m)$ $x \geq a_{m}$:
If $x = a_{m}$ the result is trivial. Now assume $x \neq a_{m}$.
In this case note that if $y > a_{m}$ $\exists y' \in (a_{m},y)$ so that $\varphi(y') = y $ we will denote $y'$ as $\varphi_{\langle m \rangle}^{-1}(y)$ (this is basically a selector function). Note that the sequence $(x_{j})_{j \in \mathbb{N}}$ with $x_{1} = x$, $x_{j+1} = \varphi_{\langle m \rangle}^{-1}(x_{j})$ is a monotonically decreasing sequence and a $\varphi$ path which is bounded below by $a_{m}$. Since there are no fixed points of $\varphi$ after $a_{m}$, we have $\lim_{j \rightarrow \infty}x_{j} = a_{m}$ as $\lim_{j \rightarrow \infty}x_{j}$ exists by monotone convergence theorem.
Suppose we proved Case $j+1)$ we will work our way downward to prove Case $j)$ where
Case $j)$ is
Case $j)$ $a_{j}\leq x<a_{j+1}$:
If $x = a_{j}$ the result is trivial. Now assume $x\neq a_{j}$
In this case there are two mini cases:
Minicase i) $\varphi(y) > y$ for $y \in (a_{j}, a_{j+1})$:
In this Minicase if for some there is some $k \in \mathbb{N}$ so that $\varphi_{k}(x) \geq a_{j+1}$ then note that by Case $j+1)$ we can find such a sequence easily. Otherwise we consider the sequence $(x_{j})_{j\in \mathbb{N}}$ with $x_{1} = x$, $x_{j+1} = \varphi(x_{j})$ which converges to $a_{j+1}$.
Minicase (ii) $\varphi(y) < y$ for $y \in (a_{j}, a_{j+1})$:
In this Minicase $\exists y' \in (y, a_{j+1})$ so that $\varphi(y') = y$ by the intermediate value theorem. This $y'$ will be denoted as $\varphi_{\langle j\rangle}^{-1}(y)$ (again a selector function). Note that the sequence $(x_{d})_{d \in \mathbb{N}}$ with $x_{1} = x$, $x_{d+1} = \varphi_{\langle j \rangle}^{-1}(x_{d})$ is a monotonically increasing sequence and a $\varphi$ path which is bounded above by $a_{j+1}$. Since there are no fixed points of $\varphi$ in the interval $(a_{j},a_{j+1})$, we have $\lim_{j \rightarrow \infty}x_{j} = a_{j+1}$ as $\lim_{j \rightarrow \infty}x_{j}$ exists by monotone convergence theorem.
This proves the claim.
Now pick an $x \in \mathbb{R}$. There exists a $\varphi$ path $(x_{j})_{j\in \mathbb{N}}$ with $x_{1} = x$ such that $\lim_{j\rightarrow \infty}x_{j} \in \{a_{1},...,a_{m}\}$. Hence by continuity of $f$ we have $f(x) \in \{f(a_{1}),...,f(a_{m})\}$ which means that $f$ only takes on finitely many values. A continuous function that takes on finitely many values is the constant function.
