If $ f $ is a Borel function, and $ X $ and $ f(X) $ are independent, then $ \mathsf{P}(f(X) = c) = 1 $ for some constant $ c \in \mathbb{R} $. 
Problem. Let $ X $ be a random variable, and $ f: \mathbb{R} \to \mathbb{R} $ a Borel function such that $ X $ and $ f(X) $ are independent. Show that there exists a constant $ c \in \mathbb{R} $ such that $ \mathsf{P}(f(X) = c) = 1 $.

This is what I have tried so far:
$ X $ and $ f(X) $ are independent, so $ X $ and $ X $ must be independent. I was then able to show that there exists a constant $ c \in \mathbb{R} $ such that $ \mathsf{P}(X = c) = 1 $. I’m not sure how to proceed further.
 A: Here is an elementary solution.


Claim 1. For any Borel subsets $ A $ and $ B $ of $ \mathbb{R} $, we have
  $$
  \mathsf{P}(f(X) \in A) \cdot \mathsf{P}(f(X) \in B)
= \mathsf{P}(f(X) \in A \cap B).
$$

Proof. Let $ A $ and $ B $ be Borel subsets of $ \mathbb{R} $. As $ X $ and $ f(X) $ are independent, we have
\begin{align}
    \mathsf{P}(f(X) \in A) \cdot \mathsf{P}(f(X) \in B)
& = \mathsf{P}(X \in {f^{\leftarrow}}[A]) \cdot \mathsf{P}(f(X) \in B) \\
& = \mathsf{P}(X \in {f^{\leftarrow}}[A] ~ \text{and} ~ f(X) \in B) \\
& = \mathsf{P}(f(X) \in A ~ \text{and} ~ f(X) \in B) \\
& = \mathsf{P}(f(X) \in A \cap B). \quad \blacksquare
\end{align}


Claim 2. There exists an $ n \in \mathbb{Z} $ such that $ \mathsf{P}(f(X) \in [n,n + 1]) = 1 $.

Proof. Suppose otherwise. For each $ n \in \mathbb{Z} $, Claim 1 says that
\begin{align}
    \mathsf{P}(f(X) \in [n,n + 1]) \cdot
    \mathsf{P}(f(X) \in \mathbb{R} \setminus [n,n + 1])
& = \mathsf{P}(f(X) \in [n,n + 1] \cap (\mathbb{R} \setminus [n,n + 1])) \\
& = \mathsf{P}(f(X) \in \varnothing) \\
& = 0.
\end{align}
Hence, for each $ n \in \mathbb{Z} $, we have
$$
\mathsf{P}(f(X) \in [n,n + 1]) = 0 \qquad \text{or} \qquad
\mathsf{P}(f(X) \in \mathbb{R} \setminus [n,n + 1]) = 0,
$$
but as these two probabilities add up to $ 1 $, we find that $ \mathsf{P}(f(X) \in [n,n + 1]) = 0 $. Consequently,
$$
     1
=    \mathsf{P}(f(X) \in \mathbb{R})
=    \mathsf{P} \! \left( f(X) \in \bigcup_{n \in \mathbb{Z}} [n,n + 1] \right)
\leq \sum_{n \in \mathbb{Z}} \mathsf{P}(f(X) \in [n,n + 1])
=    \sum_{n \in \mathbb{Z}} 0
=    0,
$$
which is a contradiction. $ \quad \blacksquare $


Claim 3. Let $ a,b \in \mathbb{R} $ with $ a < b $. If $ \mathsf{P}(f(X) \in [a,b]) = 1 $, then
  $$
\mathsf{P} \! \left( f(X) \in \left[ a,\frac{a + b}{2} \right] \right) = 1
\qquad \text{or} \qquad
\mathsf{P} \! \left( f(X) \in \left[ \frac{a + b}{2},b \right] \right) = 1.
$$

Proof. By way of contradiction, suppose that $ \mathsf{P}(f(X) \in [a,b]) = 1 $ but
$$
\mathsf{P} \! \left( f(X) \in \left[ a,\frac{a + b}{2} \right] \right) \neq 1
\qquad \text{and} \qquad
\mathsf{P} \! \left( f(X) \in \left[ \frac{a + b}{2},b \right] \right) \neq 1.
$$
By Claim 1, we have
\begin{align}
    \mathsf{P} \! \left( f(X) \in \left[ a,\frac{a + b}{2} \right] \right) \cdot
    \mathsf{P} \! \left( f(X) \in \left( \frac{a + b}{2},b \right] \right)
& = \mathsf{P} \!
    \left(
    f(X) \in
    \left[ a,\frac{a + b}{2} \right] \cap \left( \frac{a + b}{2},b \right]
    \right) \\
& = \mathsf{P}(f(X) \in \varnothing) \\
& = 0.
\end{align}
Hence,
$$
\mathsf{P} \! \left( f(X) \in \left[ a,\frac{a + b}{2} \right] \right) = 0
\qquad \text{or} \qquad
\mathsf{P} \! \left( f(X) \in \left( \frac{a + b}{2},b \right] \right) = 0.
$$
However, these two probabilities add up to $ 1 $, so $ \mathsf{P} \! \left( f(X) \in \left[ a,\dfrac{a + b}{2} \right] \right) = 0 $. A similar argument yields $ \mathsf{P} \! \left( f(X) \in \left[ \dfrac{a + b}{2},b \right] \right) = 0 $ as well. Therefore,
\begin{align}
       1
& =    \mathsf{P}(f(X) \in [a,b]) \\
& =    \mathsf{P} \!
       \left(
       f(X) \in
       \left[ a,\frac{a + b}{2} \right] \cup \left[ \frac{a + b}{2},b \right]
       \right) \\
& \leq \mathsf{P} \! \left( f(X) \in \left[ a,\frac{a + b}{2} \right] \right) +
       \mathsf{P} \! \left( f(X) \in \left[ \frac{a + b}{2},b \right] \right) \\
& =    0 + 0 \\
& =    0,
\end{align}
which is a contradiction. $ \quad \blacksquare $

Using Claims 2 and 3, we can define a nested sequence $ (I_{n})_{n \in \mathbb{N}} $ of closed intervals such that


*

*$ \mathsf{P}(f(X) \in I_{n}) = 1 $ for every $ n \in \mathbb{N} $, and

*$ \displaystyle \lim_{n \to \infty} |I_{n}| = 0 $.


By the Nested-Intervals Theorem, there exists a real number $ c $ such that $ \displaystyle \bigcap_{n = 1}^{\infty} I_{n} = \{ c \} $, so
$$
  \mathsf{P}(f(X) = c)
= \mathsf{P} \! \left( f(X) \in \bigcap_{n = 1}^{\infty} I_{n} \right)
= \lim_{n \to \infty} \mathsf{P}(f(X) \in I_{n})
= \lim_{n \to \infty} 1
= 1.
$$
